Skip to content

Commit

Permalink
Added support for ESP32
Browse files Browse the repository at this point in the history
  • Loading branch information
ridercz committed Feb 27, 2019
1 parent 6bf3b75 commit 345722f
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions HoneyESP-SPIFFS/HoneyESP-SPIFFS.ino
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#ifdef ESP8266
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <ESP8266mDNS.h>
#include <FS.h>
#else
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <ESPmDNS.h>
#include <SPIFFS.h>
#endif

#include <DNSServer.h>

#define DNS_PORT 53
#define HTTP_PORT 80
Expand All @@ -20,7 +29,11 @@
#define FILE_WRITE "a"

DNSServer dnsServer;
#ifdef ESP8266
ESP8266WebServer server(HTTP_PORT);
#else
WebServer server(HTTP_PORT);
#endif
int lastClientCount = -1;

void setup() {
Expand All @@ -31,7 +44,7 @@ void setup() {
Serial.begin(9600);
Serial.println();
Serial.println(" _ _ _____ ____ ____");
Serial.println("| | | | ___ _ __ ___ _ _| ____/ ___|| _ \\ ESP8266 honeypot version 1.6");
Serial.println("| | | | ___ _ __ ___ _ _| ____/ ___|| _ \\ ESP8266/ESP32 honeypot version 2.0");
Serial.println("| |_| |/ _ \\| '_ \\ / _ \\ | | | _| \\___ \\| |_) | SPIFFS Version");
Serial.println("| _ | (_) | | | | __/ |_| | |___ ___) | __/ github.com/ridercz/HoneyESP");
Serial.println("|_| |_|\\___/|_| |_|\\___|\\__, |_____|____/|_| (c) 2018-2019 Michal Altair Valasek");
Expand All @@ -49,6 +62,11 @@ void setup() {
}

// Create SSID
#ifdef ESP8266
WiFi.mode(WIFI_AP);
#else
WiFi.mode(WIFI_MODE_AP);
#endif
String ssid = DEFAULT_SSID_PREFIX + WiFi.softAPmacAddress();
if (SPIFFS.exists(FILENAME_SSID)) {
File ssidFile = SPIFFS.open(FILENAME_SSID, FILE_READ);
Expand All @@ -61,6 +79,13 @@ void setup() {
Serial.print(" MAC: "); Serial.println(WiFi.softAPmacAddress());
Serial.print(" Host name: "); Serial.println(HOSTNAME);

// Show HW platform
#ifdef ESP8266
Serial.println(" HW platform: ESP8266");
#else
Serial.println(" HW platform: ESP32");
#endif

// Parse IP address and netmask
IPAddress ip, nm;
ip.fromString(AP_ADDRESS);
Expand Down

0 comments on commit 345722f

Please sign in to comment.