Mypy fixes

pull/11/head
Thorsten Sick 3 years ago
parent 11206f6aee
commit 474a2ea185

@ -16,4 +16,7 @@ shipit: test
# More detailed pylint tests.
pylint:
pylint --rcfile=pylint.rc *.py app/*.py plugins/base/*.py
pylint --rcfile=pylint.rc *.py app/*.py plugins/base/*.py
mypy:
mypy app/

@ -178,12 +178,12 @@ class ExperimentConfig():
for attacker in self.raw_config["attackers"]:
self._attackers.append(MachineConfig(self.raw_config["attackers"][attacker]))
def targets(self) -> [MachineConfig]:
def targets(self) -> list[MachineConfig]:
""" Return config for targets as MachineConfig objects """
return self._targets
def attackers(self) -> [MachineConfig]:
def attackers(self) -> list[MachineConfig]:
""" Return config for attackers as MachineConfig objects """
return self._attackers

@ -212,7 +212,7 @@ class Machine():
plugin.install()
self.attack_logger.vprint(f"{CommandlineColors.OKGREEN}Installed sensor: {name}{CommandlineColors.ENDC}", 2)
def get_sensors(self) -> [SensorPlugin]:
def get_sensors(self) -> list[SensorPlugin]:
""" Returns a list of running sensors """
return self.sensors
@ -307,7 +307,7 @@ class Machine():
plugin.install(self.vm_manager)
# self.vulnerabilities.append(plugin)
def get_vulnerabilities(self) -> [VulnerabilityPlugin]:
def get_vulnerabilities(self) -> list[VulnerabilityPlugin]:
""" Returns a list of installed vulnerabilities """
return self.vulnerabilities

@ -147,7 +147,7 @@ class Metasploit():
retries -= 1
raise MetasploitError(f"Could not find session for {target.get_ip()} Name resolution worked: {name_resolution_worked}")
def meterpreter_execute(self, cmds: [str], session_number: int, delay=0) -> str:
def meterpreter_execute(self, cmds: list[str], session_number: int, delay=0) -> list[str]:
""" Executes commands on the meterpreter, returns results read from shell
@param cmds: commands to execute, a list
@ -164,7 +164,7 @@ class Metasploit():
res.append(shell.read())
return res
def meterpreter_execute_on(self, cmds: [str], target, delay=0) -> str:
def meterpreter_execute_on(self, cmds: list[str], target, delay=0) -> list[str]:
""" Executes commands on the meterpreter, returns results read from shell
@param cmds: commands to execute, a list

@ -35,7 +35,7 @@ class PluginManager():
self.base = "plugins/**/*.py"
self.attack_logger = attack_logger
def get_plugins(self, subclass, name_filter=None) -> [BasePlugin]:
def get_plugins(self, subclass, name_filter=None) -> list[BasePlugin]:
""" Returns a list plugins matching specified criteria
@ -46,7 +46,7 @@ class PluginManager():
res = []
def get_handlers(a_plugin) -> [subclass]:
def get_handlers(a_plugin):
return a_plugin.produce()
plugin_dirs = set()

@ -13,3 +13,9 @@ sphinxcontrib.asciinema==0.3.2
paramiko==2.7.2
pymetasploit3==1.0.3
pylint
# Mypy stuff
mypy
types-PyYAML
types-requests
types-simplejson
Loading…
Cancel
Save