Last active
July 25, 2023 16:05
-
-
Save rvrsh3ll/48648f071b61aa63080674952139a159 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysqlx | |
import argparse | |
# pip3 install mysql-connector-python | |
def main(target,targetport,user,passwordfile,verbose): | |
with open(passwordfile, "r") as f: | |
passwords = f.readlines() | |
for password in passwords: | |
try: | |
session = mysqlx.get_session({ | |
'host': target, | |
'port': targetport, | |
'user': user, | |
'password': password | |
}) | |
except Exception as e: | |
if verbose: | |
print("Connection failed with error: {}".format(e)) | |
else: | |
continue | |
else: | |
print("Connection success with password: {}".format(password)) | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-t', '--target', type=str, required=False) | |
parser.add_argument('-p', '--port', type=int, default=33060, required=False) | |
parser.add_argument('-u', '--user', type=str, required=False) | |
parser.add_argument('-P', '--passwordfile', type=str, required=False) | |
parser.add_argument('-v', '--verbose', action='store_true') | |
args = parser.parse_args() | |
main(args.target,args.port,args.user,args.passwordfile,args.verbose) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment