Merge pull request #71 from gadcam/patch-2

pull/72/head
Albert Koczy 2 years ago committed by GitHub
commit bd836a720f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,11 +18,17 @@ def mitmproxy_dump_file_huristic(file_path: str) -> int:
# read the first 2048 bytes # read the first 2048 bytes
with open(file_path, "rb") as f: with open(file_path, "rb") as f:
data = f.read(2048) data = f.read(2048)
# if file contains non-ascii characters # if file contains non-ascii characters after remove EOL characters
if data.decode("utf-8", "ignore").isprintable() is False: if (
data.decode("utf-8", "ignore")
.replace("\r", "")
.replace("\n", "")
.isprintable()
is False
):
val += 50 val += 50
# if first character of the byte array is a digit # if first character of the byte array is a digit
if str(data[0]).isdigit() is True: if data[0:1].decode("utf-8", "ignore").isdigit() is True:
val += 5 val += 5
# if it contains the word status_code # if it contains the word status_code
if b"status_code" in data: if b"status_code" in data:

Loading…
Cancel
Save