Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autosploit/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def main():
service_names = ("postgresql", "apache")
for service in list(service_names):
if not check_services(service):
choice = prompt("it appears that service {} is not enabled, would you like us to enable it for you[y/N]")
choice = prompt("it appears that service {} is not enabled, would you like us to enable it for you[y/N]".format(service))
if choice.lower().startswith("y"):
if "postgre" in service:
cmdline("sudo bash {}".format(START_POSTGRESQL_PATH))
Expand Down
47 changes: 20 additions & 27 deletions lib/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@
import lib.output
import lib.banner

CUR_DIR = "{}".format(os.getcwd())

# path to the file containing all the discovered hosts
HOST_FILE = "{}/hosts.txt".format(os.getcwd())
HOST_FILE = "{}/hosts.txt".format(CUR_DIR)

# path to the folder containing all the JSON exploit modules
EXPLOIT_FILES_PATH = "{}/etc/json".format(os.getcwd())
EXPLOIT_FILES_PATH = "{}/etc/json".format(CUR_DIR)

# path to the usage and legal file
USAGE_AND_LEGAL_PATH = "{}/etc/text_files/general".format(os.getcwd())
USAGE_AND_LEGAL_PATH = "{}/etc/text_files/general".format(CUR_DIR)

# path to the bash script to stack the PostgreSQL service
START_POSTGRESQL_PATH = "{}/etc/scripts/start_postgre.sh".format(os.getcwd())
START_POSTGRESQL_PATH = "{}/etc/scripts/start_postgre.sh".format(CUR_DIR)

# path to the bash script to start the Apache service
START_APACHE_PATH = "{}/etc/scripts/start_apache.sh".format(os.getcwd())
START_APACHE_PATH = "{}/etc/scripts/start_apache.sh".format(CUR_DIR)

# path to the file that will contain our query
QUERY_FILE_PATH = tempfile.NamedTemporaryFile(delete=False).name
Expand All @@ -45,8 +46,8 @@

# all the paths to the API tokens
API_KEYS = {
"censys": ("{}/etc/tokens/censys.key".format(os.getcwd()), "{}/etc/tokens/censys.id".format(os.getcwd())),
"shodan": ("{}/etc/tokens/shodan.key".format(os.getcwd()), )
"censys": ("{}/etc/tokens/censys.key".format(CUR_DIR), "{}/etc/tokens/censys.id".format(CUR_DIR)),
"shodan": ("{}/etc/tokens/shodan.key".format(CUR_DIR), )
}

# all the URLs that we will use while doing the searching
Expand Down Expand Up @@ -80,8 +81,7 @@ def validate_ip_addr(provided):
return True
except:
return False
else:
return False
return False


def check_services(service_name):
Expand Down Expand Up @@ -109,11 +109,8 @@ def write_to_file(data_to_write, filename, mode="a+"):
is_append = lib.output.prompt("would you like to (a)ppend or (o)verwrite the file")
if is_append == "o":
mode = "w"
elif is_append == "a":
mode = "a+"
else:
elif is_append != "a":
lib.output.warning("invalid input provided ('{}'), appending to file".format(is_append))
mode = "a+"
with open(filename, mode) as log:
if isinstance(data_to_write, (tuple, set, list)):
for item in list(data_to_write):
Expand All @@ -124,20 +121,18 @@ def write_to_file(data_to_write, filename, mode="a+"):
return filename


def load_api_keys(path="{}/etc/tokens".format(os.getcwd())):
def load_api_keys(path="{}/etc/tokens".format(CUR_DIR)):

"""
load the API keys from their .key files
"""

def makedir(dir):
"""
make the directory if it does not exist
"""
if not os.path.exists(dir):
os.mkdir(dir)
"""
make the directory if it does not exist
"""
if not os.path.exists(path):
os.mkdir(path)

makedir(path)
for key in API_KEYS.keys():
if not os.path.isfile(API_KEYS[key][0]):
access_token = lib.output.prompt("enter your {} API token".format(key.title()), lowercase=False)
Expand Down Expand Up @@ -179,10 +174,7 @@ def check_for_msf():
"""
check the ENV PATH for msfconsole
"""
in_env = os.getenv("msfconsole", False)
if not in_env:
return False

return os.getenv("msfconsole", False)

def logo():
"""
Expand All @@ -200,8 +192,10 @@ def animation(text):
global stop_animation
i = 0
while not stop_animation:
"""
if stop_animation is True:
print("\n")
"""
temp_text = list(text)
if i >= len(temp_text):
i = 0
Expand Down Expand Up @@ -236,13 +230,12 @@ def close(warning, status=1):
lib.output.error(warning)
sys.exit(status)


def grab_random_agent():
"""
get a random HTTP User-Agent
"""
user_agent_path = "{}/etc/text_files/agents.txt"
with open(user_agent_path.format(os.getcwd())) as agents:
with open(user_agent_path.format(CUR_DIR)) as agents:
return random.choice(agents.readlines()).strip()


Expand Down