Merge pull request #361 from VakarisZ/pba_bugfix
PBA handles hostname lookup failure
This commit is contained in:
commit
aeb07e1db6
|
@ -45,12 +45,17 @@ class PBA(object):
|
||||||
"""
|
"""
|
||||||
exec_funct = self._execute_default
|
exec_funct = self._execute_default
|
||||||
result = exec_funct()
|
result = exec_funct()
|
||||||
|
try:
|
||||||
hostname = socket.gethostname()
|
hostname = socket.gethostname()
|
||||||
|
ip = socket.gethostbyname(hostname)
|
||||||
|
except socket.error:
|
||||||
|
hostname = "Unknown"
|
||||||
|
ip = "Unknown"
|
||||||
ControlClient.send_telemetry('post_breach', {'command': self.command,
|
ControlClient.send_telemetry('post_breach', {'command': self.command,
|
||||||
'result': result,
|
'result': result,
|
||||||
'name': self.name,
|
'name': self.name,
|
||||||
'hostname': hostname,
|
'hostname': hostname,
|
||||||
'ip': socket.gethostbyname(hostname)})
|
'ip': ip})
|
||||||
|
|
||||||
def _execute_default(self):
|
def _execute_default(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -82,7 +82,7 @@ class TelemetryFeed(flask_restful.Resource):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_post_breach_telem_brief(telem):
|
def get_post_breach_telem_brief(telem):
|
||||||
return '%s post breach action executed on %s (%s) machine' % (telem['data']['name'],
|
return '%s post breach action executed on %s (%s) machine.' % (telem['data']['name'],
|
||||||
telem['data']['hostname'],
|
telem['data']['hostname'],
|
||||||
telem['data']['ip'])
|
telem['data']['ip'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue