PYTHON-EXPLOITATION
This is a repository filled with scripts that were made with Python, and designed to exploit computer systems.
Networking
The tcp_clinet.py script is used to push data to a server in the event that you are not able to use the typical networking tools. In the script we: tcp_clinet.py
Note that this script makes numerous assumptions about the server we are engaging with:
The assumptions are made for simplicity's sake. All things considered, sometimes less is more.
Our udp_client.py script is much different from our tcp script, only that it it configured to send data via the user datagram protocol (but that much was obvious): udp_client.py
- We change the socket type to SOCK_DGRAM to indicate that we will be using sending data via the UDP (line 6).
- Also, notice that there is no connect() method beforehand, since we do not need to connect to a server beforehand using UDP. This is because UDP is a connectionaless protocol.
- The last step is to call the recvfrom() method to receive UDP data back. This returns both the data and the details of the remote host and port (line 9).
The tcp_server.py is just that, a multi-threaded python TCP server that we can use in the event we want to write a command shell or craft a proxy. tcp_server.py
- Firstly, we pass in the IP address and port we want the server to listen on (line 9).
- Next, we tell the server to simply start listening with a max backlog of connections set to 5 (line 10). Now ther server waits for a connection.
- Once the clinet connects, we get the client socket in the client variable and the remote connection details in teh address variable.
- We tehn start the thread to handle the client connection (line 17).
- The handle_client function performs rec() and then sens a simple message back to the client.