Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

ssl socket python

import socket
import ssl

# SET VARIABLES
packet, reply = "<packet>SOME_DATA</packet>", ""
HOST, PORT = 'XX.XX.XX.XX', 4434

# CREATE SOCKET
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(10)

# WRAP SOCKET
wrappedSocket = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLSv1, ciphers="ADH-AES256-SHA")

# CONNECT AND PRINT REPLY
wrappedSocket.connect((HOST, PORT))
wrappedSocket.send(packet)
print wrappedSocket.recv(1280)

# CLOSE SOCKET CONNECTION
wrappedSocket.close()
Comment

PREVIOUS NEXT
Code Example
Python :: How to Get the Symmetric Difference of Sets in Python 
Python :: how to draw dendrogram in python 
Python :: geckodriver seleniunm setup 
Python :: python construct a string 
Python :: max in python 
Python :: python concatenate dictionaries 
Python :: task.loop discord.py 
Python :: remove last digit from number python 
Python :: how to split from a specific charecter to the end of the string in python 
Python :: numpy arange 
Python :: Changing default fonts in matploitlibrc file 
Python :: calendar library in python 
Python :: plot histogram from counts and bin edges 
Python :: package in python 
Python :: reading files in python 
Python :: concatenacion python 
Python :: random number generator python 
Python :: python cat 
Python :: .replace python 
Python :: urllib_errors 
Python :: python increment 
Python :: zip function python 
Python :: operator.itemgetter(1) in python 
Python :: how to create a 2d array in python 
Python :: python dynamic variable name 
Python :: randint 
Python :: numpy array [-1] 
Python :: alphabet 
Python :: convert method to str python 
Python :: remove rows from dataframe 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =