Описание проблемы и в чём мне нужна помощь. Получилось длинно, зато с картинками
Купил вот такую камеру ZOSI 1ND-5122M-W-EU https://www.zositech.com/product/1080p- ... y-monitor/ на Ali
Вот что у неё внутри. Камера 2 Мп, Onvif. telnet есть, но пароль неизвестен. Она поработала неделю и умерла. А именно – включается, вращается вправо-влево, вверх-вниз и щёлкает. Но потом ни звуков, ни реакции. На кнопку ресет не реагирует. Али рекламацию принял, выслали такую же камеру.
Мой план был такой:
1. Зайти через Uboot по UART в мёртвую камеру – получилось
2. Получить хэш пароля root – получилось
3. Подобрать пароль по хэшу – не получилось
4. Запасной вариант – считать флэшку через USB-TTL (СН314a) и найти пароль там – не получилось
5. Зайти в рабочую камеру по telnet c паролем и скачать dump (чтобы не паять и не разбирать)
6. Залить dump в поломанную камеру
Раз я пишу этот пост – значит у меня не получилось и мне нужна ваша помощь. Пожалуйста
Дальше каждый этап подробно.
Этап первый. Считать пароль по UART
1. Припаялся к единственным похожим на RX|TX|GND выводам. Обозначений на схеме не было, но всё сработало.
2. U-boot запаролен. Тогда нажимаю при запуске клавишу и запускаюсь с init . Вот вывод + содержимое некоторых папок.
3. Хэш считан, но пароль какой-то непонятный. Md5.ru знает его, но просит 20$System startup
U-Boot 2010.06 (Apr 25 2017 - 14:32:57)
Check Flash Memory Controller v100 ... Found
SPI Nor(cs 0) ID: 0xc2 0x20 0x18
Block:64KB Chip:16MB Name:"MX25L128XX"
SPI Nor total size: 16MB
Cannot found a valid SPI Nand Device
MMC:
EMMC/MMC/SD controller initialization.
Card did not respond to voltage select!
No EMMC/MMC/SD device found !
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 1 0
hisilicon # \\\ & ?
? - alias for 'help'
base - print or set address offset
bootm - boot application image from memory
bootp - boot image via network using BOOTP/TFTP protocol
bootss - boot from snapshot image
cmp - memory compare
cp - memory copy
crc32 - checksum calculation
ddr - ddr training function
ext2load- load binary file from a Ext2 filesystem
ext2ls - list files in a directory (default /)
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls - list files in a directory (default /)
getinfo - print hardware information
go - start application at address 'addr'
help - print command description/usage
loadb - load binary file over serial line (kermit mode)
loady - load binary file over serial line (ymodem mode)
loop - infinite loop on address range
md - memory display
mii - MII utility commands
mm - memory modify (auto-incrementing address)
mmc - MMC sub system
mmcinfo - mmcinfo <dev num>-- display MMC info
mtest - simple RAM read/write test
mw - memory write (fill)
nand - NAND sub-system
nboot - boot from NAND device
nm - memory modify (constant address)
ping - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
rarpboot- boot image via network using RARP/TFTP protocol
reset - Perform RESET of the CPU
saveenv - save environment variables to persistent storage
setenv - set environment variables
sf - SPI flash sub-system
tftp - tftp- download or upload image via network using TFTP protocol
usb - USB sub-system
usbboot - boot from USB device
version - print monitor version
hisilicon # setenv bootargs mem=36M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=jffs2 mtdparts=hi_sfc:1M(boot),3M(kernel),11776K(rootfs),512K(config) init=/bin/sh
hisilicon # sf probe 0
16384 KiB hi_fmc at 0:0 is now current device
hisilicon # sf read 0x82000000 0x100000 0x300000
hisilicon # bootm 0x82000000
## Booting kernel from Legacy Image at 82000000 ...
Image Name: Linux-3.4.35
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1817072 Bytes = 1.7 MiB
Load Address: 80008000
Entry Point: 80008000
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.4.35 (root@ubuntu) (gcc version 4.8.3 20131202 (prerelease) (Hisilicon_v300) ) #17 Thu Apr 20 15:21:02 CST 2017
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: hi3518ev200
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 9144
Kernel command line: mem=36M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=jffs2 mtdparts=hi_sfc:1M(boot),3M(kernel),11776K(rootfs),512K(config) init=/bin/sh
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 36MB = 36MB total
Memory: 31616k/31616k available, 5248k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc2800000 - 0xff000000 ( 968 MB)
lowmem : 0xc0000000 - 0xc2400000 ( 36 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc043b000 (4300 kB)
.init : 0xc043b000 - 0xc045b81c ( 131 kB)
.data : 0xc045c000 - 0xc0489000 ( 180 kB)
.bss : 0xc0489024 - 0xc04bf838 ( 219 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:32
VIC @fe0d0000: id 0x00641190, vendor 0x41
sched_clock: 32 bits at 49MHz, resolution 20ns, wraps every 86767ms
Console: colour dummy device 80x30
Calibrating delay loop... 269.10 BogoMIPS (lpj=1345536)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Initializing cgroup subsys freezer
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x80339040 - 0x80339098
dummy:
NET: Registered protocol family 16
Serial: AMBA PL011 UART driver
uart:0: ttyAMA0 at MMIO 0x20080000 (irq = 5) is a PL011 rev2
console [ttyAMA0] enabled
uart:1: ttyAMA1 at MMIO 0x20090000 (irq = 30) is a PL011 rev2
uart:2: ttyAMA2 at MMIO 0x200a0000 (irq = 25) is a PL011 rev2
bio: create slab <bio-0> at 0
SCSI subsystem initialized
hi-spi-master hi-spi-master.0: with 1 chip select slaves attached
hi-spi-master hi-spi-master.1: with 2 chip select slaves attached
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource timer0
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
NFS: Registering the id_resolver key type
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
fuse init (API version 7.18)
msgmni has been set to 61
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered (default)
io scheduler cfq registered
brd: module loaded
Check Flash Memory Controller v100 ... Found.
SPI Nor(cs 0) ID: 0xc2 0x20 0x18
Block:64KB Chip:16MB Name:"MX25L128XX"
SPI Nor total size: 16MB
4 cmdlinepart partitions found on MTD device hi_sfc
4 cmdlinepart partitions found on MTD device hi_sfc
Creating 4 MTD partitions on "hi_sfc":
0x000000000000-0x000000100000 : "boot"
0x000000100000-0x000000400000 : "kernel"
0x000000400000-0x000000f80000 : "rootfs"
0x000000f80000-0x000001000000 : "config"
SPI Nand ID Table Version 2.2
Cannot found a valid SPI Nand Device
himii: probed
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
hiusb-ehci hiusb-ehci.0: HIUSB EHCI
hiusb-ehci hiusb-ehci.0: new USB bus registered, assigned bus number 1
hiusb-ehci hiusb-ehci.0: irq 15, io mem 0x100b0000
hiusb-ehci hiusb-ehci.0: USB 0.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
hiusb-ohci hiusb-ohci.0: HIUSB OHCI
hiusb-ohci hiusb-ohci.0: new USB bus registered, assigned bus number 2
hiusb-ohci hiusb-ohci.0: irq 16, io mem 0x100a0000
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
hisi_i2c hisi_i2c.0: Hisilicon [i2c-0] probed!
hisi_i2c hisi_i2c.1: Hisilicon [i2c-1] probed!
hisi_i2c hisi_i2c.2: Hisilicon [i2c-2] probed!
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
NET: Registered protocol family 15
lib80211: common routines for IEEE802.11 drivers
Registering the dns_resolver key type
usb 1-1: new high-speed USB device number 2 using hiusb-ehci
VFS: Mounted root (jffs2 filesystem) on device 31:2.
Freeing init memory: 128K
/bin/sh: can't access tty; job control turned off
/ # cat /etc/shadow
cat: can't open '/etc/shadow': No such file or directory
/ #
/ # cat /etc/shadowid
uid=0(root) gid=0(root)
/ # / # id
/bin/sh: /: Permission denied
/ # uid=0(root) gid=0(root)
/bin/sh: syntax error: unexpected "("
/ # cat /etc/passwd
root:$1$dNRIgDMy$y9cVILenUGaSEl8q5dlpp0:0:0::/root:/bin/sh
/ #
/ # cat /etc/passwd
/ # uid=0(root) gid=0(root)
/ # / # id
/ # id
/ # cat /etc/shadow
cat: can't open '/etc/shadow': No such file or directory
/ # ls
app font lost+found proc tmpfs
bin home mkimg.rootfs root usr
boot init mknod_console sbin var
config komod mnt share
dev lib nfsroot sys
etc linuxrc opt tmp
/ # ls /tmp
/ # ls /etc
TZ fstab inittab passwd- resolv.conf udev
cgi group mtab profile services udhcpd.conf
fs-version init.d passwd protocols systemmsg wpa-psk.conf
/ #
/ # ls /app
bin.tgz start.sh update web.tgz
/ # ls \bin/bin
addgroup echo ionice mpstat sh
adduser ed iostat mt sleep
ash egrep ip mv ssp_read
base64 false ipaddr netstat ssp_write
btools fdflush ipcalc nice stat
busybox fgrep iplink pidof stty
cat fsync iproute ping su
catv getopt iprule ping6 sync
chgrp grep iptunnel pipe_progress tar
chmod gunzip kill powertop touch
chown gzip linux32 printenv true
conspy hiddrs linux64 ps udevadm
cp hier ln pwd udevd
cpio hiew login reformime umount
cttyhack hil2s ls rev uname
date himc lzop rm usleep
dd himd makemime rmdir vi
delgroup himd.l mkdir rpm watch
deluser himm mknod run-parts wifi_config
df hostname mktemp scriptreplay wpa_cli
dmesg hush more sed wpa_supplicant
dnsdomainname i2c_read mount setarch zcat
dumpkmap i2c_write mountpoint setserial
/ # ls /boot
/ # ls /config
wireless_WPS_param.config wireless_wifi_param.config
/ # ls /etc
/ # ls /tmp
/ # ls
/ # cat /etc/shadow
/ # cat /etc/passwd-
root:ab8nBoH3mb8.g:0:0::/root:/bin/sh
/ # ????
/bin/sh: : not found
/ # passwd
Changing password for root
New password:
Bad password: too short
Retype password:
passwd: can't create '/etc/passwd+': No space left on device
passwd: can't update password file /etc/passwd
/ #
/ # passwd
/ # ????
/ # cat /etc/passwd-
/ # ls /etc
/ # ls /tmp
/ # ls
/ # cat /etc/shadow
/ # cat /etc/passwd
root:$1$dNRIgDMy$y9cVILenUGaSEl8q5dlpp0:0:0::/root:/bin/sh
/ #
/ # cat /etc/passwd
/ # passwd
/ # ????
/ # cat /etc/passwd-
root:ab8nBoH3mb8.g:0:0::/root:/bin/sh
/ # echo "root::0:0::/root:/bin/sh" > /etc/passwd
/bin/sh: can't create /etc/passwd: No space left on device
4. Пытаюсь подменить, облом – ошибка No space left on device. Причём ни passwd, ни cp, mv и даже попытка редактировать start.sh через vi не работают, ошибка одна и та же.# cat /etc/passwd
root:$1$dNRIgDMy$y9cVILenUGaSEl8q5dlpp0:0:0::/root:/bin/sh
# cat /etc/passwd-
root:ab8nBoH3mb8.g:0:0::/root:/bin/sh
Про start.sh: думал, т.к. пароль в файле passwd- вроде как helpme, судя по интернетам, то просто подменив им оригинальный passwd (через ln) смогу войти./ # echo "root::0:0::/root:/bin/sh" > /etc/passwd
/bin/sh: can't create /etc/passwd: No space left on device
Этап второй. Считать SIP 25L12845G.
1. С впаиванием и выпаиванием – боюсь не справлюсь, поэтому через прищепку
2. При подключении – камера включается, вращается вправо-влево, вверх-вниз и щёлкает. Но ни одна программа определить тип микросхемы не может
3. Попытка выбрать вручную MX25L12845G приводит к FFFFF во всём дампе
4. Ну и проблема после этого возникла. Исчез /etc/passwd, т.е. совсем исчез, как и никнейм root.
Вот вывод id и cat
ВОПРОСЫ:/ # id
uid=0 gid=0(root)
/ # cat /etc/passwd
cat: can't open '/etc/passwd': No such file or directory
(none) login: root
Password:
Login incorrect
Dec 31 20:01:08 login[1126]: invalid password for 'UNKNOWN' on 'console'
1. Как победить ошибку No space left on device?
2. Может кто знает пароль по хэшу $1$dNRIgDMy$y9cVILenUGaSEl8q5dlpp0?
3. Почему программы не определяют тип микросхемы?
4. Получается, что в любом случае придётся припаиваться к рабочей камере, чтобы снять дамп?
5. Какой самый безболезненный путь снять/залить порекомендуете для моего случая?