Giter VIP home page Giter VIP logo

ez-captcha's Introduction

EZ Captcha

A non-AI powered node.js library for solving GameFail's captcha.

Installation

yarn add @zakku/ez-captcha
# or
npm i @zakku/ez-captcha

Usage

To use this package you need two things:

  1. Captcha challenge id - Which you can retrieve by logging into the GameFail account and looking for gf-challenge-id header.
  2. A login method - An asynchronous function that returns: { requireCaptcha: boolean, id?: string } object.

Note: The id field needs to be present when requireCaptcha is equal to true

import {LoginCaptcha, SolveResult, solveCaptcha} from "@banzar-team/ez-captcha";

const login = (): Promise<LoginCaptcha> => {
    return fetch("https://spark.gameforge.com/api/v1/auth/sessions", {
        method: "POST",
        headers: {
            "TNT-Installation-Id": "<INSTALLATION_ID>",
        },
        body: JSON.stringify({
            email: "<EMAIL>",
            locale: "<LOCALE>",
            password: "<PASSWORD>",
        }),
    }).then((res) => {
        if (res.status === 409) {
            const challengeId = res.headers.get("gf-challenge-id");

            return {
                requireCaptcha: true,
                id: challengeId !== null ? challengeId.split(";")[0] : undefined,
            };
        } else return {requireCaptcha: false};
    });
};

(async () => {
    const result: SolveResult = await solveCaptcha("<CHALLENGE_ID>", login);
    console.log(result) // { id: "<DIFFRENT_OR_THE_SAME_CHALLENGE_ID>", solved: <TRUE/FALSE> }
})();

ez-captcha's People

Contributors

dependabot[bot] avatar zakuciael avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ez-captcha's Issues

Game Token is Not working now

Response: { error: { message: 'Not allowed to create code' } }

for your info:
API /api/v1/auth/thin/codes request payload updated:
{
platformGameAccountId: "",
blackbox: ""
}

And three API call before /api/v1/auth/thin/codes

  1. https://events2.gameforge.com/
{
	"client_installation_id": "",
	"client_locale": "",
	"client_session_id": "",
	"client_version_info": {
		"branch": "master",
		"commit_id": "636a4245",
		"version": "2.1.32.1206"
	},
	"game_account_id": "",
	"game_id": "",
	"id": 0,
	"localtime": "",
	"session_id": "",
	"start_option": "",
	"type": "game_started"
}
  1. https://events2.gameforge.com/
{
	"account_id": "",
	"client_installation_id": "",
	"client_locale": "",
	"client_session_id": "",
	"game_id": "",
	"id": 0,
	"localtime": "",
	"playtime_counter": 1,
	"playtime_session_id": "",
	"product": "nostale",
	"qwevent": "PLAYTIME_START",
	"type": "PLAYTIME_START",
	"user_id": ""
}
  1. https://events2.gameforge.com/
{
	"client_installation_id": "",
	"client_locale": "",
	"client_session_id": "",
	"email_hash": "",
	"game_account_id": "",
	"game_locale": "",
	"id": ,
	"localtime": "",
	"operating_system": "",
	"operating_system_version": "",
	"product": "nostale",
	"qwevent": "TNT_migration",
	"result": "success",
	"start_option": "",
	"type": "game_launch",
	"user_id": ""
}

Allow proxy configuration

It would be nice to be able to pass something like an https-proxy-agent (repo). The lib is using fetch as sending request method, wich allows an agent object in the second parameter. This would allow to keep the account we are trying to log in isolated from our public IP.

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.