def mesajAL(sock, sun_EKRAN, key, ip): global CONNECTION kosul = True while kosul: try: mesaj = sock.recv(RECV_BUFFER) if mesaj.startswith("0MSG"): mesaj = mesaj[4:] mesaj = cipher.decipher(sun_EKRAN.kapaliKEY, mesaj) sun_EKRAN.mesajAl.text += "<{}> ".format(ip) + mesaj + "\n" if mesaj.startswith("0KEY"): sock.sendall("0KEY" + key) if mesaj == "QUIT": CONNECTION = True Window.on_close = App().stop sock.close() sun_EKRAN.mesajAl.text += u"{} kullanýcýsý konuþmadan ayrýldý. ".format( ip) + "\n" except Exception as e: sock.close() kosul = False hata = e.args[0] if hata == 10054: sun_EKRAN.mesajAl.text += u"{} kullanýcýsýnýn baðlantýsý koptu ".format( ip) + "\n" Window.on_close = App.stop
def mesajAL(sock, loader1, sayfa, kul_EKRAN, ip, yonetici): kosul = True alert = Alert() warning = WarningP() while kosul: try: data = sock.recv(4096) if data.startswith("0KEY"): kul_EKRAN.acikKEY = data[4:] if kul_EKRAN.acikKEY == None: sock.sendall("0KEY") if data.startswith("0MSG"): mesaj = data[4:] mesaj = cipher.decipher(sayfa.kapaliKEY, mesaj) kul_EKRAN.mesajAl.text += "<{}> ".format(ip) + mesaj + "\n" if data == "QUIT": kosul = False alert.text.text = u"{} mesajlaþmadan \n ayrýldý.".format(ip) sock.close() Window.on_close = App().stop yonetici.current = "katilSayfa" alert.open() if data == "WPAS": alert.text.text = u"Yanlýþ þifre girdiniz!" sock.close() yonetici.current = "katilSayfa" alert.open() except Exception as e: if e.args == 10054: warning.text = u"{}'nýn baðlantýsý koptu.".format(ip) sock.close() yonetici.current = "katilSayfa" warning.open() kosul = False print e.args[0]
% (name, str(msg))) transport.start_client() if hostkey is not None: transport._preferred_keys = [ hostkey.get_name() ] key = transport.get_remote_server_key() if (key.get_name() != hostkey.get_name() or str(key) != str(hostkey)): log.error('Bad host key from server (%s).' % name) raise AuthenticationError('Bad host key from server (%s).' % name) log.info('Server host key verified (%s) for %s' % (key.get_name(), name)) privkey = cipher.decipher(tags['site'].get('privkey', tags['site'].get('pkey', ''))) password = cipher.decipher(tags['site'].get('password', '')) password_encoding = tags['site'].get('password_encoding', 'utf8') password = convert(password, password_encoding) authentified = False if privkey: privkey = util.get_dss_key_from_string(privkey) try: transport.auth_publickey(tags['site']['login'], privkey) authentified = True except AuthenticationException: log.warning('PKey for %s was not accepted' % name) if not authentified and password: try:
def test_roundTrip(self): buf = cipher.cipher(sut, key_=0x19) f = cipher.decipher(buf, key_=0x19) result = f() self.assertTrue(result)
print("Type your input (double return when done) : ") source = list() i = input() while i: source.append(i.encode()) i = input() del i source = b"\n".join(source) current_data = source else: current_data = open(args.source, "rb").read() # deciphering if args.decipher: print("deciphering...", end="", flush=True) current_data = cipher.decipher(current_data, pwdd) # ciphering if args.cipher: print("ciphering...", end="", flush=True) current_data = cipher.cipher(current_data, pwdc) # output / steganographying if args.hide: print("hiding...", end="", flush=True) support = Image.open(args.hide) if support.mode == "RGBA": alpha = support.split()[-1] support = support.convert("RGB") stegano.hide(current_data, support)
def func_get_site_password(self, _chan, clear=False): return cipher.decipher(self.namespaces[_chan]["site"]["password"])
from runlength import rlencode, rldecode from bw import transform, inverseTransform from cipher import encipher, decipher data = input() key = input() [data, first] = transform(data) data = rlencode(data) data = encipher(data, key, first) print("\nEncrypted Data:", data, '\n') data = decipher(data, key, first) data = rldecode(data) data = inverseTransform(data, first) print("\nDecrypted Data:", data, '\n')