From fed2779af996432579ff0c1715e0aaa3b7bb5889 Mon Sep 17 00:00:00 2001 From: Rohan karki <100342753+hackerwhale@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:07:16 +0545 Subject: [PATCH] Add udp-client.py --- .../chapter2 - Network Basics/UDP-Client.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 blackhat-python3/chapter2 - Network Basics/UDP-Client.py diff --git a/blackhat-python3/chapter2 - Network Basics/UDP-Client.py b/blackhat-python3/chapter2 - Network Basics/UDP-Client.py new file mode 100644 index 0000000..d257812 --- /dev/null +++ b/blackhat-python3/chapter2 - Network Basics/UDP-Client.py @@ -0,0 +1,14 @@ +import socket + +target_host = "127.0.0.1" +target_port = 80 + +# create a socket object +client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + +# send some data +client.sendto("AAABBBCCC".encode(), (target_host, target_port)) + +# receive some data +data, addr = client.recvfrom(4096) +print(data.decode())