MCPcopy Create free account
hub / github.com/evilsocket/pwngrid / UnitReportAP

Method UnitReportAP

api/unit_report.go:46–75  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

44}
45
46func (api *API) UnitReportAP(w http.ResponseWriter, r *http.Request) {
47 unit := Authenticate(w, r)
48 if unit == nil {
49 return
50 }
51
52 client := clientIP(r)
53 body, err := ioutil.ReadAll(r.Body)
54 if err != nil {
55 ERROR(w, http.StatusUnprocessableEntity, ErrEmpty)
56 return
57 }
58
59 var ap apReport
60 if err = json.Unmarshal(body, &ap); err != nil {
61 log.Warning("error while reading wifi ap from %s: %v", client, err)
62 ERROR(w, http.StatusUnprocessableEntity, ErrEmpty)
63 return
64 }
65
66 if err := api.unitReport(client, unit, ap); err != nil {
67 log.Warning("%v", err)
68 ERROR(w, http.StatusUnprocessableEntity, ErrEmpty)
69 return
70 }
71
72 JSON(w, http.StatusOK, map[string]interface{}{
73 "success": true,
74 })
75}
76
77func (api *API) UnitReportMultipleAP(w http.ResponseWriter, r *http.Request) {
78 unit := Authenticate(w, r)

Callers

nothing calls this directly

Calls 5

unitReportMethod · 0.95
AuthenticateFunction · 0.85
clientIPFunction · 0.85
ERRORFunction · 0.85
JSONFunction · 0.85

Tested by

no test coverage detected