Merge pull request #894 from withshubh/develop

Fix code quality issues
This commit is contained in:
VakarisZ 2020-12-16 12:19:37 +02:00 committed by GitHub
commit e6bb978dc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 7 deletions

View File

@ -228,7 +228,6 @@ class ShellShockExploiter(HostExploiter):
Checks if which urls exist
:return: Sequence of URLs to try and attack
"""
import requests
attack_path = 'http://'
if is_https:
attack_path = 'https://'

View File

@ -56,7 +56,7 @@ class WebRCE(HostExploiter):
Method that creates a dictionary of configuration values for exploit
:return: configuration dict
"""
exploit_config = dict()
exploit_config = {}
# dropper: If true monkey will use dropper parameter that will detach monkey's process and try to copy
# it's file to the default destination path.

View File

@ -113,7 +113,7 @@ class NetworkScanner(object):
:return: Victim or None if victim isn't alive
"""
LOG.debug("Scanning target address: %r", victim)
if any([scanner.is_host_alive(victim) for scanner in self.scanners]):
if any(scanner.is_host_alive(victim) for scanner in self.scanners):
LOG.debug("Found potential target_ip: %r", victim)
return victim
else:

View File

@ -139,7 +139,7 @@ def check_tcp_ports(ip, ports, timeout=DEFAULT_TIMEOUT, get_banner=False):
timeout = int(round(timeout)) # clamp to integer, to avoid checking input
sockets_to_try = possible_ports[:]
connected_ports_sockets = []
while (timeout >= 0) and len(sockets_to_try):
while (timeout >= 0) and sockets_to_try:
sock_objects = [s[1] for s in sockets_to_try]
_, writeable_sockets, _ = select.select(sock_objects, sock_objects, sock_objects, 0)

View File

@ -67,8 +67,8 @@ def _get_windows_cred(pypykatz_cred: PypykatzCredential):
def _hash_to_string(hash_: Any):
if type(hash_) == str:
if type(hash_) is str:
return hash_
if type(hash_) == bytes:
if type(hash_) is bytes:
return binascii.hexlify(bytearray(hash_)).decode()
raise Exception(f"Can't convert hash_ to string, unsupported hash_ type {type(hash_)}")

View File

@ -1,6 +1,5 @@
from monkey_island.cc.database import mongo
from monkey_island.cc.models import Monkey
from monkey_island.cc.services.edge.edge import EdgeService
from monkey_island.cc.services.node import NodeService
from monkey_island.cc.services.telemetry.processing.utils import \
get_edge_by_scan_or_exploit_telemetry