Help with logon bot, please
 

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

Help with logon bot, please

Started by YASHOV, 27 February, 2005, 13:31:21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

YASHOV

Could someone please help me convert this script to lua 5???????


-- A simple logon logger by piglja - 25/04/03
-- Updated and modifyed a bit by piglja - 28/04/03
-- A bug by piglja fixed by piglja;P - 28/04/03
-- An update that Ops are logged too and disconnect are logged by piglja - 28/04/03

file_logon = "logon.txt"

function NewUserConnected(user)
description,speed,email,share=MyInfoString(user.sMyInfoString)
local share2 = share / (1024*1024*1024)
ip = user.sIP
appendto(file_logon)
write("-->> "..user.sName..","..date("%d").."."..date("%m").."."..date("%y").." - "..date("%H")..":"..date("%M").." -  with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n")
writeto()
end

function OpConnected(user)
description,speed,email,share=MyInfoString(user.sMyInfoString)
local share2 = share / (1024*1024*1024)
ip = user.sIP
appendto(file_logon)
write("-->> "..user.sName..","..date("%d").."."..date("%m").."."..date("%y").." - "..date("%H")..":"..date("%M").." -  with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n")
writeto()
end

function UserDisconnected(user)
description,speed,email,share=MyInfoString(user.sMyInfoString)
local share2 = share / (1024*1024*1024)
ip = user.sIP
appendto(file_logon)
write("<<-- "..user.sName..","..date("%d").."."..date("%m").."."..date("%y").." - "..date("%H")..":"..date("%M").." -  with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n")
writeto()
end

function OpDisconnected(user)
description,speed,email,share=MyInfoString(user.sMyInfoString)
local share2 = share / (1024*1024*1024)
ip = user.sIP
appendto(file_logon)
write("<<-- "..user.sName..","..date("%d").."."..date("%m").."."..date("%y").." - "..date("%H")..":"..date("%M").." -  with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n")
writeto()
end

function MyInfoString(data)
s,e,description,speed,email,share = strfind(data, "$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)")
if speed~=nil then
speed = strsub(speed,1,strlen(speed)-1)
end
return description,speed,email,share
end


Pothead

all parts with
..date
need replacing with
..os.date
:)

YASHOV

#2
Thank you, I did as you said, but there is nothing being written to logon.txt file

Also I am getting: logon_bot.lua:45: attempt to call global `strfind' (a nil value)

Now the script is changed to this:

Quote-- A simple logon logger by piglja - 25/04/03
-- Updated and modifyed a bit by piglja - 28/04/03
-- A bug by piglja fixed by piglja;P - 28/04/03
-- An update that Ops are logged too and disconnect are logged by piglja - 28/04/03

file_logon = "logon.txt"

function NewUserConnected(user)
description,speed,email,share=MyInfoString(user.sMyInfoString)
local share2 = share / (1024*1024*1024)
ip = user.sIP
appendto(file_logon)
write("-->> "..user.sName..","..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." -  with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n")
writeto()
end

function OpConnected(user)
description,speed,email,share=MyInfoString(user.sMyInfoString)
local share2 = share / (1024*1024*1024)
ip = user.sIP
appendto(file_logon)
write("-->> "..user.sName..","..os.date("%d").."."..date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." -  with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n")
writeto()
end

function UserDisconnected(user)
description,speed,email,share=MyInfoString(user.sMyInfoString)
local share2 = share / (1024*1024*1024)
ip = user.sIP
appendto(file_logon)
write("<<-- "..user.sName..","..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." -  with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n")
writeto()
end

function OpDisconnected(user)
description,speed,email,share=MyInfoString(user.sMyInfoString)
local share2 = share / (1024*1024*1024)
ip = user.sIP
appendto(file_logon)
write("<<-- "..user.sName..","..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." -  with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n")
writeto()
end

function MyInfoString(data)
s,e,description,speed,email,share = strfind(data, "$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)")
if speed~=nil then
speed = strsub(speed,1,strlen(speed)-1)
end
return description,speed,email,share
end

TIA

[NL]Pur


Dag

QuoteOriginally posted by YASHOV

Also I am getting: logon_bot.lua:45: attempt to call global `strfind' (a nil value)
All parts with
Quotestrfind
need replacing with -> string.find !!!

and all parts with
Quotestrsub
need replacing with -> string.sub !!!
 :D   :]   ;)

YASHOV

#5
Thank you very , I made the changes as you said, but there is still nothing being written to logon.txt file

Also I am now getting: logon_bot.lua:47: attempt to call global `strlen' (a nil value)

Now the script is changed to this:

Quote-- A simple logon logger by piglja - 25/04/03
-- Updated and modifyed a bit by piglja - 28/04/03
-- A bug by piglja fixed by piglja;P - 28/04/03
-- An update that Ops are logged too and disconnect are logged by piglja - 28/04/03

file_logon = "logon.txt"

function NewUserConnected(user)
description,speed,email,share=MyInfoString(user.sMyInfoString)
local share2 = share / (1024*1024*1024)
ip = user.sIP
appendto(file_logon)
write("-->> "..user.sName..","..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n")
writeto()
end

function OpConnected(user)
description,speed,email,share=MyInfoString(user.sMyInfoString)
local share2 = share / (1024*1024*1024)
ip = user.sIP
appendto(file_logon)
write("-->> "..user.sName..","..os.date("%d").."."..date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n")
writeto()
end

function UserDisconnected(user)
description,speed,email,share=MyInfoString(user.sMyInfoString)
local share2 = share / (1024*1024*1024)
ip = user.sIP
appendto(file_logon)
write("<<-- "..user.sName..","..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n")
writeto()
end

function OpDisconnected(user)
description,speed,email,share=MyInfoString(user.sMyInfoString)
local share2 = share / (1024*1024*1024)
ip = user.sIP
appendto(file_logon)
write("<<-- "..user.sName..","..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n")
writeto()
end

function MyInfoString(data)
s,e,description,speed,email,share = string.find(data, "$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)")
if speed~=nil then
speed = string.sub(speed,1,strlen(speed)-1)
end
return description,speed,email,share
end



Thank you

[NL]Pur

this can use some optimization

-- A simple logon logger by piglja 25/04/03 
-- Updated and modifyed a bit by piglja 28/04/03 
-- A bug by piglja fixed by piglja;28/04/03 
-- An update that Ops are logged too and disconnect are logged by piglja 28/04/03 

file_logon 
"logon.txt" 

function NewUserConnected(user
  
description,speed,email,share=MyInfoString(user.sMyInfoString
  
local share2 share / (1024*1024*1024
  
ip user.sIP 
  fileHandle 
io.open(file_logon,"a+")
  
fileHandle:write("-->> "..user.sName..","..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n"
  
fileHandle:flush() 
  
fileHandle:close()
end 

function OpConnected(user
  
description,speed,email,share=MyInfoString(user.sMyInfoString
  
local share2 share / (1024*1024*1024
  
ip user.sIP 
  fileHandle 
io.open(file_logon,"a+")
  
fileHandle:write("-->> "..user.sName..","..os.date("%d").."."..date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n"
  
fileHandle:flush() 
  
fileHandle:close()
end 

function UserDisconnected(user
  
description,speed,email,share=MyInfoString(user.sMyInfoString
  
local share2 share / (1024*1024*1024
  
ip user.sIP 
  fileHandle 
io.open(file_logon,"a+"
  
fileHandle:write("<<-- "..user.sName..","..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n"
  
fileHandle:flush() 
  
fileHandle:close()
end 

function OpDisconnected(user
  
description,speed,email,share=MyInfoString(user.sMyInfoString
  
local share2 share / (1024*1024*1024
  
ip user.sIP 
  fileHandle 
io.open(file_logon,"a+"
  
fileHandle:write("<<-- "..user.sName..","..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - with:"..speed.." IP "..ip..", e-mail "..email.." with "..share2.."Gb \r\n"
  
fileHandle:flush() 
  
fileHandle:close()
end 

function MyInfoString(data
  
s,e,description,speed,email,share string.find(data"$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)"
  if 
speed~=nil then 
    speed 
string.sub(speed,1,string.len(speed)-1
  
end 
  
return description,speed,email,share 
end 
 

nErBoS

Hi,

Check out plop 425 convertor there you all modifications that you have to make, or you can also check the LUA 5 manual that you can find in http://www.lua.org

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

SMF spam blocked by CleanTalk