Skip to content

Instantly share code, notes, and snippets.

@iqfareez
Created July 5, 2022 16:21
Show Gist options
  • Save iqfareez/2c684bfd42d96263a3d96bab8251a088 to your computer and use it in GitHub Desktop.
Save iqfareez/2c684bfd42d96263a3d96bab8251a088 to your computer and use it in GitHub Desktop.
Logout from logged in captive portal https://iqfareez.com/blog/hacking-wifi-captive-portal-1
#include <WiFi.h>
#include <Wire.h>
#include <HTTPClient.h>
#define AP_SSID "IIUM-Student"
#define AP_PASSWORD "" // leaves empty if open wifi
const String username = "111111";
const String password = "blahblah";
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// Connecting to the WIFI AP
WiFi.begin(AP_SSID, AP_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.println("Connecting to WiFi..");
}
Serial.println("Connected to the WiFi network");
// Logout from Captive Portal
HTTPClient logout;
logout.begin("https://captiveportalmahallahgombak.iium.edu.my/cgi-bin/login?cmd=logout");
int res = logout.GET();
Serial.println(res);
if (res == 200) {
Serial.println("logged out successfully");
}
logout.end();
}
void loop() {
// put your main code here, to run repeatedly:
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment