예제 #1
0
	def find_from_keywords(self, keywords, root_dir):
		found = {}
		for keyword in keywords:
			file = open(config.bash().findfilefolders(), "w+")	
			command = "find {} -iname *{}* > {}\n".format(root_dir, keyword, config.output().findfilefolders())
			file.writelines(["#!/bin/bash\n", command])
			file.close()
			call(config.bash().findfilefolders())
			file = open(config.output().findfilefolders(), "r")
			found[keyword] = file.readlines()
			file.close()
		
		for keyword in found.keys():
			organized_dict = {}
			found_items = ""
			for item in found[keyword]:
				found_items += str(item.rstrip("\n") + ", ")
			found_items = found_items.rstrip(", ")
			organized_dict["keyword"], organized_dict["found"] = keyword, found_items
			disabled = str
			dbr.ok("found_files_folders")
			dbr.fill("found_files_folders", organized_dict)
	
		
		return found.values()
예제 #2
0
	def keyword_find(keywords, root_dir):
		file = open(config.bash().findfilefolders(), "w+")	
		command = "find {} -iname '*{}*'' > {}\n".format(root_dir, keyword, config.output().findfilefolders())
		file.writelines(["#!/bin/bash\n", command])
		file.close()
		call(config.bash().findfilefolders())
		file = open(config.output().findfilefolders(), "r")
		found[keyword] = file.readlines()
		file.close()