Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve deprecation warnings #649

Merged
merged 5 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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