How to Safely Use Public Wi-Fi Networks with python implementation:-

Prateek Kumar Gupta
5 min readMar 28, 2023

--

Public Wi-Fi organizations can be extraordinarily helpful when you’re all over town. They permit you to interface with the web from cafes, air terminals, libraries, and other public spots without spending your portable information. Notwithstanding, public Wi-Fi organizations can likewise be risky. Without legitimate precautionary measures, your own data could be caught by cybercriminals. In this blog entry, we’ll go north of six key advances you can take to securely utilize public Wi-Fi organizations.

Utilize a VPN
One of the most incredible ways of safeguarding yourself while utilizing public Wi-Fi networks is to utilize a virtual Private Network(VPN). A VPN encodes your web association and conceals your IP address, making it challenging for anybody to catch your information. There are numerous VPN administrations accessible, both paid and free. A few well known choices incorporate NordVPN, ExpressVPN, and TunnelBear.

Try not to Access Delicate Data
While utilizing public Wi-Fi organizations, it’s ideal to try not to get to delicate data like your ledger, web-based entertainment accounts, or whatever other records that contain individual data. On the off chance that you should get to these records, try to do so just on a protected site with a HTTPS address.

Empower Two-Component Verification
Empowering two-factor confirmation on your records can add an additional layer of safety. Two-factor verification expects you to enter a code shipped off your telephone or email notwithstanding your secret phrase. This makes it substantially more hard for cybercriminals to get to your records regardless of whether they have your secret word.

Update Your Product
Staying up with the latest can assist with safeguarding you from digital dangers. Programmers frequently exploit weaknesses in obsolete programming to get close enough to your gadget. Make a point to consistently refresh your working framework, applications, and antivirus programming.

Switch Off Programmed Wi-Fi Associations
Your gadget may consequently interface with public Wi-Fi networks that it has recently utilized. This can be helpful, yet it can likewise be hazardous. Switch off programmed Wi-Fi associations in your gadget settings to try not to unintentionally associate with an unstable organization.

Utilize a Firewall
A firewall can assist with obstructing unapproved admittance to your gadget while you’re utilizing a public Wi-Fi organization. Most working frameworks accompany an underlying firewall, however you can likewise introduce an outsider firewall for additional security.

“The biggest cybersecurity threat to an organization is its people not being aware of the risks.” — Kevin Mitnick

All in all, by following these six stages and utilizing a VPN, you can safeguard your own data while utilizing public Wi-Fi organizations. Make sure to continuously be wary while utilizing public Wi-Fi, and try not to get to delicate data if conceivable. Remain protected out there!

import requests

# Define a function to check if a website uses HTTPS
def is_https(url):
try:
response = requests.head(url)
return response.status_code == 200 and response.url.startswith(“https”)
except:
return False

# Prompt the user to enter a website URL
url = input(“Enter a website URL: “)

# Check if the website uses HTTPS
if is_https(url):
print(“This website uses HTTPS and is secure.”)
else:
print(“Warning: This website does not use HTTPS and may not be secure.”)

This script defines a function called is_https that checks if a given website uses HTTPS. HTTPS is a secure version of HTTP that encrypts data sent between your device and the website. When you access a website over a public Wi-Fi network, it's important to make sure that the website uses HTTPS to protect your personal information.

The script prompts the user to enter a website URL and then calls the is_https function to check if the website uses HTTPS. If the website uses HTTPS, the script prints a message saying that it's secure. If the website doesn't use HTTPS, the script prints a warning message.

You can use this script to quickly check if a website is secure before logging in or entering any personal information while using public Wi-Fi networks.

import subprocess
import time

while True:
output = subprocess.check_output(“netsh interface show interface Wi-Fi”, shell=True)
if b”Disconnected” not in output:
time.sleep(300) # wait 5 minutes before checking again
continue

# Wi-Fi is disconnected, turn off Wi-Fi
subprocess.call(“netsh interface set interface Wi-Fi admin=disable”, shell=True)
time.sleep(300) # wait 5 minutes before checking again

Here’s an example of a Python script you could use to automatically turn off your device’s Wi-Fi when you’re not using it, helping to keep you safe while using public Wi-Fi networks. This script uses the netsh command to check if your device’s Wi-Fi is disconnected. If it’s not disconnected, the script waits for five minutes before checking again. If the Wi-Fi is disconnected, the script disables it and waits another five minutes before checking again. You can modify the script to run automatically when your device starts up, or you can run it manually whenever you’re using a public Wi-Fi network.

--

--

Prateek Kumar Gupta
Prateek Kumar Gupta

Written by Prateek Kumar Gupta

A proactive B.Tech Information Technology student at the Sharda University. Possess with cybersecurity, IT, leadership and writing skills.