added status command; added --sausage to scan command

This commit is contained in:
epi052
2020-02-04 20:55:49 -06:00
committed by GitHub
parent 7a24d85db4
commit 3ea2cc7399
2 changed files with 33 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ import pickle
import selectors import selectors
import threading import threading
import subprocess import subprocess
import webbrowser
from pathlib import Path from pathlib import Path
# fix up the PYTHONPATH so we can simply execute the shell from wherever in the filesystem # fix up the PYTHONPATH so we can simply execute the shell from wherever in the filesystem
@@ -20,7 +21,7 @@ import cmd2 # noqa: E402
from cmd2.ansi import style # noqa: E402 from cmd2.ansi import style # noqa: E402
# project's module imports # project's module imports
from recon import get_scans, tools, scan_parser, install_parser # noqa: F401,E402 from recon import get_scans, tools, scan_parser, install_parser, status_parser # noqa: F401,E402
# select loop, handles async stdout/stderr processing of subprocesses # select loop, handles async stdout/stderr processing of subprocesses
selector = selectors.DefaultSelector() selector = selectors.DefaultSelector()
@@ -157,6 +158,13 @@ class ReconShell(cmd2.Cmd):
command.extend(args.__statement__.arg_list) command.extend(args.__statement__.arg_list)
if args.sausage:
# sausage is not a luigi option, need to remove it
# name for the option came from @AlphaRingo
command.pop(command.index("--sausage"))
webbrowser.open("localhost:8082") # hard-coded here, can specify different with the status command
if args.verbose: if args.verbose:
# verbose is not a luigi option, need to remove it # verbose is not a luigi option, need to remove it
command.pop(command.index("--verbose")) command.pop(command.index("--verbose"))
@@ -267,6 +275,11 @@ class ReconShell(cmd2.Cmd):
# store any tool installs/failures (back) to disk # store any tool installs/failures (back) to disk
pickle.dump(tools, persistent_tool_dict.open("wb")) pickle.dump(tools, persistent_tool_dict.open("wb"))
@cmd2.with_argparser(status_parser)
def do_status(self, args):
""" Open a web browser to Luigi's central scheduler's visualization site """
webbrowser.open(f"{args.host}:{args.port}")
if __name__ == "__main__": if __name__ == "__main__":
rs = ReconShell(persistent_history_file="~/.reconshell_history", persistent_history_length=10000) rs = ReconShell(persistent_history_file="~/.reconshell_history", persistent_history_length=10000)

View File

@@ -144,6 +144,20 @@ install_parser = cmd2.Cmd2ArgumentParser()
install_parser.add_argument("tool", help="which tool to install", choices=list(tools.keys()) + ["all"]) install_parser.add_argument("tool", help="which tool to install", choices=list(tools.keys()) + ["all"])
# options for ReconShell's 'status' command
status_parser = cmd2.Cmd2ArgumentParser()
status_parser.add_argument(
"--port",
help="port on which the luigi central scheduler's visualization site is running (default: 8082)",
default="8082",
)
status_parser.add_argument(
"--host",
help="host on which the luigi central scheduler's visualization site is running (default: localhost)",
default="localhost",
)
# options for ReconShell's 'scan' command # options for ReconShell's 'scan' command
scan_parser = cmd2.Cmd2ArgumentParser() scan_parser = cmd2.Cmd2ArgumentParser()
scan_parser.add_argument("scantype", choices_function=get_scans) scan_parser.add_argument("scantype", choices_function=get_scans)
@@ -178,6 +192,11 @@ scan_parser.add_argument("--threads", help="number of threads for all of the thr
scan_parser.add_argument("--scan-timeout", help="scan timeout for aquatone") scan_parser.add_argument("--scan-timeout", help="scan timeout for aquatone")
scan_parser.add_argument("--proxy", help="proxy for gobuster if desired (ex. 127.0.0.1:8080)") scan_parser.add_argument("--proxy", help="proxy for gobuster if desired (ex. 127.0.0.1:8080)")
scan_parser.add_argument("--extensions", help="list of extensions for gobuster (ex. asp,html,aspx)") scan_parser.add_argument("--extensions", help="list of extensions for gobuster (ex. asp,html,aspx)")
scan_parser.add_argument(
"--sausage",
action="store_true",
help="ppen a web browser to Luigi's central scheduler's visualization site (see how the sausage is made!)",
)
scan_parser.add_argument( scan_parser.add_argument(
"--local-scheduler", action="store_true", help="use the local scheduler instead of the central scheduler (luigid)", "--local-scheduler", action="store_true", help="use the local scheduler instead of the central scheduler (luigid)",
) )