request, bad login notify
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

request, bad login notify

Started by Dumledude, 15 June, 2005, 02:15:44

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dumledude

Hi
I have a small request for a script, would do it myself but i have no lua skills what so ever =/

So i want the script to drop a message in mainchat everytime anyone fails to login to the hub, like when a nonregistered user connects he gets "for registered users. and so on", i would like the bot to drop a message in main with his ip/nick and time. ( only visible for ops if possible, if not bah not so important ) and so on like

Ip 666.555.24.654 Nick: (if visible) Count: 1

Somethig like this? if this is not too hard. Don't want to be a pain ;)

Now im runnig,
PtokaX DC Hub 0.3.3.1
RoboCopv10.01e
/Tian

Dessamator

so ur hub is a reg only hub and u want the script to notify you when an unreg user tries to login?
Ignorance is Bliss.

Dumledude

QuoteOriginally posted by Dessamator
so ur hub is a reg only hub and u want the script to notify you when an unreg user tries to login?

Yes

blackwings

QuoteOriginally posted by tian
QuoteOriginally posted by Dessamator
so ur hub is a reg only hub and u want the script to notify you when an unreg user tries to login?

Yes
you would get loads of spam by doing that, why would you want that?


Dumledude

QuoteOriginally posted by blackwings
QuoteOriginally posted by tian
QuoteOriginally posted by Dessamator
so ur hub is a reg only hub and u want the script to notify you when an unreg user tries to login?

Yes
you would get loads of spam by doing that, why would you want that?

Well im not so concerned about the spam, but i just want a message when a unreg tries to connect, just want to know when someone tries to connect.

Dessamator

#5
well, something like this might work :

function SupportsArrival(user, data)
	if not user.bRegistered then
		SendToOps("botname",user.sName.."with"..user.sIP.." was not registered and tried to login")
	end	
end
Ignorance is Bliss.

Dumledude

Hi, Thank you, works great.

// Tian

Dessamator

QuoteOriginally posted by tian
Hi, Thank you, works great.

// Tian

ur welcome !
Ignorance is Bliss.

Dumledude

#8
okay the scripts works fine, but just a thought i have, is is possible to add an exception/silent/skip list?

if ip 111.111.24.66 tries to login but that ip is on the exception list, the bot will just ignore it and don't notify anyone at all?

Edit, not looking for anything fancy, i mean it's enough if im able to add ip's just right to the script file, do a scriptrestart and eveything will be a-okay

Dessamator

yep its possible, do u want to add by editing the script or through a cmd ?
Ignorance is Bliss.

Dumledude

QuoteOriginally posted by Dessamator
yep its possible, do u want to add by editing the script or through a cmd ?

i would prefer a cmd, but as i said if it's too much work it just as fine just editing the script by hand.

/ Tian

Dessamator

#11
sorry, it took so much time, only recently i saw this post !
anyways here it goes :

-- Unreg Alert v1
-- By Dessamator

function Main()
	tImmune ={}
	if io.open("immune.tbl") then dofile("immune.tbl") end
end

function OnExit()
	SaveToFile("immune.tbl" , tImmune , "tImmune")
end

function ValidateNickArrival(user, data)
	if not user.bRegistered and not tImmune[user.sIP] then
		SendToOps("botname",user.sName.." with "..user.sIP.." was not registered and tried to login")
	end
end

function ChatArrival(user,data)
data=string.sub(data,1,-2)
local s,e,cmd = string.find(data,"%b<>%s+(%S+)")
local _,__,ip = string.find(data,"%b<>%s+%S+%s+(%S+)")
	if cmd =="!immune" then
		tImmune[(ip)] = 1 
	user:SendData(frmHub:GetHubBotName(),"Done!, that ip has been immuned")
	return 1
	elseif cmd =="!delimmune" then
		tImmune[(ip)] = nil
	user:SendData(frmHub:GetHubBotName(),"Done!, that ip is no longer immune")
	return 1
	elseif cmd=="!showimmune" then
		local temp="\r\n\t\Immuned IPs:\r\n"..string.rep("??",12).."\r\n"
		for i,v in tImmune do
			temp=temp.."\t•"..i.."\r\n"
		end
	user:SendData(frmHub:GetHubBotName(),temp)
	return 1
	end
end


function Serialize(tTable, sTableName, sTab)
        assert(tTable, "tTable equals nil");
        assert(sTableName, "sTableName equals nil");

        assert(type(tTable) == "table", "tTable must be a table!");
        assert(type(sTableName) == "string", "sTableName must be a string!");

        sTab = sTab or "";
        sTmp = ""

        sTmp = sTmp..sTab..sTableName.." = {\n"

        for key, value in tTable do
                local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);

                if(type(value) == "table") then
                        sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
                else
                        local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
                        sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
                end

                sTmp = sTmp..",\n"
        end

        sTmp = sTmp..sTab.."}"
        return sTmp
end

function SaveToFile(file , table , tablename)
	local handle = io.open(file,"w+")
         handle:write(Serialize(table, tablename))
	handle:flush()
         handle:close()
end
Ignorance is Bliss.

Dessamator

#12
hmm, indeed forgot 1 small bit hehe, bad copying
thnx for the hint mutor, :)
Ignorance is Bliss.

Dessamator

#13
well tis fate, b4 i had less than required now i have more, lets hope i got it just right this time,  thnx again
Ignorance is Bliss.

Dumledude

Hi
and thank you soo much for the script, works great! =) Thank you!

// Tian

Dessamator

Ignorance is Bliss.

Loading

hello ppl
i have a question can you make this script

just to detect who try to enter whinthout the min.slots ,
 min. share , min. client ?

and send a pm to masters and netfounders ?



best regards

Loading

kunal

seems there is some error in the script
even if a user is regged it sends a msg to ops

Dessamator

hmm, make sure the user is registered, it should work without probs
Ignorance is Bliss.

kunal

ya m8 i checked it couple of times. my hub is only for reg users .any reg user can connect correctly but the script sends a msg to ops that he is unregged

Dessamator

QuoteOriginally posted by kunal
ya m8 i checked it couple of times. my hub is only for reg users .any reg user can connect correctly but the script sends a msg to ops that he is unregged

Done, u were right after all .
Ignorance is Bliss.

kunal

now it isnt sending a msg to ops if a user is not regged and tries to login

Dessamator

#22
I just tested the script, and i noticed that there was a bug to begin with, the user will always be unregistered(unknown) ,because of the arrival im using.

The only arrival that could help with that would be ValidateNick arrival, but it seems that ptokax doesnt allow any info to be sent by it, probably because bandwith purposes.
Ignorance is Bliss.

Dessamator

and failed miserably.
Ignorance is Bliss.

SMF spam blocked by CleanTalk