Skip to content

Instantly share code, notes, and snippets.

@anthonykasza
Created August 9, 2018 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonykasza/60570f991be90f6c185e76d6f1fdecf2 to your computer and use it in GitHub Desktop.
Save anthonykasza/60570f991be90f6c185e76d6f1fdecf2 to your computer and use it in GitHub Desktop.
ClientHello Cloner
from scapy.all import *
import scapy_ssl_tls.ssl_tls as tls
import scapy_ssl_tls.ssl_tls_crypto as tlsc
import scapy_ssl_tls.ssl_tls_keystore as tlsk
packets = rdpcap('tls_example.pcap')
for packet in packets:
if packet.haslayer(tls.SSL):
eth = packet
ip = eth.payload
tcp = ip.payload
tls = tcp.payload
for record in tls.records:
if record.content_type == 22: # this is a handshake
handshakes = record.payload
for handshake in handshakes.handshakes:
if handshake.type == 1: # this is a clienthello
ch = handshake.payload
version = ch.version
cipher_suites = ch.cipher_suites
server_name = ''
alpn = ''
ec_p_f = ''
ec = ''
for ext in ch.extensions:
if ext.type == 0x00: #server_name
server_name = ext
if ext.type == 0x10: #alpn
alpn = ext
if ext.type == 0x0b: #ec_point_formats
ec_p_f = ext
if ext.type == 0x0a: #elliptic_cureves
ec = ext
print version, cipher_suites, server_name, alpn, ec_p_f, ec
@anthonykasza
Copy link
Author

feed a client and server script a ClientHello and ServerHello message. Have the client and server create TLS sessions which mimic common applications such as a browser and a web server to bypass TLS fingerprinting/whitelisting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment