示例#1
0
def ssh_protocol(data):
    normalized_data = ssh.normalizer.Normalizer(data).normalize()
    subclasses = SSHProcess.all_subclasses()
    meta = Metadata()

    for sub in subclasses:
        meta = sub().process(normalized_data, meta)

    if not meta.is_empty():
        normalized_data['metadata'] = normalized_data.to_dict()

    normalized_data = Juniper.has_backdoor(normalized_data)

    return normalized_data
示例#2
0
    def test_one(self):
        data = {'header': {'www_authenticate': '"Basic realm=""SPECTRE-3G"""'}}
        metadata = Spectre3G().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'B+B SmartWorx')
        self.assertEqual(metadata.device.product, 'Spectre 3G')
        self.assertEqual(metadata.device.type, 'Industrial Wireless Router')
    def test_one(self):
        data = {'header': {'www_authenticate': '"Basic realm=""Brickcom MD-300Np-360P""" '}}
        metadata = BrickComCamera().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'Brickcom')
        self.assertEqual(metadata.device.product, 'MD-300Np')
        self.assertEqual(metadata.device.type, 'Camera')
示例#4
0
    def test_one(self):
        data = {'header': {'www_authenticate': '"Basic realm=""DI-804HV"""'}}
        metadata = DLinkDIHV().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'DLink')
        self.assertEqual(metadata.device.product, 'DI-804HV')
        self.assertEqual(metadata.device.type, 'DSL Modem')
示例#5
0
    def test_one(self):
        data = {'header': {'www_authenticate': '"BASIC realm=""DPR-1061"""'}}
        metadata = DLinkPrintServerDPR().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'DLink')
        self.assertEqual(metadata.device.product, 'DPR-1061')
        self.assertEqual(metadata.device.type, 'Print Server')
示例#6
0
    def test_one(self):
        data = {'header': {'www_authenticate': '"Basic realm=""NDL485-2159917979"""'}}
        metadata = WilmersDataLogger().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'Wilmers')
        self.assertEqual(metadata.device.product, 'blueberry NDL 485')
        self.assertEqual(metadata.device.type, 'Data Logger')
示例#7
0
    def test_one(self):
        data = {'header': {'www_authenticate': '"Basic realm=""NVR8"""'}}
        metadata = SwannNVR().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'Swann')
        self.assertEqual(metadata.device.product, 'NVR8')
        self.assertEqual(metadata.device.type, 'DVR')
    def test_one(self):
        data = {'header': {'www_authenticate': '"Basic realm=""TP-LINK Router R480T+"""'}}
        metadata = TPLinkLoadBalance().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'TP-Link')
        self.assertEqual(metadata.device.product, 'R480T')
        self.assertEqual(metadata.device.type, 'Load Balance Router')
    def test_one(self):
        data = {'header': {'www_authenticate': '"Basic realm=""WRT54GL"""'}}
        metadata = LinksysWirelessRouter().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'Linksys')
        self.assertEqual(metadata.device.product, 'WRT54GL')
        self.assertEqual(metadata.device.type, 'Wireless Router')
 def generate_mock_resource(self,
                            time_created=None,
                            time_modified=None,
                            uuid=uuid.uuid4().__str__()):
     title_1 = Title('no', self.random_word(6))
     title_2 = Title('en', self.random_word(6))
     titles = {
         title_1.language_code: title_1.title,
         title_2.language_code: title_2.title
     }
     creator_one = Creator('AUTHORITY_IDENTIFIER_1')
     creator_two = Creator('AUTHORITY_IDENTIFIER_2')
     creators = [creator_one, creator_two]
     metadata = Metadata(creators, 'https://hdl.handle.net/11250.1/1',
                         'LICENSE_IDENTIFIER_1', '2019', 'Unit', titles,
                         'text')
     file_metadata_1 = FileMetadata(
         self.random_word(6) + '.txt', 'text/plain',
         '595f44fec1e92a71d3e9e77456ba80d1', '987654321')
     file_metadata_2 = FileMetadata(
         self.random_word(6) + '.pdf', 'application/pdf',
         '71f920fa275127a7b60fa4d4d41432a3', '123456789')
     file_1 = File('FILE_IDENTIFIER_1', file_metadata_1)
     file_2 = File('FILE_IDENTIFIER_2', file_metadata_2)
     files = dict()
     files[file_1.identifier] = file_1.file_metadata
     files[file_2.identifier] = file_2.file_metadata
     return Resource(uuid, time_modified, time_created, metadata, files,
                     '*****@*****.**')
