initial commit
This commit is contained in:
commit
4d3a4bc48a
|
@ -0,0 +1,84 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/tls"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
"math/rand"
|
||||||
|
"os"
|
||||||
|
"bufio"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
go request()
|
||||||
|
fmt.Print("launched\n")
|
||||||
|
go request()
|
||||||
|
fmt.Print("launched\n")
|
||||||
|
go request()
|
||||||
|
fmt.Print("launched\n")
|
||||||
|
/*
|
||||||
|
go request()
|
||||||
|
fmt.Print("launched\n")
|
||||||
|
go request()
|
||||||
|
fmt.Print("launched\n")
|
||||||
|
go request()
|
||||||
|
fmt.Print("launched\n")
|
||||||
|
go request()
|
||||||
|
fmt.Print("launched\n")
|
||||||
|
go request()
|
||||||
|
fmt.Print("launched\n")
|
||||||
|
go request()
|
||||||
|
fmt.Print("launched\n")
|
||||||
|
*/
|
||||||
|
|
||||||
|
fmt.Printf("Starting an infinite for loop because I don't wanna mess with goroutines right now\n")
|
||||||
|
for true {
|
||||||
|
time.Sleep(10000 * time.Second)
|
||||||
|
fmt.Printf("10000 seconds elapsed")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func request() {
|
||||||
|
fmt.Printf("Started")
|
||||||
|
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
|
||||||
|
comments, _ := readInput("woorden.txt")
|
||||||
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
min := 0
|
||||||
|
max := len(comments)
|
||||||
|
for true {
|
||||||
|
var comment string
|
||||||
|
var name string
|
||||||
|
name = comments[rand.Intn(max - min)]
|
||||||
|
comment = comments[rand.Intn(max - min)]
|
||||||
|
url := "https://167.86.92.38/repl-api/POST-COMMENT/?arg0=%22home%22&arg1=%22" + name + "%22&arg2=%22" + comment + "%5Cn%22"
|
||||||
|
_, err := http.Get(url)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("kut, %s\n", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Done\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func readInput(filename string) ([]string, error) {
|
||||||
|
file, err := os.Open(filename)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
numbers := make([]string, 0)
|
||||||
|
scanner := bufio.NewScanner(file)
|
||||||
|
for scanner.Scan() {
|
||||||
|
number := scanner.Text()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
numbers = append(numbers, number)
|
||||||
|
}
|
||||||
|
|
||||||
|
return numbers, nil
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue