you wrote that you can send commands over TCP/IP. Do you use the http protocol for that? If yes, then you can simulate the user name and password login by sending the right http command for that. here are the two protocol desciptions: http://tools.ietf.org/html/rfc1945; http://tools.ietf.org/html/rfc2616. You have to transfer the password "Base64-coded". You have to create first the connection to the target and then send the login commands.
I have had that problem many times before. There are a number of different ways a web page might require your login.
The 2 main methods are where the page will cause your browser to pop open a standard internet explorer password box or the page will have a custom form within its html.
If its an internet explorer style password box this is triggered as the first time you request the page the server actually returns a “403-not authorised” error, this stimulates internet explorer to pop open the password box and when you click ok it re-requests the page with another line in the header:
"Authorization: Basic :user:password(base64)"
I guess if you always just sent that header on each request it will probably work.
If it’s a customised HTML form you will need to look at the html, look at the field names and whether the return method is GET of POST and return the data the same way.
With both of these types of web login its normal for them to return a cookie - which is just a string in the header, they will expect this to be sent back in the header on each subsequent page request so they still know who you are.
However you say your device just works after you have logged in using internet explorer so it sounds like its tracking your IP address rather than using cookies
I have found it easier in the past to use a command line call to wget rather than try to do it myself. – this will work very well for you if it is just using your IP address
You can easily call this using a system exec in labview.
You can also "cheat" - use wireshark to capture whatever internet explorer is sending and just send the same 🙂 - works 95% of the time as long as there is no challenge/ response type authentication.
Hope this helps.
you can also "cheat" - use wireshark to capture wahtever internet explorer is sending and just send the same 🙂 - works 95% of teh time as long as tehr eis no challenge responce type authentication.
Hope this helps.
i think a good way to know how to send the commands to your target is to monitor the data with Wireshark. There are different ways for http authentication. Here is a link for one: http://tools.ietf.org/html/rfc2617.
here is a vi with which you can receive the data which was send to you after a GET command. At the moment it receives only the Header. Maybe it helps you.
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Host: 18.104.22.168 80
Authorization: Basic Y3liZXI6Y3liZXI="When I manually enter my username and password to log in wireshark shows this:
Authorization: Basic Y3liZXI6Y3liZXI=
Credentials: xxxx:yyyy" ----- where xxxx & yyyy represent the username and password