hashlookup / hashlookup-forensic-analyser

Analyse a forensic target (such as a directory) to find and report files found and not found from CIRCL hashlookup public service - https://circl.lu/services/hashlookup/
https://hashlookup.github.io/hashlookup-forensic-analyser/
Other
121 stars 13 forks source link

Consistent string interpolation #4

Closed sthagen closed 2 years ago

sthagen commented 2 years ago

Why?

Use one and only one approach for string interpolation.

What?

All but one interpolation tasks for strings are solved per f-strings. The requests get call uses the good all format method on strings for construction of the address parameter.

How?

This is just a proposal with single line scope that shall ease maintenance and thus maybe a diff is enough to either implement or kindly ignore the change suggested:

diff --git a/bin/hashlookup-analyser.py b/bin/hashlookup-analyser.py
index f59dfec..e9e1845 100644
--- a/bin/hashlookup-analyser.py
+++ b/bin/hashlookup-analyser.py
@@ -36,7 +36,7 @@ if not args.dir:
 def lookup(value=None):
     if value is None:
         return False
-    r = requests.get('https://hashlookup.circl.lu/lookup/sha1/{}'.format(value), headers=headers)
+    r = requests.get(f'https://hashlookup.circl.lu/lookup/sha1/{value}', headers=headers)
     return r.json()
adulau commented 2 years ago

Thank you. It's indeed more consistent. It's fixed.

sthagen commented 2 years ago

@adulau thanks a lot for taking the time to fix this on a presumably sunny Sunday 😎