Bruteforce hashes using Python 3 I've written a CLI tool in Python, for bruteforcing hashes (only md5 with this version). Apart from the fact that Python is not exactly suitable for bruteforcing (performance), what else can I do to improve my code (performance -otherwise-, styling, naming, argument handling etc.)?

from sys import argv, exit
from time import time
from hashlib import md5
from itertools import product
from datetime import datetime
from string import ascii_lowercase, ascii_uppercase, digits

hash_ = argv[1]
charset_ = argv[2]
minlength = argv[3]
maxlength = argv[4]

charset = {"1":  ascii_lowercase,
           "2":  ascii_uppercase,
           "3":  digits,
           "4":  ascii_lowercase 
               + ascii_uppercase,
           "5":  ascii_lowercase 
               + digits,
           "6":  ascii_uppercase
              + digits,
           "7":  ascii_lowercase 
              + ascii_uppercase 
              + digits
         }

 charset = charset[charset_]

 colors = {"R":"\033[91m",
           "G":"\033[92m",
           "~":"\033[00m"
         }


def bruteforce(hash_, characters, min_length, max_length):

    start = datetime.now()
    start_time = time()

    for length in range(int(min_length), int(max_length) + 1):
        products = product(characters, repeat=length)
        for attempt in products:
            hashed = "".join(attempt).encode("utf-8")
            hashed = md5(hashed).hexdigest()

            if hashed != hash_:
                print(f"{colors['R']}{''.join(attempt)}")

            else:
                diff = int(time()-start_time)
                print(f"{colors['G']}{''.join(attempt)}")
                print(colors["~"])
                print(" Statistics")
                print("~~~~~~~~~~~~~~~~~")
                print(f"Started:          {start}")
                print(f"Calculation time: {diff} seconds")
                print(f"Original hash:    {hash_}")
                print(f"Found string:     {''.join(attempt)}")
                print("~~~~~~~~~~~~~~~~~")

               return True


def main():
    print(colors["~"])
    bruteforce(hash_, charset, minlength, maxlength)
    print(colors["~"])

if __name__ == "__main__":
    main()
    exit()
1) You don't need to pass minlength and maxlength in your bruteforce function since you making it available at module level. 

2) Also there are unwanted new-lines. 

3) Also dict formatting can be improved a lot, this will help in readability of your code. Try using any online dict-formatter. 

4) You can use datetime.now().time() instead of using a separate library time.

5) If possible avoid using too many print statements or atleast do that with proper messaging rather than any random string like ~~~~~~ you are using.