forked from p15670423/monkey
- minor bug fixes
This commit is contained in:
parent
b5b8423df7
commit
35859c1a21
|
@ -101,10 +101,10 @@ class Configuration(object):
|
|||
singleton_mutex_name = "{2384ec59-0df8-4ab9-918c-843740924a28}"
|
||||
|
||||
# how long to wait between scan iterations
|
||||
timeout_between_iterations = 120
|
||||
timeout_between_iterations = 10
|
||||
|
||||
# how many scan iterations to perform on each run
|
||||
max_iterations = 5
|
||||
max_iterations = 3
|
||||
|
||||
scanner_class = TcpScanner
|
||||
finger_classes = (PingScanner, SSHFinger, SMBFinger)
|
||||
|
@ -130,11 +130,11 @@ class Configuration(object):
|
|||
#range_class = RelativeRange
|
||||
range_size = 8
|
||||
range_class = FixedRange
|
||||
range_fixed = ("10.0.0.9", "10.0.0.13", "192.168.1.100", "192.168.1.87")
|
||||
range_fixed = ("10.0.0.9", "10.0.0.13", "192.168.1.87")
|
||||
|
||||
# TCP Scanner
|
||||
tcp_target_ports = [22, 445, 135, 3389]
|
||||
tcp_scan_timeout = 1000 # 1000 Milliseconds
|
||||
tcp_scan_timeout = 3000 # 3000 Milliseconds
|
||||
tcp_scan_interval = 200
|
||||
tcp_scan_get_banner = True
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class NetworkScanner(object):
|
|||
victims_count = 0
|
||||
|
||||
for range in self._ranges:
|
||||
LOG.debug("Scanning for potantional victims in the network %r", range)
|
||||
LOG.debug("Scanning for potential victims in the network %r", range)
|
||||
for victim in range:
|
||||
# skip self IP address
|
||||
if victim.ip_addr in self._ip_addresses:
|
||||
|
@ -53,7 +53,7 @@ class NetworkScanner(object):
|
|||
|
||||
# if scanner detect machine is up, add it to victims list
|
||||
if scanner.is_host_alive(victim):
|
||||
LOG.debug("Found potational victim: %r", victim)
|
||||
LOG.debug("Found potential victim: %r", victim)
|
||||
victims_count += 1
|
||||
yield victim
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class TcpScanner(HostScanner, HostFinger):
|
|||
|
||||
is_open, banner = check_port_tcp(host.ip_addr,
|
||||
target_port,
|
||||
self._config.tcp_scan_interval / 1000.0,
|
||||
self._config.tcp_scan_timeout / 1000.0,
|
||||
self._config.tcp_scan_get_banner)
|
||||
|
||||
if is_open:
|
||||
|
|
|
@ -1,16 +1,22 @@
|
|||
import socket
|
||||
import select
|
||||
import logging
|
||||
|
||||
DEFAULT_TIMEOUT = 10
|
||||
BANNER_READ = 1024
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
def check_port_tcp(ip, port, timeout=DEFAULT_TIMEOUT, get_banner=False):
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.settimeout(timeout)
|
||||
|
||||
try:
|
||||
sock.connect((ip, port))
|
||||
except socket.error:
|
||||
except socket.timeout:
|
||||
return (False, None)
|
||||
except socket.error, exc:
|
||||
LOG.debug("Check port: %s:%s, Exception: %s", ip, port, exc)
|
||||
return (False, None)
|
||||
|
||||
banner = None
|
||||
|
|
Loading…
Reference in New Issue