Modified argparse to run in its own get_args function

master
John Hammond 2021-09-04 01:39:17 -04:00
parent 249aee4142
commit 7aa7d7a59e
1 changed files with 40 additions and 36 deletions

View File

@ -8,43 +8,47 @@ import urllib.parse
import requests
parser = argparse.ArgumentParser()
parser.add_argument(
"-t", "--target", help="The host of the Webmin 1.580 target", required=True
)
parser.add_argument(
"-p",
"--port",
help="The port that hosts Webmin 1.580",
required=False,
)
parser.add_argument(
"-U",
"--username",
help="The username to login to Webmin",
required=True,
)
parser.add_argument(
"-P",
"--password",
help="The password to login to Webmin",
required=True,
)
parser.add_argument(
"-c",
"--command",
help="The command to run on the target",
required=True,
)
parser.add_argument(
"-s",
"--ssl",
help="Whether or not we should use SSL",
action="store_true",
)
def get_args():
args = parser.parse_args()
parser = argparse.ArgumentParser()
parser.add_argument(
"-t", "--target", help="The host of the Webmin 1.580 target", required=True
)
parser.add_argument(
"-p",
"--port",
help="The port that hosts Webmin 1.580",
required=False,
)
parser.add_argument(
"-U",
"--username",
help="The username to login to Webmin",
required=True,
)
parser.add_argument(
"-P",
"--password",
help="The password to login to Webmin",
required=True,
)
parser.add_argument(
"-c",
"--command",
help="The command to run on the target",
required=True,
)
parser.add_argument(
"-s",
"--ssl",
help="Whether or not we should use SSL",
action="store_true",
)
args = parser.parse_args()
return args
class Exploit:
@ -137,7 +141,7 @@ class Exploit:
if __name__ == "__main__":
exploit = Exploit(args)
exploit = Exploit(get_args())
success = exploit.run()
if not success: