Selfreg script
 

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

Selfreg script

Started by NemeziS, 17 September, 2004, 11:39:19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

NemeziS

Hello!

Wanted a selfreg script.

If writing !reg+password  or !regme+password, user

become a registered user. I wanted everyone can register himself.

Who can help me? =)
--LUA forever! =)

[UK]Madman

--Requested by Cp6uja
--Made by nErBoS

sBot = "Reg-Bot"

function Main()
	frmHub:RegBot(sBot)
end

function DataArrival(user, data)
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
		data = strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd == "!regme" or cmd =="!reg") then
			local s,e,pass = strfind(data, "%b<>%s+%S+%s+(%S+)")
			if (pass == nil) then
				user:SendPM(sBot, "Syntax Error, !regme  or !reg , you must write a password.")
			else
				AddRegUser(user.sName, pass, 3)
				SendToOps(sBot, "The user "..user.sName.." has regiter himself.")
				user:SendPM(sBot, "You have been successufly registered with the pass: "..pass)
				user:SendPM(sBot, "Please reconnect and type your password.")
			end
			return 1
		end
	end
end


posted by Nerbos, just added !reg as a command so either !regme or !reg will work.

NemeziS

thank you very much! =)
--LUA forever! =)

NotRabidWombat

do NOT use that script.
It does not validate the username or password!!!

if(strfind(pass, "[%c|\n\r]")) then
   -- invalid password, kick/drop or whatever
   return;
end

if(strfind(user.sName, "[%c|\n\r]")) then
   -- invalid usename, kick/drop or whatever
   return;
end

Not doing this leaves your hub vulnerable to an exploit!!!

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

Psycho_Chihuahua

do you mean something like this (i know its full of bugs, just an example - no time to test)

--Requested by Cp6uja
--Made by nErBoS

sBot = "Reg-Bot"

function Main()
	frmHub:RegBot(sBot)
end

function DataArrival(user, data)
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
		data = strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd == "!regme" or cmd =="!reg") then
			local s,e,pass = strfind(data, "%b<>%s+%S+%s+(%S+)")
			elseif (strfind(pass, "[%c|\n\r]")) then
			elseif  (strfind(user.sName, "[%c|\n\r]")) then
			sUser:Disconnect() 
			SendPmToNick(sBot, Invalid Password. Please try again)
 			elseif (pass == nil) then
				user:SendPM(sBot, "Syntax Error, !regme  or !reg , you must write a password.")
			else
				AddRegUser(user.sName, pass, 3)
				SendToOps(sBot, "The user "..user.sName.." has regiter himself.")
				user:SendPM(sBot, "You have been successufly registered with the pass: "..pass)
				user:SendPM(sBot, "Please reconnect and type your password.")
			end
			return 1
		end
	end
end
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

nErBoS

Hi,

Thans RW for the warning. Fixed...

--## Self Register 1.0
--## Requested by Cp6uja
--## Secure Pass and Nick (thanks to RabidWombat) 
--## Made by nErBoS
--## Commands;
--##	!regme or !reg  - Register the user who uses the command

sBot = "Reg-Bot"

function Main()
	frmHub:RegBot(sBot)
end

function DataArrival(user, data)
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
		data = strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd == "!regme" or cmd =="!reg") then
			local s,e,pass = strfind(data, "%b<>%s+%S+%s+(%S+)")
			if (pass == nil) then
				user:SendPM(sBot, "Syntax Error, !regme  or !reg , you must write a password.")
			elseif (strfind(pass, "[%c|\n\r]")) then
				user:SendPM(sBot, "Invalid Password. Try Again.")
			elseif (strfind(user.sName, "[%c|\n\r]")) then 
				user:SendPM(sBot, "Your nick is invalid. Please choose a new one.")
			else
				AddRegUser(user.sName, pass, 3)
				SendToOps(sBot, "The user "..user.sName.." has regiter himself.")
				user:SendPM(sBot, "You have been successufly registered with the pass: "..pass)
				user:SendPM(sBot, "Please reconnect and type your password.")
			end
			return 1
		end
	end
end

Best regards, nErBoS
--## nErBoS Spot ##--

NemeziS

Thanx, nErBoS! I've changed the code. Everything works fine. :)
--LUA forever! =)

BoJlk

Hi nErBoS

If it's possible to make a rule that checks if the password is a specific length like

if the user gives a less characters needed
it displays a message

"*** please provide a 6 length password"

Herodes

#8
QuoteOriginally posted by BoJlk
Hi nErBoS

If it's possible to make a rule that checks if the password is a specific length like

if the user gives a less characters needed
it displays a message

"*** please provide a 6 length password"
uhmm the script nErBoS provided cant have generated this message since there isnt such message in his script ... so I bet it will be some other bot doing dirty .. :)

[*edit*] overdosed with many substances ....

nErBoS

#9
Hi,

Here you have...

--## Self Register 1.1
--## Requested by Cp6uja
--## Secure Pass and Nick (thanks to RabidWombat) 
--## Added a helper remenber of pass (requested by BoJlk)
--## Made by nErBoS
--## Commands;
--##	!regme or !reg  - Register the user who uses the command

sBot = "Reg-Bot"

PtokaxPath = "C:\\Ptokax\\" -- Put here you ptokax folder path
fReg = "RegisteredUsers.dat"

function Main()
	frmHub:RegBot(sBot)
	frmHub:EnableFullData(1)
end

function DataArrival(user, data)
	if (strsub(data,1,7) == "$MyPass") then
		execute("copy "..PtokaxPath..fReg)
		local s,e,pass = strfind(data, "%$MyPass%s+(.+)|") 
		local validation,len = CheckPass(user.sName,pass)
		if (validation == nil) then
			if (len ~= strlen(pass)) then
				user:SendData(sBot, "Your password is wrong. You must type a "..len.." length pass.")
				user:Disconnect()
			else
				user:SendData(sBot, "Wrong Password.")
				user:Disconnect()
			end
		end
	end
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
		data = strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd == "!regme" or cmd =="!reg") then
			local s,e,pass = strfind(data, "%b<>%s+%S+%s+(%S+)")
			if (pass == nil) then
				user:SendPM(sBot, "Syntax Error, !regme  or !reg , you must write a password.")
			elseif (strfind(pass, "[%c|\n\r]")) then
				user:SendPM(sBot, "Invalid Password. Try Again.")
			elseif (strfind(user.sName, "[%c|\n\r]")) then 
				user:SendPM(sBot, "Your nick is invalid. Please choose a new one.")
			else
				AddRegUser(user.sName, pass, 3)
				SendToOps(sBot, "The user "..user.sName.." has regiter himself.")
				user:SendPM(sBot, "You have been successufly registered with the pass: "..pass)
				user:SendPM(sBot, "Please reconnect and type your password.")
			end
			return 1
		end
	end
end

function CheckPass(nick, pass)
	readfrom(fReg)
	while 1 do
		local sLine = read()
		if (sLine == nil) then
			break
		else
			local s,e,usr,rpass = strfind(sLine, "(.+)|(.+)|%d+")
			if (usr == nick) then
				if (rpass ~= pass) then
					return nil,strlen(rpass)
				else
					return 0,0
				end
			end
		end
	end
	readfrom()
	return 0,0
end

Best regards, nErBoS
--## nErBoS Spot ##--

BoJlk

How do i combine this script's options with the
RoboCop's

I made the robocop to block any serach&download from the HUB option...
and the selfRegistering users...

what do i disable in the RoboCop to not interfere with the Selfreg Script???

I hope that wny1 understood what i wanted to say
because i don't ... ?(

nErBoS

Hi,

Just change the name of this script to be first then the RoboCop script in your script list, that way the RoboCop will not interfere with this script.

Best regards, nErBoS
--## nErBoS Spot ##--

BoJlk

Well i'll try that...

Something else!

Is it possible to make every registered user to have the [REG] prefix to be added automaticly

i mean Nickname have registered
*** reconnects and his nick will be changed to
[REG]NickName...

but if he'll change the nick and add the prefix on hisown he won't be registered!

Psycho_Chihuahua

hmm i was to slow for my suggestion *g*

would of been this or something like it

AddRegUser("[Reg]"..user.sName, pass, 3)
				SendToOps(sBot, "The user [Reg]"..user.sName.." has registered himself.")
				user:SendPM(sBot, "You have been successufly registered with the pass: "..pass)
				user:SendPM(sBot, "Please reconnect and type your password.")
				user:SendPM(sBot, "Please Insert [Reg] Prefix before your Nick.")

