Esempio n. 1
0
    def setUpClass(cls):
        cls.tmpdir = tempfile.mkdtemp()
        cls._dbname = str(uuid.uuid4())

        test_data = [{
                         "url": "http://herr-doctor.zz",

                         "extractions": [
                             {"hashes": {
                                 "md5": "10000000000000000000000000000md5",
                                 "sha1": "100000000000000000000000000000000000sha1",
                                 "sha512": "1000000000000000000000000000000000000000"
                                           "00000000000000000000000000000000000000000"
                                           "00000000000000000000000000000000000000000sha512"
                             },
                             "timestamp": "2013-03-16T19:12:51.279000"
                             },
                             {"hashes": {
                                 "md5": "20000000000000000000000000000md5",
                                 "sha1": "200000000000000000000000000000000000sha1",
                                 "sha512": "2000000000000000000000000000000000000000"
                                           "00000000000000000000000000000000000000000"
                                           "00000000000000000000000000000000000000000sha512"
                             },
                              "timestamp": "2013-02-16T19:12:51.279000"
                             }
                         ]
                     },
                     {
                         "url": "http://gerber.zz",

                         "extractions": [
                             {"hashes": {
                                 "md5": "30000000000000000000000000000md5",
                                 "sha1": "300000000000000000000000000000000000sha1",
                                 "sha512": "3000000000000000000000000000000000000000"
                                           "00000000000000000000000000000000000000000"
                                           "00000000000000000000000000000000000000000sha512"
                             },
                              "timestamp": "2013-03-16T19:12:51.279000"
                             },
                             {"hashes": {
                                 "md5": "10000000000000000000000000000md5",
                                 "sha1": "100000000000000000000000000000000000sha1",
                                 "sha512": "1000000000000000000000000000000000000000"
                                           "00000000000000000000000000000000000000000"
                                           "00000000000000000000000000000000000000000sha512"
                             },
                              "timestamp": "2013-02-16T19:12:51.279000"
                             }
                         ]
                     }
        ]

        c = MongoClient('localhost', 27017)

        for item in test_data:
            c[cls._dbname].url.insert(item)

        cls.sut = helpers.prepare_app(cls._dbname, cls.tmpdir, 'a_all')
Esempio n. 2
0
    def setUpClass(cls):
        cls.tmpdir =  tempfile.mkdtemp()
        cls._dbname = str(uuid.uuid4())
        insert_data = []

        #type, content, count, timestamp
        test_data = (
            ('inurl', '/jamesBond.php', 1, datetime(2011, 1, 1)),
            ('inurl', '/some/path', 2, datetime(2012, 2, 2)),
            ('inurl', '/no/fjords/here', 3, datetime(2013, 3, 3)),
            )

        for type_, content, count, timestamp in test_data:
            entry = {'type': type_,
                     'content': content,
                     'count': count,
                     'lasttime': timestamp}
            insert_data.append(entry)

        c = MongoClient('localhost', 27017)

        for item in insert_data:
            c[cls._dbname].dork.insert(item)

        cls.sut = helpers.prepare_app(cls._dbname, cls.tmpdir, 'a_all')
Esempio n. 3
0
    def setUpClass(cls):
        cls.tmpdir = tempfile.mkdtemp()
        cls._dbname = str(uuid.uuid4())
        insert_data = []

        #type, content, count, timestamp
        test_data = (
            ('inurl', '/jamesBond.php', 1, datetime(2011, 1, 1)),
            ('inurl', '/some/path', 2, datetime(2012, 2, 2)),
            ('inurl', '/no/fjords/here', 3, datetime(2013, 3, 3)),
        )

        for type_, content, count, timestamp in test_data:
            entry = {
                'type': type_,
                'content': content,
                'count': count,
                'lasttime': timestamp
            }
            insert_data.append(entry)

        c = MongoClient('localhost', 27017)

        for item in insert_data:
            c[cls._dbname].dork.insert(item)

        cls.sut = helpers.prepare_app(cls._dbname, cls.tmpdir, 'a_all')
Esempio n. 4
0
    def setUpClass(cls):
        cls.tmpdir = tempfile.mkdtemp()
        cls._dbname = str(uuid.uuid4())

        test_data = [{
            "content_guess":
            "PE32 executable (DLL) (GUI) Intel 80386, for MS Windows, UPX compressed",
            "data": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
            "encoding": "hex",
            "hashes": {
                "md5":
                "10000000000000000000000000000md5",
                "sha1":
                "100000000000000000000000000000000000sha1",
                "sha512":
                "1000000000000000000000000000000000000000"
                "00000000000000000000000000000000000000000"
                "00000000000000000000000000000000000000000sha512"
            },
            "hpfeed_ids": ["10f3e41b09ce4533629cea00"]
        }, {
            "content_guess":
            "PE32 executable (DLL) (GUI) Intel 80386, for MS Windows, UPX compressed",
            "data": "deadb33fdeadb33fdeadb33fdeadb33fdeadb33fdeadb33fdeadb33f",
            "encoding": "hex",
            "hashes": {
                "md5":
                "20000000000000000000000000000md5",
                "sha1":
                "200000000000000000000000000000000000sha1",
                "sha512":
                "200000000000000000000000000000000000000"
                "000000000000000000000000000000000000000"
                "00000000000000000000000000000000000000000000sha512"
            },
            "hpfeed_ids": ["20f3e41b09ce4533629cea00"]
        }]

        c = MongoClient('localhost', 27017)

        for item in test_data:
            c[cls._dbname].file.insert(item)

        cls.sut = helpers.prepare_app(cls._dbname, cls.tmpdir, 'a_all')
