wuhp commited on
Commit
fa86a89
·
verified ·
1 Parent(s): c9bebe6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -37,6 +37,7 @@ def fnv1a(s):
37
  h &= 0xFFFFFFFF
38
  return str(h)
39
 
 
40
  def normalize_int(value):
41
  try:
42
  v = int(value)
@@ -68,7 +69,7 @@ def detect(hash_value):
68
  pass
69
 
70
  return list(dict.fromkeys(candidates))
71
- -----------------------------
72
 
73
  def clean_wordlist(text):
74
  return [
@@ -78,7 +79,7 @@ def clean_wordlist(text):
78
  for w in text.splitlines()
79
  if w.strip()
80
  ]
81
- -----------------------------
82
 
83
  def try_match(func, target, words):
84
  matches = []
@@ -112,38 +113,31 @@ def analyze(hash_value, wordlist_text):
112
  detected = detect(hash_value)
113
  matches = {}
114
 
115
-
116
  if "java_hash" in detected:
117
  m = try_match(java_hash, hash_value, wordlist)
118
  if m:
119
  matches["Java hashCode"] = m
120
 
121
-
122
  if "crc32" in detected:
123
  m = try_match(crc32_hash, hash_value, wordlist)
124
  if m:
125
  matches["CRC32"] = m
126
 
127
-
128
  if "adler32" in detected:
129
  m = try_match(adler32_hash, hash_value, wordlist)
130
  if m:
131
  matches["Adler32"] = m
132
 
133
- --------------------
134
-
135
  if "djb2" in detected:
136
  m = try_match(djb2, hash_value, wordlist)
137
  if m:
138
  matches["DJB2"] = m
139
 
140
-
141
  if "fnv1a" in detected:
142
  m = try_match(fnv1a, hash_value, wordlist)
143
  if m:
144
  matches["FNV1a"] = m
145
 
146
-
147
  detected_out = "\n".join(detected) if detected else "Unknown"
148
 
149
  if matches:
@@ -178,4 +172,5 @@ with gr.Blocks() as demo:
178
  outputs=[detected_out, result_out]
179
  )
180
 
181
- demo.launch()
 
 
37
  h &= 0xFFFFFFFF
38
  return str(h)
39
 
40
+
41
  def normalize_int(value):
42
  try:
43
  v = int(value)
 
69
  pass
70
 
71
  return list(dict.fromkeys(candidates))
72
+
73
 
74
  def clean_wordlist(text):
75
  return [
 
79
  for w in text.splitlines()
80
  if w.strip()
81
  ]
82
+
83
 
84
  def try_match(func, target, words):
85
  matches = []
 
113
  detected = detect(hash_value)
114
  matches = {}
115
 
 
116
  if "java_hash" in detected:
117
  m = try_match(java_hash, hash_value, wordlist)
118
  if m:
119
  matches["Java hashCode"] = m
120
 
 
121
  if "crc32" in detected:
122
  m = try_match(crc32_hash, hash_value, wordlist)
123
  if m:
124
  matches["CRC32"] = m
125
 
 
126
  if "adler32" in detected:
127
  m = try_match(adler32_hash, hash_value, wordlist)
128
  if m:
129
  matches["Adler32"] = m
130
 
 
 
131
  if "djb2" in detected:
132
  m = try_match(djb2, hash_value, wordlist)
133
  if m:
134
  matches["DJB2"] = m
135
 
 
136
  if "fnv1a" in detected:
137
  m = try_match(fnv1a, hash_value, wordlist)
138
  if m:
139
  matches["FNV1a"] = m
140
 
 
141
  detected_out = "\n".join(detected) if detected else "Unknown"
142
 
143
  if matches:
 
172
  outputs=[detected_out, result_out]
173
  )
174
 
175
+ if __name__ == "__main__":
176
+ demo.launch()