├── config.yml ├── main.go ├── go.mod ├── brute ├── utils.go ├── generator.go ├── config.go ├── run.go └── wallet.go ├── README.md └── go.sum /config.yml: -------------------------------------------------------------------------------- 1 | host: "e.keff.org:50002" 2 | hex: "e55e78f316d314f8afa6cb1fd321213a4b54888dfd3994aecb5f414510000eac" 3 | threads: 5000 4 | output: "output.txt" -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "btc_hex_brute/brute" 5 | ) 6 | 7 | func main() { 8 | config := brute.NewConfig() 9 | brute.Run(config) 10 | } 11 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module btc_hex_brute 2 | 3 | // +heroku goVersion go1.17 4 | go 1.17 5 | 6 | require ( 7 | github.com/btcsuite/btcd v0.22.0-beta 8 | github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce 9 | github.com/fairbank-io/electrum v0.4.1 10 | gopkg.in/yaml.v2 v2.4.0 11 | ) 12 | 13 | require golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 // indirect 14 | -------------------------------------------------------------------------------- /brute/utils.go: -------------------------------------------------------------------------------- 1 | package brute 2 | 3 | import ( 4 | "log" 5 | "os" 6 | ) 7 | 8 | func saveData(data string, path string) { 9 | f, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0655) 10 | if err != nil { 11 | log.Fatal(data, err) 12 | } 13 | defer f.Close() 14 | 15 | _, err = f.WriteString(data) 16 | if err != nil { 17 | log.Fatal(err) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bitcoin hex bruteforcer 2 | 3 | Check bitcoin compressed and uncompressed address balances via sequential private hex keys. 4 | 5 | 6 | ## Install from source 7 | 8 | ``` 9 | git clone https://github.com/rust3r/btc_hex_brute.git 10 | cd eth-blute/ 11 | go get 12 | go build 13 | ``` 14 | 15 | 16 | ## Usage 17 | 18 | All config parameters are in the file [config.yaml](https://github.com/rust3r/btc_hex_brute/blob/master/config.yml) -------------------------------------------------------------------------------- /brute/generator.go: -------------------------------------------------------------------------------- 1 | package brute 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | func generateNewHEX(hex string) string { 8 | // Splitted hex []string 9 | sh := strings.Split(hex, "") 10 | possible := "0123456789abcdef" 11 | 12 | for i := len(hex) - 1; i >= 0; i-- { 13 | point := strings.Index(possible, sh[i]) 14 | if point == 15 { 15 | sh[i] = "0" 16 | } else { 17 | sh[i] = string(possible[point+1]) 18 | break 19 | } 20 | } 21 | return strings.Join(sh, "") 22 | } 23 | -------------------------------------------------------------------------------- /brute/config.go: -------------------------------------------------------------------------------- 1 | package brute 2 | 3 | import ( 4 | "io/ioutil" 5 | "log" 6 | 7 | "gopkg.in/yaml.v2" 8 | ) 9 | 10 | // Config ... 11 | type Config struct { 12 | Host string `yaml:"host"` 13 | HEX string `yaml:"hex"` 14 | Threads int `yaml:"threads"` 15 | Output string `yaml:"output"` 16 | } 17 | 18 | // NewConfig ... 19 | func NewConfig() *Config { 20 | yamlFile, err := ioutil.ReadFile("config.yml") 21 | if err != nil { 22 | log.Printf("File config.yml doesn't exist: %s\n", err) 23 | } 24 | 25 | var c Config 26 | err = yaml.Unmarshal(yamlFile, &c) 27 | if err != nil { 28 | log.Fatalf("Error unmarshal yaml file: %v\n", err) 29 | } 30 | return &c 31 | } 32 | -------------------------------------------------------------------------------- /brute/run.go: -------------------------------------------------------------------------------- 1 | package brute 2 | 3 | import ( 4 | "crypto/tls" 5 | "fmt" 6 | "log" 7 | 8 | "github.com/fairbank-io/electrum" 9 | ) 10 | 11 | // Run ... 12 | func Run(config *Config) { 13 | client, err := electrum.New( 14 | &electrum.Options{ 15 | Address: config.Host, 16 | TLS: &tls.Config{InsecureSkipVerify: true}, 17 | Protocol: electrum.Protocol11, 18 | KeepAlive: true, 19 | }, 20 | ) 21 | 22 | if err != nil { 23 | log.Fatal(err) 24 | } 25 | defer client.Close() 26 | 27 | hex := make(chan string) 28 | 29 | for threads := 0; threads < config.Threads; threads++ { 30 | go check(hex, client, config.Output) 31 | 32 | } 33 | 34 | generate(config.HEX, hex) 35 | } 36 | 37 | func generate(hex string, chHEX chan<- string) { 38 | newHex := hex 39 | for { 40 | newHex = generateNewHEX(newHex) 41 | chHEX <- newHex 42 | } 43 | } 44 | 45 | func check(hex <-chan string, client *electrum.Client, out string) { 46 | for { 47 | wallet := newWallet(<-hex) 48 | wallet.checkBalance(client, out) 49 | fmt.Println(wallet.String()) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /brute/wallet.go: -------------------------------------------------------------------------------- 1 | package brute 2 | 3 | import ( 4 | "encoding/hex" 5 | "fmt" 6 | "log" 7 | 8 | "github.com/fairbank-io/electrum" 9 | 10 | "github.com/btcsuite/btcutil" 11 | 12 | "github.com/btcsuite/btcd/btcec" 13 | "github.com/btcsuite/btcd/chaincfg" 14 | ) 15 | 16 | type wallet struct { 17 | HEX string 18 | WIF string 19 | addressUncompressed string 20 | addressCompressed string 21 | balanceConfirmedU uint64 22 | balanceUnconfirmedU uint64 23 | balanceConfirmedC uint64 24 | balanceUnconfirmedC uint64 25 | tx *[]electrum.Tx 26 | } 27 | 28 | func newWallet(HEX string) *wallet { 29 | decoded, _ := hex.DecodeString(HEX) 30 | priv, pub := btcec.PrivKeyFromBytes(btcec.S256(), decoded) 31 | wif, _ := btcutil.NewWIF(priv, &chaincfg.MainNetParams, false) 32 | uaddress, _ := btcutil.NewAddressPubKey(pub.SerializeUncompressed(), &chaincfg.MainNetParams) 33 | caddress, _ := btcutil.NewAddressPubKey(pub.SerializeCompressed(), &chaincfg.MainNetParams) 34 | return &wallet{HEX: HEX, WIF: wif.String(), addressUncompressed: uaddress.EncodeAddress(), addressCompressed: caddress.EncodeAddress()} 35 | } 36 | 37 | func (w *wallet) checkBalance(client *electrum.Client, out string) { 38 | w.balanceCompressed(client) 39 | w.balanceUncompressed(client) 40 | if w.balanceConfirmedU != 0 || w.balanceUnconfirmedU != 0 || w.balanceConfirmedC != 0 || w.balanceUnconfirmedC != 0 { 41 | saveData(w.String(), out) 42 | } 43 | } 44 | 45 | func (w *wallet) balanceUncompressed(client *electrum.Client) { 46 | balanceUncompressed, err := client.AddressBalance(w.addressUncompressed) 47 | if err != nil { 48 | log.Fatal(err) 49 | } 50 | w.balanceConfirmedU = balanceUncompressed.Confirmed 51 | w.balanceUnconfirmedU = balanceUncompressed.Unconfirmed 52 | } 53 | 54 | func (w *wallet) balanceCompressed(client *electrum.Client) { 55 | balanceCompressed, err := client.AddressBalance(w.addressCompressed) 56 | if err != nil { 57 | log.Fatal(err) 58 | } 59 | w.balanceConfirmedC = balanceCompressed.Confirmed 60 | w.balanceUnconfirmedC = balanceCompressed.Unconfirmed 61 | } 62 | 63 | func (w *wallet) getTransactions(client *electrum.Client) { 64 | tx, err := client.AddressHistory(w.addressUncompressed) 65 | if err != nil { 66 | log.Fatal(err) 67 | } 68 | w.tx = tx 69 | } 70 | 71 | func (w *wallet) String() string { 72 | return fmt.Sprintf("HEX: %s\nWIF: %s\nAddress uncompressed: %s\nAddress compressed: %s\nBalance confirmed uncompressed: %d\nBalance unconfirmed uncompressed: %d\nBalance confirmed compress: %d\nBalance unconfirmed compress: %d\n", 73 | w.HEX, w.WIF, w.addressUncompressed, w.addressCompressed, w.balanceConfirmedU, w.balanceUnconfirmedU, w.balanceConfirmedC, w.balanceUnconfirmedC, 74 | ) 75 | } 76 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= 2 | github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= 3 | github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= 4 | github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= 5 | github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= 6 | github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= 7 | github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= 8 | github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= 9 | github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= 10 | github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= 11 | github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= 12 | github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= 13 | github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= 14 | github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= 15 | github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= 16 | github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 17 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 18 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 19 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 20 | github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= 21 | github.com/fairbank-io/electrum v0.4.1 h1:VwamIvBjMftZGPEHikRchI4LeFU1FCJJO8Z4AU3VQjE= 22 | github.com/fairbank-io/electrum v0.4.1/go.mod h1:847fR1xPyEnX38AiRWSo+pa4qr640kWkktetVHwTFis= 23 | github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= 24 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 25 | github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= 26 | github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= 27 | github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= 28 | github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= 29 | github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= 30 | github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= 31 | github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= 32 | github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= 33 | github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= 34 | golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 35 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 36 | golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 37 | golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 h1:cg5LA/zNPRzIXIWSCxQW10Rvpy94aQh3LT/ShoCpkHw= 38 | golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 39 | golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 40 | golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 41 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 42 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 43 | golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 44 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 45 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 46 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 47 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 48 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 49 | gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= 50 | gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= 51 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 52 | gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 53 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 54 | --------------------------------------------------------------------------------