Esempio n. 5
0
    def setUpClass(cls):
        cls.tmpdir = tempfile.mkdtemp()
        cls._dbname = str(uuid.uuid4())

        test_data = [{
                         "content_guess": "PE32 executable (DLL) (GUI) Intel 80386, for MS Windows, UPX compressed",
                         "data": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
                         "encoding": "hex",
                         "hashes": {
                             "md5": "10000000000000000000000000000md5",
                             "sha1": "100000000000000000000000000000000000sha1",
                             "sha512": "1000000000000000000000000000000000000000"
                                       "00000000000000000000000000000000000000000"
                                       "00000000000000000000000000000000000000000sha512"
                         },
                         "hpfeed_ids": [
                             "10f3e41b09ce4533629cea00"
                         ]
                     },
                     {
                         "content_guess": "PE32 executable (DLL) (GUI) Intel 80386, for MS Windows, UPX compressed",
                         "data": "deadb33fdeadb33fdeadb33fdeadb33fdeadb33fdeadb33fdeadb33f",
                         "encoding": "hex",
                         "hashes": {
                             "md5": "20000000000000000000000000000md5",
                             "sha1": "200000000000000000000000000000000000sha1",
                             "sha512": "200000000000000000000000000000000000000"
                                       "000000000000000000000000000000000000000"
                                       "00000000000000000000000000000000000000000000sha512"
                         },
                         "hpfeed_ids": [
                             "20f3e41b09ce4533629cea00"
                         ]
                     }]

        c = MongoClient('localhost', 27017)

        for item in test_data:
            c[cls._dbname].file.insert(item)

        cls.sut = helpers.prepare_app(cls._dbname, cls.tmpdir, 'a_all')
Esempio n. 6
0
    def setUpClass(cls):
        cls.tmpdir = tempfile.mkdtemp()
        cls._dbname = str(uuid.uuid4())
        hpfeeddata = []

        #alternate 1/2 on inserts
        for x in range(100):
            entry = {'channel': 'channel_{0}'.format(x % 2),
                     'ident': 'ident_{0}'.format(x % 2),
                     'payload': 'payload_{0}'.format(x % 2),
                     'timestamp': datetime.utcnow(),
                     'normalized': False}
            hpfeeddata.append(entry)

        c = MongoClient('localhost', 27017)

        for item in hpfeeddata:
            c[cls._dbname].hpfeed.insert(item)

        daily_stats = [
            {'date': '20130906',
             'channel': 'dionaea.capture',
             'hourly': {
                 '12': 1,
                 '13': 2
             }
            },
            {

                'date': '20130907',
                'channel': 'dionaea.capture',
                'hourly': {
                    '12': 1978,
                    '13': 115
                }
            },
            {
                'date': '20130907',
                'channel': 'mwbinary.dionaea.sensorunique',
                'hourly': {
                    '12': 28,
                    '13': 2
                }
            },
            {
                'date': '20130907',
                'channel': 'glastopf.events',
                'hourly': {
                    '12': 109,
                    '13': 2
                }
            },
            {'date': '20130907',
             'channel': 'beeswarm.hive',
             'hourly': {'12': 13, '13': 1}},
            {
            '_id': 'total',
            'dionaea_capture' : 22,
            'mwbinary_dionaea_sensorunique' : 1
}
        ]

        for item in daily_stats:
            c[cls._dbname].daily_stats.insert(item)

        cls.sut = helpers.prepare_app(cls._dbname, cls.tmpdir, 'a_all')
Esempio n. 7
0
    def setUpClass(cls):
        cls.tmpdir = tempfile.mkdtemp()
        cls._dbname = str(uuid.uuid4())

        test_data = [{
            "url":
            "http://herr-doctor.zz",
            "extractions": [{
                "hashes": {
                    "md5":
                    "10000000000000000000000000000md5",
                    "sha1":
                    "100000000000000000000000000000000000sha1",
                    "sha512":
                    "1000000000000000000000000000000000000000"
                    "00000000000000000000000000000000000000000"
                    "00000000000000000000000000000000000000000sha512"
                },
                "timestamp": "2013-03-16T19:12:51.279000"
            }, {
                "hashes": {
                    "md5":
                    "20000000000000000000000000000md5",
                    "sha1":
                    "200000000000000000000000000000000000sha1",
                    "sha512":
                    "2000000000000000000000000000000000000000"
                    "00000000000000000000000000000000000000000"
                    "00000000000000000000000000000000000000000sha512"
                },
                "timestamp": "2013-02-16T19:12:51.279000"
            }]
        }, {
            "url":
            "http://gerber.zz",
            "extractions": [{
                "hashes": {
                    "md5":
                    "30000000000000000000000000000md5",
                    "sha1":
                    "300000000000000000000000000000000000sha1",
                    "sha512":
                    "3000000000000000000000000000000000000000"
                    "00000000000000000000000000000000000000000"
                    "00000000000000000000000000000000000000000sha512"
                },
                "timestamp": "2013-03-16T19:12:51.279000"
            }, {
                "hashes": {
                    "md5":
                    "10000000000000000000000000000md5",
                    "sha1":
                    "100000000000000000000000000000000000sha1",
                    "sha512":
                    "1000000000000000000000000000000000000000"
                    "00000000000000000000000000000000000000000"
                    "00000000000000000000000000000000000000000sha512"
                },
                "timestamp": "2013-02-16T19:12:51.279000"
            }]
        }]

        c = MongoClient('localhost', 27017)

        for item in test_data:
            c[cls._dbname].url.insert(item)

        cls.sut = helpers.prepare_app(cls._dbname, cls.tmpdir, 'a_all')