Skip to content

Commit

Permalink
url encoded keep as is
Browse files Browse the repository at this point in the history
  • Loading branch information
babenek committed Jun 26, 2024
1 parent 741f2fe commit f256ade
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,17 +344,22 @@ def generate_value(value):
elif hex_upper:
upper_set = upper_set[:6]

backslash_case = False
backslash_case = 0
for v in value:
# \u.... and %2.... will be kept
if '\\' == v or '%' == v:
backslash_case = True
if '%' == v:
backslash_case = 2
obfuscated_value += v
continue
if backslash_case:
if '\\' == v:
backslash_case = 1
obfuscated_value += v
backslash_case = False
continue
if 0 < backslash_case:
obfuscated_value += v
backslash_case -= 1
continue
else:
backslash_case = 0
if v in string.ascii_lowercase:
obfuscated_value += random.choice(lower_set)
elif v in string.ascii_uppercase:
Expand All @@ -363,8 +368,6 @@ def generate_value(value):
obfuscated_value += random.choice(digits_set)
else:
obfuscated_value += v
if '\\' != v or '%' == v:
backslash_case = False

return obfuscated_value

Expand Down

0 comments on commit f256ade

Please sign in to comment.