Skip to content

Instantly share code, notes, and snippets.

@ylmrx
Created October 1, 2018 15:47
Show Gist options
  • Save ylmrx/5aa4c25ad310553779a0b38ed0c88d08 to your computer and use it in GitHub Desktop.
Save ylmrx/5aa4c25ad310553779a0b38ed0c88d08 to your computer and use it in GitHub Desktop.
am i a fox?
from __future__ import print_function
import sys
import scapy
from scapy_ssl_tls.ssl_tls import *
import socket
if __name__ == "__main__":
ciphers = {
'ff': [0x1301, 0x1303, 0x1302, 0xc02b, 0xc02f, 0xcca9, 0xcca8, 0xc02c, 0xc030, 0xc013, 0xc014, 0x002f, 0x0035, 0x000a],
'ch': [0x0a0a, 0xc02b, 0xc02f, 0xc02c, 0xc030, 0xcca9, 0xcca8, 0xc013, 0xc014, 0x009c, 0x002f, 0x0035, 0x000a]
}
if len(sys.argv) <= 3:
print("usage: <host> <port> [ff|ch]")
exit(1)
target = (sys.argv[1], int(sys.argv[2]))
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(target)
p = TLSRecord(version = "TLS_1_2") / TLSHandshakes(handshakes=[TLSHandshake() /
TLSClientHello(version="TLS_1_2",
compression_methods=list(range(0xff)),
cipher_suites=ciphers[sys.argv[3]])])
p.show
print(hexdump(p))
print("Sending TLS PAyload")
s.sendall(str(p))
resp = s.recv(1024 * 8)
print("Received, %s" % repr(resp))
SSL(resp).show()
s.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment