2019-02-05 14:46:42 +01:00
|
|
|
import json
|
|
|
|
import sys
|
|
|
|
|
|
|
|
try:
|
|
|
|
from dns.resolver import Resolver, NXDOMAIN
|
|
|
|
from dns.name import LabelTooLong
|
|
|
|
resolver = Resolver()
|
|
|
|
resolver.timeout = 1
|
|
|
|
resolver.lifetime = 1
|
|
|
|
except ImportError:
|
|
|
|
sys.exit("dnspython3 in missing. use 'pip install dnspython3' to install it.")
|
|
|
|
|
|
|
|
misperrors = {'error': 'Error'}
|
|
|
|
mispattributes = {'input': ['btc'], 'output': ['text']}
|
2024-08-12 11:23:10 +02:00
|
|
|
moduleinfo = {
|
|
|
|
'version': '0.1',
|
|
|
|
'author': 'Christian Studer',
|
|
|
|
'description': 'An expansion hover module to query a special dns blacklist to check if a bitcoin address has been abused.',
|
|
|
|
'module-type': ['hover'],
|
|
|
|
'name': 'BTC Scam Check',
|
|
|
|
'logo': 'bitcoin.png',
|
|
|
|
'requirements': ['dnspython3: dns python library'],
|
|
|
|
'features': 'The module queries a dns blacklist directly with the bitcoin address and get a response if the address has been abused.',
|
|
|
|
'references': ['https://btcblack.it/'],
|
|
|
|
'input': 'btc address attribute.',
|
|
|
|
'output': 'Text to indicate if the BTC address has been abused.',
|
|
|
|
}
|
2019-02-05 14:46:42 +01:00
|
|
|
moduleconfig = []
|
|
|
|
|
|
|
|
url = 'bl.btcblack.it'
|
|
|
|
|
2019-02-11 14:23:18 +01:00
|
|
|
|
2019-02-05 14:46:42 +01:00
|
|
|
def handler(q=False):
|
|
|
|
if q is False:
|
|
|
|
return False
|
|
|
|
request = json.loads(q)
|
|
|
|
btc = request['btc']
|
|
|
|
query = f"{btc}.{url}"
|
|
|
|
try:
|
2023-07-01 14:45:41 +02:00
|
|
|
result = ' - '.join([str(r) for r in resolver.resolve(query, 'TXT')])[1:-1]
|
2019-02-05 14:46:42 +01:00
|
|
|
except NXDOMAIN:
|
|
|
|
result = f"{btc} is not known as a scam address."
|
|
|
|
except LabelTooLong:
|
|
|
|
result = f"{btc} is probably not a valid BTC address."
|
|
|
|
return {'results': [{'types': mispattributes['output'], 'values': result}]}
|
|
|
|
|
|
|
|
|
|
|
|
def introspection():
|
|
|
|
return mispattributes
|
|
|
|
|
|
|
|
|
|
|
|
def version():
|
|
|
|
moduleinfo['config'] = moduleconfig
|
|
|
|
return moduleinfo
|