GC-5050: better range calculation

This commit is contained in:
urihershgc 2016-01-13 10:27:49 +02:00
parent 54e4453d67
commit a0e87a82f7
5 changed files with 17 additions and 11 deletions

View File

@ -104,12 +104,12 @@ class Configuration(object):
singleton_mutex_name = "{2384ec59-0df8-4ab9-918c-843740924a28}"
# how long to wait between scan iterations
timeout_between_iterations = 300
timeout_between_iterations = 10
# how many scan iterations to perform on each run
max_iterations = 3
max_iterations = 1
scanner_class = TcpScanner
scanner_class = PingScanner
finger_classes = (SMBFinger, SSHFinger, PingScanner)
exploiter_classes = (SmbExploiter, WmiExploiter, RdpExploiter, Ms08_067_Exploiter, SSHExploiter)
@ -136,10 +136,10 @@ class Configuration(object):
# scanners config
###########################
range_class = RelativeRange
range_size = 30
range_class = ClassCRange
# range_size = 1
# range_class = FixedRange
range_fixed = ("", )
# range_fixed = ("", )
# TCP Scanner
tcp_target_ports = [22, 2222, 445, 135, 3389]

View File

@ -17,7 +17,10 @@ from impacket.smb3structs import SMB2_DIALECT_002, SMB2_DIALECT_21
from impacket.dcerpc.v5.dcomrt import DCOMConnection
from impacket.dcerpc.v5.dcom import wmi
from impacket.dcerpc.v5.dtypes import NULL
from impacket.dcerpc.v5.rpcrt import Exception as DceRpcException
class DceRpcException(Exception):
pass
__author__ = 'itamar'
@ -55,7 +58,7 @@ class WmiTools(object):
try:
iInterface = dcom.CoCreateInstanceEx(wmi.CLSID_WbemLevel1Login,
wmi.IID_IWbemLevel1Login)
except DceRpcException, exc:
except Exception, exc:
dcom.disconnect()
if "rpc_s_access_denied" == exc.message:

View File

@ -60,9 +60,9 @@ def main():
json_dict = json.load(config_fo)
WormConfiguration.from_dict(json_dict)
except ValueError as e:
print "Error loading config, using default: %s" % e
print "Error loading config: %s, using default" % (e,)
else:
print("Config file: %s wasn't found, using default" % config_file)
print("Config file wasn't supplied and default path: %s wasn't found, using internal default" % (config_file,))
print "Loaded Configuration: %r" % WormConfiguration.as_dict()

View File

@ -181,6 +181,7 @@ class ChaosMonkey(object):
monkey_tunnel.join()
def cleanup(self):
LOG.info("Monkey is shutting down")
self._keep_running = False
self._singleton.unlock()

View File

@ -52,7 +52,9 @@ class RelativeRange(NetworkRange):
socket.inet_ntoa(struct.pack(">L", self._base_address + self._size)))
def _get_range(self):
return range(-self._size, self._size + 1)
lower_end = -(self._size / 2)
higher_end = lower_end + self._size
return range(lower_end, higher_end + 1)
class FixedRange(NetworkRange):