Plugin Login Control for 24hBlock

I made a plugin for 24hBlock.

Added interface, number of blocked accounts can be checked quickly.

Just copy it into the …\Plugins folder. If it is blocked by the server, the 24-hour countdown will start automatically and it will continue to try when the countdown is over.
No interference will be allowed in the Phbot interface during the countdown.

Since this plugin has too many queue attempts due to excessive density on (US) servers, the account will be blocked for 24 hours when the account cannot enter the queue after 100 attempts.
The advantage of this plugin is that it does not make the accounts that are blocked on the server need to be logged in again and again.

3 Likes

language english
https://raw.githubusercontent.com/EzKime/LoginControl/main/LoginControlEnglish.py

For the plugin to work correctly, the ip address must be unblocked.

from phBot import *
import time
import struct
import sqlite3
from datetime import datetime
from datetime import timedelta
import QtBind
import random

pName = 'Login Control English'
pVersion = '0.0.9'
gui = QtBind.init(__name__, pName)
created = QtBind.createLabel(gui, 'By EzKime', 670, 297)

userName = get_startup_data()['username']
query = ("""SELECT * FROM LoginControl WHERE userName='%s'""" % userName)
maxCount = 100
minSec = 60
block1 = 60
block24 = 1440
dataBase = get_config_dir() + "AccountLoginControl.db3"
con = sqlite3.connect(dataBase)
cur = con.cursor()
cur.execute('CREATE TABLE IF NOT EXISTS "LoginControl" ("Id" INTEGER NOT NULL, "userName" TEXT NOT NULL,"loginCount" INTEGER NOT NULL,"blockingTime" TEXT,"blockType" INTEGER,"blockCount" INTEGER,"MaxQueue" INTEGER,"logCount" INTEGER, PRIMARY KEY("Id"))')
con.commit()
con.close()

lblInfo = QtBind.createLabel(gui, f'The number of attempts is set to {maxCount}.'
                                  '\nIt will try to queue until it is blocked by the server.'
                                  '\nIf it is blocked by the server, it will be blocked for 24 hours.'
                                  '\nIn this case if he keeps trying the ip will be blocked'
                                  '\nSince this plugin has too many queue attempts due to excessive'
                                  '\ndensity on (US) servers,'
                                  '\nthe account will be blocked for 24 hours when the account cannot'
                                  '\nenter the queue after 100 attempts.'
                                  '\nThe advantage of this plugin is that it does not make the accounts'
                                  '\nthat are blocked on the server need to be logged in again and again.', 350, 50)





blockAcc = QtBind.createLabel(gui, 'Blocked Accounts', 60, 35)
Display = QtBind.createList(gui, 9, 50, 180, 240)
check = QtBind.createButton(gui, 'check', ' Check ', 205, 50)
blokeAcc = "SELECT * FROM LoginControl where Id>0 ORDER by blockingTime ASC"
def check():
    count = 0
    conn = sqlite3.connect(dataBase)
    curs = conn.cursor()
    curs.execute(blokeAcc)
    accounts = curs.fetchall()
    QtBind.clear(gui, Display)
    QtBind.append(gui, Display, '       Minute   +  Accounts')
    dateTime = datetime.now()
    for account in accounts:
        blockingTime = datetime.fromisoformat(account[3])
        if account[5] > 0 and blockingTime > dateTime:
            count += 1
            dateTime = datetime.now()
            min = int((blockingTime - dateTime).seconds / 60)
            result = f'{count} - {min}-Min---{account[1]}'
            QtBind.append(gui, Display, result)


def connected():
    conn = sqlite3.connect(dataBase)
    curs = conn.cursor()
    curs.execute(query)
    accData = curs.fetchone()
    blockType = accData[4]
    blockCount = accData[5]
    dateTime =  datetime.now()
    blockingTime = datetime.fromisoformat(accData[3])
    if blockType == 1 and blockCount == 1 and blockingTime > dateTime:
        minutes = int((blockingTime - dateTime).seconds / minSec)
        countDown(minutes, blockCount)
    elif blockType == 1 and blockCount == 2 and blockingTime > dateTime:
        minutes = int((blockingTime - dateTime).seconds / minSec)
        countDown(minutes, blockCount)
    elif blockType == 1 and blockCount == 1 and blockingTime < dateTime:
        unBlock()
    elif blockType == 1 and blockCount == 2 and blockingTime < dateTime:
        reset()
    elif blockCount == 3 and blockingTime > dateTime:
        minutes = int((blockingTime - dateTime).seconds / minSec)
        countDown(minutes, blockCount)
    elif blockCount == 3 and blockingTime < dateTime:
        reset()
def countDown(minutes, blockCount):
    log(f' The {minutes}-minute countdown begins..')
    log(str(blockCount)+' reason for blocking.')
    if minutes <= 2880 and blockCount >= 2:
        while range(minutes):
            dateTime = datetime.now()
            conn = sqlite3.connect(dataBase)
            curs = conn.cursor()
            curs.execute(query)
            userData = curs.fetchone()
            if userData[6] > 0 and userData[5] != 3:
                curs.execute("Update LoginControl Set loginCount = '%s', blockingTime = '%s', blockType = %s, blockCount = %s, MaxQueue = %s  WHERE userName='%s' " % (30, dateTime, 0, 1, 0, userName))
                conn.commit()
                conn.close()
                log('>>>Reconnect on disconnect<<< must be active')
                log("There was a sudden drop in the server status. 5 attempts can be made. If the queue is not entered, it will be put back to sleep for 24 hours.")
                break
            minutes -= 1
            log(f"It will be unblocked after {minutes} minutes. block reason {blockCount}")
            time.sleep(minSec)
            if minutes < 1:
                reset()
    elif minutes <= 120 and blockCount == 1:
        while range(minutes):
            dateTime = datetime.now()
            conn = sqlite3.connect(dataBase)
            curs = conn.cursor()
            curs.execute(query)
            userData = curs.fetchone()
            if userData[6] > 0 and userData[5] != 3:
                curs.execute("Update LoginControl Set loginCount = '%s', blockingTime = '%s', blockType = %s, blockCount = %s, MaxQueue = %s  WHERE userName='%s' " % (30, dateTime, 0, 1, 0, userName))
                conn.commit()
                conn.close()
                log('>>>Reconnect on disconnect<<< must be active')
                log('There was a sudden drop in the server status. 5 attempts can be made. If the queue is not entered, it will be put to sleep for 60 minutes again.')
                break
            minutes -= 1
            log(f"It will be unblocked after {minutes} minutes. block reason {blockCount}")
            time.sleep(minSec)
            if minutes < 1:
                unBlock()

def unBlock():
    dateTime = datetime.now()
    conn = sqlite3.connect(dataBase)
    curs = conn.cursor()
    curs.execute("Update LoginControl Set loginCount = %s, blockingTime = '%s', blockType=%s, MaxQueue=%s  WHERE userName='%s' " % (0, dateTime, 0, 0, userName))
    conn.commit()
    conn.close()
    log('The countdown is over.')


def reset():
    dateTime = datetime.now()
    conn = sqlite3.connect(dataBase)
    curs = conn.cursor()
    curs.execute("Update LoginControl Set loginCount = %s, blockingTime = '%s', blockType=%s, blockCount=%s, MaxQueue=%s, logCount =%s  WHERE userName='%s' " % (0, dateTime, 0, 0, 0, 0, userName))
    conn.commit()
    conn.close()
    log('The character has entered the game. Status Reset.')

def block24h():
    blockingTime = datetime.now() + timedelta(minutes=block24)
    conn = sqlite3.connect(dataBase)
    curs = conn.cursor()
    curs.execute("Update LoginControl Set blockingTime = '%s', blockCount=%s WHERE userName='%s' " % (blockingTime, 3, userName))
    conn.commit()
    conn.close()
    log('The account has been blocked by the server. 24 hours blocked. Block reason 3')

def updateAccount():
    dateTime = datetime.now()
    conn = sqlite3.connect(dataBase)
    curs = conn.cursor()
    curs.execute(query)
    userData = curs.fetchone()
    # If the record is entered for the first time, it will be entered here.
    if userData is None:
        sql = "INSERT into LoginControl(userName, loginCount, blockingTime, blockType, blockCount, MaxQueue, logCount) VALUES (?,?,?,?,?,?,?)"
        val = (userName, 1, dateTime, 0, 0, 0, 1)
        curs.execute(sql, val)
        conn.commit()
        conn.close()
        log("Character information has been successfully added to the database")
    elif userData[2] >= maxCount:
        blockCount = userData[5]
        if blockCount == 0:
            blockingTime = datetime.now() + timedelta(minutes=block1)
            curs.execute("Update LoginControl Set blockingTime = '%s', blockType=%s, blockCount=%s  WHERE userName='%s' " % (blockingTime, 1, 1, userName))
            conn.commit()
            conn.close()
            log(f'The attempt to enter the queue failed. Queue attempt reached {userData[2]}, temporarily blocked for 60 minutes. If there is a sudden drop in the server, 5 attempts will be given if the Queue is <850.')
        elif blockCount == 1:
            blockingTime = datetime.now() + timedelta(minutes=block24)
            curs.execute("Update LoginControl Set blockingTime = '%s', blockType=%s, blockCount=%s  WHERE userName='%s' " % (blockingTime, 1, 2, userName))
            conn.commit()
            conn.close()
            log(f'The attempt to enter the queue failed. This is the 2nd try. Queue attempt reached {userData[2]}, temporarily blocked for 1440 minutes. If there is a sudden drop in the server, 5 attempts will be given if the Queue is <850.')
    elif userData[2] < maxCount:
        loginCount = userData[2]
        logCount = userData[7]
        blockCount = userData[5]
        loginCount += 1
        logCount += 1
        log(f'Queuing attempt {loginCount} will be stopped when attempt {maxCount} is reached. This is stage {blockCount+1}. Total attempts {logCount}')
        curs.execute("Update LoginControl Set loginCount = %s, logCount=%s WHERE userName='%s' " % (loginCount, logCount, userName))
        conn.commit()
        conn.close()
        dk = random.randint(2, 5)
        while range(dk):
            log(f'{dk} There will be a retry in minutes.')
            dk -= 1
            time.sleep(60)


def handle_joymax(opcode, data):
    bloke =  'Your account is blocked for 24 hours due to repeated login attempts. Please try again when your account is unblocked.'
    bloke24 = str(data)
    if opcode == 0xA10A and bloke in bloke24:
        log('You have been blocked by the server for 24 hours. :( ')
        block24h()
    elif opcode == 0xA10A and data == b'\x02\x1c':
        updateAccount()
    # When the character logs into the game.
    elif opcode == 0xA103 and data == b'\x01\x03\x00':
        reset()
    return True

log(f'Plugin: {pName} Version {pVersion} Loaded')
1 Like

how it work

In order for this to take effect immediately, reconnect on disconnect must be active.

manager.exe is also disabled so it has to be selected manually

Since there is a sudden drop in the server, the phbot needs to try immediately, otherwise the server will be full again in 1-2 minutes. server queue < 850

Updated
The number of attempts is set to 99.
It will try to queue until it is blocked by the server.

2 Likes

Very strange plugin. What is its usefulness in daily use or control?

In accounts that are temporarily blocked by the server, the manager has to restart constantly. which solves the problem 95% of the time.

keep good work

it say [19:07:19] It will be unblocked after 982 minutes. block reason 3
but account not block i try login in normal Client it’s not Blocked yet

Did you tamper with the database?

The newly installed plugin calculates previously blocked accounts as if they are currently blocked.
if it is blocked while performing a queue test, the plugin records it as 24 hours. then there will be no problem.

no
something wrong happen
[10:56:15] Connecting to the gateway server [110.234.18.129:15779]

[10:56:16] Connected

[10:56:17] Server capacity [Theia] [Full]

[10:56:19] Login: Sending login credentials

[10:56:25] Login: Secondary passcode has been entered successfully

[10:56:25] Standby list is full

[10:56:25] Queuing attempt 11 will be stopped when attempt 99 is reached. This is stage 1. Total attempts 11
and stop i back home after 2h found like that and have to restat bot and retry

I myself have not encountered this kind of error.

It does not prevent phbot from connecting, only the job of the plugin is to calculate the Standby list is full, and then to start a 24-hour countdown if there is a 24hBlock process by the server.

hocam harika sorunsuz calısıyo ve benı bı cok sıkıntıdan kurtardı eline emegıne saglık

1 Like

hello ! thanks to helpings for us
i interested about some subject

if i upload this plugins , i can live hack,trojen problems
idk anything
i just asking about danger plugins