-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
85 lines (63 loc) · 1.86 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
75
76
77
78
79
80
81
82
83
84
85
package main
import (
"anticheat_ch/anticheat"
"anticheat_ch/anticheat/cheats"
"anticheat_ch/auth"
"anticheat_ch/config"
"anticheat_ch/discord"
"anticheat_ch/message"
"anticheat_ch/utils"
"anticheat_ch/utils/game"
"anticheat_ch/utils/mutex"
"anticheat_ch/utils/mysql"
"anticheat_ch/utils/update"
"anticheat_ch/vars"
_ "github.com/go-sql-driver/mysql"
"os"
"os/signal"
"syscall"
)
func main() {
//if the tool aint running as admin, let's run it again AS ADMIN
if !utils.IsAdmin() {
utils.RunMeElevated()
}
mutex.MutexCheck()
// the header info with basic info such as sponsors
message.PrintHeader()
//is the game running?
game.DetectGame()
//connect to mysql database
db := mysql.MySQL_Connect()
//load config from db
config.LoadConfig(db)
//Initiate the connection to discord
vars.DiscordGo = discord.DiscordConnection()
//check update
update.CheckUpdate()
//request the key from the user
key := anticheat.RequestKey()
//initial authenticating
authuser := auth.AuthUser(db, key)
//final auth. only works when initial auth has been done and verfied
auth.FinalAuth(authuser, db, key, vars.DiscordGo)
//user must be in support server
check := auth.DiscordCheck()
//auth complete. send welcome message?
if check {message.WelcomeMessage()}
//check if user has no grass
cheats.GrassCheck()
cheats.RecoilCheck()
//the initial cheating checks
anticheat.InitialcheatCheck()
//async: ping the server every 60 seconds
go anticheat.PingServer()
//wait for the ctrl+c signal to interupt and close it all
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
<-sc
vars.DiscordGo.ChannelMessageSend(vars.AlertsChannel, "[CONNECTION] User "+vars.UserName+" (ID: "+vars.UserID+") has disconnected!")
// Cleanly close down the Discord session.
vars.DiscordGo.Close()
utils.CloseTerminal()
}