-
Notifications
You must be signed in to change notification settings - Fork 157
/
client_hello_rsa.py
41 lines (34 loc) · 1.13 KB
/
client_hello_rsa.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Author : tintinweb@oststrom.com <github.com/tintinweb>
from __future__ import print_function
import sys
try:
import scapy.all as scapy
except ImportError:
import scapy
try:
# This import works from the project directory
from scapy_ssl_tls.ssl_tls import *
except ImportError:
# If you installed this package via pip, you just need to execute this
from scapy.layers.ssl_tls import *
import socket
if __name__ == "__main__":
if len(sys.argv) <= 2:
print ("USAGE: <host> <port>")
exit(1)
target = (sys.argv[1], int(sys.argv[2]))
# create tcp socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(target)
# create TLS Handhsake / Client Hello packet
p = TLSRecord() / TLSHandshakes(handshakes=[TLSHandshake() /
TLSClientHello(cipher_suites=[TLSCipherSuite.RSA_WITH_AES_128_CBC_SHA])])
p.show()
print ("sending TLS payload")
s.sendall(str(p))
resp = s.recv(1024 * 8)
print ("received, %d -- %s" % (len(resp), repr(resp)))
SSL(resp).show()
s.close()