Merge "captcha(-old).py: Fix undefined variables and remove some unused ones"

This commit is contained in:
jenkins-bot 2024-01-15 20:23:25 +00:00 committed by Gerrit Code Review
commit a9cc16855e
2 changed files with 3 additions and 7 deletions

View file

@ -203,10 +203,10 @@ def run_in_thread(object):
# 64 bits of hash is plenty for this purpose # 64 bits of hash is plenty for this purpose
md5hash = hashlib.md5((key+salt+word+key+salt).encode('utf-8')).hexdigest()[:16] md5hash = hashlib.md5((key+salt+word+key+salt).encode('utf-8')).hexdigest()[:16]
filename = "image_%s_%s.png" % (salt, md5hash) filename = "image_%s_%s.png" % (salt, md5hash)
if dirs: if opts.dirs:
subdir = gen_subdir(output, md5hash, dirs) subdir = gen_subdir(output, md5hash, dirs)
filename = os.path.join(subdir, filename) filename = os.path.join(subdir, filename)
if verbose: if opts.verbose:
print(filename) print(filename)
gen_captcha(word, font, fontsize, os.path.join(output, filename)) gen_captcha(word, font, fontsize, os.path.join(output, filename))
@ -261,8 +261,6 @@ if __name__ == '__main__':
badwordlist = read_wordlist(opts.blacklist) + read_wordlist(opts.badwordlist) badwordlist = read_wordlist(opts.blacklist) + read_wordlist(opts.badwordlist)
count = opts.count count = opts.count
fill = opts.fill fill = opts.fill
dirs = opts.dirs
verbose = opts.verbose
fontsize = opts.font_size fontsize = opts.font_size
threads = opts.threads threads = opts.threads

View file

@ -210,7 +210,7 @@ def run_in_thread(object):
# 64 bits of hash is plenty for this purpose # 64 bits of hash is plenty for this purpose
md5hash = hashlib.md5((key+salt+word+key+salt).encode('utf-8')).hexdigest()[:16] md5hash = hashlib.md5((key+salt+word+key+salt).encode('utf-8')).hexdigest()[:16]
filename = "image_%s_%s.png" % (salt, md5hash) filename = "image_%s_%s.png" % (salt, md5hash)
if dirs: if opts.dirs:
subdir = gen_subdir(output, md5hash, dirs) subdir = gen_subdir(output, md5hash, dirs)
filename = os.path.join(subdir, filename) filename = os.path.join(subdir, filename)
if opts.verbose: if opts.verbose:
@ -268,8 +268,6 @@ if __name__ == '__main__':
badwordlist = read_wordlist(opts.blacklist) + read_wordlist(opts.badwordlist) badwordlist = read_wordlist(opts.blacklist) + read_wordlist(opts.badwordlist)
count = opts.count count = opts.count
fill = opts.fill fill = opts.fill
dirs = opts.dirs
verbose = opts.verbose
fontsize = opts.font_size fontsize = opts.font_size
threads = opts.threads threads = opts.threads