25 lines
564 B
Plaintext
25 lines
564 B
Plaintext
|
#
|
||
|
# 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!")
|