Exemple #1
0
 def score(self, team_obj):
     self.update_configuration(team_obj)
     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     sock.settimeout(self.timeout)
     result = sock.connect_ex((self.build_address(), self.port))
     new_score = Score()
     if result == 0:
         new_score.value = self.points
         new_score.message = ""
     else:
         new_score.value = 0
         new_score.message = "" # TODO: Could eventually use an error message here
     return new_score
Exemple #2
0
	def score(self, team_obj, service_name):
		self.update_configuration(team_obj)

		bproc = "smbclient -L "+ self.build_address()
		bproc += " -U " + self.username + "%" + self.password
		FNULL = open(os.devnull, "w")
		proc = subprocess.Popen(bproc.split(), stdout=subprocess.PIPE, stderr=FNULL)
		output = proc.communicate()[0]
		rt = proc.returncode
		FNULL.close()
		new_score = Score()
		if rt == "0" or rt == 0:
			new_score.value = self.points
			new_score.message = ""
		else:
			new_score.value = 0
			new_score.message = str(rt)
		return new_score
Exemple #3
0
	def score(self, team_obj):
		self.update_configuration(team_obj)
		new_score = Score()
		try:
			client = ftp.connect(
				self.build_address(),
				self.port,
				self.timeout)
			client.login(
				self.username,
				self.password)
			client.close()
			new_score.value = self.points
			new_score.message = ""
		except:
			new_score.value = 0
			new_score.message = "Address: %s<br>Port: %s<br>Traceback: %s" % \
				(self.build_address(),str(self.port),escape(traceback.format_exc().splitlines()[-1]))
		return new_score
Exemple #4
0
	def score(self, team_obj):
		self.update_configuration(team_obj)
		client = paramiko.SSHClient()
		client.load_system_host_keys()
		client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
		new_score = Score()
		try:
			print "self.port: '"+str(self.port)+"'"
			client.connect(
				self.build_address(),
				self.port,
				self.username,
				self.password,
				timeout=self.timeout)
			client.close()
			new_score.value = self.points
			new_score.message = ""
		except:
			new_score.value = 0
			new_score.message = "Address: %s<br>Traceback: %s" % (self.build_address(), escape(traceback.format_exc().splitlines()[-1]))
		return new_score
Exemple #5
0
	def score(self, team_obj):
		self.update_configuration(team_obj)
		address = "http://" + self.build_address(withport = True)
		new_score = Score()
		try:
			timeout
			use_timeout = True
		except NameError:
			use_timeout = False
		try:
			if use_timeout:
				request = urlopen(address, timeout = self.timeout)
			else:
				request = urlopen(address)
			html = request.read()
			new_score.value = self.points
			new_score.message = ""
		except:
			new_score.value = 0
			new_score.message = "Address: %s<br>Traceback: %s" % (address, escape(traceback.format_exc().splitlines()[-1]))
		return new_score
Exemple #6
0
	def score(self, team_obj):
		self.update_configuration(team_obj)
		domains = self.domainname.split(",")
		for i in domains:
			addr = self.build_address(machineaddr = i)
			try:
				socket.gethostbyname(addr)
			except socket.gaierror:
				new_score = Score()
				new_score.value = 0
				new_score.message = "Domain name: %s<br>Traceback: %s" % (addr, escape(traceback.format_exc().splitlines()[-1]))
				return new_score
		new_score = Score()
		new_score.value = self.points
		new_score.message = ""
		return new_score
Exemple #7
0
 def score(self, team_obj):
     self.update_configuration(team_obj)
     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     sock.settimeout(self.timeout)
     result = sock.connect_ex((self.build_address(), self.port))
     new_score = Score()
     if result == 0:
         new_score.value = self.points
         new_score.message = ""
     else:
         new_score.value = 0
         new_score.message = ""  # TODO: Could eventually use an error message here
     return new_score
Exemple #8
0
 def score(self, team_obj):
     self.update_configuration(team_obj)
     new_score = Score()
     try:
         client = ftp.connect(self.build_address(), self.port, self.timeout)
         client.login(self.username, self.password)
         client.close()
         new_score.value = self.points
         new_score.message = ""
     except:
         new_score.value = 0
         new_score.message = "Address: %s<br>Port: %s<br>Traceback: %s" % \
          (self.build_address(),str(self.port),escape(traceback.format_exc().splitlines()[-1]))
     return new_score
Exemple #9
0
 def score(self, team_obj):
     self.update_configuration(team_obj)
     address = "http://" + self.build_address(withport=True)
     new_score = Score()
     try:
         request = urlopen(address, timeout=self.timeout)
         html = request.read()
         new_score.value = self.points
         new_score.message = ""
     except:
         new_score.value = 0
         new_score.message = "Address: %s<br>Traceback: %s" % (
             address, escape(traceback.format_exc().splitlines()[-1]))
     return new_score
Exemple #10
0
    def score(self, team_obj, service_name):
        self.update_configuration(team_obj)

        bproc = "smbclient -L " + self.build_address()
        bproc += " -U " + self.username + "%" + self.password
        FNULL = open(os.devnull, "w")
        proc = subprocess.Popen(bproc.split(),
                                stdout=subprocess.PIPE,
                                stderr=FNULL)
        output = proc.communicate()[0]
        rt = proc.returncode
        FNULL.close()
        new_score = Score()
        if rt == "0" or rt == 0:
            new_score.value = self.points
            new_score.message = ""
        else:
            new_score.value = 0
            new_score.message = str(rt)
        return new_score
Exemple #11
0
 def score(self, team_obj):
     self.update_configuration(team_obj)
     client = paramiko.SSHClient()
     client.load_system_host_keys()
     client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
     new_score = Score()
     try:
         print "self.port: '" + str(self.port) + "'"
         client.connect(self.build_address(),
                        self.port,
                        self.username,
                        self.password,
                        timeout=self.timeout)
         client.close()
         new_score.value = self.points
         new_score.message = ""
     except:
         new_score.value = 0
         new_score.message = "Address: %s<br>Traceback: %s" % (
             self.build_address(),
             escape(traceback.format_exc().splitlines()[-1]))
     return new_score
Exemple #12
0
    def score(self, team_obj):
        self.update_configuration(team_obj)
        address = self.build_address()

        msg = MIMEText('This is the text body')
        msg['Subject'] = 'Testing email'
        msg['From'] = self.from_user + '@galactica.fleet'
        msg['To'] = self.to_user + '@galactica.fleet'

        try:
            s = smtplib.SMTP(address, self.port, timeout=self.timeout)
            s.sendmail(self.from_address, [self.to_address], msg.as_string())
            s.quit()
        except smtplib.SMTPException:
            new_score = Score()
            new_score.value = 0
            new_score.message = "Address: %s<br>Traceback: %s" % (
                address, escape(traceback.format_exc().splitlines()[-1]))
            return new_score
        except socket.timeout:
            new_score = Score()
            new_score.value = 0
            new_score.message = "Address: %s<br>Traceback: %s" % (
                address, escape(traceback.format_exc().splitlines()[-1]))
            return new_score
        except socket.gaierror:
            new_score = Score()
            new_score.value = 0
            new_score.message = "Address: %s<br>Traceback: %s" % (
                address, escape(traceback.format_exc().splitlines()[-1]))
            return new_score
        new_score = Score()
        new_score.value = self.points
        new_score.message = ""
        return new_score
Exemple #13
0
	def score(self, team_obj):
		self.update_configuration(team_obj)
		address = self.build_address()

		msg = MIMEText('This is the text body')
		msg['Subject'] = 'Testing email'
		msg['From'] = self.from_user + '@galactica.fleet'
		msg['To'] = self.to_user + '@galactica.fleet'

		try:
			s = smtplib.SMTP(address, self.port, timeout = self.timeout)
			s.sendmail(self.from_address, [self.to_address], msg.as_string())
			s.quit()
		except smtplib.SMTPException:
			new_score = Score()
			new_score.value = 0
			new_score.message = "Address: %s<br>Traceback: %s" % (address, escape(traceback.format_exc().splitlines()[-1]))
			return new_score
		except socket.timeout:
			new_score = Score()
			new_score.value = 0
			new_score.message = "Address: %s<br>Traceback: %s" % (address, escape(traceback.format_exc().splitlines()[-1]))
			return new_score
		except socket.gaierror:
			new_score = Score()
			new_score.value = 0
			new_score.message = "Address: %s<br>Traceback: %s" % (address, escape(traceback.format_exc().splitlines()[-1]))
			return new_score
		new_score = Score()
		new_score.value = self.points
		new_score.message = ""
		return new_score