httpclient login

hello everyone

i am trying to login to a webpage using arduino
i used http client to connect, and got the html code of the page, but now i need to login

i have tried
client.prinntln("POST name='admin'")
but didnt work
i am new to html and http, if anyone can help me or tell me what i need to learn (just give hint)

this is the part of the code that displays the login text boxes ids

thanks

what type of authentication? is it your server where you need to log in?

Juraj:
what type of authentication? is it your server where you need to log in?

i am trying to login to mikrotik configuration page.

when i login from the browser i get to login page and enter username admin and no password
i need the arduino to do that

use Fiddler to inspect http headers of the requests to the page after the login. if there is a Authorization header with value Basic ..., then it should be easy to create that header

Juraj:
use Fiddler to inspect http headers of the requests to the page after the login. if there is a Authorization header with value Basic ..., then it should be easy to create that header

thanks for replying

i have downloaded fiddler and tried to enter correct and wrong passwords

i looked through all the results selected "auth" but all were saying "no Authorization Header is present."

and i found this when logginin
Accept-Language: en-US,en;q=0.8,ar-LB;q=0.5,ar;q=0.3
Content-Type: text/plain;charset=UTF-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
Content-Length: 116
Host: 192.168.88.1
Connection: Keep-Alive
Pragma: no-cache
Cookie: username=admin

ĀĀĀĀĀĀĀ×+?¼.òL M†e£cRÃĀĀ!@#$%^&*()_+:3|~ĀĀĀĀĀĀĀĀóÄØ—z.\îÖSK8¶üCª ¼æ™)Eadmin

last word is admin, which is the username, but the rest is encoded

and in the code

function login(user, pwd, autologin) {
var expires = new Date();
expires.setTime(expires.getTime() + (30 * 24 * 60 * 60 * 1000));
document.cookie = 'username=' + user +
'; expires=' + expires.toGMTString() + '; path=/';

window.name = (autologin ? 'autologin=' : 'login=') + user + '|' + pwd;
window.location.replace('/webfig/' + window.location.hash);
}
function dologin() {
login(get('name').value, get('password').value);
}

can this help?

it's a proprietary authentication. try copy that cookie into requests from arduino

Juraj:
it's a proprietary authentication. try copy that cookie into requests from arduino

i tried adding this
client.println("POST http://192.168.88.1/jsproxy HTTP/1.1");//same found in feddler

client.println("Referer: http://192.168.88.1/webfig/");
client.println("Accept-Language: en-US,en;q=0.8,ar-LB;q=0.5,ar;q=0.3");
client.println("Content-Type: text/plain;charset=UTF-8");
client.println("Accept-Encoding: gzip, deflate");
client.println("User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko");
client.println("Content-Length: 121");
client.println("Host: 192.168.88.1");
client.println("Connection: Keep-Alive");
client.println("Pragma: no-cache");
client.println("Cookie: username=admin");
client.println("ĀĀĀ");
client.println("¬ñÁ ÊaÉr?[ƒ•Ê‚XĀĀ!@#$%^&*()_+:3|~ĀĀĀĀĀĀĀĀž‰RpšöFþnP׳–Çê”?ÖV–àadmin");

client.println("POST 'name'='admin'");//trying to login
client.println("POST 'password'=''");
client.println("dologin('admin',''");

but didnt work, no reply

i also tried using telnet client example and changing the port number to 8729 which is api port, the serial monitor says connexted but i got noreply

i tried port 80 in telnetclient and gave same result

the simple httpclient example gives me the login page code, what should i do???
thanks for helping

the cookie should by on one line. the encoded part is shown wrong decoded. don't just copy it.

this cookie is a 'ticket' which permits enter. with login page you 'buy a new ticket'.

you should first make this hack from a PC program.

if there is a telnet api use it.

Juraj:
the cookie should by on one line. the encoded part is shown wrong decoded. don't just copy it.

this cookie is a 'ticket' which permits enter. with login page you 'buy a new ticket'.

you should first make this hack from a PC program.

if there is a telnet api use it.

there is telnet
when i use telnet client example i get non sense chars
when i use cmd i can easily access and control the router but on arduino after i connect as telnet client i get some none sence chars like >/' and stuff
i tried to send the username and password as client.println("admin") but i didnt get any reply, not even to tell me that username and password are wrong

i mean, when i connect with cmd the router asks me to login, so i tried to do the same using arduino, after connecting but it didnt work

i also tried connecting with api port 8728 and port 80 on both cmd and arduino , it was connected but also no reply from the router.

is it possible to contact you on facebook for faster communication?

this things are complex. I know the standards and usual tricks, but if it is proprietary without docs than it is hard. I want try it with my huawai router, but it is low priority for me now, so I can't help you more.

See http standard, http authentication rfc, base64 encoding.

Try to get that cookie in binary.

Telnet server can send options on connect. Ignore those chars. And google telnet protocol.

Telnet client on PC handles the login for you. From Arduino you must handle it.