GithubHelp home page GithubHelp logo

anandvc / funcaptcha Goto Github PK

View Code? Open in Web Editor NEW

This project forked from noahcoolboy/funcaptcha

0.0 0.0 0.0 774 KB

A library used to interact with funcaptchas.

License: MIT License

JavaScript 54.40% TypeScript 45.60%

funcaptcha's Introduction

funcaptcha

A library used to interact with funcaptchas.

Installation

This package is available on npm.
Simply run: npm install funcaptcha

Usage And Documentation

Require the library like any other

const fun = require("funcaptcha")

You must first fetch a token using getToken

const token = await fun.getToken({
    pkey: "476068BF-9607-4799-B53D-966BE98E2B81", // The public key
    surl: "https://roblox-api.arkoselabs.com", // OPTIONAL: Some websites can have a custom service URL
    data: { // OPTIONAL
        blob: "blob" // Some websites can have custom data passed: here it is data[blob]
    },
    headers: { // OPTIONAL
        // You can pass custom headers if you have to, but keep
        // in mind to pass a user agent when doing that
        "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36'
    },
    site: "https://www.roblox.com", // OPTIONAL: The site parameter, usually not required
    proxy: "http://127.0.0.1:8888" // OPTIONAL: A proxy to fetch the token, usually not required
    // NOTE: The proxy will only be used for fetching the token, and not future requests such as getting images and answering captchas
})

You can then create a new session

// Token, in this case, may either be a string (if you already know it) or an object you received from getToken (it will strip the token out of the object)
const session = new fun.Session(token, {
    proxy: "http://127.0.0.1:8888", // OPTIONAL: A proxy used to get images and answer captchas, usually not required
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36" // OPTIONAL: Custom user agent for all future requests
})

// If you would like to let a user solve the captcha in their browser
// NOTE: Embed URLs will not work unless put in an iframe.
console.log(session.getEmbedUrl())

One session can get you 10 funcaptcha challenges, you will have to get another session after that.

let challenge = await session.getChallenge()
// Please view https://pastebin.com/raw/Gi6yKwyD to see all the data you can find 
console.log(challenge.data.game_data.game_variant)
console.log(challenge.data.game_data.customGUI.api_breaker)

// You can then use these functions
await challenge.getImage()

// For game type 1, where you have to rotate a circle to put the image in the correct orientation
// In this game type, the angle increment can vary. It can be found with challenge.increment
await challenge.answer(3) // Usually 0-6, but can be 0-5 or 0-6 depending on challenge.increment (clockwise)
await challenge.answer(51.4) // You can input the raw angle as well (clockwise, negative for counter clockwise)

// For game type 3, where you have to pick one of 6 tiles
await challenge.answer(2) // 0-5, please see https://github.com/noahcoolboy/roblox-funcaptcha/raw/master/img.gif

Full Example

const fs = require("fs")
const fun = require("funcaptcha")
const readline = require("readline")
let rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})

function ask(question) {
    return new Promise((resolve, reject) => {
        rl.question(question, (answer) => {
            resolve(answer)
        })
    })
}

fun.getToken({
    pkey: "69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC",
}).then(async token => { 
    let session = new fun.Session(token)
    let challenge = await session.getChallenge()
    console.log(challenge.data.game_data.game_variant)
    console.log(challenge.data.game_data.customGUI.api_breaker)
    
    for(let x = 0; x < challenge.data.game_data.waves; x++) {
        fs.writeFileSync(`${x}.gif`, await challenge.getImage())
        console.log(await challenge.answer(parseInt(await ask("Answer: "))))
    }
    console.log("Done!")
})

funcaptcha's People

Contributors

dependabot[bot] avatar devlzcode avatar kelvinouo avatar noahcoolboy 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.