Skip to content
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

Add poetry setup #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tool.poetry]
name = "smuggler"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.12"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
smuggler = "smuggler:main"
43 changes: 23 additions & 20 deletions smuggler.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/python3
# MIT License
#
#
# Copyright (c) 2020 Evan Custodio
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -78,14 +78,14 @@ def _test(self, payload_obj):
res_filtered += chr(single)
res = res_filtered
#if '504' in res:

#print("\n\n"+str(str(payload_obj)))
#print("\n\n"+res)
return (0, res, payload_obj) # Return code 0 if normal response returned
except Exception as exception_data:
#print(exception_data)
return (-1, None, payload_obj) # Return code -1 if some except occured

def _get_cookies(self):
RN = "\r\n"
try:
Expand Down Expand Up @@ -127,10 +127,10 @@ def _get_cookies(self):
def run(self):
RN = "\r\n"
mutations = {}

if not self._get_cookies():
return

if (self._configfile[1] != '/'):
self._configfile = os.path.dirname(os.path.realpath(__file__)) + "/configs/" + self._configfile

Expand All @@ -140,16 +140,16 @@ def run(self):
error = ((Fore.CYAN + "Cannot find config file"+ Fore.MAGENTA), self._logh)
print_info("Error : %s" % (error[0]))
exit(1)

script = f.read()
f.close()

exec(script)

for mutation_name in mutations.keys():
if self._create_exec_test(mutation_name, mutations[mutation_name]) and self._exit_early:
break

if self._quiet:
sys.stdout.write("\r"+" "*100+"\r")

Expand All @@ -163,10 +163,10 @@ def _check_tecl(self, payload, ptype=0):
te_payload.host = self._vhost
te_payload.method = self._method
te_payload.endpoint = self._endpoint

if len(self._cookies) > 0:
te_payload.header += "Cookie: " + ''.join(self._cookies) + "\r\n"

if not ptype:
te_payload.cl = 6 # timeout val == 6, good value == 5
else:
Expand All @@ -185,10 +185,10 @@ def _check_clte(self, payload, ptype=0):
te_payload.host = self._vhost
te_payload.method = self._method
te_payload.endpoint = self._endpoint

if len(self._cookies) > 0:
te_payload.header += "Cookie: " + ''.join(self._cookies) + "\r\n"

if not ptype:
te_payload.cl = 4 # timeout val == 4, good value == 11
else:
Expand Down Expand Up @@ -254,7 +254,7 @@ def write_payload(smhost, payload, ptype):
else:
dismsg = Fore.RED + "Potential CLTE Issue Found" + Fore.MAGENTA + " - " + Fore.CYAN + self._method + Fore.MAGENTA + " @ " + Fore.CYAN + ["http://","https://",][self.ssl_flag]+ self._host + self._endpoint + Fore.MAGENTA + " - " + Fore.CYAN + self._configfile.split('/')[-1] + "\n"
pretty_print(name, dismsg)

# Write payload out to file
write_payload(self._host, clte_res[2], "CLTE")
self._attempts = 0
Expand All @@ -278,7 +278,7 @@ def write_payload(smhost, payload, ptype):
#print (tecl_res2[1])
dismsg = Fore.RED + "Potential TECL Issue Found" + Fore.MAGENTA + " - " + Fore.CYAN + self._method + Fore.MAGENTA + " @ " + Fore.CYAN + ["http://","https://",][self.ssl_flag]+ self._host + self._endpoint + Fore.MAGENTA + " - " + Fore.CYAN + self._configfile.split('/')[-1] + "\n"
pretty_print(name, dismsg)

# Write payload out to file
write_payload(self._host, tecl_res[2], "TECL")
self._attempts = 0
Expand Down Expand Up @@ -313,7 +313,7 @@ def write_payload(smhost, payload, ptype):
# Disconnected
dismsg = Fore.YELLOW + "DISCONNECTED" + ["\n", ""][self._quiet]
pretty_print(name, dismsg)

self._attempts = 0
return False

Expand Down Expand Up @@ -363,7 +363,7 @@ def print_info(msg, file_handle=None):
if file_handle is not None:
file_handle.write(plaintext+"\n")

if __name__ == "__main__":
def main():
global NOCOLOR
if sys.version_info < (3, 0):
print("Error: Smuggler requires Python 3.x")
Expand Down Expand Up @@ -443,3 +443,6 @@ def print_info(msg, file_handle=None):

if FileHandle is not None:
FileHandle.close()

if __name__ == "__main__":
main()