Beispiel #1
0
    def get_edge_by_scan_or_exploit_telemetry(telemetry_json):
        dst_ip = telemetry_json['data']['machine']['ip_addr']
        src_monkey = NodeService.get_monkey_by_guid(telemetry_json['monkey_guid'])
        dst_node = NodeService.get_monkey_by_ip(dst_ip)
        if dst_node is None:
            dst_node = NodeService.get_or_create_node(dst_ip)

        return EdgeService.get_or_create_edge(src_monkey["_id"], dst_node["_id"])
Beispiel #2
0
    def get_edge_by_scan_or_exploit_telemetry(telemetry_json):
        dst_ip = telemetry_json['data']['machine']['ip_addr']
        src_monkey = NodeService.get_monkey_by_guid(telemetry_json['monkey_guid'])
        dst_node = NodeService.get_monkey_by_ip(dst_ip)
        if dst_node is None:
            dst_node = NodeService.get_or_create_node(dst_ip)

        return EdgeService.get_or_create_edge(src_monkey["_id"], dst_node["_id"])
Beispiel #3
0
 def set_monkey_tunnel(monkey_id, tunnel_host_ip):
     tunnel_host_id = NodeService.get_monkey_by_ip(tunnel_host_ip)["_id"]
     NodeService.unset_all_monkey_tunnels(monkey_id)
     mongo.db.monkey.update(
         {"_id": monkey_id},
         {'$set': {'tunnel': tunnel_host_id}},
         upsert=False)
     tunnel_edge = EdgeService.get_or_create_edge(monkey_id, tunnel_host_id)
     mongo.db.edge.update({"_id": tunnel_edge["_id"]},
                          {'$set': {'tunnel': True, 'ip_address': tunnel_host_ip}},
                          upsert=False)