ollydbg
ollydbg

Reputation: 3525

How to access url that requires http authenticate in c/c++/command line?

http://admin:[email protected]/videostream.cgi

To access a url that doesn't require http authenticate it's quite easy:

telnet 192.168.1.178 80
Get /videostream.cgi HTTP/1.1
Accept: text/html;text/plain

User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.13) Gecko/20100914 Firefox/3.5.13
Connection: close

But how to specify admin:123456?

Upvotes: 0

Views: 4967

Answers (2)

Wyatt Anderson
Wyatt Anderson

Reputation: 9893

For basic authentication, you specify the username and password as username:password, then Base64-encode it and use it as an argument to the Authentication header:

Authorization: Basic YXNkZjoxMjM0

YXNkZjoxMjM0 decodes to asdf:1234; I used curl -u adsf:1234 (specifying the username "asdf" and password "1234") to produce this result.

Upvotes: 1

RedGrittyBrick
RedGrittyBrick

Reputation: 4002

See the RFC or This Wikipedia article.

It can be educational to use Wireshark, or some other LAN sniffer, to watch what a browser and server do when you access a URL with embedded credentials such as your http://admin:[email protected]/videostream.cgi

Upvotes: 1

Related Questions