Skip to content

Commit

Permalink
Ctrl^C Passed
Browse files Browse the repository at this point in the history
  • Loading branch information
iceland2k14 authored Nov 16, 2021
1 parent 59fb5d5 commit d03bb7c
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions kangaroo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
"""
Usage :
> python kangaroo.py -p 0352b1af31d67e6a83ec7931c148f56b0755ce40c836f20c6fe2b6da612c89cf3e -keyspace 935da71d7350734c3472fe305fef82ab8aca644fb:935da71d7350734c3472fe305fff82ab8aca644f9
> python kangaroo.py -p 02CEB6CBBCDBDF5EF7150682150F4CE2C6F4807B349827DCDBDD1F2EFA885A2630 -keyspace 800000000000000000000000000000:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -rand -ncore 7
> python kangaroo.py -p 0425c2d005f3036c13070afcf139a18ce69355c3158e017cd99ae72d815d74c54fb3c7c0bc9f4089284cc2de737024d50328884282a8b9bbbaf989747198971669 -rand1
@author: iceland
@Credit: JLP
"""
import bit

This comment has been minimized.

Copy link
@litvinale

litvinale Feb 24, 2024

Import "bit" could not be resolved

import ctypes
Expand All @@ -12,13 +15,17 @@
import os
import random
import argparse
import signal
#from signal import signal, SIGINT

###############################################################################
parser = argparse.ArgumentParser(description='This tool use Kangaroo algo for searching 1 pubkey in the given range using multiple cpu',
epilog='Enjoy the program! :) Tips BTC: bc1q39meky2mn5qjq704zz0nnkl0v7kj4uz6r529at')
parser.version = '24072021'
parser.version = '15112021'
parser.add_argument("-p", "--pubkey", help = "Public Key in hex format (compressed or uncompressed)", required=True)
parser.add_argument("-keyspace", help = "Keyspace Range ( hex ) to search from min:max. default=1:order of curve", action='store')
parser.add_argument("-ncore", help = "Number of CPU to use. default = Total-1", action='store')
parser.add_argument("-n", help = "Total range search in 1 loop. default=72057594037927935", action='store')
parser.add_argument("-rand", help = "Start from a random value in the given range from min:max and search 0XFFFFFFFFFFFFFF values then again take a new random", action="store_true")
parser.add_argument("-rand1", help = "First Start from a random value, then go fully sequential, in the given range from min:max", action="store_true")

Expand All @@ -31,6 +38,8 @@
ss = args.keyspace if args.keyspace else '1:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140'
flag_random = True if args.rand else False
flag_random1 = True if args.rand1 else False
ncore = int(args.ncore) if args.ncore else platform.os.cpu_count() - 1
increment = int(args.n) if args.n else 72057594037927935
public_key = args.pubkey # '02CEB6CBBCDBDF5EF7150682150F4CE2C6F4807B349827DCDBDD1F2EFA885A2630'
if flag_random1: flag_random = True

Expand Down Expand Up @@ -83,15 +92,18 @@ def randk(a, b):
exit()
else:
return lastitem + 1

def handler(signal_received, frame):
# Handle any cleanup here
print('\nSIGINT or CTRL-C detected. Exiting gracefully. BYE')
exit(0)
###############################################################################
print('[+] Starting CPU Kangaroo.... Please Wait Version [', parser.version,']')

ncore = platform.os.cpu_count() - 1 # Leave 1 thread open
dp = 10 # -1 for automatic value
mx = 1 # 0 for Endless
mx = 2 # 0 for Endless

upub = pub2upub(public_key)
increment = 72057594037927935 # fix value dont change. Ctrl ^C handler not passed.

###############################################################################
if flag_random1 == True:
Expand All @@ -112,14 +124,19 @@ def randk(a, b):
###############################################################################
print('[+] ............................................', end='\r')
while True:
print('\n[+] Scanning Range ',hex(range_st),':', hex(range_en))
# Tell Python to run the handler() function when SIGINT is recieved
signal.signal(signal.SIGINT, signal.SIG_DFL)
print('\r[+] Scanning Range ',hex(range_st),':', hex(range_en))
pvk_found = run_cpu_kangaroo(range_st, range_en, dp, ncore, mx, upub)
if int(pvk_found.hex(),16) != 0:
print('\n============== KEYFOUND ==============')
print('Kangaroo FOUND PrivateKey : 0x'+pvk_found.hex())
print('======================================')
with open('KEYFOUNDKEYFOUND.txt','a') as fw:
fw.write('Kangaroo FOUND PrivateKey : 0x'+pvk_found.hex()+'\n')
break
lastitem = range_en
range_st = randk(a, b)
range_en = range_st + increment
print('',end='\r')
print('[+] Program Finished')

0 comments on commit d03bb7c

Please sign in to comment.