TPLINK TL-R479GP-AC ROOT过程和文件系统简单分析

参考文档:https://www.eatm.app/archives/395.html

1.导出配置

系统工具 -> 设备管理 ->备份与导入配置->备份
下载后是一个bin文件。重命名后缀名为.tar.gz,在Linux或cygwin下解压和修改(否则可能会丢失执行属性)。

tar zxvf XXX.tar.gz

2.修改配置开启SSH

打开配置文件tmp/userconfig/etc/config/dropbear

config dropbear
        option PasswordAuth 'on'
        option RootPasswordAuth 'on'
        option Port         '33400'
        option ssh_port_switch         'off'
#       option BannerFile   '/etc/banner'

把ssh_port_switch 改成’on’即可

3.添加SSH登录账户

打开配置文件tmp/userconfig/etc/passwd,新增一行对应你的SSH账户:(你想换名字也可以)

yt:x:0:0:yt:/root:/bin/ash

打开配置文件tmp/userconfig/etc/shadow,新增一行:

yt:$1$aaaabbbb$kK.jSMkFdVe9wBGQLt/xv1:17703:0:99999:7:::
#$1$aaaabbbb$kK.jSMkFdVe9wBGQLt/xv1”对应密码是123456
#可以用以下命令自行替换
perl -e 'print crypt("123456","\$1\$aaaabbbb\$") . "\n"'

4.上传修改后的配置

重新压缩并重新命名为bin

tar czvf new.tar.gz tmp/
mv new.tar.gz new.bin

然后上传这个新的bin,耐心等待路由器重启即可
此时用yt账户123456密码登录,已经拿到是root权限

5.文件系统的简单分析

root@TP-LINK:/tmp/userconfig/etc# cat /proc/cpuinfo 
system type		: Qualcomm Atheros QCA956X rev 0
machine			: TP-LINK TL-R4299G 2.0
processor		: 0
cpu model		: MIPS 74Kc V5.0
BogoMIPS		: 373.55
wait instruction	: yes
microsecond timers	: yes
tlb_entries		: 32
extra interrupt vector	: yes
hardware watchpoint	: yes, count: 4, address/irw mask: [0x0000, 0x0ff8, 0x0ff8, 0x0ff8]
ASEs implemented	: mips16 dsp
shadow register sets	: 1
kscratch registers	: 0
core			: 0
VCED exceptions		: not available
VCEI exceptions		: not available

root@TP-LINK:/tmp/userconfig/etc# uname -a
Linux TP-LINK 3.3.8 #1 Wed Nov 1 18:01:23 CST 2017 mips GNU/Linux

root@TP-LINK:/tmp/userconfig/etc# free
             total         used         free       shared      buffers
Mem:        126464        61344        65120            0         7196
-/+ buffers:              54148        72316
Swap:            0            0            0


root@TP-LINK:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                   61.8M    620.0K     61.1M   1% /
/dev/root                 8.5M      8.5M         0 100% /rom
tmpfs                    61.8M      3.4M     58.4M   5% /tmp
root                     61.8M    620.0K     61.1M   1% /tmp/root
overlayfs:/tmp/root      61.8M    620.0K     61.1M   1% /
/dev/mtdblock7            2.0M    652.0K      1.4M  32% /tmp/userconfig
tmpfs                   512.0K         0    512.0K   0% /dev

好吧。MIPS架构,128MB内存。
根据嵌入式系统一贯的ramfs的尿性,通过增加文件并重启确认,/tmp/userconfig就是刚才我们上传的文件目录,是唯一的可写区。
如果希望增加开机自启,可以修改 /tmp/userconfig/etc/rc.local,增加启动项
可以在这里面增加wget等操作下载你需要额外部署的应用到内存。

  • 8
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 12
    评论
评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值