-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
75 lines (60 loc) · 3.65 KB
/
main.go
File metadata and controls
75 lines (60 loc) · 3.65 KB
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
package main
import (
"SysSpecter/network"
"flag"
"fmt"
"strconv"
)
var version = "1.2.1"
func banner() {
fmt.Print("\033[94m"+`
██████▓██ ██▓ ██████ ██████ ██▓███ ▓█████ ▄████▄ ▄▄▄█████▓▓█████ ██▀███
▒██ ▒ ▒██ ██▒▒██ ▒ ▒██ ▒ ▓██░ ██▒▓█ ▀ ▒██▀ ▀█ ▓ ██▒ ▓▒▓█ ▀ ▓██ ▒ ██▒
░ ▓██▄ ▒██ ██░░ ▓██▄ ░ ▓██▄ ▓██░ ██▓▒▒███ ▒▓█ ▄ ▒ ▓██░ ▒░▒███ ▓██ ░▄█ ▒
▒ ██▒ ░ ▐██▓░ ▒ ██▒ ▒ ██▒▒██▄█▓▒ ▒▒▓█ ▄ ▒▓▓▄ ▄██▒░ ▓██▓ ░ ▒▓█ ▄ ▒██▀▀█▄
▒██████▒▒ ░ ██▒▓░▒██████▒▒▒██████▒▒▒██▒ ░ ░░▒████▒▒ ▓███▀ ░ ▒██▒ ░ ░▒████▒░██▓ ▒██▒
▒ ▒▓▒ ▒ ░ ██▒▒▒ ▒ ▒▓▒ ▒ ░▒ ▒▓▒ ▒ ░▒▓▒░ ░ ░░░ ▒░ ░░ ░▒ ▒ ░ ▒ ░░ ░░ ▒░ ░░ ▒▓ ░▒▓░
░ ░▒ ░ ░▓██ ░▒░ ░ ░▒ ░ ░░ ░▒ ░ ░░▒ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░▒ ░ ▒░
░ ░ ░ ▒ ▒ ░░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░░ ░
░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░
░ ░ ░
SysSpecter - System Analyzer API - v`, version, "\033[0m")
fmt.Print("\n\n\n")
}
func run_test() {
network.GetEstablishedConnections()
network.ListInterfaces()
}
func main() {
host := flag.String("host", "127.0.0.1", "Specify the host to run the server on (default: 127.0.0.1)")
port := flag.Int("port", 8080, "Specify the port to run the server on (default: 8008)")
interface_ := flag.String("interface", "", "Specify interface to start program")
limit_ip := flag.String("limit_ip", "", "Restrict API access to a specified IP address to prevent public usage.")
header_password := flag.String("password", "", "Restrict API access to a specified Header Password \"X-Pass\" to prevent public usage.")
showHelp := flag.Bool("help", false, "Show help message")
flag.Parse()
if *showHelp {
flag.Usage()
return
}
banner()
run_test()
if *interface_ == "" {
fmt.Println("[!] Please choose \033[93mat last one interface\033[0m: ", network.ListInterfaces())
} else if !Contains(network.ListInterfaces(), *interface_) {
fmt.Println("[x] \033[91mincorrect interface\033[0m please choose correct.")
return
} else {
network.DefaultInterface = *interface_
fmt.Printf(" → \033[96mSysSpecter\033[0m API running on \033[92mhttp://%s:%d\033[0m ←\n\n", *host, *port)
if *host != "localhost" && *host != "127.0.0.1" {
fmt.Println("[!] \033[93mWarning!!!\033[0m: Your host is not set to localhost or 127.0.0.1. Please be aware that your API may be accessible from the public network.")
}
// run CalculatePerSecond with go thread
go network.CalculatePerSecond()
DefaultHeaderPassword = *header_password
DefaultIpRestrict = *limit_ip
Run(*host, *port)
println("[x] \033[91mPermission Denied\033[0m. Run it as sudo. if you think your port is busy do \"lsof -P -i -n | grep :" + strconv.Itoa(*port) + "\" ")
}
}