Last active
March 24, 2024 01:25
-
-
Save ps-jessejjohnson/a192b508fe48290284573a671bc1444d to your computer and use it in GitHub Desktop.
Nodejs (Somewhat) Random TLS Fingerprint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DEFAULT_CIPHERS } from 'tls'; | |
import https from 'https'; | |
const shuffler = (a, b) => 0.5 - Math.random(); | |
const defaultCiphers = DEFAULT_CIPHERS.split(':'); | |
const shuffledCiphers = [ | |
...defaultCiphers.slice(0, 2).sort(shuffler), | |
...defaultCiphers.slice(3).sort(shuffler) | |
].join(':'); | |
https.get('https://tls.peet.ws/api/all', { | |
ciphers: shuffledCiphers | |
}, (res) => { | |
res.setEncoding('utf8'); | |
console.log('statusCode:', res.statusCode); | |
console.log('headers:', res.headers); | |
res.on('data', (chunk) => { | |
console.log(chunk); | |
}); | |
}).on('error', (e) => { | |
console.error(e); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment