Neo23x0 / munin

Online hash checker for Virustotal and other services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Debug parameter isn't passed to getVTInfo function

graememeyer opened this issue · comments

The --debug parameter isn't passed to the getVTInfo function which can result in an endless silent failure loop, even with the debug switch applied.

I believe the problem is on this line:

munin/munin.py

Line 174 in 3a05795

vt_info = munin_vt.getVTInfo(hashVal)

I have just been experiencing #29 (VT API query failure due to SSL interception), which manifests in a silent failure and getting stuck in the while loop. I think this could be considered a separate issue as well, since silent failure is less than ideal, even if the user doesn't supply the debug switch.

munin/lib/munin_vt.py

Lines 26 to 35 in 3a05795

while not success:
try:
response_dict_code = requests.get(VT_REPORT_URL % hash, headers=headers, proxies=PROXY)
response_dict = json.loads(response_dict_code.content.decode("utf-8"))
success = True
if response_dict_code.status_code == 429:
print("VirusTotal Quota exceeded.")
except Exception as e:
if debug:
traceback.print_exc()

The biggest issue here is that the debug parameter, even if supplied, doesn't make it to the getVTInfo function, so the debug info never prints in the while loop, even if the user sets debug switch.

I'm pretty bad at python, but I think changing munin.py#L174 to the following would fix it:

       vt_info = munin_vt.getVTInfo(hashVal, args.debug)

Edit: actually just to be clear, I did try the suggested fix and it does indeed print debug lines as expected (when the debug switch is applied). I'm just uncertain whether the presentation would be considered ideal enough to implement as-is (spams the same debug message endlessly in a loop).

Edit 2: Also happy to supply more info or submit a PR - unclear on etiquette for this repo and whether a single-line fix like this would be useful or whether you'd want to review the other function calls in munin.py for the same issue.

Screw it I decided to yolo a 1 line pull request in - let me know if any problems: #54