-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
53 lines (44 loc) · 742 Bytes
/
main.go
File metadata and controls
53 lines (44 loc) · 742 Bytes
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
package main
import (
"io"
"log"
"net/http"
"os"
"fmt"
)
func httpGet(url string) {
resp, err := http.Get(url)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
_, err = io.Copy(os.Stdout, resp.Body)
if err != nil {
log.Fatal(err)
}
}
func httpSPAM1(httpURL string) {
for {
httpGet(httpURL)
}
}
func main() {
var choice int
fmt.Println("Single GET or Spam (1/2)")
fmt.Scan(&choice)
if choice == 1 {
var geturl string
fmt.Println("Enter URL:")
fmt.Scan(&geturl)
httpGet(geturl)
defer os.Exit(1)
} else if choice == 2 {
var geturl string
fmt.Println("Enter URL:")
fmt.Scan(&geturl)
httpSPAM(geturl)
defer os.Exit(2)
} else {
os.Exit(3)
}
}