我正在尝试使用 golang 自动跟踪
Wifi 路由器页面位于 192.168.0.1 Wifi 路由器页面
这是使用Fiddler捕获的原始数据。(手动更改时)
POST http://192.168.0.1/goform/form2WlanBasicSetup.cgi HTTP/1.1
Host: 192.168.0.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.0.1/d_wlan_basic.asp
Cookie: curShow=
X-Skyzip-Mode: high
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 233
domain=1&hiddenSSID=0&ssid=Home&band=9&chan=0&chanwid=1&txRate=0&method_cur=0&method=6&authType=2&length=1&format=1&defaultTxKeyId=1&key1=&pskFormat=0&pskValue=3ADI0NSXEAYOI0M&checkWPS2=1&save=Apply&basicrates=496&operrates=4080
和我的golang代码如下
func RouterPass(pass string) {
routerUrl := "http://192.168.0.1"
resource := "/goform/form2WlanBasicSetup.cgi"
data := url.Values{}
data.Set("domain", "1")
data.Add("ssid", "Home")
data.Add("band", "9")
data.Add("chan", "0")
data.Add("chanwid", "1")
data.Add("txRate", "0")
data.Add("method_cur", "0")
data.Add("method", "6")
data.Add("authType", "2")
data.Add("length", "1")
data.Add("format", "1")
data.Add("defaultTxKeyId", "1")
data.Add("pskFormat", "0")
data.Add("pskValue", pass)
data.Add("checkWPS2", "1")
data.Add("save", "Apply")
data.Add("basicrates", "496")
data.Add("operrates", "4080")
u, _ := url.ParseRequestURI(routerUrl)
u.Path = resource
u.RawQuery = data.Encode()
urlStr := fmt.Sprintf("%v", u)
client := &http.Client{}
r, _ := http.NewRequest("POST", urlStr, nil)
// r.Header.Add("Authorization", "auth_token=\"XXXXXXX\"")
r.Header.Add("Content-Type", "application/x-www-form-urlencoded")
r.Header.Add("Content-Length", strconv.Itoa(len(data.Encode())))
resp, _ := client.Do(r)
fmt.Println(pass)
fmt.Println(resp.Status)
}
但我无法更改密码。我究竟做错了什么?
莫回无
相关分类