0%

极路由开启SSH并按照python笔记

前言

极路由在现在的版本中并不支持telnet连接,在网上还是找到getshell这个路由器的方法。再此复现,并作笔记。

前期准备

  • 路由器需SDcare

  • 安装 定时重拨插件(sid=118284854)

  • 安装vsftpd插件(sid=770934750)

过程

开启ssh

  • 将以下脚本保存为test.sh,放置在ftp://hiwifi.com/目录下,该目录是SD卡并被挂载在/tmp/storage下,vsftpd插件定义目录也在/tmp/storage即可
#!/bin/bash

# 启动SSH并设置自动启动
sed -i 's/1022/22/g' /etc/config/dropbear 
/etc/init.d/dropbear enable
/etc/init.d/dropbear start

img

  • 设置定时重拨规则:* * * * * sh /tmp/storage/test.sh

img

  • 启动等待一分钟即可直接ssh连接上路由器账号为root,密码为后台密码。

img

安装python和pip

  • 设置opkg源,/etc/opkg.conf设置为如下内容,其中第五行,dest usb +SD卡的地址,也就是/tmp/storage/soft
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay

dest usb /tmp/storage/soft 

arch all 100
arch ramips_24kec 200
arch ramips 300
arch mips 400
arch unkown 500


src/gz barrier_breaker_base http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/base
src/gz barrier_breaker_luci http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/luci
src/gz barrier_breaker_management http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/management
src/gz barrier_breaker_oldpackages http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/oldpackages
src/gz barrier_breaker_packages http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/packages
src/gz barrier_breaker_routing http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/routing
src/gz barrier_breaker_telephony http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/telephony
  • 安装过程
opkg update

wget http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/base/libc_0.9.33.2-1_ramips_24kec.ipk

opkg -d usb install libc_0.9.33.2-1_ramips_24kec.ipk

opkg -d usb install libreadline
opkg  -d usb install python
opkg -d usb install python-json
opkg -d usb install python-curl
opkg -d usb install python-openssl
  • 设置环境变量,也是加上python安装目录
export PATH=$PATH:/tmp/storage/soft/usr/bin 
  • 安装pip
wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py  

python get-pip.py