dunno if it would work though, just a thought that struck my mind
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

nErBoS

Hi,

I belive that BoJlk is talking about Fake Info in nick. I will do that in the morning.

Best regards, nErBoS
--## nErBoS Spot ##--

BoJlk

#15
It's GOOD!

But not what i meant...

i'm talking about the users whom don't know how to change it
(and that it have to be added to Favourites first)

So if that user connects after been registered
 after 5 times he tried to type the !reg correctly

The prefix added Automaticly
HappyUser
Reconnects after been registered...
the script identifies him/her and adds the prefix

[REG]HappyUser

BoJlk

QuoteOriginally posted by nErBoS
Hi,

I belive that BoJlk is talking about Fake Info in nick. I will do that in the morning.

Best regards, nErBoS

That would be nice too...but in a different script

nErBoS

#17
Hi,

A script can't change the favourites of a user, or neither force to change the nick. Like i said it can send FakeInfo Nick or warn a user when he regs himself to add to his nick the correct Prefix (like ty has said). Which do you want ??

Best regards, nErBoS
--## nErBoS Spot ##--

BoJlk

#18
Well in that case if you can add to this script the
Warning...
*** Change your nick and Reconnect

and maybe to force the user to change the nick untill that the script won't let him in...

Because if he won't change the Nick he'll login as Unregistered user...

--## Self Register 1.1
--## Requested by Cp6uja
--## Secure Pass and Nick (thanks to RabidWombat) 
--## Added a helper remenber of pass (requested by BoJlk)
--## Made by nErBoS
--## Commands;
--##	!regme or !reg  - Register the user who uses the command

sBot = "Reg-Bot"

PtokaxPath = "C:\\Ptokax\\" -- Put here you ptokax folder path
fReg = "RegisteredUsers.dat"

function Main()
	frmHub:RegBot(sBot)
	frmHub:EnableFullData(1)
end

function DataArrival(user, data)
	if (strsub(data,1,7) == "$MyPass") then
		execute("copy "..PtokaxPath..fReg)
		local s,e,pass = strfind(data, "%$MyPass%s+(.+)|") 
		local validation,len = CheckPass(user.sName,pass)
		if (validation == nil) then
			if (len ~= strlen(pass)) then
				user:SendData(sBot, "Your password is wrong. You must type a "..len.." length pass.")
				user:Disconnect()
			else
				user:SendData(sBot, "Wrong Password.")
				user:Disconnect()
			end
		end
	end
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
		data = strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd == "!regme" or cmd =="!reg") then
			local s,e,pass = strfind(data, "%b<>%s+%S+%s+(%S+)")
			if (pass == nil) then
				user:SendPM(sBot, "Syntax Error, !regme  or !reg , you must write a password.")
			elseif (strfind(pass, "[%c|\n\r]")) then
				user:SendPM(sBot, "Invalid Password. Try Again.")
			elseif (strfind(user.sName, "[%c|\n\r]")) then 
				user:SendPM(sBot, "Your nick is invalid. Please choose a new one.")
			else
				AddRegUser(user.sName, pass, 3)
				SendToOps(sBot, "The user "..user.sName.." has regiter himself.")
				user:SendPM(sBot, "You have been successufly registered with the pass: "..pass)
				user:SendPM(sBot, "Please reconnect and type your password.")
			end
			return 1
		end
	end
end

function CheckPass(nick, pass)
	readfrom(fReg)
	while 1 do
		local sLine = read()
		if (sLine == nil) then
			break
		else
			local s,e,usr,rpass = strfind(sLine, "(.+)|(.+)|%d+")
			if (usr == nick) then
				if (rpass ~= pass) then
					return nil,strlen(rpass)
				else
					return 0,0
				end
			end
		end
	end
	readfrom()
	return 0,0
end

And if you can explain about that?

QuoteFake Info in nick.

nErBoS

#19
Hi,

Here is the script with the request and will avoid leting the user enters with his nick as unregister.

--## Self Register 1.2
--## Requested by Cp6uja
--## Secure Pass and Nick (thanks to RabidWombat) 
--## Added a helper remenber of pass (requested by BoJlk)
--## Reg will obrigate which user to have [Reg] has a prefix (requested by BoJlk)
--## Made by nErBoS
--## Commands;
--##	!regme or !reg  - Register the user who uses the command

