guino / BazzDoorbell

128 stars 22 forks source link

How to access files on SD after successful flash remotely? #42

Open Nigel1992 opened 3 years ago

Nigel1992 commented 3 years ago

Thanks a ton for your amazing work on this, you really did something awesome! I want to be able to remotely access the files on my SD card to replace files, edit files etc.. [in example /issues/7]

Is this possible to do using WinSCP, FTP or something else ? And if so, how?

Regards, Nigel

guino commented 3 years ago

@Nigel1992 you can download files using http and upload files too (using /upload.html) — those are what I use and recommend since httpd is already running for snap/mjpeg and other features. If you have snap/mjpeg setup you just have to use the same user/pass/URL without the /cgi-bin/snap.cgi part and you should be able to browse and download any files. To upload use the same stuff just with /upload.html at the end (files will go to root of sd card).

Can you install/run ssh (for winscp) - yes but I don’t recommend due to low memory availability. There’s a github issue with a working ‘dropbear’ tool for that purpose - just search for it if you like.

For ftp you would have to compile/run a server for arm yourself (and you should mind the memory usage too).

Other than the above busybox has tftp support but it’s client side only (no server).

Nigel1992 commented 3 years ago

@guino Thanks for your quick response ! The upload function works great on http://IP:8080/upload.html Does it replace the old file if the new file has the same filename ?

Also, is there a way to reboot the camera using some type of command in telnet, perhaps?

And my last question, how do I change the admin:admin when using rtsp://admin:admin@IP:8554/Streaming/Channels/101 ?

guino commented 3 years ago

@Nigel1992 upload will replace existing files so be careful with it. you can use /devices/reboot to reboot (same user/pass as /proc/cmdline) -- works on mine at least.

Only certain firmware versions allow changing the password for onvif access -- if that's supported it will be in /home/cfg/tuya_config.json -- if it's not there there's no way to change it. You can make firewall rules on your network and/or make a script to rename the patched ppsapp to enable/disable it at will but there's no easy way to change the password.

Nigel1992 commented 3 years ago

I just did the reboot [http://IP/devices/reboot] and now none of the hacked functions are working :( Telnet, RSTP etc..

Even did a reboot by unplugging the power supply from the camera.

UPDATE: Turns out my SD-card partition lost all its data and got changed to RAW [unformatted]. No clue why it would do that after changing the onvif password [using telnet] + rebooting [using above-mentioned method].

UPDATE 2: Everything is working after doing a full restore + reset, and reflashing. But any idea why that happened?

  1. I made an image of my SD Card.
  2. Buying a brand SD card now for sure lol.
guino commented 3 years ago

@Nigel1992 the device will format the SD card if it gets full - you need to make sure that doesn’t happen by either disabling recording 24/7 or using motion only recording and configuring cleanup cgi.

I always tell people to backup their files once things are working.

If your SD card was not full then you may just have a faulty SD card - they will go bad after awhile if you’re recording daily to them.

Nigel1992 commented 3 years ago

@guino To what type does it format when it's full ? FAT32 ? Because mine was RAW

I've read that the cleanup happens automatically every 24 hours using custom.sh ?

Also as mentioned in #10, how can a sound be played when it detects motion ?

Sorry to bombard you with all these questions.

guino commented 3 years ago

It should format it as fat32 but if you remove the SD while it is formatting who knows how it may be left. An issue with the SD card could also have unknown outcomes.

You still have to configure the cleanup script for it to work (I think you need to put in the serial number in the script).

You can run play.cgi from a script in the device or with a http request. There’s nothing ready to make a sound play when motion is detected. You would have to use the log_parser script to either run the play.cgi script OR to notify some outside server which in turn can make the http request to play audio.