Skip to content

Instantly share code, notes, and snippets.

@ps-jessejjohnson
Last active March 24, 2024 01:25
Show Gist options
  • Save ps-jessejjohnson/a192b508fe48290284573a671bc1444d to your computer and use it in GitHub Desktop.
Save ps-jessejjohnson/a192b508fe48290284573a671bc1444d to your computer and use it in GitHub Desktop.
Nodejs (Somewhat) Random TLS Fingerprint
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