Giter Site home page Giter Site logo

yuezimoe / node-libcurl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ossianaa/node-libcurl

0.0 0.0 0.0 36.62 MB

node-libcurl is a request library that mimics chrome ja3 fingerprints

Home Page: https://www.npmjs.com/package/@ossiana/node-libcurl

License: MIT License

JavaScript 4.56% C++ 20.66% Python 1.37% C 60.62% TypeScript 12.38% Makefile 0.40%

node-libcurl's Introduction

node-libcurl

Different with Nodejs fetch api

  • The fingerprint can be customized to look like chrome or firefox ,it modified the BoringSSL extension, set the custom cipher suite with Libcurl

Attention by custom ja3 fingerprint!!!

  • ssl support for node-libcurl is provided by boringssl
  • boringssl does not provided the following support
    1. extension support group only support [P-256, P-384, P-521, X25519], but the library was modified to provide dummy support groups, like [ffdhe2048, ffdhe3072] (ja3 is 256,257). if you use them, it may cause an SSL connection error. This depends on whether the server selects these two support groups
    1. ec_point_format (ja3 is ...,0-1-2) only support 0 (uncompressed)
    1. extensions only support (ja3)[0, 65037, 23, 65281, 10, 11, 35, 16, 5, 13, 13172, 18, 30032, 14, 51, 45, 42, 43, 44, 57, 65445, 27, 34, 17513, 28, 41]

support

Build Status

Platform Support
Windows (x64) Yes
Windows (x86) No
Windows (arm) No
Ubuntu (x86_64) Yes
MacOS (x86_64) Yes
MacOS (arm64) No

How to build

npm i -g @ossiana/node-libcurl


Use Sample

import

import { LibCurl, fetch, requests } from '@ossiana/node-libcurl'

browser fetch style

fetch("https://xxx.io/api/graphql/").then(e => e.json())

requests style

const session = requests.session();

session.setCookie('ua', '123=/1a', '.baidu.com', '/');

const res = await session.get('https://www.baidu.com', {
    headers: {
        "user-Agent": "1"
    }
});
console.log(res.headersMap);
console.log(session.getCookiesMap().get('ua'));
console.log(res.text);

winhttp style

const curl = new LibCurl();
curl.open('POST', 'https://xxx.io/api/graphql/');
curl.setRequestHeaders(`Host: xxx.io
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Content-Type: application/octet-stream
Referer: https://xxx.io/
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
`);
curl.send(new Uint8Array([1, 255, 188]))
    .then(e => {
        console.log(curl.getResponseString());
    });

node-libcurl's People

Contributors

ossianaa avatar haozi23333 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.