Skip to content

Commit c7c815c

Browse files
authored
Merge pull request #165 from NullArray/dev-beta
Automatic issue creation
2 parents 8fb7143 + fe6e345 commit c7c815c

File tree

15 files changed

+322
-73
lines changed

15 files changed

+322
-73
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ uid.p
77
etc/tokens/*
88
autosploit_out/*
99
venv/*
10+
etc/json/*

autosploit/main.py

Lines changed: 89 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
from lib.cmdline.cmd import AutoSploitParser
88
from lib.term.terminal import AutoSploitTerminal
9+
from lib.creation.issue_creator import (
10+
request_issue_creation,
11+
hide_sensitive
12+
)
913
from lib.output import (
1014
info,
1115
warning,
@@ -19,7 +23,8 @@
1923
cmdline,
2024
close,
2125
EXPLOIT_FILES_PATH,
22-
START_SERVICES_PATH
26+
START_SERVICES_PATH,
27+
save_error_to_file,
2328
)
2429
from lib.jsonize import (
2530
load_exploits,
@@ -28,81 +33,99 @@
2833

2934

3035
def main():
31-
3236
try:
33-
is_admin = os.getuid() == 0
34-
except AttributeError:
35-
# we'll make it cross platform because it seems like a cool idea
36-
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
3737

38-
if not is_admin:
39-
close("must have admin privileges to run")
38+
try:
39+
is_admin = os.getuid() == 0
40+
except AttributeError:
41+
# we'll make it cross platform because it seems like a cool idea
42+
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
4043

41-
opts = AutoSploitParser().optparser()
44+
if not is_admin:
45+
close("must have admin privileges to run")
4246

43-
logo()
44-
info("welcome to autosploit, give us a little bit while we configure")
45-
misc_info("checking your running platform")
46-
platform_running = platform.system()
47-
misc_info("checking for disabled services")
48-
# according to ps aux, postgre and apache2 are the names of the services on Linux systems
49-
service_names = ("postgres", "apache2")
50-
if "darwin" in platform_running.lower():
51-
service_names = ("postgres", "apachectl")
47+
opts = AutoSploitParser().optparser()
5248

53-
for service in list(service_names):
54-
while not check_services(service):
55-
choice = prompt(
56-
"it appears that service {} is not enabled, would you like us to enable it for you[y/N]".format(
57-
service.title()
58-
)
59-
)
60-
if choice.lower().startswith("y"):
61-
try:
62-
if "darwin" in platform_running.lower():
63-
cmdline("{} darwin".format(START_SERVICES_PATH))
64-
elif "linux" in platform_running.lower():
65-
cmdline("{} linux".format(START_SERVICES_PATH))
66-
else:
67-
close("your platform is not supported by AutoSploit at this time", status=2)
49+
logo()
50+
info("welcome to autosploit, give us a little bit while we configure")
51+
misc_info("checking your running platform")
52+
platform_running = platform.system()
53+
misc_info("checking for disabled services")
54+
# according to ps aux, postgre and apache2 are the names of the services on Linux systems
55+
service_names = ("postgres", "apache2")
56+
if "darwin" in platform_running.lower():
57+
service_names = ("postgres", "apachectl")
6858

69-
# moving this back because it was funky to see it each run
70-
info("services started successfully")
71-
# this tends to show up when trying to start the services
72-
# I'm not entirely sure why, but this fixes it
73-
except psutil.NoSuchProcess:
74-
pass
75-
else:
76-
process_start_command = "`sudo service {} start`"
77-
if "darwin" in platform_running.lower():
78-
process_start_command = "`brew services start {}`"
79-
close(
80-
"service {} is required to be started for autosploit to run successfully (you can do it manually "
81-
"by using the command {}), exiting".format(
82-
service.title(), process_start_command.format(service)
59+
for service in list(service_names):
60+
while not check_services(service):
61+
choice = prompt(
62+
"it appears that service {} is not enabled, would you like us to enable it for you[y/N]".format(
63+
service.title()
8364
)
8465
)
66+
if choice.lower().startswith("y"):
67+
try:
68+
if "darwin" in platform_running.lower():
69+
cmdline("{} darwin".format(START_SERVICES_PATH))
70+
elif "linux" in platform_running.lower():
71+
cmdline("{} linux".format(START_SERVICES_PATH))
72+
else:
73+
close("your platform is not supported by AutoSploit at this time", status=2)
8574

86-
if len(sys.argv) > 1:
87-
info("attempting to load API keys")
88-
loaded_tokens = load_api_keys()
89-
AutoSploitParser().parse_provided(opts)
75+
# moving this back because it was funky to see it each run
76+
info("services started successfully")
77+
# this tends to show up when trying to start the services
78+
# I'm not entirely sure why, but this fixes it
79+
except psutil.NoSuchProcess:
80+
pass
81+
else:
82+
process_start_command = "`sudo service {} start`"
83+
if "darwin" in platform_running.lower():
84+
process_start_command = "`brew services start {}`"
85+
close(
86+
"service {} is required to be started for autosploit to run successfully (you can do it manually "
87+
"by using the command {}), exiting".format(
88+
service.title(), process_start_command.format(service)
89+
)
90+
)
9091

91-
if not opts.exploitFile:
92+
if len(sys.argv) > 1:
93+
info("attempting to load API keys")
94+
loaded_tokens = load_api_keys()
95+
AutoSploitParser().parse_provided(opts)
96+
97+
if not opts.exploitFile:
98+
misc_info("checking if there are multiple exploit files")
99+
loaded_exploits = load_exploits(EXPLOIT_FILES_PATH)
100+
else:
101+
loaded_exploits = load_exploit_file(opts.exploitFile)
102+
misc_info("Loaded {} exploits from {}.".format(
103+
len(loaded_exploits),
104+
opts.exploitFile))
105+
106+
AutoSploitParser().single_run_args(opts, loaded_tokens, loaded_exploits)
107+
else:
108+
warning(
109+
"no arguments have been parsed, defaulting to terminal session. "
110+
"press 99 to quit and help to get help"
111+
)
92112
misc_info("checking if there are multiple exploit files")
93113
loaded_exploits = load_exploits(EXPLOIT_FILES_PATH)
94-
else:
95-
loaded_exploits = load_exploit_file(opts.exploitFile)
96-
misc_info("Loaded {} exploits from {}.".format(
97-
len(loaded_exploits),
98-
opts.exploitFile))
114+
info("attempting to load API keys")
115+
loaded_tokens = load_api_keys()
116+
terminal = AutoSploitTerminal(loaded_tokens)
117+
terminal.terminal_main_display(loaded_exploits)
118+
except Exception as e:
119+
import traceback
120+
121+
print(
122+
"\033[31m[!] AutoSploit has hit an unhandled exception: '{}', "
123+
"in order for the developers to troubleshoot and repair the "
124+
"issue AutoSploit will need to gather your OS information, metasploit version, "
125+
"current arguments, the error message, and a traceback. "
126+
"None of this information can be used to identify you in any way\033[0m".format(str(e))
127+
)
128+
error_traceback = ''.join(traceback.format_tb(sys.exc_info()[2]))
129+
error_file = save_error_to_file(str(error_traceback))
130+
request_issue_creation(error_file, hide_sensitive(), str(e))
99131

100-
AutoSploitParser().single_run_args(opts, loaded_tokens, loaded_exploits)
101-
else:
102-
warning("no arguments have been parsed, defaulting to terminal session. press 99 to quit and help to get help")
103-
misc_info("checking if there are multiple exploit files")
104-
loaded_exploits = load_exploits(EXPLOIT_FILES_PATH)
105-
info("attempting to load API keys")
106-
loaded_tokens = load_api_keys()
107-
terminal = AutoSploitTerminal(loaded_tokens)
108-
terminal.terminal_main_display(loaded_exploits)

etc/scripts/start_services.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/bash
22

33
function startApacheLinux () {
4+
# NOTE: if you are running on Arch uncomment this
5+
#sudo systemctl start apache > /dev/null 2>&1
6+
# and comment this one out
47
sudo systemctl start apache2 > /dev/null 2>&1
58
}
69

etc/text_files/auth.key

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Vm0wd2VFMUdiRmhTV0d4V1YwZG9XVll3WkRSV1ZteHlWMjVrVlUxV2NIbFdNalZyWVZVeFYxZHVhRmRTZWtFeFZtMTRTMk15VGtsaFJscHBWa1ZhU1ZkV1VrZFRNazE0Vkc1V2FsSnRhRzlVVmxwWFRrWmFjbHBFVWxwV2JIQllWVEkxVDFkSFNraFZiR2hhWVRGYU0xWXhXbUZqTVZwMFVteG9hVlpyV1hwV1IzaGhZekZhU0ZOclpGaGlSMmhvVm1wT1UyRkdiRlpYYlhScVlrWmFlVlV5Y3pGV01rcEpVV3hzVjFaNlJUQlpla3BIWXpGT2MxWnNaR2xTYTNCWFZtMHhOR1F3TUhoalJXaHNVakJhVlZWc1VsZFhiR1J5VjIxR2FGWnNjSHBaTUZadlZqRktjMk5HYUZwaGExcG9WbXBHYTJOc1pISlBWbVJPWWxkb1dsWXhXbE5TTVZwMFZtdGthbEpXY0ZsWmExVXhZMVpTVjFkdFJrNVdiRlkxV1ROd1YxWnJNVmRqUldSWFRXNUNTRlpxUm1GV01rNUhWRzFHVTFKV2NFVldiR1EwVVRGYVZrMVZWazVTUkVFNQ==:9

etc/text_files/ethics.lst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@
99
"This provides an unending opportunity for cybercriminals and script kiddies to hijack vulnerable devices and subsequently launch attacks against online organizations with ease"
1010
"Both Metasploit and Shodan have been available for years, as integral to the pen testers toolkit as Nessus and Burpsuite. But with Autosploit pulling them together, the concern should be focused on curious kids thinking it would be fun to see what they can find"
1111
"My fear is that this has magnified the attack surface, and made it so that every exposed service on the internet will be scanned and probed on a near-constant basis by an entirely new set of attackers."
12-
"The release of tools like these exponentially expands the threat landscape by allowing a wider group of hackers to launch global attacks at will"
12+
"The release of tools like these exponentially expands the threat landscape by allowing a wider group of hackers to launch global attacks at will"
13+
"Good to know we’ve weaponized for the masses. Everyone can now be a script kiddie simply by plugging, playing and attacking."
14+
"The fact that something is really easy, does not make unauthorized computer access any less a crime. And tools like this leave a forensic footprint that is miles wide. Yes, you can compromise poorly protected systems very easily with this tool, but you can also end up in a lot of trouble."

etc/text_files/links.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
https://gist.githubusercontent.com/Ekultek/f51e6d61817721aa9341a1f1e66d3602/raw/82dfa8234d2f744c99bc277a1c73efc39770cff6/wordpress_exploits.txt
2+
https://gist.githubusercontent.com/Ekultek/76202c6fa170d6da501da5ab303f01f0/raw/da5205919f1a47f2ccc9c75ab26e1456ad91d3d4/all_exploits.txt
3+
https://gist.githubusercontent.com/Ekultek/e04f27632d40bf10da338b61b8416f95/raw/8c949dd2aa8047ded828b1220e13101b6f28d9ab/linux_exploits.txt
4+
https://gist.githubusercontent.com/Ekultek/d4658fe488f9edafe2b2edc1910e1983/raw/13c21c0ed20b4b10df79b93566fdd111df77f1ed/windows_exploits.txt
5+
https://gist.githubusercontent.com/Ekultek/219036c05e21d8352b4181cbe3df5f4f/raw/0e907b387fa2b35dc75cb94120172155d8d3eb3e/smb_exploits.txt
6+
https://gist.githubusercontent.com/Ekultek/066e1c9285f2a60d2b7103b4d1972864/raw/03d06809a3d79d51f19e3d0c77fb9783f961c485/samba_exploits.txt
7+
https://gist.githubusercontent.com/Ekultek/e9a5c7d37fc58b77bed241d8f2811e8a/raw/789839b93c2c8ce7cc6240cafedfa8e30c2ae4e1/all_rce_exploits.txt
8+
https://gist.githubusercontent.com/Ekultek/c69a01e688ed1739d9e572722ea37ed5/raw/63ead0225784de9389059745b1c869face015d7c/2018_rce_exploits.txt
9+
https://gist.githubusercontent.com/Ekultek/6d1d2d0a83715cb0314fead1ff2768a1/raw/b4fb17df1c3c09464741547ccff674262168a015/excellent_exploits.txt
10+
https://gist.githubusercontent.com/Ekultek/4a06da7d69f8f7f24542f7e978ad67a5/raw/5623ac8b9e4dc8e246e013dc7d7e2b5a31948d78/os_command_exploits.txt
11+
https://gist.githubusercontent.com/Ekultek/2d7e0d98b37b1d06676d409fe0c5b899/raw/f4fe9b3c400dcf86a8147fd903a6ee13e3fbe5f5/buffer_overflow_exploit.txt
12+
https://gist.githubusercontent.com/Ekultek/fdac157e66b82fea3075d2149e9aa1d3/raw/c5002d9c9e2918084e16b83fc1a9af06cf26bd05/osx_exploits.txt

lib/banner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import random
33

4-
VERSION = "2.2"
4+
VERSION = "2.2.1"
55

66

77
def banner_1(line_sep="#--", space=" " * 30):
@@ -61,7 +61,7 @@ def banner_3():
6161
)
6262
return banner
6363

64-
64+
6565
def banner_4():
6666
banner = r"""
6767
{red} .__. , __. . , {end}

lib/cmdline/cmd.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ def optparser():
7878
help=argparse.SUPPRESS) # easter egg!
7979
misc.add_argument("--whitelist", metavar="PATH", dest="whitelist",
8080
help="only exploit hosts listed in the whitelist file")
81+
misc.add_argument("-D", "--download", nargs="+", metavar="SEARCH1 SEARCH2 ...", dest="downloadModules",
82+
help="download new exploit modules with a provided search flag")
8183
opts = parser.parse_args()
8284
return opts
8385

@@ -138,6 +140,8 @@ def single_run_args(opt, keys, loaded_modules):
138140
lib.settings.close(
139141
"You should take this ethical lesson into consideration "
140142
"before you continue with the use of this tool:\n\n{}\n".format(ethic))
143+
if opt.downloadModules is not None:
144+
print "downloading MODULES!"
141145
if opt.exploitList:
142146
try:
143147
lib.output.info("converting {} to JSON format".format(opt.exploitList))

lib/creation/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)