-
Notifications
You must be signed in to change notification settings - Fork 13
/
main.go
82 lines (75 loc) · 1.82 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
package main
import (
"fmt"
"log"
"os"
"reflect"
"runtime"
"github.com/shlima/fortune/cmd"
"github.com/urfave/cli/v2"
)
// Version is a build time constant
var Version = ":VERSION:"
func main() {
app := &cli.App{
Name: "fortune",
Usage: "bitcoin wallet cracker",
Copyright: "© github.com/shlima/fortune",
Version: Version,
Suggest: true,
Flags: []cli.Flag{
cmd.FlagFiles,
cmd.FlagWorkers,
cmd.FlagNightMode,
cmd.FlagTestAddress,
cmd.FlagHeartBeatSec,
cmd.FlagTelegramPingSec,
cmd.FlagTelegramToken,
cmd.FlagTelegramChannel,
},
Before: func(c *cli.Context) error {
return each(c, cmd.InitLogger)
},
Commands: []*cli.Command{
{
Name: "bruteforce",
Action: cmd.Bruteforce,
Usage: "run bruteforce against the dataset of rich addresses",
}, {
Name: "random",
Action: cmd.Random,
Usage: "prints random address from the dataset files",
}, {
Name: "generate",
Action: cmd.Generate,
Usage: "random bitcoin address",
}, {
Name: "brain",
Action: cmd.Brain,
Usage: "generate brain wallet (based on a password as a first argument) and check it's current balance online",
}, {
Name: "brainforce",
Action: cmd.BrainForce,
Usage: "run bruteforce with alphabetical passwords permutations against the dataset of rich addresses",
Flags: []cli.Flag{
cmd.FlagPassState,
cmd.FlagPassLength,
cmd.FlagPassAlphabet,
cmd.FlagPassShuffle,
},
},
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}
func each(c *cli.Context, fns ...func(c *cli.Context) error) error {
for _, fn := range fns {
if err := fn(c); err != nil {
name := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name()
return fmt.Errorf("failed to execute <%s>: %w", name, err)
}
}
return nil
}