-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.py
39 lines (23 loc) · 868 Bytes
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from socket import *
import webbrowser
server_ip = input("Enter the server's IP address: ") #192.168.103.239
server_address = (server_ip, 8888) #8888 is the port number of the proxy server
# TCP connection
# Client socket
client_socket = socket(AF_INET, SOCK_STREAM)
def client():
# Create a socket for the client
client_socket.connect(server_address)
# Request a website from the proxy server
website_url = input("Enter the website URL: ")
client_socket.send(website_url.encode('utf-8'))
print("Waiting for the URL")
# Receive the website content from the proxy server
web_content = client_socket.recv(4096).decode('utf-8')
# Display the received content
webbrowser.open(web_content)
print("Received from Proxy Server:")
print("Done done")
print(web_content)
if __name__ == "__main__":
client()