Browse Source

fix: Grouped two if conditions to avoid issues with variable unassigned if the second condition is not true

pull/341/head
chrisr3d 2 years ago
parent
commit
6d19549184
No known key found for this signature in database GPG Key ID: 6BBED1B63A6D639F
  1. 6
      misp_modules/modules/expansion/hashdd.py

6
misp_modules/modules/expansion/hashdd.py

@ -23,11 +23,7 @@ def handler(q=False):
r = requests.post(hashddapi_url, data={'hash': v})
if r.status_code == 200:
state = json.loads(r.text)
if state:
if state.get(v):
summary = state[v]['known_level']
else:
summary = 'Unknown hash'
summary = state[v]['known_level'] if state and state.get(v) else 'Unknown hash'
else:
misperrors['error'] = '{} API not accessible'.format(hashddapi_url)
return misperrors['error']

Loading…
Cancel
Save