-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.go
74 lines (64 loc) · 2.05 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
package main
import (
"encoding/json"
"flag"
"fmt"
browser "github.com/sohimaster/Firefox-Passwords-Decryptor/recon/browser/firefox"
"path/filepath"
"github.com/sohimaster/Firefox-Passwords-Decryptor/recon"
)
func main() {
// Define command-line flags
sysInfoFlag := flag.Bool("sysinfo", false, "Get system information")
portsInfoFlag := flag.Bool("ports", false, "Get ports information")
devicesInfoFlag := flag.Bool("devices", false, "Get devices information")
historyFlag := flag.Bool("history", false, "Get Firefox browsing history")
passwordsFlag := flag.Bool("passwords", false, "Get Firefox passwords")
// Parse the flags
flag.Parse()
if *sysInfoFlag {
systemInfo, _ := json.MarshalIndent(recon.GetSystemInfo(), "", " ")
fmt.Println("System info: ", string(systemInfo))
}
if *portsInfoFlag {
ports, err := recon.GetPortsInfo()
if err != nil {
fmt.Println(err)
return
}
portsInfo, _ := json.MarshalIndent(ports, "", " ")
fmt.Println("Ports info: ", string(portsInfo))
}
if *devicesInfoFlag {
devicesInfo := recon.GetDevicesInfo()
devicesInfoJson, _ := json.MarshalIndent(devicesInfo, "", " ")
fmt.Println("Devices info: ", string(devicesInfoJson))
}
if *historyFlag || *passwordsFlag {
firefoxProfilePath, err := browser.GetProfilePath()
if err != nil {
fmt.Println(err)
return
} else {
fmt.Println("Firefox profile path: ", firefoxProfilePath)
}
if *historyFlag {
dbPath := filepath.Join(string(firefoxProfilePath), browser.FirefoxDBFile)
browsingHistory, err := browser.GetBrowsingHistoryTempDB(dbPath, 10) // Adjusted for compatibility
if err != nil {
fmt.Println("Error on retrieving history", err)
}
browsingHistoryJson, _ := json.MarshalIndent(browsingHistory, "", " ")
fmt.Println("Browsing history: ", string(browsingHistoryJson))
}
if *passwordsFlag {
logins, err := browser.GetPasswords(firefoxProfilePath)
if err != nil {
fmt.Println(err)
return
}
loginsText, _ := json.MarshalIndent(logins, "", " ")
fmt.Println("Logins: ", string(loginsText))
}
}
}