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