Skip to content

Commit

Permalink
better retry logic for getting VT results
Browse files Browse the repository at this point in the history
simpler to do this way than idea in b788cd2
sha results in this copy of snitch dictionary don't have to match and
are free to use for submission status
  • Loading branch information
elesiuta committed Dec 22, 2021
1 parent b788cd2 commit 8c6199b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions picosnitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ def get_vt_results(snitch: dict, q_vt: multiprocessing.Queue, q_out: multiproces
else:
while not q_vt.empty():
proc, sha256, result, suspicious = pickle.loads(q_vt.get())
snitch["SHA256"][proc["exe"]][sha256] = result
q_out.put(pickle.dumps({"type": "vt_result", "name": proc["name"], "exe": proc["exe"], "sha256": sha256, "result": result, "suspicious": suspicious}))


Expand Down Expand Up @@ -520,11 +519,14 @@ def sql_subprocess_helper(snitch: dict, fan_mod_cnt: dict, new_processes: typing
q_error.put(sha_fd_error[4:] + " for " + str(proc) + " (fallback pid hash successful)")
if proc["exe"] in snitch["SHA256"]:
if sha256 not in snitch["SHA256"][proc["exe"]]:
snitch["SHA256"][proc["exe"]][sha256] = "VT Pending"
snitch["SHA256"][proc["exe"]][sha256] = "SUBMITTED"
q_vt.put(pickle.dumps((proc, sha256)))
q_out.put(pickle.dumps({"type": "sha256", "name": proc["name"], "exe": proc["exe"], "sha256": sha256}))
elif snitch["SHA256"][proc["exe"]][sha256] == "Failed to read process for upload":
snitch["SHA256"][proc["exe"]][sha256] = "RETRY"
q_vt.put(pickle.dumps((proc, sha256)))
else:
snitch["SHA256"][proc["exe"]] = {sha256: "VT Pending"}
snitch["SHA256"][proc["exe"]] = {sha256: "SUBMITTED"}
q_vt.put(pickle.dumps((proc, sha256)))
q_out.put(pickle.dumps({"type": "sha256", "name": proc["name"], "exe": proc["exe"], "sha256": sha256}))
# filter from logs
Expand Down

0 comments on commit 8c6199b

Please sign in to comment.