Adding verbosity feature

pull/53/head
Swissky 2024-06-09 01:13:53 +02:00
parent b2eef12b15
commit 4e92e88913
2 changed files with 13 additions and 7 deletions

View File

@ -47,9 +47,9 @@ class exploit():
# Display diff between default and ssrf request # Display diff between default and ssrf request
logging.info(f"\033[32mReading file\033[0m : {f}") logging.info(f"\033[32mReading file\033[0m : {f}")
if bytes(diff, encoding='utf-8').startswith(self.file_magic["elf"]): if bytes(diff, encoding='utf-8').startswith(self.file_magic["elf"]):
print("ELF binary found - not printing to stdout") logging.info("ELF binary found - not printing to stdout")
else: else:
print(diff) logging.info(diff)
# Write diff to a file # Write diff to a file
filename = f.replace('\\','_').replace('/','_') filename = f.replace('\\','_').replace('/','_')
@ -58,4 +58,4 @@ class exploit():
f.write(diff) f.write(diff)
else: else:
print("Empty response") logging.info("Empty response")

View File

@ -27,7 +27,7 @@ def parse_args():
parser.add_argument('-p', action ='store', dest='param', help="SSRF Parameter to target") parser.add_argument('-p', action ='store', dest='param', help="SSRF Parameter to target")
parser.add_argument('-m', action ='store', dest='modules', help="SSRF Modules to enable") parser.add_argument('-m', action ='store', dest='modules', help="SSRF Modules to enable")
parser.add_argument('-l', action ='store', dest='handler', help="Start an handler for a reverse shell", nargs='?', const='1') parser.add_argument('-l', action ='store', dest='handler', help="Start an handler for a reverse shell", nargs='?', const='1')
parser.add_argument('-v', action ='store', dest='verbose', help="Enable verbosity", nargs='?', const=True) parser.add_argument('-v', action ='store_true', dest='verbose', help="Enable verbosity")
parser.add_argument('--lhost', action ='store', dest='lhost', help="LHOST reverse shell") parser.add_argument('--lhost', action ='store', dest='lhost', help="LHOST reverse shell")
parser.add_argument('--lport', action ='store', dest='lport', help="LPORT reverse shell") parser.add_argument('--lport', action ='store', dest='lport', help="LPORT reverse shell")
parser.add_argument('--rfiles', action ='store', dest='targetfiles', help="Files to read with readfiles module", nargs='?', const=True) parser.add_argument('--rfiles', action ='store', dest='targetfiles', help="Files to read with readfiles module", nargs='?', const=True)
@ -57,10 +57,16 @@ if __name__ == "__main__":
] ]
) )
logging.addLevelName( logging.WARNING, "\033[1;31m%s\033[1;0m" % logging.getLevelName(logging.WARNING)) logging.addLevelName(logging.WARNING, "\033[1;31m%s\033[1;0m" % logging.getLevelName(logging.WARNING))
logging.addLevelName( logging.ERROR, "\033[1;41m%s\033[1;0m" % logging.getLevelName(logging.ERROR)) logging.addLevelName(logging.ERROR, "\033[1;41m%s\033[1;0m" % logging.getLevelName(logging.ERROR))
display_banner() display_banner()
# SSRFmap # handle verbosity
args = parse_args() args = parse_args()
if args.verbose is True:
logging.getLogger().setLevel(logging.DEBUG)
logging.debug("Verbose output is enabled")
# SSRFmap
ssrf = SSRF(args) ssrf = SSRF(args)