示例#11
0
    def test_one(self):
        data = {'header': {'www_authenticate': '"Basic realm=""TP-LINK Router R860"""'}}
        metadata = TPLinkDSL().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'TP-Link')
        self.assertEqual(metadata.device.product, 'R860')
        self.assertEqual(metadata.device.type, 'DSL Modem')
示例#12
0
    def test_one(self):
        data = {'header': {'www_authenticate': '"Basic realm=""RT-N10P"""'}}
        metadata = AsusWirelessRouter().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'Asus')
        self.assertEqual(metadata.device.product, 'RT-N10P')
        self.assertEqual(metadata.device.type, 'Wireless Router')
示例#13
0
    def test(self):
        data = {'header': {'www_authenticate': '"Basic realm=""ZXV10 W300"""'}}
        metadata = Netgear().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'ZTE')
        self.assertEqual(metadata.device.type, 'DSL Modem')
        self.assertEqual(metadata.device.product, 'ZXV10 W300')
示例#14
0
    def test(self):
        data = {'header': {'www_authenticate': '"Digest realm=""Thomson Gateway"", nonce=""0821SF62J:00-1F-9F-11-C3-E6'
                                               ':483607:528393"", qop=""auth"",Basic realm=""Thomson Gateway"""'}}
        metadata = Thomson().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'Alcatel')
        self.assertEqual(metadata.device.type, 'DSL Modem')
示例#15
0
    def test_one(self):
        data = {'header': {'www_authenticate': '"Basic realm=""RV082"""'}}
        metadata = CiscoRV().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'Cisco')
        self.assertEqual(metadata.device.product, 'RV082')
        self.assertEqual(metadata.device.type, 'VPN Router')
示例#16
0
    def test_one(self):
        data = {'header': {'www_authenticate': '"Basic realm=""AIRNET Wireless N Router AIR-RT300GNH"""'}}
        metadata = AirnetRouter().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'Airnet')
        self.assertEqual(metadata.device.product, 'AIR-RT300GNH')
        self.assertEqual(metadata.device.type, 'Wireless Router')
示例#17
0
    def test_one(self):
        data = {'header': {'www_authenticate': '"Basic realm=""DI-824VUP"""'}}
        metadata = DLinkDI().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'DLink')
        self.assertEqual(metadata.device.product, 'DI-824VUP')
        self.assertEqual(metadata.device.type, 'Wireless Router')
示例#18
0
 def test_version_1(self):
     data = {'banner': 'SSH-2.0-dropbear_0.46'}
     metadata = Dropbear().process(data, Metadata())
     self.assertEqual(metadata.service.product, "Dropbear",
                      "Wrong service product")
     self.assertEqual(metadata.service.version, "0.46",
                      "Wrong service version")
示例#19
0
 def test_simple(self):
     data = {'banner': 'SSH-2.0-OpenSSH_4.3'}
     metadata = OpenSSH().process(data, Metadata())
     self.assertEqual(metadata.service.product, "OpenSSH",
                      "Wrong service product")
     self.assertEqual(metadata.service.version, "4.3",
                      "Wrong service version")
示例#20
0
 def test_packet_name(self):
     data = {'banner': 'SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2'}
     metadata = OpenSSH().process(data, Metadata())
     self.assertEqual(metadata.service.product, "OpenSSH",
                      "Wrong service product")
     self.assertEqual(metadata.service.version, "6.6.1p1",
                      "Wrong service version")
