python: Fix s and x patterns

This commit is contained in:
2021-11-15 01:17:52 +01:00
parent 0c266f5792
commit 0a7046d45c

View File

@ -77,17 +77,20 @@ class Passgeny:
def gen_special(match):
slen = 1 if match[1] == "" else int(match[1])
return PASSGENY_SPECIAL[bh.modulo(len(PASSGENY_SPECIAL))]
s = ""
for l in range(slen):
s += PASSGENY_SPECIAL[bh.modulo(len(PASSGENY_SPECIAL))]
return s
def gen_decimal(match):
dlen = 1 if match[1] == "" else int(match[1])
return "{}".format(bh.modulo(dlen))
def gen_hexstr(match):
xlen = 1 if match[1] == "" else int(match[1])
x = ""
for l in range(int(match[1])):
for l in range(xlen):
x += "{:x}".format(bh.modulo(16))
return x