maciejkapaste-backup-2023-2.../pastes/paste_6c5b2a.txt

25 lines
564 B
Plaintext
Raw Permalink Normal View History

2023-12-31 18:17:29 +01:00
#
# ID: 6c5b2a
# Nazwa: Python-PowerShell Socket Connection
# Opis: Python
# Publiczny: 0
# Data utworzenia/ostatniej edycji (UTC): 2023-10-18 21:15:17
#
import socket
HOST = "127.0.0.1"
PORT = 53588
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((HOST, PORT))
s.listen()
conn, addr = s.accept()
with conn:
print(f"Connected by {addr}")
while True:
data = input("Prompt> ")+"\n"
conn.sendall(data.encode("utf-8"))
print("\nSent!")