sBot = "Reg-Bot"

PtokaxPath = "C:\\Ptokax\\" -- Put here you ptokax folder path
fReg = "RegisteredUsers.dat"
arrReg = {}

function Main()
	frmHub:RegBot(sBot)
	frmHub:EnableFullData(1)
end

function NewUserConnected(user)
	if (arrReg[user.sName] ~= nil) then
		user:SendData(sBot, "Change your your nick to [Reg]"..user.sName)
		user:Disconnect()
	end
	if (user.iProfile == 3) then
		local name = strsub(data,5,strlen(user.sName))
		arrReg[name] = nil
	end
end

function DataArrival(user, data)
	if (strsub(data,1,7) == "$MyPass") then
		execute("copy "..PtokaxPath..fReg)
		local s,e,pass = strfind(data, "%$MyPass%s+(.+)|") 
		local validation,len = CheckPass(user.sName,pass)
		if (validation == nil) then
			if (len ~= strlen(pass)) then
				user:SendData(sBot, "Your password is wrong. You must type a "..len.." length pass.")
				user:Disconnect()
			else
				user:SendData(sBot, "Wrong Password.")
				user:Disconnect()
			end
		end
	end
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
		data = strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd == "!regme" or cmd =="!reg") then
			local s,e,pass = strfind(data, "%b<>%s+%S+%s+(%S+)")
			if (pass == nil) then
				user:SendPM(sBot, "Syntax Error, !regme  or !reg , you must write a password.")
			elseif (strfind(pass, "[%c|\n\r]")) then
				user:SendPM(sBot, "Invalid Password. Try Again.")
			elseif (strfind(user.sName, "[%c|\n\r]")) then 
				user:SendPM(sBot, "Your nick is invalid. Please choose a new one.")
			else
				AddRegUser("[Reg]"..user.sName, pass, 3)
				arrReg[user.sName] = 1
				SendToOps(sBot, "The user "..user.sName.." has regiter himself.")
				user:SendPM(sBot, "You have been successufly registered with the pass: "..pass)
				user:SendPM(sBot, "Change your your nick to [Reg]"..user.sName)
				user:SendPM(sBot, "Please reconnect and type your password.")
			end
			return 1
		end
	end
end

function CheckPass(nick, pass)
	readfrom(fReg)
	while 1 do
		local sLine = read()
		if (sLine == nil) then
			break
		else
			local s,e,usr,rpass = strfind(sLine, "(.+)|(.+)|%d+")
			if (usr == nick) then
				if (rpass ~= pass) then
					return nil,strlen(rpass)
				else
					return 0,0
				end
			end
		end
	end
	readfrom()
	return 0,0
end

About the Fake Info Nick, it would be leting the user entering with his own nick and then send fake info to all users and the user himself with the prefix on his nick. (but would take more resources that the other aproach)

Best regards, nErBoS
--## nErBoS Spot ##--

BoJlk

Thanks for the Script (that was fast)

And about the FakeNick!

You mean user enters the HUB with user001 nick and send to all a different Nick user002?

nErBoS

Hi,

Yes, but like i said it takes resources.

Best regards, nErBoS
--## nErBoS Spot ##--

BoJlk

A Question!?
Didn't fully tested the script
is the script works for the RoboCop's
!regvip/!regop/!upgrade Commands
or just for registered users?

And where do i change the password's Lenght in the script?

nErBoS

Hi,

You can use whatever reg script you want because this script will check the passwords from your ptokax file, so it doesn't matter which script you use. About the lenght, that i haven't understood, the lenght is the length of the pass, please be more clear.

Best regards, nErBoS
--## nErBoS Spot ##--

BoJlk

#24
Well i've tested the script on
[ProtaX v0.3.3.0 build 15.18 with RC9a]

Two things
1.Error
Syntax error: bad argument #1 to `strsub' (string expected, got nil)
stack traceback:
   1:  function `strsub' [C]
   2:  function `NewUserConnected' at line 26 [file `...:\ProtaX TESTING\scripts\Self Register v1.2.lua']


2.When Removed the Registered user from the Protax it
Tried with !deluser as well
didn't let me Login (worng password)
Had to restart the HUB to correct it

SMF spam blocked by CleanTalk