示例#21
0
    def test_one(self):
        data = {'header': {
            'www_authenticate': '"Digest qop=""auth"", stale=false, algorithm=MD5, realm=""EPARA16D3"", nonce=""1458108515"""'}}
        metadata = EparaDVR().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'EverFocus')
        self.assertEqual(metadata.device.product, 'EPARA16D3')
        self.assertEqual(metadata.device.type, 'DVR')
示例#22
0
    def test_adsl(self):
        data = {
            'header': {
                'www_authenticate': '"Basic realm=""ADSL Router"""'
            }
        }
        metadata = DSLRouter().process(data, Metadata())

        self.assertEqual(metadata.device.type, 'DSL Modem')
示例#23
0
    def test_one(self):
        data = {
            'header': {
                'www_authenticate': '"Basic realm=""Wireless IP Camera"""'
            }
        }
        metadata = GenericCamera().process(data, Metadata())

        self.assertEqual(metadata.device.type, 'Camera')
示例#24
0
    def test(self):
        data = {
            'header': {
                'www_authenticate': '"Basic realm=""ZNID24xx-Router"""'
            }
        }
        metadata = ZnidZhone().process(data, Metadata())

        self.assertEqual(metadata.device.product, 'zNID 24xx Series')
        self.assertEqual(metadata.device.manufacturer, 'Zhone')
示例#25
0
    def test_one(self):
        data = {
            'header': {
                'www_authenticate': '"Basic realm=""SAMSUNG DVR"""'
            }
        }
        metadata = SamsungDVR().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'Samsung')
        self.assertEqual(metadata.device.type, 'DVR')
示例#26
0
    def test_two(self):
        data = {
            'header': {
                'www_authenticate':
                '"Basic realm=""D5110 1.3M IR Dome Camera"""'
            }
        }
        metadata = GenericCamera().process(data, Metadata())

        self.assertEqual(metadata.device.type, 'Camera')
 def test_encoders(self):
     self.assertRaises(TypeError, encode_file_metadata, '')
     self.assertRaises(TypeError, encode_files, '')
     self.assertRaises(TypeError, encode_creator, '')
     self.assertRaises(TypeError, encode_metadata, '')
     self.assertEqual(
         encode_metadata(
             Metadata(None, None, None, None, None, dict(), None)), {},
         'Unexpected metadata')
     self.assertRaises(TypeError, encode_resource, '')
    def test_one(self):
        data = {
            'header': {
                'www_authenticate': '"Basic realm=""Westermo MRD-355"""'
            }
        }
        metadata = WestermoIndustrialRouter().process(data, Metadata())

        self.assertEqual(metadata.device.manufacturer, 'Westermo')
        self.assertEqual(metadata.device.product, 'MRD-355')
        self.assertEqual(metadata.device.type, 'Industrial Router')
示例#29
0
 def test_one(self):
     data = {
         'header': {
             'www_authenticate':
             '"Basic realm=""TP-LINK Wireless Lite N Router WR740N/WR741ND"""'
         }
     }
     metadata = TPLinkWireless().process(data, Metadata())
     self.assertEqual(metadata.device.product, 'WR740N')
     self.assertEqual(metadata.device.manufacturer, 'TP-Link')
     self.assertEqual(metadata.device.type, 'Wireless Router')
示例#30
0
 def test_four(self):
     data = {
         'header': {
             'www_authenticate':
             '""TP-LINK Outdoor Wireless Access Point WA7210N"""'
         }
     }
     metadata = TPLinkWireless().process(data, Metadata())
     self.assertEqual(metadata.device.product, 'WA7210N')
     self.assertEqual(metadata.device.manufacturer, 'TP-Link')
     self.assertEqual(metadata.device.type, 'Wireless Router')