Skip to content

Instantly share code, notes, and snippets.

@1fabunicorn
Created January 20, 2017 06:04
Show Gist options
  • Save 1fabunicorn/6e63f4c9947e93f46569becabf6d95a5 to your computer and use it in GitHub Desktop.
Save 1fabunicorn/6e63f4c9947e93f46569becabf6d95a5 to your computer and use it in GitHub Desktop.
A dash tx spammer
import os
from subprocess import check_output
from time import sleep
from json import loads
from shlex import split
#run this module while ./dashd is running
class Dashpylib:
def __init__(self, dir):
#check if global var, dir has ./dash-cli in the directory dir is pointing at
assert (not os.path.isfile('./dash-cli')), "global var 'dir', is not pointing toward a directory with ./dash-cli in it. or is file is under a different name? "
self.dir = dir
def command(self, arg):
#splits args into individual strings to work with shell syntax, using shlex
splitArg = arg.split()
x = True
while x:
sleep(.1)
turp = check_output(splitArg, shell=False, cwd=self.dir, )
if turp == None:
pass
else:
x = False
new = turp.translate(None, "\n")
try:
return loads(new)
except: #if json object can't be decoded, return it anyways
return new
from Dashpylib import Dashpylib
import time
import sys
#put directory where a dash-cli is pointing at
Pydash = Dashpylib(dir="/home/nova/Desktop/dashcore-0.12.1/bin")
counter = 0
sleepCont = 0
while True:
try:
addresses = "ya55cCV4LtmDoW3ESYfCnGbMFgNfiQwF4z"
#addresses = Pydash.command("./dash-cli getnewaddress")
Pydash.command("./dash-cli instantsendtoaddress " + addresses + " 1.2")
time.sleep(.3)
print "| ", #each | is one tx, pretty right?
counter += 1
sleepCont += 1
except:
time.sleep(.5)
#if counter > 5000:
#Pydash.command("./dash-cli stop")
#Pydash.command("./dash-cli sendtoaddress " + addresses + " 500")
#print "done!"
#sys.exit()
if sleepCont > 22:
print "sleeping!"
sleepCont = 0
time.sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment