Skip to content

Commit 61214c6

Browse files
authored
Merge pull request #62 from pax0r/cleanup
Code cleanup and automated PEP8 code style check (flake8)
2 parents 669f025 + 503d002 commit 61214c6

14 files changed

+357
-308
lines changed

.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 120
3+
exclude = __pycache__,.virtualenv,.venv,build,dist

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ language: python
22
python: 3.6
33

44
install:
5+
- pip install flake8
56
# - pip install -r ./requirements.txt
67

78
# command to run tests
8-
script: nosetests
9+
script:
10+
- nosetests
11+
- flake8

lib/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
#!/usr/bin/env python
2-
3-
pass
4-

lib/core/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
#!/usr/bin/env python
2-
3-
pass
4-

lib/core/input.py

Lines changed: 98 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
from argparse import ArgumentParser
22
import os.path
33

4-
class cli_helper(object):
4+
5+
class CliHelper(object):
56
@staticmethod
67
def readable_file(parser, arg):
78
if not os.path.exists(arg):
89
parser.error("The file %s does not exist!" % arg)
910
else:
10-
return open(arg, 'r') # return an open file handle
11+
return open(arg, 'r') # return an open file handle
1112

1213

13-
class cli_argument_parser(object):
14+
class CliArgumentParser(object):
1415
def __init__(self):
1516
self._parser = self.setup_parser()
1617

@@ -21,94 +22,97 @@ def parse(self, argv):
2122
def setup_parser():
2223
parser = ArgumentParser()
2324

