From 1ebbb83629e5a94ef2d36faf6e848a8cf471a459 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Wed, 12 Feb 2020 13:17:29 +0200 Subject: [PATCH] Improved hostname by parsing out irrelevant data --- monkey/monkey_island/cc/resources/bootloader.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/monkey/monkey_island/cc/resources/bootloader.py b/monkey/monkey_island/cc/resources/bootloader.py index eab4cd5c9..fac0998cb 100644 --- a/monkey/monkey_island/cc/resources/bootloader.py +++ b/monkey/monkey_island/cc/resources/bootloader.py @@ -23,10 +23,17 @@ class Bootloader(flask_restful.Resource): # Used by monkey. can't secure. def post(self, **kw): data = json.loads(request.data.decode().replace("\n", "")) + + # Remove local ips local_addr = [i for i in data["ips"] if i.startswith("127")] if local_addr: data["ips"].remove(local_addr[0]) + + # Clean up os info + data['os_version'] = data['os_version'].split(" ")[0] + mongo.db.bootloader_telems.insert(data) node_id = NodeService.get_or_create_node_from_bootloader_telem(data) + return make_response({"status": "OK"}, 200)