-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Autosploit automation #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When reading an API key file, tokens are not stripped properly. Non-standard endlines causes an error with shodan/censys/etc APIs
When running without the terminal and the --dry-run flag, msfconsole will not be run. A report will still be produced.
All leading and trailing whitespaces should be removed before comparing IPs
Load exploits directly from the specified file, do not prompt for exploit-file selection if this option is specified.
Specifying either will skip the prompt after a search query. --overwrite will start with a blank file but will append futher searches ex: with -s -c --overwrite, both shodan and censys results will be appended to a clean file.
Add an option to completely erase the hosts file as well |
Not sure I understand what is asked. The overwrite option will start with a clean slate. |
@Selora Don't worry about it, I'll do it later, testing. |
|
We don't need all that output for a dry run, just something like |
The |
You need to catch the error if the file doesn't exist |
Search results is not prompted anymore
Last thing; Need short hands for the arguments:
You don't have to use those, make it your own, but make short hands please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes
For the -C flag, it was in the initial PR comments. Markdown gobbled the gt/lt signes. Fixed. |
For short arguments, they are already included (see each commits, included in the PR comments are only the full argument names). |
Added a tally at the end. Suppressed much of the output during a dry-run.
lib/cmdline/cmd.py
Outdated
save_results_args.add_argument("--overwrite", action="store_true", dest="overwriteHosts", | ||
help="When specified, start from scratch by overwriting the host file with new search results.") | ||
save_results_args.add_argument("--append", action="store_true", dest="appendHosts", | ||
help="When specified, append discovered hosts to the host file.") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These don't have shorthands
exploit.add_argument("-d", "--dry-run", action="store_true", dest="dryRun", | ||
help="Do not launch metasploit's exploits. Do everything else. msfconsole is never called.") | ||
exploit.add_argument("-f", "--exploit-file-to-use", metavar="PATH", dest="exploitFile", | ||
help="Run AutoSploit with provided exploit JSON file.") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! That's perfect thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol i like the wins and losses
"censys": (open(API_KEYS["censys"][0]).read(), open(API_KEYS["censys"][1]).read()), | ||
"shodan": (open(API_KEYS["shodan"][0]).read(), ) | ||
"censys": (open(API_KEYS["censys"][0]).read().rstrip(), open(API_KEYS["censys"][1]).read().rstrip()), | ||
"shodan": (open(API_KEYS["shodan"][0]).read().rstrip(), ) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question, why .rstrip()
why not just strip it? (idc either way, just curious)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particular reasons. I had problems with copy-pasta and dangling spaces / CR-LF vs LF endings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay that makes sense. Thought there was some magic I didn't know about lol.
Output an error message to the console if the specified exploit file does not exists.
comment when you want me to start testing again. Got some iPads to configure |
Should be good to go |
retesting |
use |
The rest looks good though, good job |
Requiring 3 arguments to configure metasploit is intended. I haven't changed that argument. I edited the original PR comments. |
@Selora Oh I misunderstood, let me retest that |
Scratch the last issue. The |
merging |
Some little tweaks and fixes to provide a way to launch without any prompts.
To run a search query without any prompt:
python autosploit.py -s -c -q 'search_query' --exploit-file-to-use etc/json/other_modules.json --overwrite
To run the exploitation modules without any prompt:
python autosploit.py --whitelist /path/to/whitelist.txt -e -C "msf_autorun_$(date +%s)" LHOST LPORT --exploit-file-to-use etc/json/some_modules.json
Search engines can be chained with exploitation:
python autosploit.py -s -c -q 'search_query' --whitelist /path/to/whitelist.txt -e -C "workspace" LHOST LPORT --exploit-file-to-use etc/json/other_modules.json --dry-run --append
Summary of added options:
Other changes: