Advertisement
xtekky_

Untitled

Jul 25th, 2022
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 2.05 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5.     "math/rand"
  6.     "net"
  7.     "strconv"
  8.     "time"
  9.  
  10.     "github.com/zenthangplus/goccm"
  11. )
  12.  
  13. var (
  14.     domains = []string{"api19.tiktokv.com", "api.toutiao50.com", "api19.toutiao50.com", "api19-core-c-alisg.tiktokv.com"}
  15.  
  16.     sent   int = 0
  17.     errors int = 0
  18.     rpm    int = 0
  19.     rps    int = 0
  20. )
  21.  
  22. func get_device_id() string {
  23.     var id string
  24.  
  25.     for i := 1; i <= 19; i++ {
  26.         id += strconv.Itoa(rand.Intn(9-1) + 9)
  27.     }
  28.  
  29.     return id
  30. }
  31.  
  32. func connect_and_send(api_addr string, payload []byte) {
  33.     conn, err := net.Dial("tcp", api_addr+":80")
  34.  
  35.     if err != nil {
  36.         return
  37.     }
  38.  
  39.     _, err = conn.Write(payload)
  40.  
  41.     if err != nil {
  42.         errors++
  43.     } else {
  44.         sent++
  45.     }
  46. }
  47.  
  48. func rpmCounter() {
  49.     for {
  50.         before := sent
  51.         time.Sleep(6000 * time.Millisecond)
  52.         after := sent
  53.  
  54.         rpm = (after - before) * 10
  55.     }
  56. }
  57.  
  58. func rpsCounter() {
  59.     for {
  60.         before := sent
  61.         time.Sleep(1 * time.Second)
  62.         after := sent
  63.  
  64.         rps = (after - before) * 10
  65.     }
  66. }
  67.  
  68. func update_counter() {
  69.     for {
  70.         time.Sleep(time.Millisecond * 500)
  71.         fmt.Printf("--> Sent: %d - err: %d | rpm: %d - rps: %d     \r", sent, errors, rpm, rps)
  72.     }
  73. }
  74.  
  75. func main() {
  76.     var video_id string
  77.     var threads int
  78.  
  79.     fmt.Print("[>] Threads: ")
  80.     fmt.Scanln(&threads)
  81.  
  82.     fmt.Print("[>] ID: ")
  83.     fmt.Scanln(&video_id)
  84.  
  85.     fmt.Print("\n\n")
  86.  
  87.     go rpmCounter()
  88.     go rpsCounter()
  89.     go update_counter()
  90.  
  91.     c := goccm.New(threads)
  92.  
  93.     for {
  94.         c.Wait()
  95.  
  96.         go func() {
  97.             addr := domains[rand.Intn(len(domains))]
  98.             connect_and_send(addr, []byte(fmt.Sprintf("POST /aweme/v1/aweme/stats/?channel=tiktok_web&device_type=iPhone1,1&deviceID=161612101510139131516111091112141411&os_version=20&version_code=220400&appName=tiktok_web&device_platform=iphone&aid=1988 HTTP/1.1\r\nUser-Agent: Mozilla/5.0 (Linux; Android 7.1.1; Moto E (4) Plus) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.111 Mobile Safari/537.36\r\nHost: %s\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nContent-Length: 41\r\n\r\nitem_id=%s&share_delta=1", addr, video_id)))
  99.             c.Done()
  100.         }()
  101.     }
  102.  
  103.     c.WaitAllDone()
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement