Notify to OPs
 

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

Notify to OPs

Started by BlazeXxX, 31 October, 2003, 03:01:33

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

BlazeXxX

Useful Script for you  all - Written by klownietklowniet



-- Start Copying From this line
-- Date: 02-09-2003
--
-- code from klownietklowniet
-- network: [ > DC - UniteD < ]
--
-- Request by Discs
--
-- Send notice to OPs when certaion ip or username logs into the hub
--

BotName = "ReportCertain"

CommandNotifyIP="!notifyip"
CommandNotifyUSR="!notifyusr"

usernames={}
ips={}

function Main()
--frmHub:RegBot(BotName)
LoadUsernames()
LoadIPs()
end


function NewUserConnected(curUser)

if usernames[curUser.sName] then
SendPmToOps(BotName, curUser.sName.." with ip "..curUser.sIP.."just logged in and wanted to notify you!")
end

if ips[curUser.sIP] then
SendPmToOps(BotName, curUser.sIP.." belonging to "..curUser.sName.."just logged in and wanted to notify you!")
end

end


function DataArrival(curUser,data)

local MessageRecognized = 0
if isPM(data)==1 then
whoto,from,message=ParsePM(data)
MessageRecognized=1
elseif isMCM(data)==1 then
message=ParseMCM(data)
MessageRecognized=1
end


if MessageRecognized==1 and curUser.iProfile>=0 and curUser.iProfile<=1 then
if (strfind(strlower(message), strlower(CommandNotifyIP))) then
AddIPs(message, curUser)
elseif (strfind(strlower(message), strlower(CommandNotifyUSR))) then
AddUsernames(message, curUser)
end
end

end



function isMCM(data)
if( strsub(data, 1, 1) == "<" ) then
return 1
else
return 0
end
end

function isPM(data)
if( strsub(data, 1, 3) == "$To" ) then
return 1
else
return 0
end
end

function ParsePM(data)
s,e,whoTo,from,message = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
message = strsub(message,1,strlen(message)-1)
return whoTo,from,message
end

function ParseMCM(data)
s,e,message = strfind(data, "%b<> (.*)")
message = strsub(message,1,strlen(message)-1)
return message
end

function GetOneParam(message)
s,e,param1=strfind(message,"%S+%s(.+)")
return param1
end

function LoadUsernames()
readfrom("usernames.txt")
while 1 do
local line = read()
if (line == nil) then
break
else
s,e, n, i = strfind(line,"(%S+) (%S+)")
usernames[n]=i
end
end
readfrom()
end

function SaveUsernames()
writeto("usernames.txt")
for n, i in usernames do
write(n.." "..i.."\r\n")
end
writeto()
end

function LoadIPs()
readfrom("ips.txt")
while 1 do
local line = read()
if (line == nil) then
break
else
s,e, n, i = strfind(line,"(%S+) (%S+)")
ips[n]=i
end
end
readfrom()
end

function SaveIPs()
writeto("ips.txt")
for n, i in ips do
write(n.." "..i.."\r\n")
end
writeto()
end

function AddUsernames(message, curUser)
local n = GetOneParam(message)
if (n~=nil) then
usernames[n]="1"
SaveUsernames()
curUser:SendPM(BotName,"Added username "..n.." for notification!")
else
curUser:SendPM(BotName,"Usage: "..CommandNotifyUSR.." username")
end
end

function AddIPs(message, curUser)
local n = GetOneParam(message)

if (n~=nil) then
ips[n]="1"
SaveIPs()
curUser:SendPM(BotName,"Added ip "..n.." for notification!")
else
curUser:SendPM(BotName,"Usage: "..CommandNotifyIP.." ip")
end
end

-- Finsh Copying

Twix

At the momment this alerts ops everytime a user or IP connects.
Is there anyway changing it so I can remove a username or IP from the list manually.
Or possible have the name/IP removed auto after a preset number of connects?

TIA

Twix

BlazeXxX

Sorry for the  late reply!

The usernames that will be notified shud be recorded in usernames.txt and ips wud be stored in ips.txt

SMF spam blocked by CleanTalk