Пример #1
0
	def bashscript_processor(self):
		file = open("./bash/output/cronlist.output", "r")
		lines = [line.split() for line in file.readlines()]
		file.close()
		lines = [line for line in lines if line != ""]
		formatted_lines = []
		for int in range(0, len(lines)): # for every line in cron dump
			command = " ".join(lines[int][6:]) # select every item from six and beyond, meaning select the whole command (ncat or ncat -p)
			pre = lines[int][:6] # select everything before the command
			pre.append(command) # join the whole command to the whole list, avoiding issues with cases like "nmap -A -T5 10.0.1.1"
			formatted_lines.append(pre)
		organized_dict = tools.make_organized_dict(formatted_lines, ["minute", "hour", "day", "month", "week", "user", "command"])
		for item in organized_dict:
			dbr.ok("cron_script")
			dbr.fill("cron_script", item)
Пример #2
0
	def abnormal_installed(self):
		'''returns progams that are installed on this system, but not in a clean 12.04'''
		file = open("./resources/12.04-clean-installed", "r")
		clean = [line.split("\n")[0] for line in file.readlines()]
		list_installed()
		file = open("./bash/output/list-installed.output", "r")
		installed = [line.split("\t")[0] for line in file.readlines()]
		file.close()
		uhoh = [line for line in installed if line not in clean]
		
		for application in uhoh:
			dbr.ok("abnormal_installed_apps")
			application_entry = tools.make_organized_dict([[application]], ["apps"])[0]
			dbr.fill("abnormal_installed_apps", application_entry)

		return uhoh