def main(): opt = op("Usage: %prog [args] [values]") opt.add_option("-k", "--key", dest="key", help="Set key.", default=4, type="int") opt.add_option( "-d", "--do", dest="do", help= "If this argument is equal to its default value ('encode') it will encode your text, else, it will decode it.", default="encode") (o, argv) = opt.parse_args() if pv()[0] == "3": raw_input = input mytext = raw_input("Input your text here: ") if o.do == "encode": encoded = encode(mytext, o.key) else: encoded = decode(mytext, o.key) print(encoded) pyperclip.copy(encoded)
def __init__(self, ip, port, listen): if str(pv())[0] == "3": print("Python 3 detectado, creando compatibilidad") raw_input = input self.sock = socket(AF_INET, SOCK_STREAM) self.sock.bind((ip, int(port))) self.sock.listen(int(listen)) self.sock.setblocking(False) self.connections = [] esperar = Thread(target=self.waitothers) leer = Thread(target=self.reader) esperar.daemon = True leer.daemon = True esperar.start() leer.start() cmd = "" while cmd != "exit": cmd = raw_input("{}>".format(getcwd())) try: if cmd[:2] == "cd": chdir(cmd[3:]) else: system(cmd) except Exception as e: print(e)
def main(): opt = op("Usage: %prog [args] [values]") opt.add_option("-s", "--server", dest="server", help="Set server's ip", default="127.0.0.1") opt.add_option("-p", "--port", dest="port", help="Set server's port", default=5000, type="int") opt.add_option("-k", "--key", dest="key", help="Set key", default="YxqChramWzhDUQiNoAnNseAYTblCjapnL8aQu3ehofQ=") (o, argv) = opt.parse_args() o.key = o.key.encode() c = Client() c.start(o.server, o.port, o.key) h = Thread(target=c.hear) h.daemon = True h.start() if pv()[0] == "3": raw_input = input cmd = "" while cmd != "exit": cmd = raw_input(">>>") c.send(cmd)
def console(self): if str(pv())[0] == "3": raw_input = input if str(platform())[0].lower() == "w": clear = "cls" else: clear = "clear" cmd = "" while cmd != "exit": cmd = raw_input(">>") try: if cmd == clear: system(clear) elif cmd[:2] == "cd": chdir(cmd[3:]) elif cmd == "dir": for file in listdir(): if path.isdir(file): print("[dir] {}".format(file)) else: print(file) elif cmd[:9] == "lowsearch": search(cmd[10:], "l") elif cmd[:12] == "middlesearch": search(cmd[13:], "n") elif cmd[:10] == "hardsearch": search(cmd[11:], "h") elif cmd[:4] == "find": search(cmd[5:]) else: print("Command ''{}'' not found.".format(cmd)) except Exception as e: print(e)
def __init__(self, host, port, lisent, key): if str(pv())[0] == "3": raw_input = input if str(p())[0] == "W": clear = "cls" else: clear = "clear" self.f = fern(key) self.l = lisent self.sock = socket(AF_INET, SOCK_STREAM) try: self.sock.bind((host, port)) except Exception as e: print(e) exit() self.sock.listen(self.l) self.sock.setblocking(False) self.clients = {} self.conns = [] w = Thread(target=self.wait) w.daemon = True w.start() h = Thread(target=self.heartoall) h.daemon = True h.start() d = Thread(target=self.death) d.daemon = True d.start() c = "" costum_clear = clear while c != "exit": c = raw_input(">") if c == costum_clear: system(clear) elif c[:17] == "set costume clear": costum_clear = c[18:] elif c[:3] == "all": self.sendtoall(c[4:]) elif c[:3] == "ban": for c in self.clients: if self.clients[c][0] == c[4:]: banned = c for c in self.conns: if str(c) == banned: c.shutdown(SHUT_WR) c.close() for client in self.conns: client.shutdown(SHUT_WR) client.close() self.sock.close()
def main(): if pv()[0] == "3": raw_input = input message = "Coe nsononnioomm sst mmse co" for key in range(1, len(message)): print("Trying with key number {}.".format(key)) decoded = decode(message, key) if isEnglish(decoded): ask = raw_input("Is this English?:\n{}\n[yes] [no]>>".format( decoded[:100])) if ask == "yes": return decoded return False
def get(self, modname, methodname): """Returns a list of args for the specified method in the class of a func module. This is useful when register_method_args is not defined (or not properly) """ vtuple=pv() pyver=vtuple[0]+'.'+vtuple[1] sys.path.append('/usr/lib/python'+pyver+'/site-packages/func/minion/modules/') the_mod=__import__(modname) name,data=inspect.getmembers(the_mod, inspect.isclass)[0] the_class=modname+'.'+name c=getattr(the_mod, name) return [ arg for arg in inspect.getargspec(eval('c.'+methodname))[0] if arg != 'self' ]
def checkargs(key, do, inp): if not len(key) == len(LETTERS): print("{} is not a valid key.".format(key)) exit() if not do in ("encode", "decode", "generatekey"): print("'{}' mode not found".format(do)) exit() if not do == "generatekey": if inp == "manually": if pv()[0] == "3": raw_input = input text = raw_input("Input your text: ") elif inp == "variable": text = "Input your text here" return text
def main(): opt = op("Usage: %prog [arg] [value]") opt.add_option("-H", "--host", dest="host", default="127.0.0.1", help="Set server's ip") opt.add_option("-p", "--port", dest="port", default=5000, help="Set server's port", type="int") opt.add_option("-k", "--key", dest="key", default="YxqChramWzhDUQiNoAnNseAYTblCjapnL8aQu3ehofQ=", help="Set key", type="string") opt.add_option( "-l", "--listen", dest="l", default=2, help="Set how many clients can be connected at the same time", type="int") (o, argv) = opt.parse_args() o.key = o.key.encode() s = Server() s.start(o.host, o.port, o.key, o.l) w = Thread(target=s.wait4all) w.daemon = True w.start() h = Thread(target=s.hear2all) h.daemon = True h.start() if pv()[0] == "3": raw_input = input if p()[0] == "W": clear = "cls" else: clear = "clear" costumclear = clear cmd = "" while cmd != "exit": cmd = raw_input(">>>") if cmd == costumclear: system(clear)
def checkargs(do, i, key): if not validatekey(key): print("You are using a not valid key.") exit() if not do in ("encode", "decode", "onepad"): print("{} mode not found.".format(do.title())) exit() if i == "typed": message = "Type your message in this variable" elif i == "input": if pv()[0] == "3": raw_input = input message = raw_input("Input your text: ") else: print("{} method not found.".format(i)) exit() return message
def ganar(status, seed): if str(pv())[0] == "3": raw_input = input print("Haz derrotado al ladrón, decide que hacer con el.") print(''' [M]atar [R]obar [P]erdonar''') do = "" while do != "m" and do != "r" and do != "p": do = raw_input(">>>") do = do.lower() if do == "m": status["Karma"] -= randint(2,7) * status["Nivel"] elif do == "r": status["Karma"] -= status["Nivel"] status["Dinero"] += randint(seed, seed * 2) elif do == "p": status["Karma"] += randint(2,7) * status["Nivel"]
from platform import python_version as pv print(pv()) #print(system()) # https://docs.python.org/3/py-modindex.html
""" def attack(service, command): print("\n+------------------------------+") print(service) print("+------------------------------+") print("\n\n\n") os.system(command) # Restart #################### ############################## if __name__ == '__main__': if str(pv())[0] == "3": raw_input = input if s() == "Windows": clear = "cls" else: clear = "clear" bhydra = "" while bhydra != "0" and bhydra != "00" and bhydra != 0: os.system(clear) print("___ _ ____ ____ _ _ _ _ _ _ ___ ____ ____") print("|__] | |__| | |_/ |__| \_/ | \ |__/ |__|") print("|__] |___ | | |___ | \_ | | | |__/ | \ | |") print("-----------------------------------------------------") print("[]xxxxx[]::::::::::::::::::::> 24-07-2017 (7:53)") print(" [*] Author: DedSecTL --- [*] Version 1.0") print("c=={:::::::::::::::> Black Hydra Console")
def combat(clear,pnombre,status,bstatus, bnombre, inv, avatar, bavatar, spells): olive = bstatus["Salud"] cando = [] if str(pv())[0] == "3": raw_input = input while status["Salud"] > 0 and bstatus["Salud"] > 0: system(clear) cmd = raw_input(''' [{}] [{}] [{}] [{}] {} {} [A] Atacar. [B] Bloquear ataque. [I] Inventario. [M] Magia. >>>'''.format(pnombre, status["Salud"], bnombre, bstatus["Salud"], avatar, bavatar)) cmd = cmd.lower() if cmd == "a": bstatus["Salud"] -= randint(int(status["Fuerza"] / 2), status["Fuerza"] * 2) elif cmd == "b": status["Salud"] += bstatus["Fuerza"] /2 elif cmd == "i": print("Objeto | Cantidad | Tipo") for obj in inv: print("---------------------------------------------") print("{} | {} | {}".format(obj, inv[obj][0], inv[obj][1][0])) select = "" while not select in inv: select = raw_input("Ingresa el objeto que usaras: ") if inv[select][1][2]: buff = inv[select][1][1] if buff == "Fuerza" or buff == "Salud": status[buff] += inv[select][2] else: print("**Este objeto no se puede usar en combate.") else: print("**Este objeto no es consumible.") getpass("Aprieta enter para continuar.") elif cmd == "m": if cando == []: for spell in spells: if spells[spell][2] == "Daño": cando.append(spell) else: continue for do in cando: print("{} : {}".format(do, spells[do][1])) do = "" while not do in cando: do = raw_input(">>") spells[do][0](bstatus) if bstatus["Salud"] <= 0: ganar(status, olive) continue bchoice = randint(1,2) if bchoice == 1: status["Salud"] -= bstatus["Fuerza"] elif bchoice == 2: bstatus["Salud"] += status["Fuerza"] / 2 system(clear) if status["Salud"] > bstatus["Salud"]: return 1 else: return 0
from platform import python_version as pv from commands import * def getflags(string): args = ["", []] index = 0 for arg in string.split(): if index == 0: args[index] = arg index += 1 continue args[index].append(arg) return args if __name__ == '__main__': shell = Shell() inputcmd = "" if pv()[0] == "3": raw_input = input while inputcmd != "exit": inputcmd = raw_input("{}>".format(getcwd())) cmd, flags = getflags(inputcmd) if cmd in shell.cmds: if shell.cmds[cmd][1]: shell.cmds[cmd][0](flags) else: shell.cmds[cmd][0]() else: print("Command '{}' not found.".format(cmd))