ThatUsernameAlreadyExist / JCO-PM203-Fisheye-Ingenic-T20-P2P-camera-hacks

Hacks for p2p-only camera that allow you to use rtsp/web-interface/ftp and other functions.
32 stars 10 forks source link

Stuck at Step 7 #14

Closed BD5M closed 4 years ago

BD5M commented 4 years ago

Hi, I am having problems with installing the patch. I get to step 7 and this happens.

jabsco login: root Password:

Processing /etc/profile... Done

root@jabsco:/root# /opt/media/mmcblk0p1/install.sh =====Installing patch===== WARNING: found unsupported system version. Do you wish to force apply this patch?[y/n Default:y]: y cp: omitting directory '/opt/etc/lzbox' ERROR: can't create backup of file /opt/etc/lzbox ERROR: patch not applied

My firmwarte version is 3.1.34

ThatUsernameAlreadyExist commented 4 years ago

'/opt/etc/lzbox' must be a file, but your error "cp: omitting directory '/opt/etc/lzbox'" says, that it is a directory. Maybe your firmware is changed.

Check 'lzbox' file in telnet: tail /opt/etc/lzbox

If you get error: 'tail: read error: Is a directory' then check contents of 'lzbox' directory: ls -las /opt/etc/lzbox

Print result here.

BD5M commented 4 years ago

Hi yeah i got that error here is the print out

jabsco login: root Password:

Processing /etc/profile... Done

root@jabsco:/root# tail /opt/etc/lzbox tail: read error: Is a directory root@jabsco:/root# ls -las /opt/etc/lzbox 0 drwxr-xr-x 2 root root 0 Jan 19 09:39 . 0 drwxr-xr-x 3 root root 0 Jan 19 09:39 .. root@jabsco:/root#

ThatUsernameAlreadyExist commented 4 years ago

check firmware release: cat /etc/ROOT_RELEASE and attach file /ipc/etc/auto_run.sh

BD5M commented 4 years ago

root@jabsco:/root# cat /etc/ROOT_RELEASE Release 2019-06-14.10:04:05@192.168.2.248 Platforms DANALE Revirsion Option -d1 -f -w 8f root@jabsco:/root#

and i am not usre how to downlaod auto_run.sh from the ipcam.

ThatUsernameAlreadyExist commented 4 years ago

cat /ipc/etc/auto_run.sh and copy all content.

Release 2019-06-14.10:04:05@192.168.2.248

You have new firmware - my is "Release 2018-06-13.17:06:03@192.168.2.248"

BD5M commented 4 years ago

ahh

root@jabsco:/root# cat /ipc/etc/auto_run.sh

! /bin/sh

function xt_ret() { [ "${1}" = "0" ] && return 0 printf "${BASH_SOURCE[1]##*/}%-6s %s\n" "|${BASH_LINENO[0]}|" "${@:2}" return 1 }

function fn_mount_lang() { lang=cat /proc/cmdline | xargs -n1 | awk -F'=' '/lang/{print $2}' case ${lang:=0} in 1) mount --bind /ipc/etc/pcm/01.pcm.neu /ipc/etc/pcm/01.pcm ;; 2) mount --bind /ipc/etc/english/ /ipc/etc/pcm ;; *) ;; esac }

function fn_scan_tmp_mp4() { echo "____ scan after sd card mount ____" sd_path="df -h | awk '/mmcblk/{print $6}'/IPCamera" [ -d "${sd_path}" ] || return

cd ${sd_path}
rm -rf 20181001
sd_latest=`ls -d 20* | tail -1`
[ -d "${sd_latest}" ] || return

cd ${sd_latest}

dirmp4=${PWD}
rec_list=/var/run/reclist.tmp
> ${rec_list}

for f in *.mp4.tmp; do
    test -f "${f}" || { echo "not exsit $f" ; continue ;}
    # Attention: [  echo 00 | sed 's/\<0//g'  ] is empty
    hhmmee=(`ls -le -c $f | awk '{print $9}'| sed 's/:/ /g'`)
    e_hh=${hhmmee[0]}
    e_mm=${hhmmee[1]}
    e_ss=${hhmmee[2]}

    hhmmoo=${f##[AS]-}
    hhmmoo=${hhmmoo%%.mp4.tmp}
    s_hh=${hhmmoo:0:2}
    s_mm=${hhmmoo:2:2}
    s_ss=${hhmmoo:4:2}

    let end=${e_hh#0}*60*60+${e_mm#0}*60+${e_ss#0}
    let sta=${s_hh#0}*60*60+${s_mm#0}*60+${s_ss#0}
    let len=${end}-${sta}

    [ "${len}" -gt 900 ] && len=900
    len=`printf "%04d" ${len}`

    echo "${dirmp4}/$f ${dirmp4}/${f:0:1}-${hhmmoo}-${len}.mp4" >> ${rec_list}
    logger "_______ mv $f ${f:0:1}-${hhmmss}-${len}.mp4"
done

return $?

} function fn_roll() { file=${1} bo=${2:-4} let zhong=bo-1

test -f ${file}
xt_ret $? "[$1] not exist" || return $?

for (( i=$zhong,j=$bo; i>0; i-=1,j-=1 )); do
    test -f "${file}.$i" && mv ${file}.$i ${file}.$j
done

test -f "${file}" && mv ${file} ${file}.1

}

function fn_reboot() { logger -t autorun "exit jco_server"

fn_roll /opt/log/messages.reboot 2
cp /tmp/messages /opt/log/messages.reboot
fn_roll /opt/log/dmesg 2
dmesg | tail -500 > /opt/log/dmesg
test -f /tmp/messages.dot && tail -500 > /opt/log/messages.dot
sync

echo "reboot as jco_server exit"
reboot -f

}

function fn_reloadsensordrv() { SENSORTYPE=cat /proc/cmdline| xargs -n1 | grep sensor= | awk -F'=' '{print $2}' SENSORTYPE=${SENSORTYPE%[0-9]} case "$SENSORTYPE" in "SC3035") rmmod /ipc/drv/sensor_sc3035.ko insmod /ipc/drv/sensor_sc3035.ko echo reload sc3035.ko ;; "SC2235") rmmod /ipc/drv/sensor_sc2235.ko insmod /ipc/drv/sensor_sc2235.ko echo reload sc2235.ko ;; "JXF22") rmmod /ipc/drv/sensor_jxf22.ko insmod /ipc/drv/sensor_jxf22.ko echo reload jxf22.ko ;; *) echo "Invalid argument for video frontend: $SENSORTYPE" esac sleep 2 }

