Navigation
DOWNLOAD
usage: scryptcc.py [-h] [--username USERNAME] [--password PASSWORD] [--pin PIN] [--max_btc MAX_BTC] [--max_price MAX_PRICE] [--interval INTERVAL] optional arguments: -h, --help show this help message and exit --username USERNAME your usename. If omitted will be requested at runtime --password PASSWORD your password . If omitted will be requested at runtime --pin PIN your pin. If omitted will be requested at runtime --max_btc MAX_BTC max number of btc to be reinvested If 0 infinite --max_price MAX_PRICE max price per khs If 0 infinite --interval INTERVAL interval in seconds between each buy
#DONATION 16RdQZ86NUWQbE6rM86JbxnnaCDcAKqa9 ####SCRYPT.CC AUTOBUY#### #ver:1.4 import cookielib, urllib2,urllib,random,time,math username='' password='' pin='' MAX_PRICE_TO_BUY=0.0 #0 is infinite MAX_BTC_TOREINVEST=0 #0 is infinite interval=600 #600seconds=10 minutes cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) headers = {} headers["User-Agent"] = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0" headers["Referer"] = 'https://scrypt.cc/login.php' headers["Host"] = 'scrypt.cc' headers["Connection"] ='keep-alive' headers["Accept-Language"] ='en-US,en;q=0.5' headers["accept"]='text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' def get_key(kwargs,key,replace=''): if kwargs.has_key(key): return kwargs[key] else: return replace def perform_request(url,**kwargs): global headers,opener post = urllib.urlencode(get_key(kwargs,'post')) get = urllib.urlencode(get_key(kwargs,'get')) headers.update(get_key(kwargs,'headers',{})) if len(get)>0: url+='?'+get try: req = urllib2.Request(url,post,headers) r = opener.open(req) res=r.read() except Exception,e: print str(time.time()),'ERROR: ', str(e),'url: '+ str(url),'post: '+ str(post),'header: '+ str(headers) raise e return res def login(): print str(time.time()), ': performing Login' global username,password params = {'username': username, 'password': password , 'action':1,'submit':'Login'} res=perform_request("https://scrypt.cc/login.php", post=params) return res def buy_khs(amt,prc): print str(time.time()), ': buy ', amt, prc global pin params = {'type':1,'amt': amt, 'pin': pin , 'prc':prc} res = perform_request("https://scrypt.cc/users/trade-api.php", post=params) return res def getOrders(): params ={'method':2,'r': random.random()} res = perform_request("https://scrypt.cc/users/api.php", get=params) return res def getBalance(): params ={'method':1,'r': random.random()} res = perform_request("https://scrypt.cc/users/api.php", get=params) return res def getBalanceBtc(): balance=getBalance() if balance=='': login() balance=getBalance() if balance=='': raise Exception('Can\'t login') balance=balance.split('|') return balance[0], balance[1] def get_last_order(): orders=getOrders() amount=orders[1:orders.find(',')] price=orders[orders.find(',')+1:orders.find('_')] return amount,price def buy(btc): qty,price=get_last_order() if MAX_PRICE_TO_BUY == 0 or float(price) <= MAX_PRICE_TO_BUY : amount = math.floor(float(btc) / float(price)); if amount>qty: amount=qty; if amount >= 1: buy_khs(amount,price) buy(float(btc)-(amount*float(price))) def main(): while True: try: balance,khs=getBalanceBtc() print str(time.time()),': BTC:' + str(balance),'KHS: ' +khs if MAX_BTC_TOREINVEST>0 and float(balance)>MAX_BTC_TOREINVEST: balance=MAX_BTC_TOREINVEST buy(balance) except Exception,e: print str(time.time()), ': ERROR: ' + str(e) finally: time.sleep(interval) def parse_args(): import argparse parser = argparse.ArgumentParser() parser.add_argument('--username',help='your usename. If omitted will be requested at runtime') parser.add_argument('--password',help='your password . If omitted will be requested at runtime') parser.add_argument('--pin',help='your pin. If omitted will be requested at runtime' ) parser.add_argument('--max_btc',help='max number of btc to be reinvested If 0 infinite',type=int,default=0) parser.add_argument('--max_price',help='max price per khs If 0 infinite',type=int,default=0) parser.add_argument('--interval',help='interval in seconds between each buy',type=int,default=600) args = parser.parse_args() global username,password,pin, MAX_PRICE_TO_BUY, MAX_BTC_TOREINVEST, interval if args.username:username=args.username if args.password:password=args.password if args.pin:pin=args.pin if args.max_btc: MAX_BTC_TOREINVEST =args.max_btc if args.max_price: MAX_PRICE_TO_BUY =args.max_price if args.interval: interval=args.interval if username=='': username=raw_input('username:') if password=='': password=raw_input('password:') if pin=='': pin=raw_input('pin:') if __name__=='__main__': parse_args() main()