24-
parser.add_argument("-t",
25-
dest="target_hosts",
26-
required=True,
27-
help="Set a target range of addresses to target. Ex 10.11.1.1-255")
28-
29-
parser.add_argument("-o",
30-
dest="output_directory",
31-
required=True,
32-
help="Set the output directory. Ex /root/Documents/labs/")
33-
34-
parser.add_argument("-w",
35-
dest="wordlist",
36-
required=False,
37-
help="Set the wordlist to use for generated commands. Ex /usr/share/wordlist.txt",
38-
default=False)
39-
40-
parser.add_argument("-p",
41-
dest="port",
42-
required=False,
43-
help="Set the port to use. Leave blank to use discovered ports. Useful to force virtual host scanning on non-standard webserver ports.",
44-
default=80)
45-
46-
parser.add_argument("--pingsweep",
47-
dest="ping_sweep",
48-
action="store_true",
49-
help="Write a new target.txt by performing a ping sweep and discovering live hosts.",
50-
default=False)
51-
52-
parser.add_argument("--dns","--dnssweep",
53-
dest="find_dns_servers",
54-
action="store_true",
55-
help="Find DNS servers from a list of targets.",
56-
default=False)
57-
58-
parser.add_argument("--services",
59-
dest="perform_service_scan",
60-
action="store_true",
61-
help="Perform service scan over targets.",
62-
default=False)
63-
64-
parser.add_argument("--hostnames",
65-
dest="hostname_scan",
66-
action="store_true",
67-
help="Attempt to discover target hostnames and write to 0-name.txt and hostnames.txt.",
68-
default=False)
69-
70-
parser.add_argument("--snmp",
71-
dest="perform_snmp_walk",
72-
action="store_true",
73-
help="Perform service scan over targets.",
74-
default=False)
75-
76-
parser.add_argument("--quick",
77-
dest="quick",
78-
action="store_true",
79-
required=False,
80-
help="Move to the next target after performing a quick scan and writing first-round recommendations.",
81-
default=False)
82-
83-
parser.add_argument("--virtualhosts",
84-
dest="virtualhosts",
85-
action="store_true",
86-
required=False,
87-
help="Attempt to discover virtual hosts using the specified wordlist.",
88-
default=False)
89-
90-
parser.add_argument('--ignore-http-codes',
91-
dest='ignore_http_codes',
92-
type=str,
93-
help='Comma separated list of http codes to ignore with virtual host scans.',
94-
default='404')
95-
96-
parser.add_argument('--ignore-content-length',
97-
dest='ignore_content_length',
98-
type=int,
99-
help='Ignore content lengths of specificed amount. This may become useful when a server returns a static page on every virtual host guess.',
100-
default=0)
101-
102-
parser.add_argument("--quiet",
103-
dest="quiet",
104-
action="store_true",
105-
help="Supress banner and headers to limit to comma dilimeted results only.",
106-
default=False)
107-
108-
parser.add_argument("--no-udp",
109-
dest="no_udp_service_scan",
110-
action="store_true",
111-
help="Disable UDP services scan over targets.",
112-
default=False)
113-
return parser
114-
25+
parser.add_argument("-t",
26+
dest="target_hosts",
27+
required=True,
28+
help="Set a target range of addresses to target. Ex 10.11.1.1-255")
29+
30+
parser.add_argument("-o",
31+
dest="output_directory",
32+
required=True,
33+
help="Set the output directory. Ex /root/Documents/labs/")
34+
35+
parser.add_argument("-w",
36+
dest="wordlist",
37+
required=False,
38+
help="Set the wordlist to use for generated commands. Ex /usr/share/wordlist.txt",
39+
default=False)
40+
41+
parser.add_argument("-p",
42+
dest="port",
43+
required=False,
44+
help="Set the port to use. Leave blank to use discovered ports. "
45+
"Useful to force virtual host scanning on non-standard webserver ports.",
46+
default=80)
47+
48+
parser.add_argument("--pingsweep",
49+
dest="ping_sweep",
50+
action="store_true",
51+
help="Write a new target.txt by performing a ping sweep and discovering live hosts.",
52+
default=False)
53+
54+
parser.add_argument("--dns", "--dnssweep",
55+
dest="find_dns_servers",
56+
action="store_true",
57+
help="Find DNS servers from a list of targets.",
58+
default=False)
59+
60+
parser.add_argument("--services",
61+
dest="perform_service_scan",
62+
action="store_true",
63+
help="Perform service scan over targets.",
64+
default=False)
65+
66+
parser.add_argument("--hostnames",
67+
dest="hostname_scan",
68+
action="store_true",
69+
help="Attempt to discover target hostnames and write to 0-name.txt and hostnames.txt.",
70+
default=False)
71+
72+
parser.add_argument("--snmp",
73+
dest="perform_snmp_walk",
74+
action="store_true",
75+
help="Perform service scan over targets.",
76+
default=False)
77+
78+
parser.add_argument("--quick",
79+
dest="quick",
80+
action="store_true",
81+
required=False,
82+
help="Move to the next target after performing a quick scan and writing "
83+
"first-round recommendations.",
84+
default=False)
85+
86+
parser.add_argument("--virtualhosts",
87+
dest="virtualhosts",
88+
action="store_true",
89+
required=False,
90+
help="Attempt to discover virtual hosts using the specified wordlist.",
91+
default=False)
92+
93+
parser.add_argument('--ignore-http-codes',
94+
dest='ignore_http_codes',
95+
type=str,
96+
help='Comma separated list of http codes to ignore with virtual host scans.',
97+
default='404')
98+
99+
parser.add_argument('--ignore-content-length',
100+
dest='ignore_content_length',
101+
type=int,
102+
help='Ignore content lengths of specificed amount. '
103+
'This may become useful when a server returns a static page on '
104+
'every virtual host guess.',
105+
default=0)
106+
107+
parser.add_argument("--quiet",
108+
dest="quiet",
109+
action="store_true",
110+
help="Supress banner and headers to limit to comma dilimeted results only.",
111+
default=False)
112+
113+
parser.add_argument("--no-udp",
114+
dest="no_udp_service_scan",
115+
action="store_true",
116+
help="Disable UDP services scan over targets.",
117+
default=False)
118+
return parser

0 commit comments

Comments
 (0)