2015-08-30 15:27:35 +08:00
|
|
|
__author__ = 'itamar'
|
|
|
|
|
2015-11-30 16:56:20 +08:00
|
|
|
|
2015-08-30 15:27:35 +08:00
|
|
|
class VictimHost(object):
|
|
|
|
def __init__(self, ip_addr):
|
|
|
|
self.ip_addr = ip_addr
|
2015-09-29 22:55:54 +08:00
|
|
|
self.os = {}
|
|
|
|
self.services = {}
|
|
|
|
self.monkey_exe = None
|
2015-10-14 22:22:05 +08:00
|
|
|
self.default_tunnel = None
|
2015-12-03 22:38:50 +08:00
|
|
|
self.default_server = None
|
2015-09-29 22:55:54 +08:00
|
|
|
|
|
|
|
def as_dict(self):
|
|
|
|
return self.__dict__
|
2015-08-30 15:27:35 +08:00
|
|
|
|
|
|
|
def __hash__(self):
|
|
|
|
return hash(self.ip_addr)
|
|
|
|
|
|
|
|
def __eq__(self, other):
|
|
|
|
if not isinstance(other, VictimHost):
|
|
|
|
return False
|
|
|
|
|
|
|
|
return self.ip_addr.__eq__(other.ip_addr)
|
|
|
|
|
|
|
|
def __cmp__(self, other):
|
|
|
|
if not isinstance(other, VictimHost):
|
|
|
|
return -1
|
|
|
|
|
|
|
|
return self.ip_addr.__cmp__(other.ip_addr)
|
|
|
|
|
|
|
|
def __repr__(self):
|
2017-10-11 23:05:03 +08:00
|
|
|
return "<VictimHost %s>" % self.ip_addr
|
2015-08-30 15:27:35 +08:00
|
|
|
|
2016-09-06 02:10:17 +08:00
|
|
|
def __str__(self):
|
|
|
|
victim = "Victim Host %s: " % self.ip_addr
|
|
|
|
victim += "OS - ["
|
|
|
|
for k, v in self.os.iteritems():
|
|
|
|
victim += "%s-%s " % (k, v)
|
|
|
|
victim += "] Services - ["
|
|
|
|
for k, v in self.services.iteritems():
|
|
|
|
victim += "%s-%s " % (k, v)
|
|
|
|
victim += ']'
|
|
|
|
return victim
|
|
|
|
|
2015-12-03 22:38:50 +08:00
|
|
|
def set_default_server(self, default_server):
|
|
|
|
self.default_server = default_server
|