You've already forked hackingtool
mirror of
https://github.com/Z4nzu/hackingtool.git
synced 2025-06-20 06:15:54 +02:00
Do not use bare except:
Do not use bare `except:`, it also catches unexpected events like memory errors, interrupts, system exit, and so on. Prefer `except Exception:`. If you're sure what you're doing, be explicit and write `except BaseException:`.
This commit is contained in:
18
core.py
18
core.py
@ -11,21 +11,18 @@ from typing import Tuple
|
|||||||
|
|
||||||
|
|
||||||
def clear_screen():
|
def clear_screen():
|
||||||
if system() == "Linux":
|
os.system("cls" if system() == "Windows" else "clear")
|
||||||
os.system("clear")
|
|
||||||
if system() == "Windows":
|
|
||||||
os.system("cls")
|
|
||||||
|
|
||||||
|
|
||||||
def validate_input(ip, val_range):
|
def validate_input(ip, val_range):
|
||||||
|
val_range = val_range or []
|
||||||
try:
|
try:
|
||||||
ip = int(ip)
|
ip = int(ip)
|
||||||
if ip in val_range:
|
if ip in val_range:
|
||||||
return ip
|
return ip
|
||||||
else:
|
except Exception:
|
||||||
return None
|
pass
|
||||||
except:
|
return None
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
class HackingTool(object):
|
class HackingTool(object):
|
||||||
@ -46,8 +43,7 @@ class HackingTool(object):
|
|||||||
|
|
||||||
def __init__(self, options = None, installable: bool = True,
|
def __init__(self, options = None, installable: bool = True,
|
||||||
runnable: bool = True):
|
runnable: bool = True):
|
||||||
if options is None:
|
options = options or []
|
||||||
options = []
|
|
||||||
if isinstance(options, list):
|
if isinstance(options, list):
|
||||||
self.OPTIONS = []
|
self.OPTIONS = []
|
||||||
if installable:
|
if installable:
|
||||||
@ -176,7 +172,7 @@ class HackingToolsCollection(object):
|
|||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
print("Please enter a valid option")
|
print("Please enter a valid option")
|
||||||
input("\n\nPress ENTER to continue:")
|
input("\n\nPress ENTER to continue:")
|
||||||
except Exception as e:
|
except Exception:
|
||||||
print_exc()
|
print_exc()
|
||||||
input("\n\nPress ENTER to continue:")
|
input("\n\nPress ENTER to continue:")
|
||||||
return self.show_options(parent = parent)
|
return self.show_options(parent = parent)
|
||||||
|
Reference in New Issue
Block a user