示例#1
0
    def test_get_os(self):
        linux_monkey = Monkey(guid=str(uuid.uuid4()),
                              description="Linux shay-Virtual-Machine 4.15.0-50-generic #54-Ubuntu")
        windows_monkey = Monkey(guid=str(uuid.uuid4()),
                                description="Windows bla bla bla")
        unknown_monkey = Monkey(guid=str(uuid.uuid4()),
                                description="bla bla bla")
        linux_monkey.save()
        windows_monkey.save()
        unknown_monkey.save()

        assert 1 == len([m for m in Monkey.objects() if m.get_os() == "windows"])
        assert 1 == len([m for m in Monkey.objects() if m.get_os() == "linux"])
        assert 1 == len([m for m in Monkey.objects() if m.get_os() == "unknown"])
示例#2
0
 def get_technique_status_and_data():
     monkeys = list(Monkey.objects())
     info = [{
         "src": monkey["command_control_channel"]["src"],
         "dst": monkey["command_control_channel"]["dst"],
     } for monkey in monkeys if monkey["command_control_channel"]]
     if info:
         status = ScanStatus.USED.value
     else:
         status = ScanStatus.UNSCANNED.value
     return (status, info)
示例#3
0
文件: T1041.py 项目: zkbupt/monkey
 def get_technique_status_and_data():
     monkeys = list(Monkey.objects())
     info = [{
         'src': monkey['command_control_channel']['src'],
         'dst': monkey['command_control_channel']['dst']
     } for monkey in monkeys if monkey['command_control_channel']]
     if info:
         status = ScanStatus.USED.value
     else:
         status = ScanStatus.UNSCANNED.value
     return (status, info)
示例#4
0
文件: T1041.py 项目: wau/monkey
 def get_report_data():
     monkeys = list(Monkey.objects())
     info = [{'src': monkey['command_control_channel']['src'],
              'dst': monkey['command_control_channel']['dst']}
             for monkey in monkeys if monkey['command_control_channel']]
     if info:
         status = ScanStatus.USED.value
     else:
         status = ScanStatus.UNSCANNED.value
     data = T1041.get_base_data_by_status(status)
     data.update({'command_control_channel': info})
     return data
示例#5
0
    def test_get_os(self):
        self.fail_if_not_testing_env()
        self.clean_monkey_db()

        linux_monkey = Monkey(
            guid=str(uuid.uuid4()),
            description=
            "Linux shay-Virtual-Machine 4.15.0-50-generic #54-Ubuntu")
        windows_monkey = Monkey(guid=str(uuid.uuid4()),
                                description="Windows bla bla bla")
        unknown_monkey = Monkey(guid=str(uuid.uuid4()),
                                description="bla bla bla")
        linux_monkey.save()
        windows_monkey.save()
        unknown_monkey.save()

        self.assertEqual(
            1, len([m for m in Monkey.objects() if m.get_os() == "windows"]))
        self.assertEqual(
            1, len([m for m in Monkey.objects() if m.get_os() == "linux"]))
        self.assertEqual(
            1, len([m for m in Monkey.objects() if m.get_os() == "unknown"]))