Access to http://<ipaddress>/cgi-bin/snapshot.cgi?1

Have some questions or having issues with your IP Camera(s), Post them here for the mods and other users to assist you with.
helifreak
Posts: 1
Joined: Wed Apr 19, 2017 4:38 pm

Access to http://<ipaddress>/cgi-bin/snapshot.cgi?1

Post by helifreak »

I have a couple of the IP3M-HX2s, after upgrading to the march firmware getting a JPEG snapshot via the HTTP GET mechanism doesn't seem to work reliably anymore. I have code (on Windows) that does the HTTP request and using Wireshark there is a difference in how the camera responds to the credentials between the two firmware versions. I can provide more details if this is an appropriate level of detail for this forum - but hoping someone is programming to these cameras and has seen this.

Thanks,
Nick.
jamestx10
Posts: 34
Joined: Fri Jul 15, 2016 7:36 am

Re: Access to http://<ipaddress>/cgi-bin/snapshot.cgi?1

Post by jamestx10 »

I have the same issue. I have created my own webpage that displays snapshots from all my cameras and like you I get an auth prompt now.
IP2M-841
vegas50000
Posts: 22
Joined: Wed Jan 11, 2017 12:32 am

Re: Access to http://<ipaddress>/cgi-bin/snapshot.cgi?1

Post by vegas50000 »

Ditto. They fucked it up in the latest firmware update.
Oendaril
Posts: 16
Joined: Sun Dec 20, 2015 12:48 pm

Re: Access to http://<ipaddress>/cgi-bin/snapshot.cgi?1

Post by Oendaril »

Yeah, authentication in the cgi api is screwed up in the latest. It's responding to basic auth with a digest auth prompt response.
jon
Posts: 1
Joined: Wed Apr 26, 2017 12:54 pm

Re: Access to http://<ipaddress>/cgi-bin/snapshot.cgi?1

Post by jon »

Just leaving a note to say I am affected by this issue.
tedp
Posts: 10
Joined: Mon Jul 11, 2016 10:01 am

Re: Access to http://<ipaddress>/cgi-bin/snapshot.cgi?1

Post by tedp »

I wish they would have mentioned this in the release notes. I wouldn't have upgraded as I rely on the snapshot.cgi to interface to my home automation system.
mfarley281
Posts: 5
Joined: Sun Jun 25, 2017 6:54 pm

Re: Access to http://<ipaddress>/cgi-bin/snapshot.cgi?1

Post by mfarley281 »

Here is some code to get around this in PHP or JavaScript: https://pastebin.com/mb0M3yVM
jamestx10
Posts: 34
Joined: Fri Jul 15, 2016 7:36 am

Re: Access to http://<ipaddress>/cgi-bin/snapshot.cgi?1

Post by jamestx10 »

Can you post a full example of using that PHP or JavaScript code? I am using a RasberryPi as my host.
IP2M-841
meisner
Posts: 7
Joined: Mon Dec 25, 2017 9:24 pm

Re: Access to http://<ipaddress>/cgi-bin/snapshot.cgi?1

Post by meisner »

mfarley281 wrote:Here is some code to get around this in PHP or JavaScript: https://pastebin.com/mb0M3yVM
@mfarley281, thanks for the code...it's a great starting point!

You are referring to a variable called "$boundary" near the end of the php code. But it's not initialized anywhere.

Also, your php code only returns status code 401 (exception caught at line 34):

root@server:~# php amcrest.php
* Hostname was NOT found in DNS cache
* Trying 192.168.2.203...
* Connected to 192.168.2.203 (192.168.2.203) port 8083 (#0)
* Server auth using Digest with user 'admin'
> GET /cgi-bin/snapshot.cgi HTTP/1.1
Host: 192.168.2.203:8083
Accept: */*

< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: Basic realm="Device_CGI"
< CONNECTION: close
< CONTENT-LENGTH: 0
<
* Closing connection 0
PHP Fatal error: Uncaught exception 'Exception' with message 'exception 'Exception' with message 'Response with Status Code [401].' in /root/amcrest.php:34
Stack trace:
#0 {main}' in /root/amcrest.php:38
Stack trace:
#0 {main}
thrown in /root/amcrest.php on line 38
meisner
Posts: 7
Joined: Mon Dec 25, 2017 9:24 pm

Re: Access to http://<ipaddress>/cgi-bin/snapshot.cgi?1

Post by meisner »

As a quick update, I have made the following changes to your script:

I set boundary as follows:
$boundary = "\xffd9";

and I commented out the line that seems to enabled digest auth:
// CURLOPT_HTTPAUTH => CURLAUTH_DIGEST

Now the script works perfectly for me and my IP2M-850!!
Post Reply