This repository has been archived by the owner on Nov 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
main.go
147 lines (119 loc) · 3.55 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
package main
import (
"bufio"
"fmt"
"math/rand"
"os"
"os/exec"
"strings"
"sync"
"time"
"github.com/admin100/util/console"
"github.com/valyala/fasthttp"
"github.com/valyala/fasthttp/fasthttpproxy"
)
var (
avaliable int
taken int
start int
end int
usernames []string
proxies []string
threads int
green = "\x1b[38;5;77m"
red = "\x1b[38;5;167m"
reset = "\x1b[0m"
)
func main() {
clear()
rand.Seed(time.Now().UnixNano())
console.SetConsoleTitle("TikTok Username Checker")
wg := sync.WaitGroup{}
f, err := os.Open("assets/usernames.txt")
if err != nil {
fmt.Printf("[%s%s%s] Failed to read assets/usernames.txt\n", red, time.Now().Format("15:04:05"), reset)
return
}
s := bufio.NewScanner(f)
for s.Scan() {
usernames = append(usernames, s.Text())
}
f, err = os.Open("assets/proxies.txt")
if err != nil {
fmt.Printf("[%s%s%s] Failed to read assets/proxies.txt\n", red, time.Now().Format("15:04:05"), reset)
return
}
s = bufio.NewScanner(f)
for s.Scan() {
proxies = append(proxies, s.Text())
}
fmt.Printf("[\x1b[38;5;63m%s\x1b[0m] Threads\x1b[38;5;63m>\x1b[0m ", time.Now().Format("15:04:05"))
fmt.Scanln(&threads)
clear()
goroutines := make(chan struct{}, threads)
start = int(time.Now().Unix())
go background()
for i := 0; i < len(usernames); i++ {
wg.Add(1)
go func(username string) {
defer wg.Done()
goroutines <- struct{}{}
check(username)
<-goroutines
}(usernames[i])
}
wg.Wait()
end = int(time.Now().Unix())
fmt.Println()
fmt.Println("Avaliable\x1b[38;5;63m:\x1b[0m", avaliable)
fmt.Println("Taken\x1b[38;5;63m:\x1b[0m", taken)
fmt.Printf("Took\x1b[38;5;63m:\x1b[0m %ds\n", (end - start))
time.Sleep(3 * time.Millisecond)
}
func background() {
for {
console.SetConsoleTitle(fmt.Sprintf("TikTok Username Checker - Checked %d/%d", avaliable, (avaliable + taken)))
time.Sleep(500)
}
}
func check(username string) {
if strings.Contains(username, "-") || strings.Contains(username, " ") {
taken++
fmt.Printf("[%s%s%s] Invalid (%s%s%s)\n", red, time.Now().Format("15:04:05"), reset, red, username, reset)
return
}
req := fasthttp.AcquireRequest()
res := fasthttp.AcquireResponse()
defer fasthttp.ReleaseRequest(req)
defer fasthttp.ReleaseResponse(res)
req.Header.SetMethod("GET")
req.SetRequestURI("https://t.tiktok.com/node/share/user/@" + username)
req.Header.Set("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36")
proxy := proxies[rand.Intn(len(proxies))]
client := &fasthttp.Client{
Dial: fasthttpproxy.FasthttpHTTPDialer(proxy),
ReadBufferSize: 50_000,
}
err := client.Do(req, res)
if err != nil {
return
}
body := string(res.Body())
if strings.Contains(body, "10202") {
avaliable++
fmt.Printf("[%s%s%s] Avaliable (%s%s%s)\n", green, time.Now().Format("15:04:05"), reset, green, username, reset)
file, _ := os.OpenFile("avaliable.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
file.Write([]byte(username + "\n"))
} else if strings.Contains(body, "10221") || strings.Contains(body, "10222") {
taken++
fmt.Printf("[%s%s%s] Banned (%s%s%s)\n", red, time.Now().Format("15:04:05"), reset, red, username, reset)
} else {
taken++
fmt.Printf("[%s%s%s] Taken (%s%s%s)\n", red, time.Now().Format("15:04:05"), reset, red, username, reset)
}
}
func clear() {
c := exec.Command("cmd", "/c", "cls")
c.Stdout = os.Stdout
c.Run()
}