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
|
||||
result = exec_funct()
|
||||
hostname = socket.gethostname()
|
||||
try:
|
||||
hostname = socket.gethostname()
|
||||
ip = socket.gethostbyname(hostname)
|
||||
except socket.error:
|
||||
hostname = "Unknown"
|
||||
ip = "Unknown"
|
||||
ControlClient.send_telemetry('post_breach', {'command': self.command,
|
||||
'result': result,
|
||||
'name': self.name,
|
||||
'hostname': hostname,
|
||||
'ip': socket.gethostbyname(hostname)})
|
||||
'ip': ip})
|
||||
|
||||
def _execute_default(self):
|
||||
"""
|
||||
|
|
|
@ -82,9 +82,9 @@ class TelemetryFeed(flask_restful.Resource):
|
|||
|
||||
@staticmethod
|
||||
def get_post_breach_telem_brief(telem):
|
||||
return '%s post breach action executed on %s (%s) machine' % (telem['data']['name'],
|
||||
telem['data']['hostname'],
|
||||
telem['data']['ip'])
|
||||
return '%s post breach action executed on %s (%s) machine.' % (telem['data']['name'],
|
||||
telem['data']['hostname'],
|
||||
telem['data']['ip'])
|
||||
|
||||
@staticmethod
|
||||
def get_attack_telem_brief(telem):
|
||||
|
|
Loading…
Reference in New Issue