-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
37 lines (31 loc) · 829 Bytes
/
main.go
File metadata and controls
37 lines (31 loc) · 829 Bytes
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
package main
import (
"flag"
"fmt"
"log"
"os"
"path/filepath"
"biscoito/go-subdoc/ooxml"
)
func main() {
// Parse cmd arguments
flag.StringVar(&ooxml.GlobalVar.FileName, "input", "", "Target document")
flag.StringVar(&ooxml.GlobalVar.Target, "target", "", "Target server (only domain / ip address)")
flag.Parse()
// If argument invalid / not supplied
if len(ooxml.GlobalVar.FileName) <= 0 || len(ooxml.GlobalVar.Target) <= 0 {
fmt.Printf("Usage: %s -input target.docx/docm -target example.com/127.0.0.1\n", filepath.Base(os.Args[0]))
flag.PrintDefaults()
os.Exit(0)
}
// Get absolute file path of the target file
filePath, err := filepath.Abs(ooxml.GlobalVar.FileName)
if err != nil {
log.Fatal(err)
}
// Initialize routine
err = ooxml.Initialize(filePath)
if err != nil {
log.Fatal(err)
}
}