forked from ahhh/bintriage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (30 loc) · 811 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"
"log"
"os"
"github.com/Binject/bintriage/bt"
)
func main() {
var srcFile = flag.String("inFile", "a.out", "Input file to triage")
flag.StringVar(srcFile, "i", "a.out", "Input file to triage")
flag.StringVar(srcFile, "input", "a.out", "Input file to triage")
var logFile = flag.String("logFile", "", "send stdout to a log file")
flag.StringVar(logFile, "l", "", "send stdout to a log file")
flag.Parse()
if *logFile != "" {
logTown, err := os.OpenFile(*logFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Fatalf("error opening file: %v", err)
}
defer logTown.Close()
log.SetOutput(logTown)
log.Println("Log file started!")
}
err := bt.BinTriage(*srcFile)
if err != nil {
log.Println(err)
} else {
log.Println("Done!")
}
}