def checkdat(): if os.path.exists("config/userdat.ini") == True: version = "2.0" config = configparser.ConfigParser() config.read("config/userdat.ini") config['DEFAULT']['VERSION'] = version now = time.strftime("%c") config['DEFAULT']['LASTRUN'] = now with open("config/userdat.ini", "w") as configfile: config.write(configfile) print(colors.BLUE + " [" + time.strftime("%H:%M") + "] Loaded Configuration File" + colors.END) else: startup.createdat()
def main(): print("") config = configparser.ConfigParser() config.read("config/userdat.ini") terminalname = colors.BLUE + "[" + colors.END + "DSPF" + colors.BLUE + "]> " + colors.END terminal = input(terminalname + colors.END).lower() if terminal[0:4] == "help": helper.menu() main() elif terminal[0:1] == "?": helper.menu() main() elif terminal[0:5] == "clear": os.system("clear") welcome.welcome() main() elif terminal[0:] == "show": print(colors.GREEN) showlist.showlist() print(colors.END) main() elif terminal[0:3] == "use": if terminal[4:] == terminal[4:]: check = "%s.plugin" % (terminal[4:]) if os.path.exists(check) == True: os.system("%s.plugin" % (terminal[4:])) main() else: print(colors.RED + "[!]" + colors.END + "%s: Could Not Be Found!" % (terminal[4:])) main() elif terminal[0:17] == "show " + terminal[5:]: print("") print(colors.BLUE + "Plugin Category: " + terminal[5:]) print("==============") print("Name ") print("" + colors.END) directorylist = glob.glob(terminal[5:] + "/*.plugin") for line in directorylist: about = line with open(about, "r") as myfile: data = myfile.read().splitlines() desc = data[0] datar = desc.replace("Description = '", "") x = datar.rstrip("'") bb = line.split(terminal[5:] + "/")[1].split('.plugin')[0] print("{0:17s}".format(bb.upper())) print(" ") main() elif terminal[0:6] == "addkey": if terminal[7:] == terminal[7:]: print("") newkey = terminal[7:] newvalue = input("%s Value: " % (newkey)) config['DEFAULT'][newkey] = newvalue with open("config/userdat.ini", "w") as configfile: config.write(configfile) main() elif terminal[0:3] == "set": if terminal[4:] == "lhost": config['DEFAULT']['LHOST'] = input("\nEnter Value: ") with open("config/userdat.ini", "w") as configfile: config.write(configfile) main() elif terminal[0:] == "set lport": config['DEFAULT']['LPORT'] = input("\nEnter Value: ") with open("config/userdat.ini", "w") as configfile: config.write(configfile) main() elif terminal[4:9] == "rhost": config['DEFAULT']['RHOST'] = input("\nEnter Value: ") with open("config/userdat.ini", "w") as configfile: config.write(configfile) main() elif terminal[4:9] == "rport": config['DEFAULT']['RPORT'] = input("\nEnter Value: ") with open("config/userdat.ini", "w") as configfile: config.write(configfile) main() elif terminal[4:12] == "userlist": config['DEFAULT']['USERLIST'] = input("\nEnter Directory: ") with open("config/userdat.ini", "w") as configfile: config.write(configfile) main() elif terminal[4:12] == "passlist": config['DEFAULT']['PASSLIST'] = input("\nEnter Directory: ") with open("config/userdat.ini", "w") as configfile: config.write(configfile) main() elif terminal[4:13] == "interface": config['DEFAULT']['PASSLIST'] = input("\nEnter Interface: ") with open("config/userdat.ini", "w") as configfile: config.write(configfile) main() elif terminal[0:5] == "reset": os.system("rm config/userdat.ini") startup.createdat() checkdat() main() elif terminal[0:4] == "exit": print("Exiting Framework..") exit() elif terminal[0:7] == "session": try: print(colors.GREEN) print("Key: Value:") print("========================\n") for key, value in config.items('DEFAULT'): pressed = "{0:17s}{1:12s}".format(key,value).upper() print(pressed) print(colors.END) main() except KeyboardInterrupt: main() elif terminal[0:7] == "restart": os.system("./start.py") elif terminal[0:3] == "run": if terminal[4:] == terminal[4:]: os.system("%s" % (terminal[4:])) main() else: print("Unknown Command. Use help or ? to see available commands.") main()