|
| 1 | +import os |
| 2 | +import sys |
| 3 | +import random |
| 4 | +import argparse |
| 5 | + |
| 6 | + |
| 7 | +class AutoSploitParser(argparse.ArgumentParser): |
| 8 | + |
| 9 | + def __init__(self): |
| 10 | + super(AutoSploitParser, self).__init__() |
| 11 | + |
| 12 | + @staticmethod |
| 13 | + def optparser(): |
| 14 | + parser = argparse.ArgumentParser() |
| 15 | + parser.add_argument("-c", "--censys", action="store_true", dest="searchCensys", |
| 16 | + help="use censys.io as the search engine instead of shodan.io to gather hosts") |
| 17 | + parser.add_argument("-b", "--both", action="store_true", dest="searchBoth", |
| 18 | + help="search both shodan.io and censys.io for hosts") |
| 19 | + parser.add_argument("--proxy", metavar="PROTO://IP:PORT", dest="proxyConfig", |
| 20 | + help="run behind a proxy while performing the searches") |
| 21 | + parser.add_argument("-e", "--exploit-file", metavar="PATH", dest="exploitList", |
| 22 | + help="provide a text file to convert into JSON and save for later use") |
| 23 | + parser.add_argument("-E", "--exploit", metavar="EXPLOIT", dest="singleExploit", |
| 24 | + help="pass a single exploit in the same format as the JSON file(s)") |
| 25 | + parser.add_argument("--ethics", action="store_true", dest="displayEthics", |
| 26 | + help=argparse.SUPPRESS) # easter egg! |
| 27 | + opts = parser.parse_args() |
| 28 | + return opts |
| 29 | + |
| 30 | + @staticmethod |
| 31 | + def single_run_args(opt): |
| 32 | + if opt.displayEthics: |
| 33 | + ethics_file = "{}/etc/text_files/ethics.lst".format(os.getcwd()) |
| 34 | + with open(ethics_file) as ethics: |
| 35 | + ethic = random.choice(ethics.readlines()).strip() |
| 36 | + print("Your ethic for the day:\n\n{}".format(ethic)) |
| 37 | + sys.exit(0) |
0 commit comments