Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| zh:docs:guide-developer:adding_new_device [2020/09/09 02:01] – [补丁] star_twinkling | zh:docs:guide-developer:adding_new_device [2020/09/09 02:44] – [从设备获取数据] star_twinkling | ||
|---|---|---|---|
| Line 106: | Line 106: | ||
| ===== 小窍门 ===== | ===== 小窍门 ===== | ||
| - | ==== Getting a shell on the target device | + | ==== 使用目标设备中的shell ==== |
| - | In order to collect relevant data for a port of LEDE to the device of interest one wants shell access. Most devices though do not offer a way to get a shell with telnet | + | 为了获取到某个你感兴趣的OpenWrt设备的端口的相关数据,需要进行shell访问。但是大多数设备都没有提供使用telnet或者ssh连接shell的方法。 |
| - | With [[https://wiki.openwrt.org/toh/netgear/ | + | ==== 通过PING或者NTP功能进入shell ==== |
| - | When such means cannot be used, one could try to flash an image build from the sources published by the vendor with telnetd | + | 某些路由器提供ping测试或NTP服务器配置,并且可能无法正确清理用户输入。尝试输入shell脚本,看看您是否幸运。您可能需要一些JavaScript知识才能禁用客户端输入验证。 |
| + | == 使用telnetd == | ||
| + | <code bash> | ||
| + | $( /bin/busybox telnetd -l/bin/sh -p23 & ) | ||
| + | </code> | ||
| + | == 如果需要远程登录,请使用HTTP获取密码哈希或使用“sed”删除/ | ||
| + | <code bash> | ||
| + | $( cp /etc/shadow /www ) | ||
| + | $( cp /etc/passwd /www ) | ||
| + | </ | ||
| + | 然后尝试将他们下载到您的电脑并且破解哈希密码。 | ||
| + | == 降级固件 == | ||
| + | 某些路由器可能会在启动之初尝试从特定的专用IP下载固件文件(例如TP-Link Archer C2 AC750),从而允许用户降级到较旧的固件。 | ||
| + | == HTTP服务器漏洞 == | ||
| + | 一些路由器可能正在运行过时/ | ||
| + | == 网件 == | ||
| + | 使用 [[toh: | ||
| - | With [[https:// | + | 通过 |
| + | ==== 收集相关数据 ==== | ||
| + | 在[[https:// | ||
| - | ==== Collecting relevant data ==== | + | 通常可以使用以下的命令: |
| - | On [[https:// | + | <code bash> |
| - | + | ||
| - | Typically one can use the following commands: | + | |
| dmesg # log buffer might be to small, see note 1. | dmesg # log buffer might be to small, see note 1. | ||
| cat / | cat / | ||
| Line 129: | Line 145: | ||
| ls / | ls / | ||
| brctl show | brctl show | ||
| - | + | | |
| - | Note 1: Often the log buffer is to small and the earliest messages may be missing from the information retrieved with '' | + | </ |
| + | |||
| + | **注意1**:通过**dmesg**检索时,如果日志的缓存区太小,就会丢失掉最早的信息。如果从供应商发布的资源中构建库存及镜像文件,则可以在内核配置中设置更大的缓冲区大小。 | ||
| + | |||
| + | **注意2**: | ||
| + | |||
| + | 获取设置LED信息的另一个有用的工具是[[https:// | ||
| + | |||
| + | |||
| + | ==== 从设备获取数据 ==== | ||
| + | 由于空间有限,常见的文件传输实用程序(例如rsync/ | ||
| + | |||
| + | 假设路由器ip为192.168.0.123,要传输的文件位于/ | ||
| + | |||
| + | === HTTP通过" | ||
| + | |||
| + | 如果从/ | ||
| + | |||
| + | == Sender == | ||
| + | <code bash> | ||
| + | mount -o bind /tmp /www | ||
| + | </ | ||
| + | |||
| + | == Receiver == | ||
| + | <code bash> | ||
| + | wget http:// | ||
| + | </ | ||
| + | |||
| + | === FTP通过“busybox ftpput” === | ||
| + | == Receiver == | ||
| + | 设置一个FTP服务器,添加一个具有写权限的匿名账号。 | ||
| + | <code bash> | ||
| + | python -m pyftpdlib -w -p 21 | ||
| + | </ | ||
| + | |||
| + | |||
| + | == Sender == | ||
| + | <code bash> | ||
| + | busybox ftpput 192.168.0.123 important-data.txt / | ||
| + | </ | ||
| + | |||
| + | === netcat通过“buxybox nc” === | ||
| + | == Receiver == | ||
| + | <code bash> | ||
| + | busybox nc -l -p 12345 > important-data.txt | ||
| + | </ | ||
| + | |||
| + | == Sender == | ||
| + | <code bash> | ||
| + | cat / | ||
| + | </ | ||
| - | Note 2: http:// | + | === TFTP通过“busybox tftp” === |
| + | == Receiver == | ||
| + | Setup a tftp server | ||
| - | Another useful tool for getting information for setting LEDs might be [[https://github.com/ | + | == Sender == |
| + | <code bash> | ||
| + | busybox tftp -p -l /tmp/important-data.txt -r important-data.txt 192.168.0.123 | ||
| + | </ | ||
| - | ==== Getting collected data from a device ==== | + | === 通过终端(terminal)复制 |
| - | Sometimes no normal means such as scp or ftp are available for retrieving files from a device. Still one could use httpd and busybox its mount command to do so. How? | + | 如果上述所有工具/小工具都不可用,则可以从telnet终端进行复制,但不适用于二进制文件 |
| - | Assume the files with relevant data on the device with IP address '' | + | |
| - | On the device do: | + | |
| - | cp important-data.txt /tmp | + | |
| - | mount -o bind /tmp /www | + | |
| - | After that the data on the host connected to the device do: | + | |
| - | wget http:// | + | |
| | | ||