It Is Possible To Create Wifi Splash Page Using Python ???
When Someone Connect My WIFI Automatically Load My HTML Page to connected device
AnyOne Have An Idea Please Answer
-
do you want open page in browser after someone connect your WIFI? what is your host OS?Daniil Loban– Daniil Loban2021-02-05 06:15:04 +00:00Commented Feb 5, 2021 at 6:15
-
Your access point has to support a captive portal.Klaus D.– Klaus D.2021-02-05 06:38:44 +00:00Commented Feb 5, 2021 at 6:38
-
I Using Windows OS , Router - TPlinkKrisHnA– KrisHnA2021-02-05 06:41:37 +00:00Commented Feb 5, 2021 at 6:41
Add a comment
|
1 Answer
In linux you need install Nmap ("Network Mapper"):
sudo apt install nmap
and
pip3 install who-is-on-my-wifi
This code scans and write html than open it, you can make it with if conditions and while:
import who_is_on_my_wifi
import subprocess, sys
WHO = who_is_on_my_wifi.who()
body = ''
for i in range(0, len(WHO)):
body += '<p>' + ' '.join(WHO[i]) + '</p>\n'
page = f'''<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
{body}
</body>
</html>'''
with open("connections.html", "w") as write_file:
write_file.write(page)
# opener ="open" if sys.platform == "darwin" else "xdg-open"
# break with sudo: subprocess.call([opener, 'connections.html'])
subprocess.call(['sudo', '-u', 'daniil', 'xdg-open', 'wifi.html'])
When you run without sudo it shows only your IP :(
sudo python3 wifi.py
on browser you can see:
4 Comments
KrisHnA
Thank You For Your Answer But How Can I Run it on windows ??
Daniil Loban
read this for installation nmap.org/book/inst-windows.html and run sript as administator
Daniil Loban
for open page os.startfile('connections.html') read stackoverflow.com/questions/17317219/…
KrisHnA
DHCP Hijacking Is Posible Or Not Using Python