function fn_main() { fn_mount_lang

    date -s "2018.10.01-00:00:10"
test -f /opt/conf/reboot.epoch && source  /opt/conf/reboot.epoch    # load epoch by reboot_linux()
test -s /opt/conf/reboot.epoch && >       /opt/conf/reboot.epoch

echo "PATH: ${PATH}"
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"

# sync ubifs_bgt0_0 block with high-cpu-usage,
# reboot in client_fee_watchdog(), reboot here will block
# speed of I/O write() is .33M/s, after ENCODE exit 21M/14 -> 1.5M/s
# flush when dirty upto 1.2M or .6M, freeTotal is 60M
echo   5 >/proc/sys/vm/dirty_ratio
echo   3 >/proc/sys/vm/dirty_background_ratio       # 1.8M
#cho 300 >/proc/sys/vm/dirty_writeback_centisecs    # 0.9M default 500
#cho 500 >/proc/sys/vm/dirty_expire_centisecs       # 1.8M default 3000

# load dr
logger -t autorun "start load drivers"
touch /tmp/smac0
mkdir /dev/shm

/ipc/etc/load || exit 0
CWD=${PWD}; fn_scan_tmp_mp4; cd ${CWD}
#sleep 1

/ipc/drv/airlink/wifi_load.sh
#sleep 1

    if ! ps | grep '[t]elnetd'; then
    telnetd -p9527
    (sleep 300; ps|awk '/[p]9527/ {print $1}' | xargs kill -9) &
    fi

touch /tmp/nodumpncu
ulimit -s 6144
test -e /opt/etc/local.rc && source /opt/etc/local.rc

# support factory authorized sd-card start up WEBpage
if [ ! -f "/tmp/tag.test_ver" ] && [ -f '/opt/media/mmcblk0p1/force_dbg.txt' ]; then
    lzbox 0 /tmp/cid.txt
    diff '/tmp/cid.txt' '/opt/media/mmcblk0p1/cid.txt' >& /dev/null
    test $? -eq 0 && { echo "__1_test__"; lzbox 1 ;}
fi

# rollback sd.log
if [ -f '/opt/media/mmcblk0p1/sdcollect.txt' ]; then
    CWD=$PWD
    cd /opt/media/mmcblk0p1/
    nr=`ls messages* sd.log* | wc -l`
    let nr++
    [ -f messages ] && mv messages messages.${nr}
    let nr++
    [ -f sd.log ] && mv sd.log sd.log.${nr}
    cd $CWD
fi

while :; do
    echo "
    +------------------------------------------------+
         Hello Server World @`date +%F.%T`!!
    +------------------------------------------------+
    "

    logger -t autorun "start jco_server @${count:=0}"
    test -f /opt/media/mmcblk0p1/ffw.txt && rm -f /opt/media/mmcblk0p1/repair.txt  # void change to another working camera
    rm -rf /opt/upgrade/*
    /ipc/app/jco_server
    echo "______ jco_server end[$count]@`date +%F.%T` errno $?" | tee -a /opt/log/messages
    fn_reload_sensordrv
    let count++; [ "${count:-0}" -ge 5 ] && reboot -f && fn_reboot
    fn_reboot
done

}

fn_main $@ root@jabsco:/root#

BD5M commented 4 years ago

new 1.zip

made a notpad with code if easy as the formating sucks,,, and dam bloody buttons.

ThatUsernameAlreadyExist commented 4 years ago

print result: ls -las /ipc/bin/

BD5M commented 4 years ago

root@jabsco:/root# ls -las /ipc/bin/ 0 drwxr-xr-x 2 root root 367 Jun 14 2019 . 0 drwxr-xr-x 10 root root 119 Nov 16 2018 .. 9 -rwxr-xr-x 1 root root 9472 Jun 14 2019 Wget 2 -rwxr-xr-x 1 root root 2391 Sep 3 2018 auto_mount.sh 0 -rwxr-xr-x 1 root root 411 Sep 3 2018 auto_umount.sh 0 -rwxr-xr-x 1 root root 250 Sep 3 2018 ccli 0 -rwxr-xr-x 1 root root 66 Nov 29 2018 feed 56 -rwxr-xr-x 1 root root 57416 Jun 14 2019 fsck.fat 10 -rwxr-xr-x 1 root root 10352 Jun 14 2019 impdbg 0 lrwxrwxrwx 1 root root 5 Jun 3 2019 jzzzz -> lzbox 0 -rwxr-xr-x 1 root root 398 Sep 3 2018 ka 26 -rwxr-xr-x 1 root root 26376 Jun 14 2019 logcat 28 -rwxr-xr-x 1 root root 28515 Jun 3 2019 lzbox 0 lrwxrwxrwx 1 root root 8 Sep 3 2018 mkdosfs -> mkfs.fat 32 -rwxr-xr-x 1 root root 32440 Jun 14 2019 mkfs.fat 3 -rwxr-xr-x 1 root root 3534 Sep 3 2018 networking 2 -rwxr-xr-x 1 root root 1723 Apr 9 2019 reset2factory 4 -rwxr-xr-x 1 root root 4416 Jun 14 2019 sample_sinfo 0 lrwxrwxrwx 1 root root 5 Jun 3 2019 toggle -> lzbox 2 -rwxr-xr-x 1 root root 2157 Sep 3 2018 udhcpc.script 54 -rwxr-xr-x 1 root root 54788 Jun 14 2019 wpa_cli 519 -rwxr-xr-x 1 root root 531412 Jun 14 2019 wpa_supplicant 52 -rwxr-xr-x 1 root root 53428 Jun 14 2019 xml_shuttle 2 -rwxr-xr-x 1 root root 1807 Nov 15 2018 ztop

ThatUsernameAlreadyExist commented 4 years ago

Try copy patched file manually:

rm -r /opt/etc/lzbox cp /opt/media/mmcblk0p1/patch/patched/lzbox /opt/etc/lzbox

and reboot camera. After reboot check /opt/etc/lzbox - copied file exist or it is overwrited by empty directory? If file exist - check 'ls -las /ipc/bin/', there must be line 'lzbox -> /opt/etc/lzbox'

BD5M commented 4 years ago

hmmmmm

root@jabsco:/root# ls -las /ipc/bin/ 0 drwxr-xr-x 2 root root 367 Jun 14 2019 . 0 drwxr-xr-x 10 root root 119 Nov 16 2018 .. 9 -rwxr-xr-x 1 root root 9472 Jun 14 2019 Wget 2 -rwxr-xr-x 1 root root 2391 Sep 3 2018 auto_mount.sh 0 -rwxr-xr-x 1 root root 411 Sep 3 2018 auto_umount.sh 0 -rwxr-xr-x 1 root root 250 Sep 3 2018 ccli 0 -rwxr-xr-x 1 root root 66 Nov 29 2018 feed 56 -rwxr-xr-x 1 root root 57416 Jun 14 2019 fsck.fat 10 -rwxr-xr-x 1 root root 10352 Jun 14 2019 impdbg 0 lrwxrwxrwx 1 root root 5 Jun 3 2019 jzzzz -> lzbox 0 -rwxr-xr-x 1 root root 398 Sep 3 2018 ka 26 -rwxr-xr-x 1 root root 26376 Jun 14 2019 logcat 28 -rwxr-xr-x 1 root root 28515 Jun 3 2019 lzbox 0 lrwxrwxrwx 1 root root 8 Sep 3 2018 mkdosfs -> mkfs. fat 32 -rwxr-xr-x 1 root root 32440 Jun 14 2019 mkfs.fat 3 -rwxr-xr-x 1 root root 3534 Sep 3 2018 networking 2 -rwxr-xr-x 1 root root 1723 Apr 9 2019 reset2factory 4 -rwxr-xr-x 1 root root 4416 Jun 14 2019 sample_sinfo 0 lrwxrwxrwx 1 root root 5 Jun 3 2019 toggle -> lzbox 2 -rwxr-xr-x 1 root root 2157 Sep 3 2018 udhcpc.script 54 -rwxr-xr-x 1 root root 54788 Jun 14 2019 wpa_cli 519 -rwxr-xr-x 1 root root 531412 Jun 14 2019 wpa_supplicant 52 -rwxr-xr-x 1 root root 53428 Jun 14 2019 xml_shuttle 2 -rwxr-xr-x 1 root root 1807 Nov 15 2018 ztop root@jabsco:/root# /opt/etc/lzbox Usage: lzbox list # list all commands lzbox {id|key} [value:0] # exec key command lzbox / key # list key details

0 cid # create 32bit cid to sdcard 1 telnet {0|[1]} # enable telnetd in local.rc 2 ffw {untar|info|600} # info or untar or create en_chn_600s.txt 3 sysinfo # sysctrl -act list FORMAT 4 wifictl {on|off|reset} # {air|dhcp|scan|freq|stat|conf|rmmod|insmod} 5 log # tar all messages 6 sdlog [rm] # add|rm syslog to sdcard 7 stat # fd 8 calc a+b*c^5 # statement 9 box # Frequent command 10 adda # adda308 11 audiofd [443] # audio fd 12 tag test # test_ver 13 fat # fat read error repair 14 vm [d|drop] # memory 15 rbt # rollback timestamp 16 core [d|drop] # generate coredump

BD5M commented 4 years ago

root@jabsco:/root# /opt/media/mmcblk0p1/install.sh =====Installing patch===== System check success. SUCCESS install patch! Reboot in 3 seconds...

oh but this happened

BD5M commented 4 years ago

awww. still problems. cant FTP/HTTPS into the camera. (tired IP-ADDRESS, IP-ADDRESS:9527) can still use Telnet though

ThatUsernameAlreadyExist commented 4 years ago

No, this not work. We need a way to replace '/ipc/bin/lzbox' to our patched version '/opt/media/mmcblk0p1/patch/patched/lzbox'. In new firmware it is read-only and can't be replaced, maybe only creating and flashing "patched" firmware can help. Dump your firmware and attach files, maybe I found solution... Use following Command to dump the layout: cat /proc/mtd dev: size erasesize name mtd0: 00040000 00010000 "boot" mtd1: 00220000 00010000 "kernel" mtd2: 00340000 00010000 "root" mtd3: 00240000 00010000 "system" mtd4: 00010000 00010000 "factory" mtd5: 00010000 00010000 "param"

Dump Firmware according to the layout dd if=/dev/mtdblock0 of=uboot.bin dd if=/dev/mtdblock1 of=kernel.bin dd if=/dev/mtdblock2 of=rootfs.bin dd if=/dev/mtdblock3 of=system.bin dd if=/dev/mtdblock4 of=factory.bin dd if=/dev/mtdblock5 of=param.bin Then zip everything and provide the zip in the issue. Dump files to your SD-card - before dumping navigate to your sd-card root: cd /opt/media/mmcblk0p1/

BD5M commented 4 years ago

Hope this is right Sannce-2019-06-14.100405.zip

ThatUsernameAlreadyExist commented 4 years ago

Paste attached file 'local.rc' to /opt/etc (to copy from sdcard root: cp /opt/media/mmcblk0p1/local.rc /opt/etc/local.rc), run chmod +x /opt/etc/local.rc and reboot camera. Now it must boot with enabled hack (no need to run 'install' script).

patch.zip

BD5M commented 4 years ago

We have liftoff. thank you that has worked wonderfully. i can access the https on it as we speak.