LINUX.ORG.RU

Авторизоваться и получить главную страницу с помощью curl.

 , , ,


1

1

Не проходит авторизация с указанием пароля

curl -u user:pass -v http://192.168.0.1
* Rebuilt URL to: http://192.168.0.1/
* Hostname was NOT found in DNS cache
*   Trying 192.168.0.1...
* Connected to 192.168.0.1 (192.168.0.1) port 80 (#0)
* Server auth using Digest with user 'user'
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 192.168.0.1
> Accept: */*
> 
< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: Digest  realm="user", domain="/",nonce="03j8bvg6iomnb78ijcxzqujggfdr7yjmkiy603e",opaque="039jhbv78mnzq235hgfvbmijhfde6cxvcdf506",algorithm="MD5",qop="auth"
< Content-Type: text/html
< Connection: close
< 
* Closing connection 0
* Issue another request to this URL: 'http://192.168.0.1/'
* Hostname was found in DNS cache
*   Trying 192.168.0.1...
* Connected to 192.168.0.1 (192.168.0.1) port 80 (#1)
* Server auth using Digest with user 'user'
> GET / HTTP/1.1
> Authorization: Digest username="user", realm="user", nonce="03j8bvg6iomnb78ijcxzqujggfdr7yjmkiy603e", uri="/", cnonce="ZTc2MmNmN2Y0ZLMKMJiuughgytRTTTGGDG=", nc=00000001, qop=auth, response="755KMu8ughgffhvvcfffghhghr645ccb1a", opaque="039jhbv78mnzq235hgfvbmijhfde6cxvcdf506", algorithm="MD5"
> User-Agent: curl/7.35.0
> Host: 192.168.0.1
> Accept: */*
> 
< HTTP/1.1 401 Unauthorized
* Authentication problem. Ignoring this.
< WWW-Authenticate: Digest  realm="user", domain="/",nonce="039fc451c20480jnhh76fvbnhy7ytfvhgu77df542d",opaque="03j8bvg6iomnb78ijcxzqujggfdr7yjmkiy603e",algorithm="MD5",qop="auth"
< Content-Type: text/html
< Connection: close
< 
<html>
  <head>
    <title>Configuration</title>
  </head>
  <body>
        <p><font size="5">401 Unauthorized
!</p>
</body>
</head></html>
* Closing connection 1

Если пароль указать вручную, то авторизация проходит без проблем.

curl --digest -u user -v http://192.168.0.1Enter host password for user 'user':
* Rebuilt URL to: http://192.168.0.1/
* Hostname was NOT found in DNS cache
*   Trying 192.168.0.1...
* Connected to 192.168.0.1 (192.168.0.1) port 80 (#0)
* Server auth using Digest with user 'user'
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 192.168.0.1
> Accept: */*
> 
< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: Digest  realm="user", domain="/",nonce="03g3g2h2j32jh3g2as3s2d32df2f3h23gffh4g26",opaque="039fc451c2h3g3b2n383h3b3h3gf3c3vm3j2d",algorithm="MD5",qop="auth"
< Content-Type: text/html
< Connection: close
< 
* Closing connection 0
* Issue another request to this URL: 'http://192.168.0.1/'
* Hostname was found in DNS cache
*   Trying 192.168.0.1...
* Connected to 192.168.0.1 (192.168.0.1) port 80 (#1)
* Server auth using Digest with user 'user'
> GET / HTTP/1.1
> Authorization: Digest username="user", realm="user", nonce="03g3g2h2j32jh3g2as3s2d32df2f3h23gffh4g26", uri="/", cnonce="ZmJmMDY0MNJUHGBVGhhgffhhfhfhfhGFTtfgdd4NjU=", nc=00000001, qop=auth, response="03d75d1e56e9daeh2324e7f7cf22", opaque="039fc451c2h3g3b2n383h3b3h3gf3c3vm3j2d", algorithm="MD5"
> User-Agent: curl/7.35.0
> Host: 192.168.0.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type: text/html
< Cache-Control: must-revalidate, no-store
< Connection: close
< 

Как нужно указывать пароль чтобы авторизация была успешной.



Последнее исправление: simlifarka (всего исправлений: 1)

Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.