Giter VIP home page Giter VIP logo

dahua-camera-ptz's Introduction

dahua-camera-ptz

This is a simple PHP implementation of Dahua IP Cam HTTP API.

Impelements both Basic and Digest auth, this script should be able to handle both new and old firmware, and 3rd Party branded Dahua cameras.

Config

The script requires these configs:

  • user: Username for ipCam
  • pass: password for ipCam
  • cam_list: a list of the ip cameras.
  • basic_auth_list: a list of ip cameras that requires Basic Auth

Arguments

This script takes the following querystrings:

  • c : camera number specified in cam_list
  • a : API_CALL you wish to execute. See Dahua HTTP API documentation for example
  • p : ptz preset. If this is specified, the script ignores the API Call you set in 'a', and will execute PTZ - GotoPreset.
  • d : debug flag. set to 1 to view the full header info.

Example

After the configuration, you can save the script on a web host with PHP enabled, and call the script like this:

http://HOSTNAME/SCRIPTNAME.php?c=CAM_NUMBER&a=API_CALL_NAME

For instance, this gives you the General Config of the camera 1:

http://HOSTNAME/SCRIPTNAME.php?c=1&a=GetGeneralConfig

There is also a shortcut for GotoPreset for PTZ ( which is my most used function ), you can:

http://HOSTNAME/SCRIPTNAME.php?c=CAM_NUMBER&p=PRESET_NUMBER

Meaning this will set camera no.2 to PTZ preset 4

http://HOSTNAME/SCRIPTNAME.php?c=2&p=4

License

As you can see in the script, I have not implement any of the config setting API calls or user actions for security reason. If you wish to use those, it should be relatively easy to implement.

MIT license. Do whatever you want! ( and no evil! )

dahua-camera-ptz's People

Contributors

git-moe avatar moet78 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dahua-camera-ptz's Issues

Won't work with modern Dahua (Imou, ...) cameras

Unfortunately it won't work with modern modern Dahua (Imou, ...) cameras.

$ nmap 192.168.XXX.XXX

Starting Nmap 7.40 ( https://nmap.org ) at 2022-02-20 12:15 CET
Nmap scan report for 192.168.XXX.XXX
Host is up (0.0040s latency).
Not shown: 996 closed ports
PORT STATE SERVICE
53/tcp filtered domain
80/tcp open http
554/tcp open rtsp
8086/tcp open d-s-n

Nmap done: 1 IP address (1 host up) scanned in 43.27 seconds

https://localhost/dahua_cam.php?c=1&p=1&d=1
http://192.168.XXX.XXX/cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=1&arg3=0
Array
(
[0] =>
)

http://192.168.XXX.XXX:8086/cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=1&arg3=0
Array
(
[0] => HTTP/1.1 401 Unauthorized
[1] => Cache-Control: no-cache
[2] => Session-Id: 2606109608
[3] => User-Agent: AEDA HTTP Server/1.0
[4] => x-pcs-request-id:
[5] => WWW-Authenticate: Digest realm="Login to 54FFB94ED89C7ABB",nonce="4bac67d2-084d-41d2-b0e2-145994c4b6f2"
[6] =>
[7] => HTTP/1.1 500 Internal Server Error
[8] => Cache-Control: no-cache
[9] => Session-Id: 2353181066
[10] => User-Agent: AEDA HTTP Server/1.0
[11] => x-pcs-request-id:
[12] =>
[13] =>
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.