From cdd5d62199c300c8c797c89f1785c07a3df58633 Mon Sep 17 00:00:00 2001 From: Julian Einwag Date: Mon, 5 Apr 2021 14:30:39 +0200 Subject: [PATCH] fix login with username and password for FB 7490 and OS 7.21 --- config/fritzclientconfig.go | 5 ----- fritz/fritzclient.go | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/config/fritzclientconfig.go b/config/fritzclientconfig.go index 8399ffca..e4a0ee22 100644 --- a/config/fritzclientconfig.go +++ b/config/fritzclientconfig.go @@ -67,8 +67,3 @@ func New(path string) (*Config, error) { func (config *Config) GetLoginURL() string { return fmt.Sprintf("%s://%s:%s%s", config.Net.Protocol, config.Net.Host, config.Net.Port, config.Login.LoginURL) } - -// GetLoginResponseURL returns the URL that is queried for the login challenge -func (config *Config) GetLoginResponseURL(response string) string { - return fmt.Sprintf("%s?response=%s&username=%s", config.GetLoginURL(), response, config.Login.Username) -} diff --git a/fritz/fritzclient.go b/fritz/fritzclient.go index 5aa46e96..83c6f3ed 100644 --- a/fritz/fritzclient.go +++ b/fritz/fritzclient.go @@ -7,6 +7,7 @@ import ( "fmt" "io/ioutil" "net/http" + "net/url" "github.com/bpicode/fritzctl/config" "github.com/bpicode/fritzctl/httpread" @@ -97,9 +98,8 @@ func (client *Client) solveChallenge() (*SessionInfo, error) { func (client *Client) solveAttempt() func() (*http.Response, error) { challengeAndPassword := client.SessionInfo.Challenge + "-" + client.Config.Login.Password challengeResponse := client.SessionInfo.Challenge + "-" + toUTF16andMD5(challengeAndPassword) - url := client.Config.GetLoginResponseURL(challengeResponse) return func() (*http.Response, error) { - return client.HTTPClient.Get(url) + return client.HTTPClient.PostForm(client.Config.GetLoginURL(), url.Values{"username": {client.Config.Login.Username}, "response": {challengeResponse}}) } }