Skip to content

Commit

Permalink
Merge pull request #649 from JakubOnderka/remove-deprecated
Browse files Browse the repository at this point in the history
Resolve deprecation warnings
  • Loading branch information
JakubOnderka authored Jan 8, 2024
2 parents 9dc3fbe + 938e300 commit 4e91d3f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion misp_modules/modules/expansion/btc_scam_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def handler(q=False):
btc = request['btc']
query = f"{btc}.{url}"
try:
result = ' - '.join([str(r) for r in resolver.query(query, 'TXT')])[1:-1]
result = ' - '.join([str(r) for r in resolver.resolve(query, 'TXT')])[1:-1]
except NXDOMAIN:
result = f"{btc} is not known as a scam address."
except LabelTooLong:
Expand Down
2 changes: 1 addition & 1 deletion misp_modules/modules/expansion/dbl_spamhaus.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def handler(q=False):
return misperrors
query = "{}.{}".format(requested_value, dbl)
try:
query_result = resolver.query(query, 'A')[0]
query_result = resolver.resolve(query, 'A')[0]
result = "{} - {}".format(requested_value, dbl_mapping[str(query_result)])
except dns.resolver.NXDOMAIN as e:
result = e.msg
Expand Down
2 changes: 1 addition & 1 deletion misp_modules/modules/expansion/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def handler(q=False):
r.nameservers = ['8.8.8.8']

try:
answer = r.query(toquery, 'A')
answer = r.resolve(toquery, 'A')
except dns.resolver.NXDOMAIN:
misperrors['error'] = "NXDOMAIN"
return misperrors
Expand Down
2 changes: 1 addition & 1 deletion misp_modules/modules/expansion/qrcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def handler(q=False):
q = json.loads(q)
filename = q['attachment']
try:
img_array = np.fromstring(binascii.a2b_base64(q['data']), np.uint8)
img_array = np.frombuffer(binascii.a2b_base64(q['data']), np.uint8)
except Exception as e:
err = "Couldn't fetch attachment (JSON 'data' is empty). Are you using the 'Query enrichment' action?"
misperrors['error'] = err
Expand Down
2 changes: 1 addition & 1 deletion misp_modules/modules/expansion/reversedns.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def handler(q=False):
r.nameservers = ['8.8.8.8']

try:
answer = r.query(revname, 'PTR')
answer = r.resolve(revname, 'PTR')
except resolver.NXDOMAIN:
misperrors['error'] = "NXDOMAIN"
return misperrors
Expand Down
2 changes: 1 addition & 1 deletion tests/test_expansions.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def test_dbl_spamhaus(self):
self.assertEqual(self.get_values(response), 'totalmateria.net - spam test domain')
except Exception:
try:
self.assertTrue(self.get_values(response).startswith('None of DNS query names exist:'))
self.assertTrue(self.get_values(response).startswith('The DNS query name does not exist:'))
except Exception:
self.assertEqual(self.get_errors(response), 'Not able to reach dbl.spamhaus.org or something went wrong')

Expand Down

0 comments on commit 4e91d3f

Please sign in to comment.