Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rikoudosenin/bf96fd7839e99718af33bd8f12159773 to your computer and use it in GitHub Desktop.
Save rikoudosenin/bf96fd7839e99718af33bd8f12159773 to your computer and use it in GitHub Desktop.
package main
import (
"github.com/franela/goreq"
"fmt"
"io/ioutil"
)
type Item struct {
csrf_token string
otp string
password string
destination string
username string
}
func main() {
item := Item{
csrf_token: "160b7329948f8fe35db85ace4ab15d3ca5fa3073",
password: "password",
destination: "https://www.reddit.com",
username: "username",
}
req := goreq.Request{
Method: "POST",
Uri: "https://www.reddit.com/login",
Proxy: "http://127.0.0.1:8888",
Body: item,
ContentType: "application/x-www-form-urlencoded",
UserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36",
Accept: "*/*",
}
req.AddHeader("Accept-Encoding", "gzip, deflate, br")
resp, err := req.Do()
checkError(err)
defer resp.Body.Close()
bytes, err := ioutil.ReadAll(resp.Body)
checkError(err)
fmt.Println(string(bytes))
}
func checkError(err error) {
if err!=nil {
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment