Skip to content

Commit

Permalink
fixed payload detection; text_prep changes
Browse files Browse the repository at this point in the history
  • Loading branch information
eyaler committed Aug 10, 2022
1 parent 23345f7 commit 0bc8b4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

books = 30123, 2600
mtf_variants = 0, 80
output_folder = 'output'
output_folder = 'output_oct08'


for book, mtf in zip(books, mtf_variants):
Expand Down
4 changes: 3 additions & 1 deletion ztml/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ def validate_files(filenames: Mapping[str, str],
if ext == 'html' and label != 'base64_html':
with open(filename, 'rb') as f:
script = f.read()
script = script.replace(max(regex.finditer(webify.get_literals_regex(payload_var).encode(), script), key=lambda m: len(m[0]), default=b'')[0].split(b'`')[1], b'')
if label == 'crenc_html':
print('hi')
script = script.replace(max(regex.finditer(webify.get_literals_regex(payload_var).encode(), script), key=lambda m: len(m[0]), default=b'')[0].split(b'`', 1)[1].rsplit(b'`', 1)[0], b'')
stats.append(f'code: {len(script):,} B = {round(len(script) / 1024, 1):,} kB')
stats = ' '.join(stats)
if stats:
Expand Down

0 comments on commit 0bc8b4d

Please sign in to comment.