Skip to content

Commit 16b0050

Browse files
committed
add support for interface_ip property in Process model
1 parent 5293685 commit 16b0050

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/cbapi/response/models.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,25 @@ def comms_ip(self):
23022302
"""
23032303
Returns ascii representation of the ip address used to communicate with the Cb Response Server
23042304
"""
2305-
return socket.inet_ntoa(struct.pack('>i', self._attribute('comms_ip', 0)))
2305+
try:
2306+
ip_address = socket.inet_ntoa(struct.pack('>i', self._attribute('comms_ip', 0)))
2307+
except:
2308+
ip_address = self._attribute('comms_ip', 0)
2309+
2310+
return ip_address
2311+
2312+
@property
2313+
def interface_ip(self):
2314+
"""
2315+
Returns ascii representation of the ip address of the interface used to communicate with the Cb Response server.
2316+
If using NAT, this will be the "internal" IP address of the sensor.
2317+
"""
2318+
try:
2319+
ip_address = socket.inet_ntoa(struct.pack('>i', self._attribute('interface_ip', 0)))
2320+
except:
2321+
ip_address = self._attribute('interface_ip', 0)
2322+
2323+
return ip_address
23062324

23072325
@property
23082326
def process_md5(self):
@@ -2404,6 +2422,13 @@ def last_update(self):
24042422
"""
24052423
return convert_from_solr(self.get('last_update', -1))
24062424

2425+
@property
2426+
def last_server_update(self):
2427+
"""
2428+
Returns a pretty version of when this process last updated
2429+
"""
2430+
return convert_from_solr(self.get('last_server_update', -1))
2431+
24072432
@property
24082433
def username(self):
24092434
"""

0 commit comments

Comments
 (0)