Skip to content

Commit afc6567

Browse files
author
ekultek
committed
moved some stuff to settings, created a class for the exploitation so it is easier to mess with, edited the modules and removed -j and use #54, added new args to the available options, edited the api's by adding a description of what is happening at the time of the execution, a couple edits to autosploit.py
1 parent 38e7329 commit afc6567

File tree

8 files changed

+425
-374
lines changed

8 files changed

+425
-374
lines changed

api_calls/censys.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import requests
22

33
from lib.errors import AutoSploitAPIConnectionError
4-
from lib.output import error
4+
from lib.output import (
5+
error,
6+
info
7+
)
58
from lib.settings import (
69
HOST_FILE,
710
API_URLS,
@@ -25,6 +28,7 @@ def censys(self):
2528
"""
2629
connect to the Censys API and pull all IP addresses from the provided query
2730
"""
31+
info("searching Censys with given query '{}'".format(self.query))
2832
discovered_censys_hosts = set()
2933
try:
3034
req = requests.post(API_URLS["censys"], auth=(self.id, self.token), json={"query": self.query})

api_calls/shodan.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
import requests
44

55
from lib.errors import AutoSploitAPIConnectionError
6-
from lib.output import error
6+
from lib.output import (
7+
error,
8+
info
9+
)
710
from lib.settings import (
811
API_URLS,
912
HOST_FILE,
@@ -27,6 +30,7 @@ def shodan(self):
2730
"""
2831
connect to the API and grab all IP addresses associated with the provided query
2932
"""
33+
info("searching Shodan with given query '{}'".format(self.query))
3034
discovered_shodan_hosts = set()
3135
try:
3236
req = requests.get(API_URLS["shodan"].format(query=self.query, token=self.token))

api_calls/zoomeye.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
import requests
66

77
from lib.errors import AutoSploitAPIConnectionError
8-
from lib.output import error
8+
from lib.output import (
9+
error,
10+
info
11+
)
912
from lib.settings import (
1013
API_URLS,
1114
HOST_FILE,
@@ -56,6 +59,7 @@ def zoomeye(self):
5659
connect to the API and pull all the IP addresses that are associated with the
5760
given query
5861
"""
62+
info("searching ZoomEye with given query '{}'".format(self.query))
5963
discovered_zoomeye_hosts = set()
6064
try:
6165
token = self.__get_auth()

autosploit.py

Lines changed: 4 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@
3434
from lib.settings import (
3535
validate_ip_addr,
3636
check_services,
37+
cmdline,
3738
load_api_keys,
3839
PLATFORM_PROMPT,
3940
AUTOSPLOIT_PROMPT,
40-
AUTOSPLOIT_TERM_OPTS
41+
AUTOSPLOIT_TERM_OPTS,
42+
USAGE_AND_LEGAL_PATH
4143
)
4244
from lib.output import (
4345
info,
@@ -55,7 +57,6 @@
5557
local_host = ""
5658
configured = False
5759
toolbar_width = 60
58-
usage_and_legal_path = "{}/etc/general".format(os.getcwd())
5960
loaded_exploits = load_exploits("{}/etc/json".format(os.getcwd()))
6061
stop_animation = False
6162

@@ -91,32 +92,12 @@ def animation(text):
9192

9293
def usage():
9394
"""Usage & Legal."""
94-
global usage_and_legal_path
9595
print("\033[H\033[J") # Clear terminal
9696
logo()
97-
with open(usage_and_legal_path) as info:
97+
with open(USAGE_AND_LEGAL_PATH) as info:
9898
print(info.read())
9999

100100

101-
def cmdline(command):
102-
"""
103-
Function that allows us to store system command output in a variable.
104-
We'll change this later in order to solve the potential security
105-
risk that arises when passing untrusted input to the shell.
106-
107-
I intend to have the issue resolved by Version 1.5.0.
108-
"""
109-
110-
command = shlex.split(command)
111-
112-
process = subprocess.Popen(
113-
args=command,
114-
stdout=subprocess.PIPE,
115-
shell=True
116-
)
117-
return process.communicate()[0]
118-
119-
120101
def exploit(query=None, single=None):
121102
"""Exploit component"""
122103

@@ -557,63 +538,6 @@ def try_shodan():
557538

558539
if __name__ == "__main__":
559540

560-
'''from api_calls import (
561-
shodan,
562-
censys,
563-
zoomeye
564-
)
565-
from lib.settings import (
566-
load_api_keys,
567-
API_URLS,
568-
AUTOSPLOIT_PROMPT
569-
)
570-
571-
from lib.output import (
572-
prompt,
573-
info,
574-
warning
575-
)
576-
577-
tokens = load_api_keys()
578-
579-
possible_apis = API_URLS.keys()
580-
581-
def get_query():
582-
query = prompt("enter your search query")
583-
return query
584-
585-
selected = False
586-
info_msg = "searching {} API with query '{}'"
587-
info("pick a search engine")
588-
for i, api in enumerate(sorted(possible_apis), start=1):
589-
print("{}. {}".format(i, api))
590-
591-
while not selected:
592-
choice = raw_input(AUTOSPLOIT_PROMPT)
593-
try:
594-
choice = int(choice)
595-
if choice == 1:
596-
selected = True
597-
query = get_query()
598-
info(info_msg.format("Shodan", query))
599-
censys.CensysAPIHook(tokens["censys"][1], tokens["censys"][0], query).censys()
600-
elif choice == 2:
601-
selected = True
602-
query = get_query()
603-
info(info_msg.format("Censys", query))
604-
shodan.ShodanAPIHook(tokens["shodan"][0], query).shodan()
605-
elif choice == 3:
606-
query = get_query()
607-
selected = True
608-
info("ZoomEye token will be loaded automatically")
609-
info(info_msg.format("Zoomeye", query))
610-
zoomeye.ZoomEyeAPIHook(query).zoomeye()
611-
else:
612-
warning("choice must be between 1-{}".format(len(API_URLS.keys())))
613-
except:
614-
warning("choice must be integer not string")'''
615-
616-
617541
logo()
618542

619543
if len(sys.argv) > 1:

0 commit comments

Comments
 (0)