How to send HTTP request with authentication basic? - c++

I'm using SOCKET (WINSOCK2.H) to connect to IP camera.
After connect, I want to send the command "GET /nphMotionJpeg?Resolution=640x480&Quality=Standard HTTP/1.1\r\n\r\n" to get video stream.
But this command is not successful because the camera is protected by authentication basic.
Now, I want to insert into request command username and password but i don't know the syntax to do it.

the syntax is explained in the related wikipedia article: https://en.wikipedia.org/wiki/Basic_access_authentication

Related

Is it possible to intercept Google Recaptcha answer-response via Wireshark?

I'm using PolarProxy for decrypting HTTPS requests.
When I look at intercepted response from Recaptcha, I see pretty strange payload
enter image description here
It is HTTP2 protocol.
As you can see, cookies are the same, it means we a looking at the same requests, but response in Wireshark is completely different from response in browser. Why?
Does anyone know how to intercept that response from Recaptcha?
I want to do it in C++ (libpcap) in future, but first I want to do it manually.

How to send a webservice request in jmeter to https rather than http

I have created a new project using the template 'Building a SOAP WebService Test Plan' in jmeter (followed the steps in the tutorial from the apache jmeter website to set this up). The responses aren't being accepted and in the results log I am seeing the message:
1446205258738,20995,Soap Request,Non HTTP response code: org.apache.http.conn.HttpHostConnectException,Non HTTP response message: Connection to http://(server name).com refused,Number of Users 1-10,text,false,2273,1,1,0
It's making the connection to http rather than https which I think is why the connection is not being made. Is there anyway to change this? I've tried using the different implementations in the soap request but this hasn't worked, currently using HttpClient4.
Please see the http request details
HTTP REQUEST DETAILS
As per #Rage answer (who should answer in response not comment , I'll be happy to remove my answer if he does), just change :
Protocol [http] value to https
See:
As per your last comment, you modified to https and now you face another issue , getting a 404.
So most probably your Path or Server Name or IP are wrong, as the hoster or developer for the correct connection informations.

How to authenticate with IP Camera?

I encountered the problem when working with IP Camera Panasonic (BL-C111CE).
I want to get motion jpeg stream from this camera. So i did the following steps:
1. Open socket on HTTP port:
mySocket = connect("192.168.1.253" /*ip*/, "80" /*port*/);
2. Send the following string command to camera:
"GET /nphMotionJpeg?&Resolution=640x480&Quality=Motion&Framerate=30 HTTP/1.1\r\n\r\n"
This command work fine when I enabled the privilege view video for general user in camera's settings. But when I disable this privilege, the above command is failed.
I have searched, and I knew I need send admin's username and password in order to authenticate to Camera.
But I don't know the syntax for sending my username and password. And which step must I send it?
Many thanks,
Phong Le
I think you might need to use some sort of HTTP Authentication, either Basic or Digest. I'd try with Basic Authentication first, so send an additional header in your Request like
GET /nphMotionJpeg?&Resolution=640x480&Quality=Motion&Framerate=30 HTTP/1.1
Authorization: Basic <AuthString>
For AuthString you construct a string 'username:password' and encode it using BASE64.
Have a look at the linked Wikipedia articles for more information about HTTP Authentication.
i resolved the part about authorization by
request.setHeader("Authorization","Basic " + Base64.encodeToString ("user:password".getBytes(), Base64.NO_WRAP));
where request is a HttpGet instance;

Simple FTP Client authentication?

I have written a simle FTP Client-Server code using WinSocks. But I am confused in "How to use a simple Username-Password Authentication" ? I have gone through the Authentication links given in MSDN but that made me more confused. Any help will be appreciated.
The FTP authentication process is done with the USER and PASS commands:
Command: USER AbhineetK7
Response: 331 Password required for AbhineetK7.
Command: PASS **********
Response: 230 Hello!
You can find more details here.
If I understand you correctly you are looking for something like this:
FTP Winapi
As you can see that URL contains full description with examples about FTP connection between Client and Server, with Username-Password Authentication.

Connecting a desktop application with a website

I made an application using Qt/C++ that reads some values every 5-7 seconds and sends them to a website.
My approach is very simple. I am just reading the values i want to send and then i make an HTTP POST to the website. I also send the username and password to the website.
The problem is that i cannot find out if the request is successful. I mean that if i send the request and server gets it, i will get an HTTP:200 always. For example if the password is not correct, there is no way to know it. It is the way HTTP works.
Now i think i will need some kind of a protocol to take care the communication between the application and the website.
The question is what protocol to use?
If the action performed completes before the response header is sent you have the option of adding a custom status to it. If your website is built on PHP you can call header() to add the custom status of the operation.
header('XAppRequest-Status: complete');
if you can modify the server side script you could do the following
on one end :
You can make the HTTP post request via ajax
and evaluate the result of the ajax request.
On the serve side
On the HTTP request you do your process and if everything goes accordingly you can send data back to the ajax script that called it.
solves your problem .. ?