Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from Pwnagotchi-Unofficial/development
Browse files Browse the repository at this point in the history
library switching
  • Loading branch information
dj1ch committed Apr 9, 2024
2 parents dc5f1a2 + 424ec68 commit a7e0f91
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 13 deletions.
12 changes: 9 additions & 3 deletions minigotchi/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void Channel::init(int initChannel) {

// switch channel
Minigotchi::monStop();
wifi_set_channel(initChannel);
esp_wifi_set_channel(initChannel, WIFI_SECOND_CHAN_NONE);
Minigotchi::monStart();

if (initChannel == getChannel()) {
Expand Down Expand Up @@ -61,7 +61,7 @@ void Channel::switchC(int newChannel) {

// monitor this one channel
Minigotchi::monStop();
wifi_set_channel(newChannel);
esp_wifi_set_channel(newChannel, WIFI_SECOND_CHAN_NONE);
Minigotchi::monStart();

// switched channel
Expand All @@ -72,7 +72,13 @@ void Channel::switchC(int newChannel) {
}

int Channel::getChannel() {
return wifi_get_channel();
wifi_country_t country;
memset(&country, 0, sizeof(country));
esp_wifi_get_country(&country);

wifi_promiscuous_channel_info_t info;
esp_wifi_get_channel(&info);
return info.primary;
}

int Channel::list() {
Expand Down
3 changes: 2 additions & 1 deletion minigotchi/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

#include "minigotchi.h"
#include "config.h"
#include <ESP8266WiFi.h>
#include <WiFi.h>
#include <esp_wifi.h>

class Channel {
public:
Expand Down
2 changes: 1 addition & 1 deletion minigotchi/deauth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void Deauth::start() {

// send the deauth 150 times(ur cooked if they find out)
for (int i = 0; i < 150; ++i) {
wifi_send_pkt_freedom(const_cast<uint8_t*>(deauthFrame), frameSize, 0);
WiFi.rawPacket(deauthFrame, sizeof(deauthFrame));
Serial.println("(>-<) Sent Deauth Frame!");
delay(100);
}
Expand Down
3 changes: 2 additions & 1 deletion minigotchi/deauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#include <vector>
#include <string>
#include <sstream>
#include <ESP8266WiFi.h>
#include <WiFi.h>
#include <esp_wifi.h>

class Deauth {
public:
Expand Down
2 changes: 1 addition & 1 deletion minigotchi/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ void Frame::send() {

// send full frame
// we dont use raw80211 since it sends a header(which we don't need), although we do use it for monitoring, etc.
wifi_send_pkt_freedom(beaconFrame.data(), frameSize, 0);
WiFi.rawPacket(beaconFrame.data(), frameSize);
}


Expand Down
4 changes: 2 additions & 2 deletions minigotchi/frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <sstream>
#include <vector>
#include <string>
#include <user_interface.h>
#include <ESP8266WiFi.h>
#include <WiFi.h>
#include <esp_wifi.h>

class Frame {
public:
Expand Down
4 changes: 2 additions & 2 deletions minigotchi/minigotchi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ void Minigotchi::cpu() {
*/

void Minigotchi::monStart() {
wifi_promiscuous_enable(1);
esp_wifi_set_promiscuous(true);
}

void Minigotchi::monStop() {
wifi_promiscuous_enable(0);
esp_wifi_set_promiscuous(false);
}

/** developer note:
Expand Down
3 changes: 2 additions & 1 deletion minigotchi/minigotchi.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#include "channel.h"
#include "config.h"
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <WiFi.h>
#include <esp_wifi.h>

class Minigotchi {
public:
Expand Down
3 changes: 2 additions & 1 deletion minigotchi/pwnagotchi.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

#include "frame.h"
#include <ArduinoJson.h>
#include <ESP8266WiFi.h>
#include <WiFi.h>
#include <esp_wifi.h>
#include <Arduino.h>
#include <stdint.h>
#include <string>
Expand Down

0 comments on commit a7e0f91

Please sign in to comment.