Last active
February 16, 2021 18:03
-
-
Save azzlabs/9c963d30e34114c85307c6a900734ce2 to your computer and use it in GitHub Desktop.
Get a snapshot/still image from a Tmezon 7 inch doorbell network-enabled intercom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
By reverse-engineering a bit the web interface, I wrote this simple script to get a clean still of a Tmezon doorbell camera | |
This script has been tested with the old 720p version of this: https://www.tmezon.com/7-inch-ip-intercom-p0013.html | |
It outputs an inline image, so you can upload this page to a php server and curl it to get a nice image of the current view from your doorbell | |
As a bonus, notice that the doorbell password does not appear anywhere. NEAT :I | |
*/ | |
// Basic token authentication | |
if (!(isset($_GET['token']) && $_GET['token'] == '-- Write some gibberish here --')) die('noauth'); | |
// Set the doorbell IP here | |
$ip = '192.168.X.X'; | |
// Turn on the doorbell camera (it goes to sleep after a minute) | |
file_get_contents("http://$ip/cgi-bin/hi3510/doorConnect.cgi?&-door=0"); | |
// Take a snapshot | |
$snap_path = file_get_contents("http://$ip/web/cgi-bin/hi3510/param.cgi?cmd=snap&"); | |
// Let's clean up a bit the snapshot string to get a nice path | |
$snap_path = substr($snap_path, 11); | |
$snap_path = substr($snap_path, 0, -3); | |
// We can use this to check the snapshot progressive number | |
if (isset($_GET['getlast'])) die($snap_path); | |
// Read the image | |
$img = file_get_contents("http://$ip$snap_path"); | |
// Tell the browser we're outputting a jpeg image | |
header('Content-type: image/jpeg'); | |
header('Content-Length: ' . strlen($img)); | |
header('Content-Disposition: inline; filename="' . substr($snap_path, 23) . '"'); | |
// Finally, output the image | |
echo $img; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment