aboutsummaryrefslogtreecommitdiff
path: root/netsec-assignment1-S4498062/exercise1/netcat.py
diff options
context:
space:
mode:
authorCamil Staps2015-09-05 13:47:35 +0200
committerCamil Staps2015-09-05 13:47:57 +0200
commitbe217b0370ecc19dd205615b739e6995c066bdd1 (patch)
tree0603788062d94a5681f43f87af66cd93e7cc1c0d /netsec-assignment1-S4498062/exercise1/netcat.py
Assignment 1
Diffstat (limited to 'netsec-assignment1-S4498062/exercise1/netcat.py')
-rwxr-xr-xnetsec-assignment1-S4498062/exercise1/netcat.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/netsec-assignment1-S4498062/exercise1/netcat.py b/netsec-assignment1-S4498062/exercise1/netcat.py
new file mode 100755
index 0000000..1bd7fd9
--- /dev/null
+++ b/netsec-assignment1-S4498062/exercise1/netcat.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+import socket
+
+s = socket.create_connection(("localhost", 42424))
+stringbuf = ""
+for i in range(0, 1000):
+ stringbuf = stringbuf + "spam " + str(i) + "\n"
+buf = stringbuf.encode("utf-8")
+s.sendall(buf)
+s.close()
+