Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

zCoin Submit Script

By: a guest on Nov 22nd, 2013  |  syntax: Python  |  size: 1.28 KB  |  views: 147  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import socket
  2. import hashlib
  3. import json
  4. import random
  5. import string
  6. import sqlite3
  7. import threading
  8. import time
  9.  
  10. def check_coin(data):
  11.     node = sqlite3.connect("nodes.db")
  12.     node = node.execute("SELECT ip, port FROM data WHERE relay=?", [True])
  13.     node = node.fetchall()
  14.     random.shuffle(node)
  15.     for x in node:
  16.         s = socket.socket()
  17.         try:
  18.             s.settimeout(1)
  19.             s.connect((x[0], x[1]))
  20.         except:
  21.             s.close()
  22.             continue
  23.         else:
  24.             data['cmd'] = "check_coin"
  25.             s.send(json.dumps(data))
  26.         s.close()
  27. def file_len(fname):
  28.     with open(fname) as f:
  29.         for i, l in enumerate(f):
  30.             pass
  31.         return i + 1
  32.  
  33. print 'Loading Coin Sender...'
  34. total = file_len('coins.txt')
  35. i = 1
  36. with open('coins.txt') as f:
  37.     print "Submitting coins. This could take a bit."
  38.     for line in f:
  39.       time.sleep(1)
  40.       line = line[:-1]
  41.       c = hashlib.sha512(line).hexdigest()
  42.       wall = sqlite3.connect("wallet.db")
  43.       address = wall.execute("SELECT address FROM data")
  44.       address = address.fetchall()[0][0]
  45.       check_coin({"starter":line, "hash":c, "address":address})
  46.       print 'Coin Added: [' + line + '] Number: ' + str(i) + ' of ' + str(total)
  47.       i +=1