mirror of
https://github.com/k4m4/kickthemout.git
synced 2024-11-29 16:34:23 +01:00
NETFLAG added for user in no connection wlan
This commit is contained in:
parent
2e557699d6
commit
a1c9b3467c
@ -10,6 +10,11 @@ See License at nikolaskama.me (https://nikolaskama.me/kickthemoutproject)
|
|||||||
import os, sys, logging, math, traceback, optparse, threading
|
import os, sys, logging, math, traceback, optparse, threading
|
||||||
from time import sleep
|
from time import sleep
|
||||||
BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m'
|
BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m'
|
||||||
|
NETFLAG=0
|
||||||
|
|
||||||
|
#NETFLAG=0 User have no access to internet
|
||||||
|
#NETFLAG=1 User have access to internet
|
||||||
|
#NETFLAG=2 User have no access to internet and choose to skip checkInternetConnection
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# check whether user is root
|
# check whether user is root
|
||||||
@ -125,13 +130,16 @@ def runDebug():
|
|||||||
|
|
||||||
# try skip checkInternetConnection
|
# try skip checkInternetConnection
|
||||||
def trySkipCheckInternetConnection():
|
def trySkipCheckInternetConnection():
|
||||||
|
global NETFLAG
|
||||||
try:
|
try:
|
||||||
print("\n{}ERROR: It seems you have no access to internet, skip checking connection ?{}\n".format(RED, END))
|
print("\n{}ERROR: It seems you have no access to internet, skip checking connection ?{}\n".format(RED, END))
|
||||||
header = ('{}kickthemout{}> {}(y/n): '.format(BLUE, WHITE, RED, END))
|
header = ('{}kickthemout{}> {}(y/n): '.format(BLUE, WHITE, RED, END))
|
||||||
ans=input(header)
|
ans=input(header)
|
||||||
if ans == "y":
|
if ans == "y":
|
||||||
|
NETFLAG=2
|
||||||
return True
|
return True
|
||||||
elif ans == "n":
|
elif ans == "n":
|
||||||
|
NETFLAG=0
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
print("\n{}Invalid input.{}".format(RED, END))
|
print("\n{}Invalid input.{}".format(RED, END))
|
||||||
@ -143,8 +151,10 @@ def trySkipCheckInternetConnection():
|
|||||||
|
|
||||||
# make sure there is an internet connection
|
# make sure there is an internet connection
|
||||||
def checkInternetConnection():
|
def checkInternetConnection():
|
||||||
|
global NETFLAG
|
||||||
try:
|
try:
|
||||||
urlopen('https://github.com', timeout=3)
|
urlopen('https://github.com', timeout=3)
|
||||||
|
NETFLAG=1
|
||||||
return True
|
return True
|
||||||
except URLError as err:
|
except URLError as err:
|
||||||
trySkipCheckInternetConnection()
|
trySkipCheckInternetConnection()
|
||||||
@ -228,6 +238,8 @@ def retrieveMACAddress(host):
|
|||||||
|
|
||||||
# resolve mac address of each vendor
|
# resolve mac address of each vendor
|
||||||
def resolveMac(mac):
|
def resolveMac(mac):
|
||||||
|
global NETFLAG
|
||||||
|
if NETFLAG == 1:
|
||||||
try:
|
try:
|
||||||
# send request to macvendors.co
|
# send request to macvendors.co
|
||||||
url = "http://macvendors.co/api/vendorname/"
|
url = "http://macvendors.co/api/vendorname/"
|
||||||
@ -241,6 +253,8 @@ def resolveMac(mac):
|
|||||||
shutdown()
|
shutdown()
|
||||||
except:
|
except:
|
||||||
return "N/A"
|
return "N/A"
|
||||||
|
elif NETFLAG == 2:
|
||||||
|
return "N/A"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user