Commit 2bab6d69 authored by owlo's avatar owlo

hacktrace!

parent 82eab41a
No preview for this file type
......@@ -197,6 +197,24 @@ func signer(path string) []byte {
}
return returnable
}
func runHackTrace(user string, target string, initializedActors []libs.ActorS) string {
userList := strings.Split(user, ":")
user = userList[0]
//index := 0
for i := range initializedActors {
if initializedActors[i].PreferredUsername == user {
// index = i
break
}
}
//if initializedActors[i].Stat > hitCalc()
// return "OK"
//else
// return "NO"
return "OK"
}
func upBork(borks []libs.ActorS) []byte {
borkFile, err := os.Create("tests/borks.json")
defer borkFile.Close()
......@@ -449,6 +467,33 @@ func main() {
w.Write(signedContent)
}
})
mux.HandleFunc("/getHackTrace", func(w http.ResponseWriter, req *http.Request) {
// Before any call to WriteHeader or Write, declare
// the trailers you will set during the HTTP
// response. These three headers are actually sent in
// the trailer.
fmt.Println("WHAT DOING?")
signed := req.Header.Get("Signature")
target := req.Header.Get("Target")
// signature := req.Header.Get("Authorization")
signature, err := ioutil.ReadAll(req.Body)
fmt.Println(string(signed))
if err != nil {
fmt.Println(err)
}
ok := validateLogin(signed, []byte(signature), initializedActors)
if ok {
w.Header().Set("Authorization", "ok")
w.WriteHeader(http.StatusOK)
fmt.Println("GOT" + signed)
results := runHackTrace(signed, target, initializedActors)
w.Write([]byte(results))
} else {
w.Header().Set("Authorization", "not authorized")
w.Write([]byte("ennt!"))
}
})
mux.HandleFunc("/getMap", func(w http.ResponseWriter, req *http.Request) {
// Before any call to WriteHeader or Write, declare
// the trailers you will set during the HTTP
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment