Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 5 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions PenTestingComms/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,4 @@ framework = arduino
lib_deps =
Wire
SPI
adafruit/RTClib
adafruit/Adafruit ADT7410 Library
adafruit/Adafruit BusIO
adafruit/Adafruit Unified Sensor
bblanchon/ArduinoJson@^6.21.3
adafruit/Adafruit ST7735 and ST7789 Library
adafruit/Adafruit seesaw Library
adafruit/Adafruit SSD1306
adafruit/Adafruit Motor Shield V2 Library
adafruit/Adafruit GFX Library
madhephaestus/ESP32Servo@^1.1.0
89 changes: 83 additions & 6 deletions PenTestingComms/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,98 @@
#include <Arduino.h>
#include "WiFi.h"
#include <HTTPClient.h>
#include "sensitiveInformation.h"
#include <SPI.h>

void sendData(String encryptedData)
/*
This function returns the server response from the HTTP POST request.

The encryptedData String is uploaded to the internal server - http://192.168.1.10/2023/JEDI2023/dataTransfer.php
The dataTransfer.php file, stores the data into the MySQL server on the same machine, into the JEDI2023 database in the moduleData table.

@params String encryptedData: The data to upload to the server.
*/
{


String serverResponse;
if (WiFi.status() == WL_CONNECTED)
{
WiFiClient client;
HTTPClient http;

// Your Domain name with URL path or IP address with path
http.begin(client, serverURL);

// Specify content-type header
http.addHeader("Content-Type", "application/x-www-form-urlencoded");

// Send HTTP POST request, and store response code
http.addHeader("Content-Type", "application/json");
String postJSONString = "{\"api_key\":\"" + apiKeyValue + "\",\"userName\":\"" + userName + "\",\"moduleName\":\"" + moduleName + "\",\"moduleData\":\"" + encryptedData + "\"}";
Serial.print("Debug JSON String: ");
Serial.println(postJSONString);
int httpResponseCode = http.POST(postJSONString);

// Get the HTML response from the server.
serverResponse = http.getString();

if (httpResponseCode > 0)
{
Serial.print("HTTP Response code: ");
Serial.println(httpResponseCode);
}
else
{
Serial.print("Error code: ");
Serial.println(httpResponseCode);
}

// Free resources
http.end();
}
else
{
Serial.println("WiFi Disconnected");
}
// Send an HTTP POST request every 30 seconds

void sendData(){
Serial.println("Encrypt some data");
}

void connectToWifi() {
while (!Serial)
{
delay(10);
}
delay(1000);
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED)
{
delay(1000);
Serial.println("Connecting to WiFi..");
}
Serial.println();
Serial.print("Connected to the Internet");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}

void setup()
{
// put your setup code here, to run once:
pinMode(13, OUTPUT);
Serial.begin(9600);
Serial.println("Hello World");

// Connect to Wifi
connectToWifi();
}

void loop()
{
// put your main code here, to run repeatedly:
sendData();
sendData("uggc://192.168.1.13/elnafqnexargfvgr");

// waits 10 seconds before starting the loop again
delay(10000);
delay(1000);
}
22 changes: 22 additions & 0 deletions PenTestingComms/src/sensitiveInformation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Contains any sensitive Information that you do not want published to Github.
*
* The SSID and Password variables will need to be changed if you’re connecting to another Wireless Access Point (such as at home). * The SSID and Password variables will need to be changed if you’re connecting to another Wireless Access Point (such as at home).

* The `http_username` and `http_password` variables are used to authenticate when users are attempting to access secured pages.
*
* Make sure this file is included in the .gitignore!
*/

const char* host = "Encrypted-data";
const char* ssid = "CyberRange"; // Wifi Network Name
const char* password = "CyberRange"; // Wifi Password



const char* serverURL = "http://192.168.1.10/2023/JEDI2023/dataTransfer.php";
const char* eventLogURL = "http://192.168.1.10/2023/JEDI2023/eventLog.php";

const String apiKeyValue = "cyber2024S1-Ryan";
const String moduleName = "cyber2024S1-Ryan";
const String userName = "Ryan Cather";
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[![Open in Visual Studio Code](https://classroom.github.com/assets/open-in-vscode-718a45dd9cf7e7f842a935f5ebbe5719a5e09af4491e668f4dbf3b35d5cca122.svg)](https://classroom.github.com/online_ide?assignment_repo_id=14344078&assignment_repo_type=AssignmentRepo)
# PenTesting