Fix #286 - URLError handling

This commit is contained in:
k4m4 2018-04-25 17:15:59 +03:00
parent e680a9baa7
commit 8202c984c5
No known key found for this signature in database
GPG Key ID: A85C514862FA7B26
2 changed files with 10 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -27,11 +27,17 @@ def shutdown():
logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up scapy!
try:
from scapy.config import conf
conf.ipv6_enabled = False
from scapy.all import *
try:
from scapy.config import conf
conf.ipv6_enabled = False
from scapy.all import *
except:
from scapy3k.config import conf
conf.ipv6_enabled = False
from scapy3k.all import *
import scan, spoof, nmap
from urllib.request import urlopen, Request
from urllib.error import URLError
except KeyboardInterrupt:
shutdown()
except:
@ -128,7 +134,7 @@ def checkInternetConnection():
try:
urlopen('https://google.com', timeout=3)
return True
except urllib.URLError as err:
except URLError as err:
return False
except KeyboardInterrupt:
shutdown()