Comments (5)
Hi,
For the most part this should work out of the box. Do something like that:
pkt = TLSRecord() / TLSHandshake() / TLSClientHello(version=TLSVersion.TLS_1_2, extensions=[TLSExtension() / TLSExtRenegotiationInfo()])
with TLSSocket(socket.socket(), client=True) as s:
s.connect(("127.0.0.1", 8443))
s.sendall(pkt)
r = s.recvall()
r[TLSServerHello].extensions[0].show()
Will output:
###[ TLS Extension ]###
type= renegotiation_info
length= 0x1
###[ TLS Extension Renegotiation Info ]###
length= 0x0
data= ''
Just continue the full handshake as examplified in examples/full_rsa_connection_with_application_data.py
, but after sending a few bytes of payload, send a new client hello with the verify_data set in the renegotiation_info extension.
Ciphers can be specified at TLSClientHello
time, as well as ECs through the use of extensions:
TLSClientHello(cipher_suites=TLSCipherSuite.ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, extensions=[TLSExtension() / TLSExtEllipticCurves(elliptic_curves=TLSEllipticCurve.SECP521R1), TLSExtension() / TLSExtECPointsFormat(ec_point_formats=TLSEcPointFormat.UNCOMPRESSED)]).show2()
###[ TLS Client Hello ]###
version= TLS_1_0
gmt_unix_time= 1476220482
random_bytes= '\x9d\xbc\xd9\x84\xa5\xe9\x1d\x9b7-\xbeN\xc7h+:1\xf1\xe5Y}\xee\x89\xdb\x87KZK'
session_id_length= 0x0
session_id= ''
cipher_suites_length= 0x2
cipher_suites= ['ECDHE_ECDSA_WITH_AES_128_CBC_SHA256']
compression_methods_length= 0x1
compression_methods= ['NULL']
extensions_length= 0xe
\extensions\
|###[ TLS Extension ]###
| type= supported_groups
| length= 0x4
|###[ TLS Extension Elliptic Curves ]###
| length= 0x2
| elliptic_curves= ['secp521r1']
|###[ TLS Extension ]###
| type= ec_point_formats
| length= 0x2
|###[ TLS Extension EC Points Format ]###
| length= 0x1
| ec_point_formats= ['uncompressed']
Now for the issues ;):
- verify_data is not exposed in the TLSSessionCtx, meaning that you'll have a hard time getting a hold of it. I'll fix that once #73 is merged.
- All this would be way easier if
do_handshake()
accepted an extension argument. I'll add that in the same PR
Hope that helps with the general flow.
from scapy-ssl_tls.
Thanks very much for the response.
I will keep watching for the #73 merger.
from scapy-ssl_tls.
Hi @mukundamj,
#73 has been merged. I'll have a look into addressing this. You can follow progress on renegotiation branch if interested.
Alex
from scapy-ssl_tls.
OK, so this is way more complicated then I initially thought. I've got this working until the second symmetric encryption kicks in. So master-secret and symmetrical keys are re-negotiated OK.
For this to work fully, I'd have to split the _process
function into a client and a server state machine like construct. I don't have time to do this major work right now, so I'll be putting this on hold.
Sorry, this will have to wait a bit.
If you want to play with the half backed solution, you can checkout the renegotiation branch. It's hacky though.
from scapy-ssl_tls.
Thanks Alex. I will try if I can figure out something in the renegotiation branch.
from scapy-ssl_tls.
Related Issues (20)
- Trying to Encrypt and Decrypt the communication between Client and Server using Modbus/TCP protocol.
- How to send raw data in tls? HOT 3
- Bad record mac when using ECDHE_RSA_WITH_AES_256_CBC_SHA384 cipher
- Missing os import
- How to create the Certificate Status message from the server? Any examples would be appreciated. HOT 1
- 2.0.0 server_rsa.py quit with error HOT 1
- TLSSessionCtx support for DTLS
- how to generate completely arbitrary messages HOT 1
- TLS 1.3 support HOT 2
- Pip Install Error HOT 4
- Feature: How to analyse statemachines using scapy-ssl_tls?
- UserWarning: Verification of GCM tag failed: MAC check failed HOT 1
- Documentation is sparse HOT 1
- Feature request: Implement please SSLKEYLOG decryption HOT 5
- Handling of curve25519 and curve448 ServerKeyExchange
- Pip Install Error HOT 4
- any guide for gmtls?
- Error Loading module scapy.layers.ssl_tls
- Getting Error 'ssl_tls_registry' not found
- Cryptographic API Misuse Vulnerability
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scapy-ssl_tls.