diff --git a/misp_modules/modules/expansion/btc_scam_check.py b/misp_modules/modules/expansion/btc_scam_check.py index f5519265..44fa7326 100644 --- a/misp_modules/modules/expansion/btc_scam_check.py +++ b/misp_modules/modules/expansion/btc_scam_check.py @@ -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: diff --git a/misp_modules/modules/expansion/dbl_spamhaus.py b/misp_modules/modules/expansion/dbl_spamhaus.py index 4ecdfb92..2bccd008 100644 --- a/misp_modules/modules/expansion/dbl_spamhaus.py +++ b/misp_modules/modules/expansion/dbl_spamhaus.py @@ -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 diff --git a/misp_modules/modules/expansion/dns.py b/misp_modules/modules/expansion/dns.py index c5af9d6a..99df52cf 100755 --- a/misp_modules/modules/expansion/dns.py +++ b/misp_modules/modules/expansion/dns.py @@ -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 diff --git a/misp_modules/modules/expansion/qrcode.py b/misp_modules/modules/expansion/qrcode.py index 9a628270..bb3effdb 100644 --- a/misp_modules/modules/expansion/qrcode.py +++ b/misp_modules/modules/expansion/qrcode.py @@ -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 diff --git a/misp_modules/modules/expansion/reversedns.py b/misp_modules/modules/expansion/reversedns.py index 3b945a74..43df562a 100644 --- a/misp_modules/modules/expansion/reversedns.py +++ b/misp_modules/modules/expansion/reversedns.py @@ -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 diff --git a/tests/test_expansions.py b/tests/test_expansions.py index 8099a62c..96017249 100644 --- a/tests/test_expansions.py +++ b/tests/test_expansions.py @@ -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')