Noah Magill
Published © GPL3+

Hacker Detector

A small device that uses the MAX32620FTHR to detect hackers over a WiFi network.

IntermediateFull instructions provided1 hour5,230

Things used in this project

Hardware components

MAX32620FTHR
Maxim Integrated MAX32620FTHR
×1
ESP8266 ESP-01
Espressif ESP8266 ESP-01
×1
Female/Female Jumper Wires
Female/Female Jumper Wires
×1
0.96 Inch Yellow Blue I2c IIC Serial Oled LCD LED Module 12864 128X64
×1
Solder (Generic)
×1
Tape (Generic)
×1
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Scissors (Generic)
Ruler (Generic)

Story

Read more

Custom parts and enclosures

The Lid

This is the lid used to go on top of the box. Please feel free to adjust the size of the lid dependent on how tight you would want it to fit.

The Box

This is the box that is used to store all the componets inside

Schematics

Final Diagram

Final diagram for the circuitry in this project.

Code

WIFICA.ino

Arduino
This is the script to be uploaded onto the ESP8266 Module
#include <ESP8266WiFi.h>

//analog out port 
#define APORT  0

struct Wifi {
   String  ssid;
   String  password;
};




//different hosts and SHA-1 keys from the certificate
const char* host = "appleid.apple.com";
const char* fingerprint = "C1 A0 0F CE D7 5B C3 56 A2 1C 86 21 0A C1 4C BD 9A FE AA 85";

const char* host2 = "www.snapchat.com";
const char* fingerprint2 = "49 73 A3 46 FC B6 14 3B 02 6C 70 6E 8A 26 92 CB 54 9A E7 D3";

const char* host3 = "www.instagram.com";
const char* fingerprint3 = "92 D1 B5 7C AE 6F 88 3F 62 E0 E8 C8 A5 EC 5C AF E2 D0 FF 37";

const char* host4 = "www.ebay.com";
const char* fingerprint4 = "F6 AC 99 99 F8 69 EB 25 91 6C F3 66 5A 1F AB 34 1B 39 F0 CE";

//stores if hacker is detected
bool appleHacker = false;
bool snapchatHacker = false;
bool instagramHacker = false; 
bool ebayHacker = false; 

void setup() {
  Serial.begin(115200);
  delay(10);

  pinMode(LED_BUILTIN, OUTPUT);


  //to add wifis, create a struct and add a ssid and password
  

  // add your struct to the array
  struct Wifi wifis[10];


  //example wifi:
  
  struct Wifi house;
  house.ssid ="houseMain";
  house.password = "1234567890";
  

  wifis[0] = house; 




  //Connect to a WiFi network
  Serial.println();
  Serial.println();
  
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();

  delay(1000);

//scans networks in the area
  int n = WiFi.scanNetworks();
  Serial.print(n);
  Serial.println(" network(s) found");
       char ssid[20] = "";
      char password[20] =  ""; 

  for (int i = 0; i < n; i++)
  {
    Serial.println(WiFi.SSID(i));
     for (int w = 0; w < n; w++){
      if(wifis[w].ssid == WiFi.SSID(i)){
      wifis[w].ssid.toCharArray(ssid, 20);
       Serial.println(ssid);

      wifis[w].password.toCharArray(password, 20); 
      break;
      }
      
     }

  
  }
  Serial.println();
if(ssid != ""){
 WiFi.begin(ssid, password);  }

  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());


}
//integers for counting the amount of times the connection fail via https
//up to 
int countApple = 0;
int countSnap = 0;
int countInstagram = 0;
int countEbay = 0;

void loop() {
  delay(5000);
  
  if(countApple == 0){
  apple();
  }
  if(countSnap == 0){
  snapchat();
  }
  if(countInstagram == 0){
  instagram();
  }
  if(countEbay == 0){
  ebay();
  }
  /*After running the above checks, if a hacker has been detected, 
  the appropriate function gets run*/
 
  hackerDetected();  
  


}

void apple(){
  //Connects to a client via the host 
  WiFiClientSecure client;
Serial.print("connecting to ");
Serial.println(host);
delay(2000);
if (!client.connect(host, 443)) {
  Serial.println("connection failed for appleid.apple.com");
 //allows the connection to try and reconnect 4 times before assuming that there is a problem with the HTTPS port
 if(countApple == 3){
  Serial.println("No HTTPS port, hacker may be trying to force you to use HTTP!");
    
    appleHacker = true;
 }else{
   countApple = countApple + 1;
   apple();
  }
}else{
  //checks the certificate 
  if (client.verify(fingerprint, host)) {
  Serial.println("certificate matches for appleid.apple.com");
  client.flush();
  client.stop();
} else {
  
  client.flush();
  client.stop();
  Serial.println("certificate doesn't match for appleid.apple.com! Hacker dectected");

    
    appleHacker = true;


}
}
}

void snapchat(){
  
  WiFiClientSecure client;
Serial.print("connecting to ");
Serial.println(host2);
delay(2000);
if (!client.connect(host2, 443)) {
  Serial.println("connection failed for accounts.snapchat.com");
 if(countSnap == 3){
  Serial.println("No HTTPS port, hacker may be trying to force you to use HTTP!");
    
    snapchatHacker = true;
 }else{
   countSnap = countSnap + 1;
   snapchat();
  }
}else{
  
  if (client.verify(fingerprint2, host2)) {
  Serial.println("certificate matches for snapchat.com");
  client.flush();
  client.stop();
} else {
  Serial.println("certificate doesn't match for snapchat.com! Hacker dectected");
  client.flush();
  client.stop();

    
    snapchatHacker = true;

}
}
}
void instagram(){
  
  WiFiClientSecure client;
Serial.print("connecting to ");
Serial.println(host3);
delay(2000);
if (!client.connect(host3, 443)) {
  Serial.println("connection failed for instagram.com");
 if(countInstagram == 3){
  Serial.println("No HTTPS port, hacker may be trying to force you to use HTTP!");
    instagramHacker = true;
 }else{
   countInstagram = countInstagram + 1;
   instagram();
  }
}else{
  
  if (client.verify(fingerprint3, host3)) {
  Serial.println("certificate matches for instagram.com");
  client.flush();
  client.stop();
} else {
  Serial.println("certificate doesn't match for instagram.com! Hacker dectected");
  client.flush();
  client.stop();
    
    instagramHacker = true;


    
}
}
}

void ebay(){
  
  WiFiClientSecure client;
Serial.print("connecting to ");
Serial.println(host4);
delay(2000);
if (!client.connect(host4, 443)) {
  Serial.println("connection failed for ebay.com");
 if(countInstagram == 3){
  Serial.println("No HTTPS port, hacker may be trying to force you to use HTTP!");
    ebayHacker = true;
 }else{
   countEbay = countEbay + 1;
   ebay();
  }
}else{
  
  if (client.verify(fingerprint4, host4)) {
  Serial.println("certificate matches for ebay.com");
  client.flush();
  client.stop();
} else {
  Serial.println("certificate doesn't match for ebay.com! Hacker dectected");
  client.flush();
  client.stop();

    
    ebayHacker = true;

}
}
}
//writes analog out if a hacker is detected 
bool analog = false;
void hackerDetected(){

  pinMode(2, OUTPUT);
  pinMode(0,OUTPUT);

  if(appleHacker){
  digitalWrite(2, HIGH);
  analog = true;
  } 
  if(snapchatHacker){
    if(!analog){
  digitalWrite(2, HIGH);
  analog = true;
  }
  }
  if(instagramHacker){
 
  if(!analog){
  digitalWrite(2, HIGH);
  analog = true;
}
 }
 if(ebayHacker){
  if(!analog){
 
  digitalWrite(2, HIGH);  
  analog = true;
} 
 }
 if(!analog){
 digitalWrite(2, LOW);
 digitalWrite(0, HIGH);

 }

delay(5000);

//resets all values
countApple = 0;
countSnap = 0;
countInstagram = 0;
countEbay = 0;
analog = false;
appleHacker = false; 
snapchatHacker = false;
instagramHacker = false; 
ebayHacker = false; 
digitalWrite(0, LOW);
digitalWrite(2, LOW);
digitalWrite(LED_BUILTIN, LOW);
}

  

MAXIM.ino

Arduino
This is the script to be uploaded onto the ESP8266 Module
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <MAX77650-Arduino-Library.h>
//
////Definitions
//
#define MAX77650_PHLD P2_2   //Pin 18 -> connected to MAX77650 power hold input pin (A1)
#define MAX77650_IRQpin P2_3 //Pin 19 -> connected to MAX77650 IRQ output pin (C2)

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
#define POWER 256

#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define I2C_7BITADDR 8 // DS1307


#define LOGO16_GLCD_HEIGHT 16 
#define LOGO16_GLCD_WIDTH  16 
static const unsigned char PROGMEM logo16_glcd_bmp[] =
{ B00000000, B11000000,
  B00000001, B11000000,
  B00000001, B11000000,
  B00000011, B11100000,
  B11110011, B11100000,
  B11111110, B11111000,
  B01111110, B11111111,
  B00110011, B10011111,
  B00011111, B11111100,
  B00001101, B01110000,
  B00011011, B10100000,
  B00111111, B11100000,
  B00111111, B11110000,
  B01111100, B11110000,
  B01110000, B01110000,
  B00000000, B00110000 };

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

void setup() {
delay(1000);
Serial.begin(9600);

  //batery configuration
  pinMode(MAX77650_PHLD, OUTPUT);          
  digitalWrite(MAX77650_PHLD, HIGH);     

   MAX77650_init();
  MAX77650_setCHG_EN(true);

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3D (for the 128x64)
  
  // Adafruit splashscreen
  display.display();
  delay(2000);

  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.setTextSize(2);
  display.println("Scanning");
  display.display();
  delay(100);
  
}



void loop() {
//detects if a hacker is or is not there via analog input 
int volt1 = analogRead(A0);
int volt2 = analogRead(A1);

int count1 = 0;
 
if(volt1 > 500){
//displays hacker is detected
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.setTextSize(2);
  display.println("Hacker Detected");
  display.display(); 
  delay(5000);
 
}
if(volt2 > 500){
//displays hacker isn't detected
display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.setTextSize(2);
  display.println("No Hackers Detected");
  display.display(); 
  delay(5000);
  

}
}

Credits

Noah Magill

Noah Magill

2 projects • 2 followers

Comments