Source Code - A Simple Python Code for Remote Control | Web Scripts | Crax

Welcome To Crax.Pro Forum!

Check our new Marketplace at Crax.Shop

   Login! SignUp Now!

Source Code A Simple Python Code for Remote Control

Source Code A Simple Python Code for Remote Control

LV
1
 

aa125488

Member
Joined
Jul 28, 2023
Threads
12
Likes
2
Awards
4
Credits
1,294©
Cash
0$
Server code:
Python:
import socket
 
host = 'localhost'
port = 8888
 
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((host, port))
s.listen(1)
 
print('Listening for connections...')
 
while True:
    conn, addr = s.accept()
    print('Connected by', addr)
    while True:
        data = conn.recv(1024)
        if not data: break
        output = subprocess.check_output(data.decode(), shell=True)
        conn.sendall(output)
    conn.close()

Client code:
Python:
import socket
 
host = 'localhost'
port = 8888
 
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
 
while True:
    cmd = input("Enter command: ")
    s.sendall(cmd.encode())
    data = s.recv(1024)
    print(data.decode())
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

Top Bottom