Remove unused imports. Removed bad asserts

This commit is contained in:
Daniel Goldberg 2019-11-03 15:03:00 -05:00
parent 029c3bb24d
commit cd716eb1c8
8 changed files with 0 additions and 23 deletions

View File

@ -8,8 +8,6 @@ from requests.exceptions import Timeout, ConnectionError
import infection_monkey.config
import infection_monkey.network.HostFinger
from common.data.network_consts import ES_SERVICE
from infection_monkey.model.host import VictimHost
import infection_monkey.network
ES_PORT = 9200
ES_HTTP_TIMEOUT = 5
@ -32,7 +30,6 @@ class ElasticFinger(infection_monkey.network.HostFinger.HostFinger):
:param host:
:return: Success/failure, data is saved in the host struct
"""
assert isinstance(host, VictimHost)
try:
url = 'http://%s:%s/' % (host.ip_addr, ES_PORT)
with closing(requests.get(url, timeout=ES_HTTP_TIMEOUT)) as req:

View File

@ -1,7 +1,5 @@
import infection_monkey.config
import infection_monkey.network
import infection_monkey.network.HostFinger
from infection_monkey.model.host import VictimHost
import logging
LOG = logging.getLogger(__name__)
@ -22,7 +20,6 @@ class HTTPFinger(infection_monkey.network.HostFinger.HostFinger):
pass
def get_host_fingerprint(self, host):
assert isinstance(host, VictimHost)
from requests import head
from requests.exceptions import Timeout, ConnectionError
from contextlib import closing

View File

@ -3,8 +3,6 @@ import logging
import socket
import infection_monkey.network.HostFinger
from infection_monkey.model.host import VictimHost
import infection_monkey.network
import infection_monkey.config
__author__ = 'Maor Rayzin'
@ -32,7 +30,6 @@ class MSSQLFinger(infection_monkey.network.HostFinger.HostFinger):
Discovered server information written to the Host info struct.
True if success, False otherwise.
"""
assert isinstance(host, VictimHost)
# Create a UDP socket and sets a timeout
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

View File

@ -3,8 +3,6 @@ import socket
import infection_monkey.config
import infection_monkey.network.HostFinger
from infection_monkey.model.host import VictimHost
import infection_monkey.network
from infection_monkey.network.tools import struct_unpack_tracker, struct_unpack_tracker_string
MYSQL_PORT = 3306
@ -29,7 +27,6 @@ class MySQLFinger(infection_monkey.network.HostFinger.HostFinger):
:param host:
:return: Success/failure, data is saved in the host struct
"""
assert isinstance(host, VictimHost)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(self.SOCKET_TIMEOUT)

View File

@ -7,8 +7,6 @@ import sys
import infection_monkey.config
import infection_monkey.network.HostFinger
import infection_monkey.network.HostScanner
from infection_monkey.model.host import VictimHost
import infection_monkey.network
__author__ = 'itamar'
@ -31,7 +29,6 @@ class PingScanner(infection_monkey.network.HostScanner.HostScanner, infection_mo
self._ttl_regex = re.compile(TTL_REGEX_STR, re.IGNORECASE)
def is_host_alive(self, host):
assert isinstance(host, VictimHost)
timeout = self._config.ping_scan_timeout
if not "win32" == sys.platform:
@ -45,7 +42,6 @@ class PingScanner(infection_monkey.network.HostScanner.HostScanner, infection_mo
stderr=self._devnull)
def get_host_fingerprint(self, host):
assert isinstance(host, VictimHost)
timeout = self._config.ping_scan_timeout
if not "win32" == sys.platform:

View File

@ -3,9 +3,7 @@ import struct
import logging
from odict import odict
import infection_monkey.network
import infection_monkey.network.HostFinger
from infection_monkey.model.host import VictimHost
SMB_PORT = 445
SMB_SERVICE = 'tcp-445'
@ -109,7 +107,6 @@ class SMBFinger(infection_monkey.network.HostFinger.HostFinger):
self._config = WormConfiguration
def get_host_fingerprint(self, host):
assert isinstance(host, VictimHost)
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

View File

@ -2,8 +2,6 @@ import re
import infection_monkey.config
import infection_monkey.network.HostFinger
from infection_monkey.model.host import VictimHost
import infection_monkey.network
from infection_monkey.network.tools import check_tcp_port
SSH_PORT = 22
@ -35,7 +33,6 @@ class SSHFinger(infection_monkey.network.HostFinger.HostFinger):
break
def get_host_fingerprint(self, host):
assert isinstance(host, VictimHost)
for name, data in list(host.services.items()):
banner = data.get('banner', '')

View File

@ -2,7 +2,6 @@ from itertools import zip_longest
from random import shuffle
import infection_monkey.config
import infection_monkey.network
import infection_monkey.network.HostFinger
import infection_monkey.network.HostScanner
from infection_monkey.network.tools import check_tcp_ports, tcp_port_to_service