Ejemplo n.º 1
0
def update_edge_info_with_new_exploit(edge, telemetry_json):
    telemetry_json['data']['info']['started'] = dateutil.parser.parse(
        telemetry_json['data']['info']['started'])
    telemetry_json['data']['info']['finished'] = dateutil.parser.parse(
        telemetry_json['data']['info']['finished'])
    new_exploit = copy.deepcopy(telemetry_json['data'])
    new_exploit.pop('machine')
    new_exploit['timestamp'] = telemetry_json['timestamp']
    mongo.db.edge.update({'_id': edge['_id']},
                         {'$push': {
                             'exploits': new_exploit
                         }})
    if new_exploit['result']:
        EdgeService.set_edge_exploited(edge)
Ejemplo n.º 2
0
    def process_exploit_telemetry(telemetry_json):
        edge = Telemetry.get_edge_by_scan_or_exploit_telemetry(telemetry_json)
        Telemetry.encrypt_exploit_creds(telemetry_json)

        new_exploit = copy.deepcopy(telemetry_json['data'])

        new_exploit.pop('machine')
        new_exploit['timestamp'] = telemetry_json['timestamp']

        mongo.db.edge.update(
            {'_id': edge['_id']},
            {'$push': {'exploits': new_exploit}}
        )
        if new_exploit['result']:
            EdgeService.set_edge_exploited(edge)

        for attempt in telemetry_json['data']['attempts']:
            if attempt['result']:
                found_creds = {'user': attempt['user']}
                for field in ['password', 'lm_hash', 'ntlm_hash', 'ssh_key']:
                    if len(attempt[field]) != 0:
                        found_creds[field] = attempt[field]
                NodeService.add_credentials_to_node(edge['to'], found_creds)