This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.
JavaScript algorithmsartificial-intelligencebugbountycryptographycyber-threat-intelligencecybersecurity-projectsethical-hackinghacking-toolsmalwarenessusnetwork-monitoringnetwork-securitynmapportscannerpythonpythonprojectsthreat-intelligencevirus-scanning
Create tcp_server.py
Abdul Wahab Junaid2e1a46b95616
diff --git a/Python Tools/TCP_Client_Server.py/tcp_server.py b/Python Tools/TCP_Client_Server.py/tcp_server.pynew file mode 100644index 0000000..e97af11--- /dev/null+++ b/Python Tools/TCP_Client_Server.py/tcp_server.py@@ -0,0 +1,33 @@+#!/usr/bin/python++import socket+import threading++SERVER_IP = "127.0.0.1"+SERVER_PORT = 9998++# family = Internet, type = stream socket means TCP+server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)++server.bind((SERVER_IP,SERVER_PORT))++server.listen(5)++print("[*] Server Listening on %s:%d" % (SERVER_IP,SERVER_PORT))++client,addr = server.accept()++client.send("I am the server accepting connections...".encode())++print("[*] Accepted connection from: %s:%d" % (addr[0],addr[1]))++def handle_client(client_socket):+ request = client_socket.recv(1024)+ print("[*] Received request : %s from client %s" , request, client_socket.getpeername())+ client_socket.send(bytes("ACK","utf-8"))++while True:+ handle_client(client)++client_socket.close()+server.close()