PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: frankyk on 13 March, 2004, 01:33:00

Title: Standalone change pw script?
Post by: frankyk on 13 March, 2004, 01:33:00
Hi, I run a hub and I was curious to see if there was a standalone script that users could type in +changepw and change their password.  I've been taking registration and entering their password but it takes a long time so I was wondering if there was a script that would allow users to change their pw while online in the hub and it would change the little registration profile in my server software itself.

The hub is pw protected so that only regged users can log in.

Thanks!

PS - I did a few searches, but I couldn't find anything that was standalone or was decodeable to just take that line of code only.
Title:
Post by: BlazeXxX on 15 March, 2004, 04:45:24
I didn't get time to check the script, whether its working or not.. so give it a try and let me knwo if its working.

-- Written by BlazeXxX
-- Requested by frankyk
-- Start copying from here

sBot = "PassChanger"

function Main()
frmHub:RegBot(sBot)
end

function DataArrival(user, data)
   if (cmd=="!repass") then
   if user.iProfile >= 0 then
   local usersprofile = user.iProfile
   _,_,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
   if arg == nil then user:SendData(sBot, "Enter a new password!") return 1 end
   AddRegUser(user.sName, arg, usersprofile)
   SendToNick(user.sName, "<" ..sBot.."> Your password has been changed to: "..arg)
   return 1
   end
        end
end

-- Finish copying
Title:
Post by: plop on 15 March, 2004, 10:14:17
QuoteOriginally posted by BlazeXxX
I didn't get time to check the script, whether its working or not.. so give it a try and let me knwo if its working.

-- Written by BlazeXxX
-- Requested by frankyk
-- Start copying from here

sBot = "PassChanger"

function Main()
frmHub:RegBot(sBot)
end

function DataArrival(user, data)
   if (cmd=="!repass") then
   if user.iProfile >= 0 then
   local usersprofile = user.iProfile
   _,_,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
   if arg == nil then user:SendData(sBot, "Enter a new password!") return 1 end
   AddRegUser(user.sName, arg, usersprofile)
   SendToNick(user.sName, "<" ..sBot.."> Your password has been changed to: "..arg)
   return 1
   end
        end
end

-- Finish copying
pls use the code tags 2 post scripts.
this will cause a minor problem, as it doesn't overwrite the old entry in the reg list.
insert a delete before the add and it should work.

plop
Title:
Post by: Skrollster on 15 March, 2004, 11:51:26
changed it a bit, and fixed some buggs....

-- Written by BlazeXxX
-- Requested by frankyk
-- Start copying from here
-- Debugged Skrollster

sBot = "PassChanger"

function Main()
frmHub:RegBot(sBot)
end

function DataArrival(user, data)
local _,_,cmd,password = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
local userProfile = user.iProfile
if (cmd=="+changepw") and userProfile >= 0 then
if not password then
user:SendData(sBot, "Enter a new password!")
return 1
else
DelRegUser(user.sName)
AddRegUser(user.sName, password, userProfile )
user:SendData(sBot, "Your password has been changed to: "..password)
return 1
end
end
end
Title:
Post by: frankyk on 16 March, 2004, 00:04:10
I tried it out, works fine other than when the Password is changed, it changes the PW and adds a | at the very end of the pw which messes the new password up.

Can you change it so when I type +changepw frank for example, it will store "frank" as the pw and not "frank|"
Title:
Post by: Skrollster on 16 March, 2004, 08:33:53
-- Written by BlazeXxX
-- Requested by frankyk
-- Start copying from here
-- Debugged Skrollster

sBot = "PassChanger"

function Main()
frmHub:RegBot(sBot)
end

function DataArrival(user, data)
data=strsub(data,1,strlen(data)-1)
local _,_,cmd,password = strfind( data, "%b<>%s+(%S+)%s+(%C+)" )
local userProfile = user.iProfile
if (cmd=="+changepw") and userProfile >= 0 then
if not password then
user:SendData(sBot, "Enter a new password!")
return 1
else
DelRegUser(user.sName)
AddRegUser(user.sName, password, userProfile )
user:SendData(sBot, "Your password has been changed to: "..password)
return 1
end
end
end

*edit* changed it, thx
Title:
Post by: NotRabidWombat on 16 March, 2004, 16:04:19
DO NOT USE ANY OF THE ABOVE EXAMPLES.

This opens an exploit in PtokaX.

Instead of:
"%b<>%s+(%S+)%s+(.+)"
Use:
"%b<>%s+(%S+)%s+(%C+)"

-NotRabidWombat