Skip to content

Commit

Permalink
modified: README.md
Browse files Browse the repository at this point in the history
	new file:   sdcard/config.txt
	modified:   sdcard/debug_cmd.sh
	modified:   sdcard/hack/ptz-ctrl
	modified:   sdcard/hack/www/cgi-bin/webui
	copied:     sdcard/debug_cmd.sh -> sdcard/persistenthack.sh
	new file:   sdcard/restore.sh
	new file:   sdcard/sdcardhack.sh
	modified:   sdcard/start.sh
	deleted:    sdcardrestore.zip
  • Loading branch information
ant-thomas committed Mar 30, 2018
1 parent 42295f4 commit b34259d
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 38 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ This is a cheap Pan Tilt IP Camera (supposedly 1080p) that for a time was availa
* Create network connection
* WiFi - setup camera via app
* Ethernet - plug in to network (doesn't need app setup)
* Download [zsgx1hacks-v0.3.zip](https://github.com/ant-thomas/zsgx1hacks/raw/master/zsgx1hacks-v0.3.zip) and extract the contents of the zip file to a vfat/fat32 formatted microSD card
* Download [zsgx1hacks-v0.4.zip](https://github.com/ant-thomas/zsgx1hacks/raw/master/zsgx1hacks-v0.4.zip) and extract the contents of the zip file to a vfat/fat32 formatted microSD card
* Change options in `config.txt`
* Option for persistent hack without SD card
* Option to restore original state of camera without hack
* Option to silence the voices
* This may be causing issues on some cameras so use at your own risk
* Insert microSD card into camera and boot
* Result should be
* No communication to cloud services
Expand Down
23 changes: 23 additions & 0 deletions sdcard/config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
###########################
# ZS-GX1 Hacks Config File
###########################

## Persistent hack
# YES = SD Card NOT required after hack is installed
# NO = SD Card always required
# Default = NO

PERSISTENT=NO

## Restore camera to original state
# Default = NO

RESTORE=NO

## Silence Voices
# YES = Silence Voices
# NO = Keep Voices
# Default = NO
# Possibly causes some cameras to fail - use at your own risk

VOICE=NO
38 changes: 26 additions & 12 deletions sdcard/debug_cmd.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
#!/bin/sh
#

#Copy hack files
mkdir /home/hack
cp -R /mnt/hack/* /home/hack/

#Copy new hack start.sh
if [ ! -f /home/start.sh.orig ]; then
cp /home/start.sh /home/start.sh.orig
# include config
. /mnt/config.txt

if [ "$VOICE" = "YES" ]; then
rm /home/VOICEOFF
rm /home/VOICEON
touch /home/VOICEOFF
else
rm /home/VOICEOFF
rm /home/VOICEON
touch /home/VOICEON
fi

cp /mnt/start.sh /home/start.sh

#Rename debug_cmd.sh to prevent it running again
mv /mnt/debug_cmd.sh /mnt/debug_cmd.sh.hack
if [ "$RESTORE" = "YES" ]; then
/mnt/restore.sh

elif [ "$PERSISTENT" = "YES" ];then
rm /home/HACKP
rm /home/HACKSD
touch /home/HACKP
/mnt/persistenthack.sh

elif [ ! "$PERSISTENT" = "YES" ];then
rm /home/HACKP
rm /home/HACKSD
touch /home/HACKSD
/mnt/sdcardhack.sh
fi

#reboot to apply hacks
reboot



22 changes: 14 additions & 8 deletions sdcard/hack/ptz-ctrl
Original file line number Diff line number Diff line change
@@ -1,36 +1,42 @@
#!/bin/sh
#

if [ -f /home/HACKP ]; then
ptzfolder="/home/hack"
elif [ -f /home/HACKSD ]; then
ptzfolder="/media/hack"
fi

if [ $1 = "u" ];
then
/home/hack/ptz 0x65 0x14 && sleep 1 && /home/hack/ptz 0x64 0x14
$ptzfolder/ptz 0x65 0x14 && sleep 1 && $ptzfolder/ptz 0x64 0x14
fi
if [ $1 = "d" ];
then
/home/hack/ptz 0x66 0x14 && sleep 1 && /home/hack/ptz 0x64 0x14
$ptzfolder/ptz 0x66 0x14 && sleep 1 && $ptzfolder/ptz 0x64 0x14
fi
if [ $1 = "l" ];
then
/home/hack/ptz 0x67 0x14 && sleep 1 && /home/hack/ptz 0x64 0x14
$ptzfolder/ptz 0x67 0x14 && sleep 1 && $ptzfolder/ptz 0x64 0x14
fi
if [ $1 = "r" ];
then
/home/hack/ptz 0x68 0x14 && sleep 1 && /home/hack/ptz 0x64 0x14
$ptzfolder/ptz 0x68 0x14 && sleep 1 && $ptzfolder/ptz 0x64 0x14
fi
if [ $1 = "lu" ];
then
/home/hack/ptz 0x69 0x200020 && sleep 1 && /home/hack/ptz 0x64 0x14
$ptzfolder/ptz 0x69 0x200020 && sleep 1 && $ptzfolder/ptz 0x64 0x14
fi
if [ $1 = "ld" ];
then
/home/hack/ptz 0x6a 0x200020 && sleep 1 && /home/hack/ptz 0x64 0x14
$ptzfolder/ptz 0x6a 0x200020 && sleep 1 && $ptzfolder/ptz 0x64 0x14
fi
if [ $1 = "ru" ];
then
/home/hack/ptz 0x6b 0x200020 && sleep 1 && /home/hack/ptz 0x64 0x14
$ptzfolder/ptz 0x6b 0x200020 && sleep 1 && $ptzfolder/ptz 0x64 0x14
fi
if [ $1 = "rd" ];
then
/home/hack/ptz 0x6c 0x200020 && sleep 1 && /home/hack/ptz 0x64 0x14
$ptzfolder/ptz 0x6c 0x200020 && sleep 1 && $ptzfolder/ptz 0x64 0x14
fi

34 changes: 25 additions & 9 deletions sdcard/hack/www/cgi-bin/webui
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ command=`echo "$QUERY_STRING" | awk '{split($0,array,"&")} END{print array[1]}'
date=`date`
ipadd=`ip route get 1 | awk '{print $NF;exit}'`
uptime=`uptime`

if [ -f /home/HACKP ]; then
hacktype="PERSISTENT"
elif [ -f /home/HACKSD ]; then
hacktype="SD CARD"
fi


cat <<EOT
<!DOCTYPE html>
<html>
Expand Down Expand Up @@ -54,39 +62,47 @@ IP Address - $ipadd
<br />
Uptime - $uptime
<br />
Hack Type - $hacktype
<br />
<a href="https://github.com/ant-thomas/zsgx1hacks" target="_blank">ZS-GX1 Hacks - Github</a>
</body></html>
EOT

if [ -f /home/HACKP ]; then
ptzfolder="/home/hack"
elif [ -f /home/HACKSD ]; then
ptzfolder="/media/hack"
fi


if [ "$command" = "iron" ]; then
gio -s 46 1 > /dev/null
fi
if [ "$command" = "iroff" ]; then
gio -s 46 0 > /dev/null
fi
if [ "$command" = "ptzu" ]; then
/home/hack/ptz-ctrl u > /dev/null
$ptzfolder/ptz-ctrl u > /dev/null
fi
if [ "$command" = "ptzd" ]; then
/home/hack/ptz-ctrl d > /dev/null
$ptzfolder/ptz-ctrl d > /dev/null
fi
if [ "$command" = "ptzl" ]; then
/home/hack/ptz-ctrl l > /dev/null
$ptzfolder/ptz-ctrl l > /dev/null
fi
if [ "$command" = "ptzr" ]; then
/home/hack/ptz-ctrl r > /dev/null
$ptzfolder/ptz-ctrl r > /dev/null
fi
if [ "$command" = "ptzlu" ]; then
/home/hack/ptz-ctrl lu > /dev/null
$ptzfolder/ptz-ctrl lu > /dev/null
fi
if [ "$command" = "ptzld" ]; then
/home/hack/ptz-ctrl ld > /dev/null
$ptzfolder/ptz-ctrl ld > /dev/null
fi
if [ "$command" = "ptzru" ]; then
/home/hack/ptz-ctrl ru > /dev/null
$ptzfolder/ptz-ctrl ru > /dev/null
fi
if [ "$command" = "ptzrd" ]; then
/home/hack/ptz-ctrl rd > /dev/null
$ptzfolder/ptz-ctrl rd > /dev/null
fi

22 changes: 22 additions & 0 deletions sdcard/persistenthack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
#

#Copy hack files
mkdir /home/hack
cp -R /mnt/hack/* /home/hack/

#Copy new hack start.sh
if [ ! -f /home/start.sh.orig ]; then
cp /home/start.sh /home/start.sh.orig
fi

cp /mnt/start.sh /home/start.sh

#Rename debug_cmd.sh to prevent it running again
mv /mnt/debug_cmd.sh /mnt/debug_cmd.sh.hack

#reboot to apply hacks
reboot



21 changes: 21 additions & 0 deletions sdcard/restore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
#

#remove hack files
rm -rf /home/hack
rm /home/VOICEOFF
rm /home/VOICEON
rm /home/HACKP
rm /home/HACKSD

#restore original start.sh
cp /home/start.sh.orig /home/start.sh

#restore original VOICE.tgz
cp /home/VOICE-orig.tgz /home/VOICE.tgz

#Rename debug_cmd.sh to prevent it running again
mv /mnt/debug_cmd.sh /mnt/debug_cmd.sh.restore

#reboot to apply hacks
reboot
52 changes: 52 additions & 0 deletions sdcard/sdcardhack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/sh

#ANT-THOMAS
############
# HACKS HERE

# mount sd card to separate location
if [ -b /dev/mmcblk0p1 ]; then
mount -t vfat /dev/mmcblk0p1 /media
elif [ -b /dev/mmcblk0 ]; then
mount -t vfat /dev/mmcblk0 /media
fi

cp /media/hack/group /etc/group

# install updated version of busybox
cp /bin/busybox /bin/busybox-orig
cp /media/hack/busybox-armv6l /bin/busybox
/bin/busybox --install -s

# busybox httpd
busybox httpd -p 8080 -h /media/hack/www

# setup and install dropbear ssh server
#cp /media/hack/dropbearmulti /bin/dropbearmulti
mkdir /etc/dropbear
cp /media/hack/dropbear_ecdsa_host_key /etc/dropbear/dropbear_ecdsa_host_key
/media/hack/dropbearmulti dropbear

# update hosts file to prevent communication
cp /media/hack/hosts.new /etc/hosts

# start ftp server
(tcpsvd -E 0.0.0.0 21 ftpd / ) &

# sync the time
(sleep 20 && ntpd -q -p 0.uk.pool.ntp.org ) &

# silence the voices
if [ ! -f /home/VOICE-orig.tgz ]; then
cp /home/VOICE.tgz /home/VOICE-orig.tgz
fi

if [ -f /home/VOICEOFF ]; then
cp /media/hack/VOICE-new.tgz /home/VOICE.tgz
fi

# turn off high pitched noise
(sleep 20 && /media/hack/goke_volume -s 0 ) &

#
############
12 changes: 4 additions & 8 deletions sdcard/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,23 @@ cp /home/hack/dropbear_ecdsa_host_key /etc/dropbear/dropbear_ecdsa_host_key
cp /home/hack/hosts.new /etc/hosts

# start ftp server
(tcpsvd -E 0.0.0.0 21 ftpd / ) &
(tcpsvd -E 0.0.0.0 21 ftpd / ) &

# sync the time
(sleep 20 && ntpd -q -p 0.uk.pool.ntp.org ) &
(sleep 20 && ntpd -q -p 0.uk.pool.ntp.org ) &

# silence the voices
if [ ! -f /home/VOICE-orig.tgz ]; then
cp /home/VOICE.tgz /home/VOICE-orig.tgz
fi

if [ -f /home/VOICEOFF ]; then
cp /home/hack/VOICE-new.tgz /home/VOICE.tgz

# turn off high pitched noise
(sleep 20 && /home/hack/goke_volume -s 0 ) &

fi

#
############



umount /mnt

#update form flash
Expand Down

0 comments on commit b34259d

Please sign in to comment.