Last active
July 19, 2021 14:19
-
-
Save bakueikozo/f6e0796bd0b70c178e8c2fa2ab260e65 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
set -x | |
export LD_LIBRARY_PATH=/tmp/newroot/lib/:/tmp/newroot/usr/lib | |
export HOOKURL=https://maker.ifttt.com/trigger/called/with/key/[your_ifttt_key] | |
DATETIME=`date "+%H:%M:%S"` | |
#どこか自分で設置した転送用のftpサーバに画像をアップロードする | |
/tmp/busybox ftpput -u atomcam -p atomcam ftp.example.com alarm.jpg /tmp/alarm.jpg | |
#アップロードした画像にアクセスできるURLを指定する | |
#IFTTTの場合、IP直打ちはNGでした | |
JSON="{\"value1\":\"http://example.com/atomcam/alarm.jpg\", \"value2\":\"$DATETIME\"}" | |
#curlコマンドでwebhookする | |
/tmp/newroot/lib/ld.so.1 /tmp/newroot/usr/bin/curl -k -X POST $HOOKURL -H "Content-Type: application/json" -d "$JSON" | |
This file contains hidden or 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
#!/bin/sh | |
set -x | |
if [ -e $1 ]; then | |
echo "$1 is file parameter" | |
FILE=$1 | |
OPT=$2 | |
fi | |
if [ -e $2 ]; then | |
echo "$2 is file parameter" | |
FILE=$2 | |
OPT=$1 | |
fi | |
if [[ "$FILE" = "/tmp/alarm.jpg" || "$FILE" = "/tmp/alarm_record.mp4" ]]; then | |
FMT=`date +"%Y%m%d_%H%M%S"` | |
echo $FMT > /dev/console | |
mkdir /media/mmc/alarm_files/ | |
str=`echo ${FILE} | awk -F "/" '{ print $NF }'` | |
echo "basename:${str}" | |
OUTPATH="/media/mmc/alarm_files/"$FMT"_"$str | |
echo "outpath:$OUTPATH" > /dev/console | |
cp $FILE $OUTPATH | |
if [ -e /media/mmc/scripts/alarmhook.sh ]; then | |
if [ "$FILE" = "/tmp/alarm.jpg" ]; then | |
source /media/mmc/scripts/alarmhook.sh $OUTPATH | |
fi | |
fi | |
fi | |
busybox rm $1 $2 |
This file contains hidden or 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
#!/bin/sh | |
set -x | |
export PATH='/media/mmc/scripts:/system/bin:/bin:/sbin:/usr/bin:/usr/sbin' | |
echo "called from app_init.sh" | |
echo "overmount busybox and passwords" | |
cp /tmp/Test/busybox /tmp | |
cp /tmp/Test/passwd /tmp | |
cp /tmp/Test/shadow /tmp | |
echo "mount mmc to /tmp/mmc" | |
mkdir /tmp/mmc | |
mount /dev/mmcblk0p1 /tmp/mmc | |
# rm.shが呼び出されるようにする | |
cp -r /bin /tmp/bin | |
rm -r /tmp/bin/rm | |
mount -o bind /tmp/busybox /bin/busybox | |
mount -o bind /tmp/bin /bin | |
cp /tmp/mmc/scripts/rm.sh /bin/rm | |
chmod 755 /bin/rm | |
#ここまで | |
echo "insmod ext2 driver" | |
insmod /tmp/mmc/modules/crc16.ko | |
insmod /tmp/mmc/modules/mbcache.ko | |
insmod /tmp/mmc/modules/jbd2.ko | |
insmod /tmp/mmc/modules/ext4.ko | |
insmod /tmp/mmc/modules/v4l2loopback.ko video_nr=1 | |
echo "mount ext2 new rootfs" | |
mkdir /tmp/newroot | |
mount -t ext2 /tmp/mmc/rootfs_hack.ext2 /tmp/newroot | |
mount -o bind /tmp/passwd /etc/passwd | |
mount -o bind /tmp/shadow /etc/shadow | |
echo "run /tmp/mmc/scripts/pre.sh" | |
source /tmp/mmc/scripts/pre.sh | |
echo "run rtsp hacked tool" | |
mkswap /tmp/mmc/swap | |
swapon /tmp/mmc/swap | |
/system/bin/hl_client & | |
LD_PRELOAD=/tmp/mmc/modules/libcallback.so /system/bin/iCamera_app & | |
/system/bin/dongle_app & | |
sleep 15 | |
LD_LIBRARY_PATH=/tmp/newroot/lib:/tmp/newroot/usr/lib:/lib:/usr/lib /tmp/newroot/lib/ld.so.1 /tmp/newroot/usr/bin/v4l2rtspserver /dev/video1 & | |
echo "run /tmp/mmc/post.sh" | |
source /tmp/mmc/scripts/post.sh | |
tcpsvd -vE 0.0.0.0 21 busybox ftpd / & | |
ProcessName=telnetd | |
set +x | |
while true | |
do | |
count=`ps | grep $ProcessName | grep -v grep | wc -l` | |
if [ $count = 0 ]; then | |
echo "$ProcessName is dead." | |
telnetd | |
else | |
# echo "$ProcessName is alive." | |
fi | |
sleep 5 | |
done | |
echo "finish. login root from UART or telnet" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment