Danny-Dasilva / CycleTLS

Spoof TLS/JA3 fingerprints in GO and Javascript
GNU General Public License v3.0
824 stars 164 forks source link

I would like to have the option to reuse the socket/connection for future requests. #111

Open HoodyStiliyan opened 2 years ago

HoodyStiliyan commented 2 years ago

Description

Basically, for example in nodejs I can make a new tls connection socket, get the alpn protocol the endpoint needs, then make a new http2.connect socket and feed the tls socket to it. Then I can reuse the connection for multiple requests. The problem that your amazing work solves is it lets me spoof the tls fingerprint, but at the cost of not having control over how the packets are sent.

I would like it there to be a way for me to get the connection socket of the request and feed it to my next request so I can reuse it.

An example of the behavior would be:

// getting the connection socket for later when I want to reuse it
const response = await cycleTLS('https://ja3er.com/json', {
    body: '',
    ja3: '771,4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49161-49171-49172-51-57-47-53-10,0-23-65281-10-11-35-16-5-51-43-13-45-28-21,29-23-24-25-256-257,0',
   socketCallback: socket => mySocket = socket
  }, 'get');

// feeding the socket instead of doing a tripple handshake per each request
const response = await cycleTLS('https://ja3er.com/json', {
    body: '',
    ja3: '771,4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49161-49171-49172-51-57-47-53-10,0-23-65281-10-11-35-16-5-51-43-13-45-28-21,29-23-24-25-256-257,0',
   socket: mySocket
  }, 'get');

Issue Type

Feature Request

Operating System

Windows 10, Linux, Mac OS

Node Version

Other

Golang Version

Other

Relevant Log Output

No response

Danny-Dasilva commented 2 years ago

Hey, I kinda understand what you mean but need some clarification and perhaps a better example. Are you asking me to implement TLS session based resumption for reuse (so we don't reuse a handshake) or do you have something else in mind? Your specific example (exposing the underlying network object) won't quite work like the example you provided in practice.

HoodyStiliyan commented 2 years ago

Yes, I wanted to have the option to reuse the TLS connection and send HTTP packets through it without having to essentially make a handshake for each request.

HoodyStiliyan commented 1 year ago

Any work on this?