Skip to content

Instantly share code, notes, and snippets.

@halidaltuner
Created July 21, 2017 08:50
Show Gist options
  • Save halidaltuner/c08b6be0723e3f629cf67d9b44681754 to your computer and use it in GitHub Desktop.
Save halidaltuner/c08b6be0723e3f629cf67d9b44681754 to your computer and use it in GitHub Desktop.
btc_checker
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import json
from bs4 import BeautifulSoup
import random
from termcolor import colored
import time
import requests
rndStart = "856083576414584832184365027012002209974486074049742179003044245104477177639"
scanCount = 0
foundCount = 0
def randomPage(page):
global scanCount, foundCount
addressCount = 0
trueStop = 0
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
lines = []
r = requests.get('http://directory.io/' + str(page))
soup = BeautifulSoup(r.text, "lxml")
for link in soup.select('pre.keys span a'):
data = link.get_text()
if data != "+":
lines.append(data.strip())
# print lines
# -------------- Checking Adresses at BlockChain
try:
openBalance = open("/srv/btcchecker/balance.txt", "a")
for cc in xrange(0,12):
ccYeni = cc+1
r = requests.get('https://blockchain.info/multiaddr?active=' + '|'.join(lines[50*cc:50*ccYeni]), headers=headers)
# print r.text
j_obj = r.json()
for x in j_obj["addresses"]:
addressCount+=1
dataPrint = str(addressCount) + ": Adress:" + str(x["address"]) + " final_balance: " + str(x["final_balance"]).strip() + " --- total_received: " + str(x["total_received"]).strip()
print dataPrint
if(x["final_balance"] != 0 or x["total_received"] != 0):
print colored("-- FOUND BALANCED !!! ", 'yellow')
print colored("Page: " + str(page) + ' Address: ' + str(x["address"]), 'yellow')
foundCount+=1
openBalance.write("Page: " + str(page) + " ||| " + str(dataPrint) + "\n")
trueStop = 1
time.sleep(0)
except Exception as e:
print "ERROR !"
fh = open("/srv/btcchecker/errors.txt", "a")
time.sleep(0)
fh.write("Page: " + str(page) + " Error: " + r.text + "\n")
fh.close()
# print r.text
# rnd = random.randint(0,99999999999999999999999999999)
openBalance.close()
# ReCall Function
rnd = random.getrandbits(128)
scanCount+=1
print colored("-- Scan Count: ", 'red'), scanCount
print colored("-- Found Count: ", 'white'), foundCount
print "Random Number: " + str(rnd)
time.sleep(0)
randomPage(rnd)
rnd = random.getrandbits(128)
if rndStart != "":
print "Random: ", rndStart
randomPage(rndStart)
else:
print "Random: ", rnd
randomPage(rnd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment