Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
decoded = str(line, "cp437")
found_list.append(
local_breach_target(t, file_to_parse, cnt, decoded)
)
c.good_news(
f"Found occurrence [{file_to_parse}] Line {cnt}: {decoded}"
)
except Exception as e:
c.bad_news(
f"Got a decoding error line {cnt} - file: {file_to_parse}"
)
c.good_news(
f"Found occurrence [{file_to_parse}] Line {cnt}: {line}"
)
found_list.append(
local_breach_target(t, file_to_parse, cnt, str(line))
)
return found_list
decoded = str(line, "cp437")
found_list.append(
local_breach_target(t, filepath, cnt, decoded)
)
c.good_news(
f"Found occurrence [{filepath}] Line {cnt}: {decoded}"
)
except Exception as e:
c.bad_news(
f"Got a decoding error line {cnt} - file: {filepath}"
)
c.good_news(
f"Found occurrence [{filepath}] Line {cnt}: {line}"
)
found_list.append(
local_breach_target(t, filepath, cnt, str(line))
)
return found_list
except Exception as e:
c.bad_news("Something went wrong with gzip worker")
print(e)
decoded = str(line, "cp437")
found_list.append(
local_breach_target(t, file_to_parse, cnt, decoded)
)
c.good_news(
f"Found occurrence [{file_to_parse}] Line {cnt}: {decoded}"
)
except Exception as e:
c.bad_news(
f"Got a decoding error line {cnt} - file: {file_to_parse}"
)
c.good_news(
f"Found occurrence [{file_to_parse}] Line {cnt}: {line}"
)
found_list.append(
local_breach_target(t, file_to_parse, cnt, str(line))
)
return found_list
try:
found_list = []
size = os.stat(filepath).st_size
with gzip.open(filepath, "r") as gzipfile:
c.info_news(
"Worker [{PID}] is searching for targets in {filepath} ({size} bytes)".format(
PID=os.getpid(), filepath=filepath, size=size
)
)
for cnt, line in enumerate(gzipfile):
for t in target_list:
if t in str(line):
try:
decoded = str(line, "cp437")
found_list.append(
local_breach_target(t, filepath, cnt, decoded)
)
c.good_news(
f"Found occurrence [{filepath}] Line {cnt}: {decoded}"
)
except Exception as e:
c.bad_news(
f"Got a decoding error line {cnt} - file: {filepath}"
)
c.good_news(
f"Found occurrence [{filepath}] Line {cnt}: {line}"
)
found_list.append(
local_breach_target(t, filepath, cnt, str(line))
)
return found_list
except Exception as e:
for file_to_parse in files_to_parse:
with gzip.open(file_to_parse, "r") as fp:
size = os.stat(file_to_parse).st_size
c.info_news(
"Searching for targets in {file_to_parse} ({size} bytes)".format(
file_to_parse=file_to_parse, size=size
)
)
for cnt, line in enumerate(fp):
progress_gzip(cnt)
for t in target_list:
if t in str(line):
try:
decoded = str(line, "cp437")
found_list.append(
local_breach_target(t, file_to_parse, cnt, decoded)
)
c.good_news(
f"Found occurrence [{file_to_parse}] Line {cnt}: {decoded}"
)
except Exception as e:
c.bad_news(
f"Got a decoding error line {cnt} - file: {file_to_parse}"
)
c.good_news(
f"Found occurrence [{file_to_parse}] Line {cnt}: {line}"
)
found_list.append(
local_breach_target(t, file_to_parse, cnt, str(line))
)
return found_list
try:
with open(filepath, "rb") as fp:
found_list = []
size = os.stat(filepath).st_size
c.info_news(
"Worker [{PID}] is searching for targets in {filepath} ({size} bytes)".format(
PID=os.getpid(), filepath=filepath, size=size
)
)
for cnt, line in enumerate(fp):
for t in target_list:
if t in str(line):
try:
decoded = str(line, "cp437")
found_list.append(
local_breach_target(t, filepath, cnt, decoded)
)
c.good_news(
f"Found occurrence [{filepath}] Line {cnt}: {decoded}"
)
except Exception as e:
c.bad_news(
f"Got a decoding error line {cnt} - file: {filepath}"
)
c.good_news(
f"Found occurrence [{filepath}] Line {cnt}: {line}"
)
found_list.append(
local_breach_target(t, filepath, cnt, str(line))
)
return found_list
except Exception as e:
decoded = str(line, "cp437")
found_list.append(
local_breach_target(t, filepath, cnt, decoded)
)
c.good_news(
f"Found occurrence [{filepath}] Line {cnt}: {decoded}"
)
except Exception as e:
c.bad_news(
f"Got a decoding error line {cnt} - file: {filepath}"
)
c.good_news(
f"Found occurrence [{filepath}] Line {cnt}: {line}"
)
found_list.append(
local_breach_target(t, filepath, cnt, str(line))
)
return found_list
except Exception as e:
c.bad_news("Something went wrong with worker")
print(e)
c.info_news(
"Searching for targets in {file_to_parse} ({size} bytes, {lines_no} lines)".format(
file_to_parse=file_to_parse, size=size, lines_no=lines_no
)
)
for cnt, line in enumerate(fp):
lines_left = lines_no - cnt
progress(
cnt, lines_no, f"{cnt} lines checked - {lines_left} lines left"
)
for t in target_list:
if t in str(line):
try:
decoded = str(line, "cp437")
found_list.append(
local_breach_target(t, file_to_parse, cnt, decoded)
)
c.good_news(
f"Found occurrence [{file_to_parse}] Line {cnt}: {decoded}"
)
except Exception as e:
c.bad_news(
f"Got a decoding error line {cnt} - file: {file_to_parse}"
)
c.good_news(
f"Found occurrence [{file_to_parse}] Line {cnt}: {line}"
)
found_list.append(
local_breach_target(t, file_to_parse, cnt, str(line))
)
return found_list