so i have this working like i want it .. well almost then ..
if anybody can help me with making this to make an exeption for .mp3 and or other key's (second table)in the searchstring, that would be very nice to have .. ;0)
-----------------------------------------------------------------------
last version one post below..
-------------------------------------------------------------
it looks for searches made on the hub ..
and if a bad word is found then..
1. it sends a message to op-chat (containing the whole string)
2. it sends a message to main chat ..
3. then a message to the "dirt-searcher" ..
4. does the action chosen in the first table for each wordthere is the choice between ..
1. only a warning .. (warn)
2. a disconnection (diisco)
3. a timeban(tban)
4. a permban(pban)
(warn is only a message)
mostly thanks to this 'year-old' post by plop (http://board.univ-angers.fr/thread.php?threadid=598&boardid=13&styleid=1) [/URL]
latest version ..
finds the key word in the middle.. like..
key words on begining of the string..
also to find it if the last word is the key
and words like keycode are no longer a problem...
fixed the messy chat with no nick thing now getsend properly.. i will work on the "estethics' of the messages later ..
moved a few messages down ..
------------------------------------------------------------------------
hiho
Syntax error: unfinished string;
last token read: `"
"..' at line 57 in file `C:\My_Downloads\0.330.b15.25.dbg\scripts\antibadporn.lua'
well the thingy got to big to post in one message now .. so i will post it in two parts ...
---------------------------part1-----------------------------
-- pm to ops chat of any one
-- searching for bad files
-- ban or warn user
-- by ??????Hawk??????
-- 28-06-2004
---------------------------
-- / also kick and timeban + msg. to mainchat. UwV? 07/2004
-- // cleaned and retabbed for better board readability. 08/2004
-- /// strfind's changed a little, no more "bad grapes" found). UwV? 11/08/04
-- /// now finding the way to exclude some file extensions (.mp3)
-- // no fileextension exclusions yet .. but i have put in a second time ban (again) just for the fun of having one ,, actually handy aswell .. ;0)
-------------------------------------------------
Time1 = 17
Time2 = 1403
Bot = "Bad-Search"
BadFiles = {
["childsex"]="tban2",
["childporn"]="tban2",
["underage"]="ban2",
["animalsex"]="ban2",
["preteen"]="tban1",
["preteen$sex"]="tban2",
["r@ygold"]="ban",
["lolita$sex"]="tban1",
["forced$to$suck"]="ban2",
["forced$to$fuck"]="ban2",
["forced$to$have$sex"]="ban2",
["incest"]="tban1",
["beastiality"]="tban",
["rape"]="tban1",
["rape$real"]="tban2",
["real$rape"]="tban2",
["raped"]="tban1",
["raped$real"]="tban2",
["teen$fuck"]="tban1",
["teen$raped"]="tban2",
["gangbang"]="warn",
["zoo-sex"]="ban",
["blowjob"]="warn",
["fuck"]="warn"
}
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(tUser, sData)
if tUser.bOperator == nil then
if strsub(sData, 1, 12) == "$Search Hub:" then
local _,_, sSearch = strfind(sData, "$Search Hub:%S+%s+%a%?%a%?%d+%?%d+(%?.*|)")
for key,a in BadFiles do
if( strfind( strlower(sSearch), "%A"..key.."%A") ) or ( strfind( strlower(sSearch), "^"..key.."$") ) then
OldString = sSearch
MidString = gsub(OldString, "[$]", " ")
DSNString = gsub(MidString, "[|]", " ")
NewString = gsub(DSNString, "[?]", " ")
if BadFiles[key] == "ban" then
SendPmToOps(frmHub:GetOpChatName(), "Really bad search:\r\n"..
"User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
"\t\t ... and has now been BANNED !! feels good now doesn't it :0)" )
SendToAll(Bot, "User: "..tUser.sName.." Searched for:- \""..key.."\" and has been BANNED !! :0o" )
tUser:SendPM(Bot, "\r\n\r\n"..
"-: YOU have been cought seaRching for really BAD files :-\r\n\r\n"..
" User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
"these details have been logged \r\n\r\n"..
"and YOU aRe now BANNED from this hub" )
tUser:Ban()
tUser:Disconnect()
elseif BadFiles[key] == "tban2" then
SendPmToOps(frmHub:GetOpChatName(), "Very, Very bad search :\r\n"..
"User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
"\t\t.. and has been tempbanned for "..Time2.." minutes ;0/" )
SendToAll(Bot, "User: "..tUser.sName.." Searched for:- \""..key.."\" and has been banned for "..Time2.." minutes ;0/")
tUser:SendPM(Bot, "\r\n\r\n"..
"-: You where searching for Very Bad files :-\r\n"..
" User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
" These Details have been Logged \r\n"..
" And you have been banned for "..Time2.." minutes \r\n"..
"\t Watch out !! "..tUser.sName.." \"Really bad searches\" will \"really\" get you banned..... :0o\r\n")
tUser:TimeBan(Time2)
tUser:Disconnect()
elseif BadFiles[key] == "tban1" then
SendPmToOps(frmHub:GetOpChatName(), "Very bad search :\r\n"..
"User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
"\t\t.. and has been tempbanned for "..Time1.." minutes ;0/" )
SendToAll(Bot, "User: "..tUser.sName.." Searched for:- \""..key.."\" and has been banned for "..Time1.." minutes ;0/")
tUser:SendPM(Bot, "\r\n\r\n"..
"-: You where searching for Very Bad files :-\r\n"..
" User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
" These Details have been Logged \r\n And you have been banned for "..Time1.." minutes \r\n"..
"\t Watch out !! "..tUser.sName.." \"Very, Very bad searches\" would even get you banned for "..Time2.." minutes\r\n")
tUser:TimeBan(Time1)
tUser:Disconnect()
elseif BadFiles[key] == "disco" then
SendPmToOps(frmHub:GetOpChatName(), "Bad search :\r\n"..
"User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
"and has been disconnected :0P" )
SendToAll(Bot, "user: "..tUser.sName.."Searched for:- \""..key.."\" and has been disconnected." )
tUser:SendPM(Bot, "\r\n\r\n"..
"-:You where searching for Bad files.:-\r\n\r\n User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
" You have now been disconnected ...\r\n\t ... in the future Please do behave ...\r\n"..
"\t and watch out "..tUser.sName..",... \"Bad searches\" could just get you banned for "..Time1.." minutes\r\n")
tUser:Disconnect()
elseif BadFiles[key] == "warn" then
-- SendPmToOps(frmHub:GetOpChatName(), "Nasty search :\r\n"..
-- "User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
-- "\t\t,... and he has only been warned ?" )
SendToAll(Bot, "I'm only warning you,.. "..tUser.sName.." is looking to get "..key.."'ed ,... :Ox ")
tUser:SendPM(Bot, "\r\n\r\n"..
" Are you searching for Nasty files,... ?\r\n\r\n"..
" User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
"\t watch out now "..tUser.sName.." \"really\" bad searches will \"really\" get you banned..... ;0)\r\n")
end
end
end
elseif strsub(sData, 1, 7) == "$Search" then
local _,_, sSearch = strfind(sData, "%$Search %d+%.%d+%.%d+%.%d+:%d+%s+%a%?%a%?%d+%?%d+(%?.*|)")
for key,a in BadFiles do
OldString = sSearch
MidString = gsub(OldString, "[$]", " ")
DSNString = gsub(MidString, "[|]", " ")
NewString = gsub(DSNString, "[?]", " ")
if( strfind( strlower(sSearch), "%A"..key.."%A") ) or ( strfind( strlower(sSearch), "^"..key.."$") ) then
if BadFiles[key] == "ban" then
SendPmToOps(frmHub:GetOpChatName(), "Really bad search:\r\n"..
"User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
"\t\t ... and has now been BANNED !! feels good now doesn't it :0)" )
SendToAll(Bot, "User: "..tUser.sName.." Searched for:- \""..key.."\" and has been BANNED !! :0o" )
tUser:SendPM(Bot, "\r\n\r\n"..
"-: YOU have been cought seaRching for really BAD files :-\r\n\r\n"..
" User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
"these details have been logged \r\n\r\n"..
"and YOU aRe now BANNED from this hub" )
tUser:Ban()
tUser:Disconnect()
elseif BadFiles[key] == "tban2" then
SendPmToOps(frmHub:GetOpChatName(), "Very, Very bad search :\r\n"..
"User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
"\t\t.. and has been tempbanned for "..Time2.." minutes ;0/" )
SendToAll(Bot, "User: "..tUser.sName.." Searched for:- \""..key.."\" and has been banned for "..Time2.." minutes ;0/")
tUser:SendPM(Bot, "\r\n\r\n"..
"-: You where searching for Very Bad files :-\r\n"..
" User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
" These Details have been Logged \r\n"..
" And you have been banned for "..Time2.." minutes \r\n"..
"\t Watch out !! "..tUser.sName.." \"Really bad searches\" will \"really\" get you banned..... :0o\r\n")
tUser:TimeBan(Time2)
tUser:Disconnect()
elseif BadFiles[key] == "tban1" then
SendPmToOps(frmHub:GetOpChatName(), "Very bad search :\r\n"..
"User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
"\t\t.. and has been tempbanned for "..Time1.." minutes ;0/" )
SendToAll(Bot, "User: "..tUser.sName.." Searched for:- \""..key.."\" and has been banned for "..Time1.." minutes ;0/")
tUser:SendPM(Bot, "\r\n\r\n"..
"-: You where searching for Very Bad files :-\r\n"..
" User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
" These Details have been Logged \r\n And you have been banned for "..Time1.." minutes \r\n"..
"\t Watch out !! "..tUser.sName.." \"Very, Very bad searches\" would even get you banned for "..Time2.." minutes\r\n")
tUser:TimeBan(Time1)
tUser:Disconnect()
elseif BadFiles[key] == "disco" then
SendPmToOps(frmHub:GetOpChatName(), "Bad search :\r\n"..
"User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
"and has been disconnected :0P" )
SendToAll(Bot, "user: "..tUser.sName.."Searched for:- \""..key.."\" and has been disconnected." )
tUser:SendPM(Bot, "\r\n\r\n"..
"-:You where searching for Bad files.:-\r\n\r\n User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
" You have now been disconnected ...\r\n\t ... in the future Please do behave ...\r\n"..
"\t and watch out "..tUser.sName..",... \"Bad searches\" could just get you banned for "..Time1.." minutes\r\n")
tUser:Disconnect()
elseif BadFiles[key] == "warn" then
-- SendPmToOps(frmHub:GetOpChatName(), "Nasty search :\r\n"..
-- "User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
-- "\t\t,... and he has only been warned ?" )
SendToAll(Bot, "I'm only warning you,.. "..tUser.sName.." is looking to get "..key.."'ed ,... :Ox ")
tUser:SendPM(Bot, "\r\n\r\n"..
" Are you searching for Nasty files,... ?\r\n\r\n"..
" User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
"\t watch out now "..tUser.sName.." \"really\" bad searches will \"really\" get you banned..... ;0)\r\n")
end
end
end
---------------------------------read part 2 in the next post ----------------
--------------------- part 2 ----------------------
elseif strsub(sData, 1, 3) == "$SR" then
local _,_, sSearch = strfind(sData, "$SR %S+%s(.*|)")
for key,a in BadFiles do
if( strfind( strlower(sSearch), "%A"..key.."%A") ) or ( strfind( strlower(sSearch), "^"..key.."$") ) then
OldString = sSearch
MidString = gsub(OldString, "[$]", " ")
DSNString = gsub(MidString, "[|]", " ")
NewString = gsub(DSNString, "[?]", " ")
if BadFiles[key] == "ban" then
SendPmToOps(frmHub:GetOpChatName(), "Really bad search:\r\n"..
"User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
"\t\t ... and has now been BANNED !! feels good now doesn't it :0)" )
SendToAll(Bot, "User: "..tUser.sName.." Searched for:- \""..key.."\" and has been BANNED !! :0o" )
tUser:SendPM(Bot, "\r\n\r\n"..
"-: YOU have been cought seaRching for really BAD files :-\r\n\r\n"..
" User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
"these details have been logged \r\n\r\n"..
"and YOU aRe now BANNED from this hub" )
tUser:Ban()
tUser:Disconnect()
elseif BadFiles[key] == "tban2" then
SendPmToOps(frmHub:GetOpChatName(), "Very, Very bad search :\r\n"..
"User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
"\t\t.. and has been tempbanned for "..Time2.." minutes ;0/" )
SendToAll(Bot, "User: "..tUser.sName.." Searched for:- \""..key.."\" and has been banned for "..Time2.." minutes ;0/")
tUser:SendPM(Bot, "\r\n\r\n"..
"-: You where searching for Very Bad files :-\r\n"..
" User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
" These Details have been Logged \r\n"..
" And you have been banned for "..Time2.." minutes \r\n"..
"\t Watch out !! "..tUser.sName.." \"Really bad searches\" will \"really\" get you banned..... :0o\r\n")
tUser:TimeBan(Time2)
tUser:Disconnect()
elseif BadFiles[key] == "tban1" then
SendPmToOps(frmHub:GetOpChatName(), "Very bad search :\r\n"..
"User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
"\t\t.. and has been tempbanned for "..Time1.." minutes ;0/" )
SendToAll(Bot, "User: "..tUser.sName.." Searched for:- \""..key.."\" and has been banned for "..Time1.." minutes ;0/")
tUser:SendPM(Bot, "\r\n\r\n"..
"-: You where searching for Very Bad files :-\r\n"..
" User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
" These Details have been Logged \r\n And you have been banned for "..Time1.." minutes \r\n"..
"\t Watch out !! "..tUser.sName.." \"Very, Very bad searches\" would even get you banned for "..Time2.." minutes\r\n")
tUser:TimeBan(Time1)
tUser:Disconnect()
elseif BadFiles[key] == "disco" then
SendPmToOps(frmHub:GetOpChatName(), "Bad search :\r\n"..
"User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
"and has been disconnected :0P" )
SendToAll(Bot, "user: "..tUser.sName.."Searched for:- \""..key.."\" and has been disconnected." )
tUser:SendPM(Bot, "\r\n\r\n"..
"-:You where searching for Bad files.:-\r\n\r\n User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
" You have now been disconnected ...\r\n\t ... in the future Please do behave ...\r\n"..
"\t and watch out "..tUser.sName..",... \"Bad searches\" could just get you banned for "..Time1.." minutes\r\n")
tUser:Disconnect()
elseif BadFiles[key] == "warn" then
-- SendPmToOps(frmHub:GetOpChatName(), "Nasty search :\r\n"..
-- "User ---->\t"..tUser.sName.." (With IP:- "..tUser.sIP..")\r\nKey ----->\t"..key.."'\r\n String -->\t"..NewString.."\r\n"..
-- "\t\t,... and he has only been warned ?" )
SendToAll(Bot, "I'm only warning you,.. "..tUser.sName.." is looking to get "..key.."'ed ,... :Ox ")
tUser:SendPM(Bot, "\r\n\r\n"..
" Are you searching for Nasty files,... ?\r\n\r\n"..
" User :-\t"..tUser.sName.."\r\n IP :-\t"..tUser.sIP.."\r\n Search:-\t"..key.."\r\n\r\n"..
"\t watch out now "..tUser.sName.." \"really\" bad searches will \"really\" get you banned..... ;0)\r\n")
end
end
end
end
end
end
there is a little syntax error that comes up a few times a day ..
Syntax error: bad argument #1 to `gsub' (string expected, got nil)
stack traceback:
1: function `gsub' [C]
2: function `DataArrival' at line 130 [file `...Dwarf17(NEW)~\scripts\x.02.Perv-Advertiser2.lua']
but not anything critical hub, runs fine and script keeps doing it's job .. so not really a problem
QuoteOriginally posted by DEEP-GOA
hiho
Syntax error: unfinished string;
last token read: `"
"..' at line 57 in file `C:\My_Downloads\0.330.b15.25.dbg\scripts\antibadporn.lua'
fixed too .. ;)
thx
replacing the
elseif strsub(sData, 1, 7) == "$Search" then
local _,_, sSearch = strfind(sData, "%$Search %d+%.%d+%.%d+%.%d+:%d+%s+%a%?%a%?%d+%?%d+(%?.*|)")
for key,a in BadFiles do
OldString = sSearch
MidString = gsub(OldString, "[$]", " ")
DSNString = gsub(MidString, "[|]", " ")
NewString = gsub(DSNString, "[?]", " ")
if( strfind( strlower(sSearch), "%A"..key.."%A") ) or ( strfind( strlower(sSearch), "^"..key.."$") ) then
WIht
elseif strsub(sData, 1, 7) == "$Search" then
local _,_, sSearch = strfind(sData, "%$Search %d+%.%d+%.%d+%.%d+:%d+%s+%a%?%a%?%d+%?%d+(%?.*|)")
for key,a in BadFiles do
NewString = sSearch
-- MidString = gsub(OldString, "[$]", " ")
-- DSNString = gsub(MidString, "[|]", " ")
-- NewString = gsub(DSNString, "[?]", " ")
if( strfind( strlower(sSearch), "%A"..key.."%A") ) or ( strfind( strlower(sSearch), "^"..key.."$") ) then
fixes the error mentioned above ..
this script looks nice. But one question, have you solve the problem with that these kind of script doesn't work against passive users?
not me,..
someone else has solved that,
look HERE (http://lua.uknnet.com/thread.php?threadid=403&sid=98a25fc4d74702b19b4f95e352274e0d)
" elseif strsub(sData, 1, 3) == "$SR " "
i think
Mutor
Respectfully, (did it, ( again) as always)
correct me if i am wrong ..
Hi,
Script Interface can't catch passive results, because passive users do not respond with the string "$SR". The "$Search" is sent by HUB or user (passive or active)to search from others, but won't get any result from passive users, only get the responce from active users with the string "$SR". This is why a passive search won't get the result search from other passive users.
Best regards, nErBoS
strange thing is.. i turn on passive on my client .. do a "dirty search" and guess what ..
i get kicked ..
so how comes nerbos ?
or what do you mean with "results" .. i just want to kick/ban/timeban/advertize perverts searching for nasty stuff here ..
i use a client to search for bad files in share.. if that is what you mean ..
or .. i guess you do know what i mean ..
you know lua better then i do .. so please explain if i misunderstand that you are misunderstanding me ..
thanks..
heya peeps
i think theres a little confusion here
you can't search a passive users file list with hub scripts ...
but you can see actual search strings sent to the hub from passive and active users.
elseif strsub(sData, 1, 12) == "$Search Hub:" then -- Pasive Searchs
-- :: $Search Hub: |
local _,_, sUsername, sSearch = strfind(sData, "$Search Hub:(%S+)%s+(.*)|")
tUser:SendData("Search Hub: -> sUsername: " .. sUsername .. ", sSearch: " .. sSearch)
elseif strsub(sData, 1, 7) == "$Search" then -- Active Searchs
-- :: $Search : |
local _,_, sIP, sPort, sSearch = strfind(sData, "%$Search (%d+):(%d+)%s+(.*)|")
tUser:SendData("Search -> sIP: " .. sIP .. ", sPort: " .. sPort .. ", sSearch: " .. sSearch)
code taken from this thread.
http://board.univ-angers.fr/thread.php?threadid=2105&boardid=4&styleid=1&sid=6aa40fabc83390d57f2992a69220f767
thanks .. i was getting confused ...
I never had a "problem" with catching those pasive searches .. and actaully only tested it after adding the $SR part ..
so i presumed that this was what fixed the non-existant "problem"
i am just get to the people that are searching for things ..
so actaully the $SR i don't really need ? .. i guess i just keep it for now ..
thanks for teh enlightnement ..
and i think here is the clue i was looking for to get the mp3's never to be "bad" too .. ..
But then again .. "clever" pervs .. could just search for "forbiddenkey_forbidden - more forbidden key's.mp3"
and still get results ..
and then again.. guess if they cue it and the auto search wants to find more sources... script gets em anyway ..