• If you need help or want to discuss things, you now can also join us on our Discord Server!

EN I need a captcha script for sinusbot.

MarcoTechno

Member
Hi, is it possible to create a captcha script? I mean, when a new user joins the server it gets a message from the bot with random letters and numbers. The user has to rewrite the letters and numbers to get a specific pex. Thanks!
 

Montiary

Donor
is awesome!
Contributor
ofc is it possible, i think the best way would be to use a math question and sticky client

if(n user joins) then (give sticky and ask question) if(answer right refuse sticky client)
 

Multivitamin

Well-Known Member
Tier III
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
This could easily be manipulated if a user targets a server directly unfortunately,
if you ask something like: Captcha Check, please solve this match problem: 4 + 1 then it could be easily bypassed with this code for example in a sinusbot script: https://jsfiddle.net/y6v5mkf7/1/
 

Montiary

Donor
is awesome!
Contributor
This could easily be manipulated if a user targets a server directly unfortunately,
if you ask something like: Captcha Check, please solve this match problem: 4 + 1 then it could be easily bypassed with this code for example in a sinusbot script: https://jsfiddle.net/y6v5mkf7/1/
every captcha can be bypassed also these with the fucking pictures xD

i just typed some code, tested only 1 time ->
Code:
registerPlugin({
    name: 'Montys Captcha Code',
    version: '0.1.0',
    description: 'Captcha Test',
    author: 'Montary',
    vars: [
                {
                    name: 'ShowLog',
                    indent: 1,
                    title: 'Show Logs?',
                    type: 'select',
                    options: ['NO','YES']
                },
                {
                    name: 'AffectedGroupId',
                    indent: 1,
                    title: 'The group who use the script',
                    type: 'number'
                },{
                    name: "MsgVerification",
                    title: "The verification message [quest] displays the math quest",
                    indent: 1,
                    type: "string"
                },{
                    name: "MsgWrongAnswer",
                    title: "MsgWrongAnswer",
                    indent: 1,
                    type: "string"
                },{
                    name: "MsgRightAnswer",
                    title: "MsgRightAnswer",
                    indent: 1,
                    type: "string"
                },{
                    name: "StickyGroupId",
                    title: "StickyGroupId",
                    indent: 1,
                    type: "number"
                }
            ]
            
}, (_, config, meta) => {
    const engine = require('engine');
    const store = require('store');
    const event = require('event');
    
    //setting var
    var AffectedGroups = config.AffectedGroups;
    var ShowLog = config.ShowLog;
    var MsgWrongAnswer = config.MsgWrongAnswer;
    var MsgRightAnswer = config.MsgRightAnswer;

    
    event.on('chat', function(ev) {
        
        var Message = ev.text;
        var Client = ev.client;
        var ClientGroups = Client.getServerGroups();
        if(Client.isSelf()){
            return;
        }
        for(var i = 0; i< ClientGroups.length;i++){
            if(ClientGroups[i].id()==config.AffectedGroupId){
                if(ShowLog){engine.log('Got message "'+ Message +'" from '+ Client.name());}
                
                if(Message == store.get(Client.uid()+"Sum")){
                    store.unset(Client.uid()+"Sum");
                    Client.removeFromServerGroup(config.StickyGroupId);
                    Client.chat(MsgRightAnswer);
                }else{
                    Client.chat(MsgWrongAnswer);
                }
            }
        }
    });
    
    event.on('clientMove', function(cm) {
        var Client = cm.client;
        var FromChannel = cm.fromChannel;
        var ClientGroups = Client.getServerGroups();
        
        if (typeof FromChannel == 'undefined' || FromChannel == '') {
            //joined
            for(var i = 0; i< ClientGroups.length;i++){
                if(ClientGroups[i].id()==config.AffectedGroupId){
                    Client.addToServerGroup(config.StickyGroupId);
                    
                    var random1 = Math.floor(Math.random() * Math.floor(20));
                    var random2 = Math.floor(Math.random() * Math.floor(20));
                    var opterator = "";
                    var rndOpterator = Math.floor(Math.random() * Math.floor(4));
                    
                    if(rndOpterator == 0){
                        opterator = "+";
                        store.set(Client.uid()+"Sum",""+(random1+random2));
                    }else if(rndOpterator == 1){
                                    opterator = "-";
                        store.set(Client.uid()+"Sum",""+(random1-random2));
                    }else if(rndOpterator == 2){
                                    opterator = "*";
                        store.set(Client.uid()+"Sum",""+(random1*random2));
                    }else if(rndOpterator == 3){
                                    opterator = "/";
                        store.set(Client.uid()+"Sum",""+(random1/random2));
                    }
                    
                    var textAnswer = ""+random1+opterator+random2;
                    Client.chat(config.MsgVerification.replace("[quest]",textAnswer));
                }
        }
        }
        
    });
});
 

Similar threads

Top