Isaacdelly / Plutus

An automated bitcoin wallet collider that brute forces random wallet addresses
1.11k stars 520 forks source link

Console show useful stats in verbose #276

Open GoZippy opened 1 year ago

GoZippy commented 1 year ago

Working on giving console output of Iterations: Time: Total Iters/sec: Address: with curses so it's a little easier to see what's going on on each machine running this code and tell pretty quickly if there are any issues...



`` def task(countN): countN += 1 return countN

def main(database, args): stdscr = curses.initscr() curses.cbreak() curses.noecho() stdscr.keypad(True) stdscr.nodelay(True) curses.start_color() curses.use_default_colors()

try:
    with Pool(processes=cpu_count()) as pool:
        countN = [0] * args['cpu_count']
        start_time = time.time()
        while True:
            countN = pool.map(task, countN)
            if countN[0] % 100 == 0:
                elapsed_time = time.time() - start_time
                total_countN = np.sum(countN)
                avg_iters_sec = total_countN / elapsed_time
                stdscr.move(2, 13)
                stdscr.clrtoeol()
                stdscr.addstr(2, 13, 'Iterations: ' + str(total_countN))
                stdscr.move(3, 12)
                stdscr.clrtoeol()
                stdscr.addstr(3, 12, 'Time: ' + str(elapsed_time) + ' sec')
                stdscr.move(4, 0)
                stdscr.clrtoeol()
                stdscr.addstr(4, 0, "Total Iters/sec: " + str(avg_iters_sec))
                for i, val in enumerate(countN):
                    avg_iters_sec_per_cpu = val / elapsed_time
                    stdscr.move(5 + i, 0)
                    stdscr.clrtoeol()
                    stdscr.addstr(5 + i, 0, "Thread {} count: {}".format(i, val))
                    stdscr.addstr(5 + i, 25, "Thread {} Iters/sec: {}".format(i, avg_iters_sec_per_cpu))
                stdscr.refresh()

    if args['verbose']:
                stdscr.move(5 + cpu_count(), 0)
                stdscr.clrtoeol()
                stdscr.addstr(5 + cpu_count(), 0, "Address: " + str(address))
                stdscr.refresh()

    if address[-args['substring']:] in database:
        for filename in os.listdir(DATABASE):
            with open(DATABASE + filename) as file:
                if address in file.read():
                    with open('plutus.txt', 'a') as plutus:
                        plutus.write('hex private key: ' + str(private_key) + '\n' +
                                     'WIF private key: ' + str(private_key_to_wif(private_key)) + '\n'
                                     'public key: ' + str(public_key) + '\n' +
                                     'uncompressed address: ' + str(address) + '\n\n')
                    foundN += 1                 
                    print(" Whoa! You found: ", foundN)
                    curses.endwin()
                    break                 
    else:
                    with open('others.txt', 'a') as plutus:
                        plutus.write('hex private key: ' + str(private_key) + '\n' +
                                     'WIF private key: ' + str(private_key_to_wif(private_key)) + '\n'
                                     'public key: ' + str(public_key) + '\n' +
                                     'uncompressed address: ' + str(address) + '\n\n')
                   print(" Address Count: ", countN) 
    stdscr.refresh()
    interval_iterations += 1

finally:
    curses.endwin()

``

GoZippy commented 1 year ago

plus just nice to see over time how well it is performing..... but don't want to screw with efficiency of overall code to calculate these stats too badly so might think of better way to run the counts outside of the main...

Here I am attempting to update UI every 100 loops.. can make it every 100,000 or whatever makes sense for your hardware...

GoZippy commented 1 year ago

this should, when finished, show each core/thread process stats and then a total of all...