forked from shukla141015/keys-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
104 lines (77 loc) · 1.65 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"strconv"
"time"
)
func main() {
keysPerPage := 128
file, err := os.Create("keys.txt")
fmt.Fprintln(file, time.Now().UTC().Format("15:04:05") + "\n\n")
if err != nil {
log.Fatal(err)
}
for {
res := printBitcoinKeys(keysPerPage)
if (res) {
break;
}
time.Sleep(1000 * time.Millisecond)
}
}
func printBitcoinKeys(keysPerPage int)bool {
compressedKeys := ""
bitcoinKeys := generateBitcoinKeys(keysPerPage)
length := len(bitcoinKeys)
for i, key := range bitcoinKeys {
compressedKeys += key.compressed
if i != length - 1 {
compressedKeys += ","
}
}
foundedBalance := checkBtcBalanceWallet(compressedKeys)
if foundedBalance != "" {
for i, key := range bitcoinKeys {
if key.compressed == foundedBalance {
file, err := os.Open("keys.txt")
if err != nil {
log.Fatal(err)
}
fmt.Println("Wallet found! " + key.private)
fmt.Fprintln(file, i, key)
return true
}
}
} else {
fmt.Println(time.Now().UTC().Format("15:04:05") + " Nothing found..." + "\n")
return false
}
return false
}
func checkBtcBalanceWallet(compressed string) string {
resp, err := http.Get("https://blockchain.info/balance?cors=true&active=" + compressed)
if err != nil {
panic(err)
}
if resp.StatusCode != 200 {
panic(resp.Status)
}
fmt.Print("StatusCode: " + strconv.Itoa(resp.StatusCode) + " ")
type Data struct {
final_balance int
n_tx int
total_received int
}
var result map[string]Data
json.NewDecoder(resp.Body).Decode(&result)
for i, key := range result {
if key.final_balance != 0 {
return i
}
}
return ""
}