Skip to content

Commit 147b648

Browse files
authored
Update views.py
1 parent c1605f4 commit 147b648

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

web/analysis/views.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,15 +2172,17 @@ def search(request, searched=""):
21722172

21732173
if not term:
21742174
value = value.lower()
2175-
if re.match(r"^([a-fA-F\d]{32})$", value):
2175+
split_by = "," if "," in value else " "
2176+
tmp_value = value.split(split_by)[0]
2177+
if len(tmp_value) == 64 and re.match(r"^([a-fA-F\d]{64})$", tmp_value):
2178+
term = "sha256"
2179+
elif len(tmp_value) == 32 and re.match(r"^([a-fA-F\d]{32})$", tmp_value):
21762180
term = "md5"
2177-
elif re.match(r"^([a-fA-F\d]{40})$", value):
2181+
elif len(tmp_value) == 40 and re.match(r"^([a-fA-F\d]{40})$", tmp_value):
21782182
term = "sha1"
2179-
elif re.match(r"^([a-fA-F\d]{64})$", value):
2180-
term = "sha256"
2181-
elif re.match(r"^([a-fA-F\d]{96})$", value):
2183+
elif len(tmp_value) == 96 and re.match(r"^([a-fA-F\d]{96})$", tmp_value):
21822184
term = "sha3"
2183-
elif re.match(r"^([a-fA-F\d]{128})$", value):
2185+
elif len(tmp_value) == 128 and re.match(r"^([a-fA-F\d]{128})$", tmp_value):
21842186
term = "sha512"
21852187

21862188
if term == "ids":

0 commit comments

Comments
 (0)