예제 #1
0
 def test_https(self):
     services = (
         (8000, 'https'),
         (8080, 'https'),
     )
     with Services(services):
         args = [
             '-n', '127.0.0.0/29', '-c', 'tests/files/pukpuk-test.conf',
             '--debug'
         ]
         main = pukpuk.Main(args)
         main.init_with_args()
         main.run()
         assert set(main.targets) == {
             ('127.0.0.1', 8000, 'https'),
             ('127.0.0.1', 8080, 'https'),
         }
     assert pathlib.Path(main.args.output_directory, 'response',
                         'https-127.0.0.1-8000.txt').exists() is True
     assert pathlib.Path(main.args.output_directory, 'response',
                         'https-127.0.0.1-8080.txt').exists() is True
     assert pathlib.Path(main.args.output_directory, 'grabber',
                         'https-127.0.0.1-8000.png').exists() is True
     assert pathlib.Path(main.args.output_directory, 'grabber',
                         'https-127.0.0.1-8080.png').exists() is True
     main.delete_output()
예제 #2
0
 def test_hosts_from_cidr(self):
     args = []
     main = pukpuk.Main(args)
     output = main.hosts_from_cidr('10.0.0.0/24')
     expected = ['10.0.0.' + str(i) for i in range(256)]
     expected.pop(0)
     expected.pop(len(expected) - 1)
     assert output == expected
예제 #3
0
 def test_hosts_from_file(self):
     args = []
     main = pukpuk.Main(args)
     output = main.hosts_from_file('tests/files/hosts.txt')
     expected = [
         '192.168.100.100',
         '192.168.100.200',
     ]
     assert output == expected
예제 #4
0
 def test_targets_from_csv(self):
     args = []
     main = pukpuk.Main(args)
     main.targets_from_csv('tests/files/targets.csv')
     expected = [
         ('127.0.0.1', 80, ''),
         ('127.0.0.1', 443, 'https'),
         ('127.0.0.1', 8080, 'http'),
     ]
     assert main.targets == expected
예제 #5
0
 def test_config_update_args(self):
     args = ['-n', '127.0.0.0/24', '-c', 'tests/files/pukpuk.conf']
     main = pukpuk.Main(args)
     main.init_with_args()
     del main.args.config
     del main.args.socks5_proxy
     del main.args.targets
     del main.args.hosts
     del main.args.loglevel
     del main.args.randomize
     assert main.args.__dict__ == {
         'modules': ['pukpuk.mods.response', 'pukpuk.mods.grabber'],
         'workers': 10,
         'user_agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
         'socket_timeout': 3.0,
         'nameserver': '192.168.100.1',
         'network': '127.0.0.0/24',
         'process_timeout': 15.0,
         'ports': ['8000', '8080', '8443/https', '9443/https'],
         'browser': 'chrome',
         'output_directory': 'pukpuk-tmp',
     }
예제 #6
0
 def test_build_url(self):
     args = []
     main = pukpuk.Main(args)
     output = main.build_url('example.com', 8080, 'https')
     expected = 'https://example.com:8080/'
     assert output == expected