mirror of
https://github.com/autistic-symposium/sec-pentesting-toolkit.git
synced 2025-05-03 23:34:54 -04:00
socket scripts added
This commit is contained in:
parent
d01824f424
commit
ac171e1195
5 changed files with 159 additions and 7 deletions
|
@ -4,3 +4,31 @@ __author__ = "bt3"
|
|||
|
||||
|
||||
import socket
|
||||
|
||||
# Defining constants
|
||||
HOST = 'localhost'
|
||||
PORT = 9090
|
||||
DATA = 'GET / HTTP/1.1\r\nHost: google.com\r\n\r\n'
|
||||
|
||||
|
||||
def tcp_client():
|
||||
|
||||
# Create a socket object
|
||||
# AF_INET parameter: to use standard IPv4 address
|
||||
# SOCK_STREAM: to indicate tcp client
|
||||
client = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
# Connect the client
|
||||
client.connect(( HOST, PORT ))
|
||||
|
||||
# Send data
|
||||
client.send(DATA)
|
||||
|
||||
# Receive some data
|
||||
response = client.recv(4096)
|
||||
print response
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
tcp_client()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue