-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (31 loc) · 819 Bytes
/
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
package main
import (
"flag"
"fmt"
"os"
"github.com/linxiulei/sucker/analyzer"
"github.com/linxiulei/sucker/builder"
)
func main() {
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
fmt.Fprintf(os.Stderr, " %s [OPTIONS] [cmd1, cmd2...]\n", os.Args[0])
fmt.Fprintf(os.Stderr, "\n")
fmt.Fprintf(os.Stderr, "OPTIONS:\n")
flag.PrintDefaults()
os.Exit(0)
}
var exportDir = flag.String("export-dir", "export_dir", "dir for export")
var execPrefix = flag.String("exec-prefix", "", "dir of running cmd")
flag.Parse()
if *execPrefix == "" {
execPrefix = exportDir
}
a := new(analyzer.Analyzer)
packer := new(builder.Packer)
for _, i := range flag.Args() {
elfObject := a.AnaFromFile(i)
packer.ElfObject = elfObject
packer.Export(*exportDir, *execPrefix)
}
}