[REL] Modified Searchkick 1.5 of Gadget

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
InnerCity
Posts: 105
Joined: 2003-05-17 00:35

[REL] Modified Searchkick 1.5 of Gadget

Post by InnerCity » 2003-11-15 05:33

i want to create a very customizable searchkick, but i am not a scripter, anyway i'll try to do it by the observe-copy-and-paste method
the final purpose is have a searchkick working as it do it inside General Bot (not as Searchkick 1.5) but with no General Bot needed, so that you can decide every action for every forbidden finded file, and also modify values while running
ill post the steps (2 or 3) here so that if anyone can help testing (i am tired of connect and reconnect to my hub), advising about the code or something else, just do it

this first step have this new options
opers file list can be checked (why not?)
can set isearchinterval=0 but the new users connected will be checked anyway
can set the min, b/w method while running: only searchs when a new users connected (isearchinterval=0) that is to waste the minimun bandwith
can change to max. b/w method while running: searchs by interval and searchs when a new user is connected
can able/disable searchs to new users while running (allownew)
can able/disable allowops while running (allowops)
the bot will work as register and will accept public chat and private mode commands

REMEMBER SEARCH INTERVAL MODE IS RANDOMIZED

COMMANDS:
-skoff: turn script off (no searchs)
-skon: turn it on
-skallowop: no searchs in opers
-sknoallowop: searchs in opers
-sknoallownew: searchs in new user connect
-skallownew: no searchs in new user connect
-skmin: turn min. method on
-skmax: turn max. method on

i'll try to writte a "-skhelp" command and explain the script better, and add the actions for every kind of file, now i must studyyyyyyyyyyyyyy

http://www.iespana.es/itspanish/Searchkick3.script

Code: Select all

'This famous script allows users to kick other users themselves! Whoever finds forbidden files with search, gots the honor to be a "op"... Scripts can also do searches by itself. It kicks active users with large .wav, .vob, .tmp, .temp, kazaa .dat, audiogalaxy temp, windows or program files on share automatically. It really keeps the Hub clean!
'SearchKick script v1.5 by Gadget <[email protected]> http://gadget.no-ip.info
Dim Reason,i,Filename,Suffix,Kicker,ShowAll,LastKicked,sBotName,OpsOnly,iQuietMode,iSearchInterval,aSearchString,iMinute,iMaxFileSize,iOff

Sub Main()

  '----------EDITABLE SETTINGS----------

  iQuietMode      = False        '<- False=all users can see kick messages, True=Only "kicker" and kicked gets private messages.
  sBotName        = "Searchkick" '<- Bot's name
  iSearchInterval = 15           '<- Bad file search interval in minutes. 0=Disable self-search.
  iMaxFileSize    = 5*1024^3     '<- (5 gigabytes) ^0=bytes, ^1=kilobytes, ^2=megabytes, ^3=gigabytes, ^4=terabytes.

  '----------END OF SETTINGS----------

  aSearchString=Array("T?F?0?1?.tmp","T?F?10485760?1?.wav","T?F?0?1?download1$.dat","T?F?0?1?.vob","T?F?0?1?msimn.exe","T?F?0?1?share$faker","T?F?0?1?explorer","T?F?0?1?system","T?F?2147483648?1?.")
  tmrScriptTimer.Interval=60000
  tmrScriptTimer.Enabled=True
  iOff=False
  colUsers.SendChatToAll cStr(sBotName),"Gadget's Searchkick 1.5 started on "+cStr(Now())
End Sub

Sub tmrScriptTimer_Timer()
  If iSearchInterval=0 or iOff Then Exit Sub
  iMinute=iMinute+1
  If iMinute=>iSearchInterval Then
    iMinute=0
    For Each sUser in colUsers
      sUser.SendData "$Search Hub:"+CStr(sBotName)+cStr(Rnd*100)+" "+aSearchString(Int(Rnd*(UBound(aSearchString)+1)))+"|"
    Next
  End If
End Sub

Sub NewUserConnected(curUser)
  If iSearchInterval=0 or iOff Then Exit Sub
  For i=0 To UBound(aSearchString)
    curUser.SendData "$Search Hub:"+CStr(sBotName)+CStr(i)+" "+aSearchString(i)+"|"
  Next
End Sub

Sub DataArival (curUser, sCurData)
  If curUser.bOperator and LCase(sCurData)=LCase("<"+curUser.sName+"> "+sBotname+" on") Then
    iOff=False
    colUsers.SendChatToAll cStr(sBotName),cStr(sBotname)+" is on"
  End If
  If curUser.bOperator and LCase(sCurData)=LCase("<"+curUser.sName+"> "+sBotname+" off") Then
    iOff=True
    colUsers.SendChatToAll cStr(sBotName),cStr(sBotname)+" is off"
  End If
  If curUser.bOperator or iOff Then Exit Sub
  Reason=""
  If Left(sCurData,4)<>Chr(36)+"SR " Then Exit Sub
  i=InStr(1,sCurData,chr(5))
  if i=0 then Exit Sub
  sFileName=Lcase(Mid(sCurData,InStr(5,sCurData," ")+1,i-InStr(5,sCurData," ")-1))
  Suffix=Right(sFileName,4)
  If Suffix=".tmp" or Right(sFileName,5)=".temp" Then Reason="NO TEMP FILES!"
  If Suffix=".vob" Then Reason="NO VOB FILES!"
  If Suffix=".dat" Then
    If instr(1,sFileName,"download10")>1 Then Reason="DO NOT SHARE YOUR KAZAA TEMP FILES!"
  End If
  If Suffix=".wav" Then
    If FileSize(sCurData)>10*1024^2 Then Reason="NO WAVS OVER 10 MB!"
  End If
  If sFileName="windows\explorer.exe" Or sFileName="winnt\explorer.exe" Then Reason="DO NOT SHARE YOUR WINDOWS FOLDER!"
  If sFileName="windows\system.ini" Or sFileName="winnt\system.ini" Then Reason="DO NOT SHARE YOUR WINDOWS FOLDER!"
  If Right(sFileName,17)="express\msimn.exe" Then Reason="DO NOT SHARE INSTALLED APPS!"
  If Right(sFileName,14)="\dcplusplus.xml" Then Reason="DO NOT SHARE INSTALLED APPS!"
  If sFileName="C:\autoexec.bat" Then Reason="DO NOT SHARE YOUR WHOLE HARD DISK!"
  If InStr(1,sFileName,"\__incomplete__") Then Reason="DO NOT SHARE AUDIOGALAXY TEMP FILES!"
  If InStr(1,sFileName,"share faker") Then Reason="NO SHARE FAKERS!"
  If FileSize(sCurData)>iMaxFileSize Then Reason="TOO LARGE FILE ON SHARE!"
  If Reason="" Then Exit Sub
  Do
    i=InStr(i+1,sCurData,Chr(5))
  Loop Until InStr(i+1,sCurData,Chr(5))<1
  Kicker=Mid(sCurData,i+1)
  If Kicker="" Then Kicker=sBotName
  If Left(Kicker,Len(sBotName))=sBotName Then Kicker=sBotName
  If CurUser.sName=LastKicked Then Exit Sub
  LastKicked=CurUser.sName
  If iQuietMode Then
    curUser.PrivateMessage cStr(Kicker),Kicker+" is kicking "+CurUser.sName+" because: "+Reason+" ("+sFileName+")"
    colUsers.ItemByName(cStr(Kicker)).PrivateMessage cStr(sBotName),Kicker+" is kicking "+CurUser.sName+" because: "+Reason+" ("+sFileName+")"
    colUsers.ItemByName(cStr(Kicker)).PrivateMessage cStr(sBotName),"The user "+CurUser.sName+" was kicked by "+Kicker+". IP: "+CurUser.IP
    frmHub.DoEventsForMe  
    curUser.Kick()
  Else
    curUser.PrivateMessage cStr(Kicker),Kicker+" is kicking "+CurUser.sName+" because: "+Reason+" ("+sFileName+")"
    colUsers.SendChatToAll cStr(Kicker),Kicker+" is kicking "+CurUser.sName+" because: "+Reason+" ("+sFileName+")"
    colUsers.SendChatToAll "Hub-Security","The user "+CurUser.sName+" was kicked by "+Kicker+". IP: "+CurUser.IP
    frmHub.DoEventsForMe  
    curUser.Kick()
  End If
End Sub

Function FileSize(SearchData)
  i=InStr(1,SearchData,Chr(5))
  FileSize=CDbl(Mid(SearchData,i+1,InStr(i,SearchData," ")-i-1))
End Function
Hi hi hoo

InnerCity
Posts: 105
Joined: 2003-05-17 00:35

Post by InnerCity » 2003-11-15 05:35

suck, i pasted the original version...sorry

http://www.iespana.es/itspanish/Searchkick3.script

Code: Select all

'This famous script allows users to kick other users themselves! Whoever finds forbidden files with search, gots the honor to be a "op"... Scripts can also do searches by itself. It kicks active users with large .wav, .vob, .tmp, .temp, kazaa .dat, audiogalaxy temp, windows or program files on share automatically. It really keeps the Hub clean!
'SearchKick script v1.5 by Gadget <[email protected]> http://gadget.no-ip.info
'Modified version 0.990 by InnerCity <[email protected]>

Dim Reason,i,Filename,allowop,allownew,sReply,Suffix,Kicker,ShowAll,LastKicked,sBotName,OpsOnly,iQuietMode,iSearchInterval,iSearchIntervalD,aSearchString,iMinute,iMaxFileSize,iOff

Sub Main()

  '----------EDITABLE SETTINGS----------

  allowop          = False        '<- True=ops are not checked, False=everybody is checked (that includes you :-)
  iQuietMode       = False        '<- False=all users can see kick messages, True=Only "kicker" and kicked gets private messages.
  sBotName         = "Searchkick" '<- Bot's name
  iSearchIntervalD = 10           '<- Default Bad file search interval in minutes. 0=Disable self-search (but can search to every new user connected if allownew=false)
  iMaxFileSize     = 5*1024^3     '<- (5 gigabytes) ^0=bytes, ^1=kilobytes, ^2=megabytes, ^3=gigabytes, ^4=terabytes.
  allownew         = False        '<-- False=Searchs every new user connected even though isearchinterval=0. True=searchs are only made by interval
  '----------END OF SETTINGS----------

  aSearchString=Array("T?F?0?1?.tmp","T?F?10485760?1?.wav","T?F?0?1?download1$.dat","T?F?0?1?.vob","T?F?0?1?msimn.exe","T?F?0?1?share$faker","T?F?0?1?explorer","T?F?0?1?system","T?F?2147483648?1?.")
  tmrScriptTimer.Interval=60000
  tmrScriptTimer.Enabled=True
  frmHub.RegisterBotName(sBotName)
  iOff=False
  iSearchInterval = iSearchIntervalD '<--- isearchinterval start as default, but can be changed to 0 if decide to use min.B/W method
  colUsers.SendChatToAll cStr(sBotName),"Modified Gadget's Searchkick 0.990 started on "+cStr(Now())
End Sub

Sub tmrScriptTimer_Timer()
  If iSearchInterval=0 or iOff Then Exit Sub
  iMinute=iMinute+1
  If iMinute=>iSearchInterval Then
    iMinute=0
    For Each sUser in colUsers
      sUser.SendData "$Search Hub:"+CStr(sBotName)+cStr(Rnd*100)+" "+aSearchString(Int(Rnd*(UBound(aSearchString)+1)))+"|"
    Next
  End If
End Sub

Sub NewUserConnected(curUser)
  If allownew or iOff Then Exit Sub '<--- If searchinterval=0 but allownew is false then files are checked
  For i=0 To UBound(aSearchString)
    curUser.SendData "$Search Hub:"+CStr(sBotName)+CStr(i)+" "+aSearchString(i)+"|"
  Next
End Sub

Sub OPConnected(curUser)
  If allowop or iOff or allownew Then Exit Sub
  Call NewUserConnected(curUser)
End Sub

Sub DataArival (curUser, sCurData)
  If (curUser.bOperator and Left(sCurData,1)="<") Or (curUser.bOperator and Left(sCurData,Len(sBotName)+6)="$To: "+sBotName+" ") Then
    sCmd=Mid(sCurData,InStr(sCurData,">")+2)
    sReply=""
    Select Case LCase(sCmd)
    Case "-skon"
    iOff=False
    sReply=" is on"
    Case "-skoff"
    iOff=True
    sReply=" is off"
    Case "-skallowop"
    allowop=True
    sReply=" will not check opers file list"
    Case "-sknoallowop"
    allowop=False
    sReply=" will check opers file list"
    Case "-sknoallownew"
    allownew=False
    sReply=" will not be check users when connect"
    Case "-skallownew"
    allownew=True
    sReply=" only work searchs interval if <> 0"
    Case "-skmin"
    allownew=False
    iSearchInterval = 0
    sReply=" min. B/w method is on"
    Case "-skmax"
    allownew=False
    iSearchInterval = iSearchIntervalD 
    sReply=" max. B/w method is on"
    End Select
    If sReply<>"" Then
      If Left(sCurData,1)="<" Then
        colUsers.SendChatToAll cStr(sBotName),cStr(sBotname)+CStr(sReply)
      Else
        curUser.PrivateMessage CStr(sBotName),cStr(sBotname)+cStr(sReply)
      End If
    End If
  End If
  If (curUser.bOperator and allowop) or iOff Then Exit Sub '<--If ops are allowed then op files are not checked even though isearchinterval<>0, if allowop=false then ops are checked
  Reason=""
  If Left(sCurData,4)<>Chr(36)+"SR " Then Exit Sub
  i=InStr(1,sCurData,chr(5))
  if i=0 then Exit Sub
  sFileName=Lcase(Mid(sCurData,InStr(5,sCurData," ")+1,i-InStr(5,sCurData," ")-1))
  Suffix=Right(sFileName,4)
  If Suffix=".tmp" or Right(sFileName,5)=".temp" Then Reason="NO TEMP FILES!"
  If Suffix=".vob" Then Reason="NO VOB FILES!"
  If Suffix=".dat" Then
    If instr(1,sFileName,"download10")>1 Then Reason="DO NOT SHARE YOUR KAZAA TEMP FILES!"
  End If
  If Suffix=".wav" Then
    If FileSize(sCurData)>10*1024^2 Then Reason="NO WAVS OVER 10 MB!"
  End If
  If sFileName="windows\explorer.exe" Or sFileName="winnt\explorer.exe" Then Reason="DO NOT SHARE YOUR WINDOWS FOLDER!"
  If sFileName="windows\system.ini" Or sFileName="winnt\system.ini" Then Reason="DO NOT SHARE YOUR WINDOWS FOLDER!"
  If Right(sFileName,17)="express\msimn.exe" Then Reason="DO NOT SHARE INSTALLED APPS!"
  If Right(sFileName,14)="\dcplusplus.xml" Then Reason="DO NOT SHARE INSTALLED APPS!"
  If sFileName="C:\autoexec.bat" Then Reason="DO NOT SHARE YOUR WHOLE HARD DISK!"
  If InStr(1,sFileName,"\__incomplete__") Then Reason="DO NOT SHARE AUDIOGALAXY TEMP FILES!"
  If InStr(1,sFileName,"share faker") Then Reason="NO SHARE FAKERS!"
  If FileSize(sCurData)>iMaxFileSize Then Reason="TOO LARGE FILE ON SHARE!"
  If Reason="" Then Exit Sub
  Do
    i=InStr(i+1,sCurData,Chr(5))
  Loop Until InStr(i+1,sCurData,Chr(5))<1
  Kicker=Mid(sCurData,i+1)
  If Kicker="" Then Kicker=sBotName
  If Left(Kicker,Len(sBotName))=sBotName Then Kicker=sBotName
  If CurUser.sName=LastKicked Then Exit Sub
  LastKicked=CurUser.sName
  If iQuietMode Then
    curUser.PrivateMessage cStr(Kicker),Kicker+" is kicking "+CurUser.sName+" because: "+Reason+" ("+sFileName+")"
    colUsers.ItemByName(cStr(Kicker)).PrivateMessage cStr(sBotName),Kicker+" is kicking "+CurUser.sName+" because: "+Reason+" ("+sFileName+")"
    colUsers.ItemByName(cStr(Kicker)).PrivateMessage cStr(sBotName),"The user "+CurUser.sName+" was kicked by "+Kicker+". IP: "+CurUser.IP
    frmHub.DoEventsForMe  
    curUser.Kick()
  Else
    curUser.PrivateMessage cStr(Kicker),Kicker+" is kicking "+CurUser.sName+" because: "+Reason+" ("+sFileName+")"
    colUsers.SendChatToAll cStr(Kicker),Kicker+" is kicking "+CurUser.sName+" because: "+Reason+" ("+sFileName+")"
    colUsers.SendChatToAll "Hub-Security","The user "+CurUser.sName+" was kicked by "+Kicker+". IP: "+CurUser.IP
    frmHub.DoEventsForMe  
    curUser.Kick()
  End If
End Sub

Function FileSize(SearchData)
  i=InStr(1,SearchData,Chr(5))
  FileSize=CDbl(Mid(SearchData,i+1,InStr(i,SearchData," ")-i-1))
End Function
Hi hi hoo

InnerCity
Posts: 105
Joined: 2003-05-17 00:35

Post by InnerCity » 2003-11-17 21:07

the second step is here, the actions for every kind of forbidden files are implemented, so you only need to edit settings the way you like, is enough set the ipolicy but can edit other settings if you want but...
i am trying to finish the script and...have some questions and problems
first, i need the instructions to ban a nick

frmHub.lstPermBan.AddItem(curUser.IP()) '<-- IP Banned
'<-- Nick banned... if i find the instructions
frmHub.DoEventsForMe
CurUser.Disconnect()
anyone have them? please, please, gimme
another question is ... the actions (kick and so on) can be out of the subdataarival¿? can i use this actions in other sub? ¿can i have two differents Sub tmrScriptTimer_Timer in different parts of the script¿?
i want to solve the problem of messages that are not sent before kick or disconnect using a timer but... it seems that finally i'll have to use a stupid function counting numbers or something similiar to force a delay in the micro
any suggestions?
this instruction doesnt work
If InStr(1,sFileName,"r@ygold") or InStr(1,sFileName,"teletubbies") or InStr(1,sFileName,"Hitler") Then iReason=6
the searchs are made and files identify (they appear in status messages) but script doesnt act... what does the 1 mean?
come on, a little help and this script will be finished

http://www.iespana.es/itspanish/Searchkick6.script

Code: Select all

'This famous script allows users to kick other users themselves! Whoever finds forbidden files with search, gots the honor to be a "op"...
'Scripts can also do searches by itself. It kicks active users with large .wav, .vob, .tmp, .temp, kazaa .dat, audiogalaxy temp, windows or program files on share automatically. It really keeps the Hub clean!
'SearchKick script v1.5 by Gadget <[email protected]> http://gadget.no-ip.info
'Modified version 0.995 by InnerCity <[email protected]>

Dim sReason(6),iPolicy(6),sAction(5),sPolicy(5),iReason,i,Filename,allowop,allownew,sReply,Suffix,Kicker,ShowAll
Dim LastKicked,sBotName,OpsOnly,iQuietMode,iSearchInterval,iSearchIntervalD,aSearchString,iMinute,iMaxFileSize,iOff

Sub Main()

  '----------EDITABLE SETTINGS----------

  allowop          = False        '<- True=ops are not checked, False=everybody is checked (that includes you :-)
  iQuietMode       = False        '<- False=all users can see kick messages, True=Only "kicker" and kicked gets private messages.
  sBotName         = "Searchkick" '<- Bot's name
  iSearchIntervalD = 10           '<- Default Bad file search interval in minutes. 0=Disable self-search (but can search to every new user connected if allownew=false)
  iMaxFileSize     = 5*1024^3     '<- (5 gigabytes) ^0=bytes, ^1=kilobytes, ^2=megabytes, ^3=gigabytes, ^4=terabytes.
  allownew         = False        '<-- False=Searchs every new user connected even though isearchinterval=0. True=searchs are only made by interval

 'REASONS and POLICIES
 'YOU CAN EDIT THE POLICY ACTION (iPolicy(i)=number) FOR EVERY KIND OF FINDED FILE
 '-----Policies action: 0=no action, 1=warn, 2=redirect, 3=disconnect, 4=kick, 5=kick&permban

 '-----FILES OK (iReason nº0)-----
 sReason(0)    = "FILES ARE OK!"    '<--- This message will never be sent, dont worry about it
 iPolicy(0)    = 0
 '-----TEMP (iReason nº1)-----
 sReason(1)    = "NO TEMP, VOB, AUDIOGALAXY EMULE or KAZAA FILES!"
 iPolicy(1)    = 1  '<--- If files are allowed just set iPolicy(i)=0, there will be no messages sent and no actions
 '-----INSTALLED APPS (iReason nº2)-----
 sReason(2)    = "DO NOT SHARE INSTALLED APPS!"
 iPolicy(2)    = 1
 '-----MUSIC (iReason nº3)-----
 sReason(3)    = "NO WAVS OVER 10 MB, MP3 OVER 2 MB OR WMA OVER 2MB! MUSIC IS FORBIDDEN"
 iPolicy(3)    = 5
 '-----FILMS (iReason nº4)-----
 sReason(4)    = "NO AVI, MPG OR MPEG OVER 200 MB! FILMS ARE FORBIDDEN"
 iPolicy(4)    = 5
 '-----FAKE (iReason nº5)-----
 sReason(5)    = "NO FAKE FILES"
 iPolicy(5)    = 1
 '-----MIND CLEAN (iReason nº6)-----
 sReason(6)    = "NO CHILD PORNOGRAPHY, NAZISM APOLOGY OR TELETUBBIES EPISODES (KEEP YOUR MIND CLEAN)"
 iPolicy(6)    = 5

 'ACTIONS - YOU CAN EDIT THE BYE-BYE-MESSAGE-TEXT OF EVERY iPolicy, exmp: sPolicy(iPolicy(3)=2)=sPolicy(2)=redirect message
 '-----Policies action: 0=no action, 1=warn, 2=redirect, 3=disconnect, 4=kick, 5=kick&permban
 sPolicy(0)    = " What a nice file list...Welcome!" '<--- This message will never be shown cos noADMIN want to be so... stupid
 sAction(0)    = "hello"
 sPolicy(1)    = " This time I let you in, but next time I'll kill your whole family and friends!" '<-- Isn't it convincent?
 sAction(1)    = "warn"
 sPolicy(2)    = " You have been redirected to a better place for your shareds" & "(" & frmHub.txtRedirect & ")"
 sAction(2)    =  "(" & frmHub.txtRedirect & ")" & "redirect"
 sPolicy(3)    = " You have been disconnected."
 sAction(3)    = "disconnect"
 sPolicy(4)    = " You have been kicked. You are 15 minutes banned."
 sAction(4)    = "kick"
 sPolicy(5)    = " You have been baned. Mail to [email protected] to ask for unban."
 sAction(5)    = "ban"

'----------END OF SETTINGS----------
  aSearchString=Array("T?F?0?1?.tmp","T?F?10485760?1?.wav","T?F?2097152?1?.mp3","T?F?2097152?1?.wma","T?F?209715200?1?.avi","T?F?209715200?1?.mpg","T?F?209715200?1?.mpeg","T?F?0?1?download1$.dat","T?F?0?1?.vob","T?F?0?1?msimn.exe","T?F?0?1?part.met","T?F?0?1?share$faker","T?F?0?1?explorer","T?F?0?1?Hitler","T?F?0?1?teletubbies","T?F?0?1?r@ygold","T?F?0?1?system","T?F?2147483648?1?.")
  tmrScriptTimer.Interval=60000
  tmrScriptTimer.Enabled=True
  frmHub.RegisterBotName(sBotName)
  iOff=False
  iSearchInterval = iSearchIntervalD '<--- iSearchInterval start as default, but can be changed to 0 if decide to use min.B/W method
  colUsers.SendChatToAll cStr(sBotName),"Modified Gadget's Searchkick 0.995 started on "+cStr(Now())
End Sub

Sub tmrScriptTimer_Timer()
  If iSearchInterval=0 or iOff Then Exit Sub
  iMinute=iMinute+1
  If iMinute=>iSearchInterval Then
    iMinute=0
    For Each sUser in colUsers
      sUser.SendData "$Search Hub:"+CStr(sBotName)+cStr(Rnd*100)+" "+aSearchString(Int(Rnd*(UBound(aSearchString)+1)))+"|"
    Next
  End If
End Sub

Sub NewUserConnected(curUser)
  If allownew or iOff Then Exit Sub '<--- If searchinterval=0 but allownew is false then files are checked
  For i=0 To UBound(aSearchString)
    curUser.SendData "$Search Hub:"+CStr(sBotName)+CStr(i)+" "+aSearchString(i)+"|"
  Next
End Sub

Sub OPConnected(curUser)
  If allowop or iOff or allownew Then Exit Sub   '<--- If oper are allowed there is no search when they connnect
  Call NewUserConnected(curUser)
End Sub

Sub DataArival (curUser, sCurData)
  If (curUser.bOperator and Left(sCurData,1)="<") Or (curUser.bOperator and Left(sCurData,Len(sBotName)+6)="$To: "+sBotName+" ") Then
    sCmd=Mid(sCurData,InStr(sCurData,">")+2)
    sReply=""
    Select Case LCase(sCmd)
    Case "-skon"
    iOff=False
    sReply=" is on"
    Case "-skoff"
    iOff=True
    sReply=" is off"
    Case "-skallowop"
    allowop=True
    sReply=" will not check opers file list"
    Case "-sknoallowop"
    allowop=False
    sReply=" will check opers file list"
    Case "-sknoallownew"
    allownew=False
    sReply=" will not be check users when connect"
    Case "-skallownew"
    allownew=True
    sReply=" only work searchs interval if <> 0"
    Case "-skmin"
    allownew=False
    iSearchInterval = 0
    sReply=" minimum bandwith method is on"
    Case "-skmax"
    allownew=False
    iSearchInterval = iSearchIntervalD 
    sReply=" maximum bandwith method is on"
    Case "-skhelp"
    sReply=" COMMANDS: " & vbCrLf & "-skoff: turn script off (no searchs)" & vbCrLf & "-skon: turn script on" & vbCrLf & "-skallowop: no searchs in opers" & vbCrLf & "-sknoallowop: searchs in opers" & vbCrLf
    sReply=sReply & "-sknoallownew: searchs in new user connect" & vbCrLf & "-skallownew: no searchs in new user connect" & vbCrLf
    sReply=sReply & "-skmin: turn minimum bandwith method on (searchs only over new users connected)" & vbCrLf & "-skmax: turn maximum bandwith method on (searchs by interval and over new users connected)"
    End Select
    If sReply<>"" Then
      If Left(sCurData,1)="<" Then
        colUsers.SendChatToAll cStr(sBotName),cStr(sBotname)+CStr(sReply)
      Else
        curUser.PrivateMessage CStr(sBotName),cStr(sBotname)+cStr(sReply)
      End If
    End If
  End If
  If (curUser.bOperator and allowop) or iOff Then Exit Sub '<--If ops are allowed then op files are not checked even though isearchinterval<>0, if allowop=false then ops are checked
  iReason=0  '<---- We suposse files are OK before start checking
  If Left(sCurData,4)<>Chr(36)+"SR " Then Exit Sub
  i=InStr(1,sCurData,chr(5))
  if i=0 then Exit Sub
  sFileName=Lcase(Mid(sCurData,InStr(5,sCurData," ")+1,i-InStr(5,sCurData," ")-1))
  Suffix=Right(sFileName,4)
  If Suffix=".tmp" or RightB(sFileName,10)=".temp" Then iReason=1 '<--- Every iReason=i is associated the to the sReason(i) of SETTINGS
  If Suffix=".vob" Then iReason=1
  If Suffix=".dat" Then
    If instr(1,sFileName,"download10")>1 Then iReason=1
  End If
  If Suffix=".wav" Then
    If FileSize(sCurData)>10*1024^2 Then iReason=3
  End If
  If Suffix=".mp3" or Suffix=".wma" Then
    If FileSize(sCurData)>2*1024^2 Then iReason=3
  End If
  If Suffix=".avi" or Suffix=".mpg" or Suffix=".mpeg" Then
    If FileSize(sCurData)>200*1024^2 Then iReason=4
  End If
  If sFileName="windows\explorer.exe" Or sFileName="winnt\explorer.exe" Then iReason=2
  If sFileName="windows\system.ini" Or sFileName="winnt\system.ini" Then iReason=2
  If RightB(sFileName,34)="express\msimn.exe" Then iReason=2
  If RightB(sFileName,28)="\dcplusplus.xml" Then iReason=2
  If RightB(sFileName,24)="001.part.met" or RightB(sFileName,24)="part.met.bak" Then iReason=1
  If sFileName="C:\autoexec.bat" Then iReason=2
  If InStr(1,sFileName,"\__incomplete__") Then iReason=1
  If InStr(1,sFileName,"share faker") Then iReason=5
  If InStr(1,sFileName,"r@ygold") or InStr(1,sFileName,"teletubbies") or InStr(1,sFileName,"Hitler") Then iReason=6
  If FileSize(sCurData)>iMaxFileSize Then iReason=5
  If iReason=0 or iPolicy(iReason)=0 Then Exit Sub    '<--- If supossition is true (files OK) or files has no policy action (iPolicy(i)=0) then lets EXIT
  Do
    i=InStr(i+1,sCurData,Chr(5))
  Loop Until InStr(i+1,sCurData,Chr(5))<1
  Kicker=Mid(sCurData,i+1)
  If Kicker="" Then Kicker=sBotName
  If Left(Kicker,Len(sBotName))=sBotName Then Kicker=sBotName
  If CurUser.sName=LastKicked Then Exit Sub  '<--- User is advertised only one time, so will not receive multiple message if have multiple forbidden files
  LastKicked=CurUser.sName
  '<--- Lets send the messages
  curUser.PrivateMessage cStr(Kicker),Kicker & " is " & sAction(iPolicy(iReason)) & "ing to " & CurUser.sName & " because: " & sReason(iReason) & " (" & sFileName & ")" & sPolicy(iPolicy(iReason))
  frmHub.DoEventsForMe
     If iQuietMode Then
      colUsers.ItemByName(cStr(Kicker)).PrivateMessage cStr(sBotName),Kicker & " is " & sAction(iPolicy(iReason)) & "ing to " & CurUser.sName & " because: " & sReason(iReason) & " (" & sFileName & ")"
      colUsers.ItemByName(cStr(Kicker)).PrivateMessage cStr(sBotName),"The user " & CurUser.sName & " was " & sAction(iPolicy(iReason)) & "ed by " & Kicker & ". IP: " & CurUser.IP
      frmHub.DoEventsForMe
     Else
      colUsers.SendChatToAll cStr(Kicker),Kicker & " is " & sAction(iPolicy(iReason)) & "ing to " & CurUser.sName & " because: " & sReason(iReason) & " (" & sFileName & ")"
      colUsers.SendChatToAll "Hub-Security","The user " & CurUser.sName & " was " & sAction(iPolicy(iReason)) & "ed by " & Kicker & ". IP: " & CurUser.IP
      frmHub.DoEventsForMe
     End If
  '--- Lets do the policy action associated to every iReason ---
  Select Case iPolicy(iReason)
  Case 2
    CurUser.ForceMove frmHub.txtRedirect
    frmHub.DoEventsForMe
    CurUser.Disconnect()
  Case 3
    CurUser.Disconnect()
  Case 4
    CurUser.Kick()
  Case 5
    frmHub.lstPermBan.AddItem(curUser.IP())      '<-- IP Banned
    '<-- Nick banned... if i find the instructions
    frmHub.DoEventsForMe
    CurUser.Disconnect()
  End Select
End Sub

Function FileSize(SearchData)
  i=InStr(1,SearchData,Chr(5))
  FileSize=CDbl(Mid(SearchData,i+1,InStr(i,SearchData," ")-i-1))
End Function

  '----------END OF SCRIPT----------
Hi hi hoo

ButterflySoul
Posts: 210
Joined: 2003-01-23 17:24
Location: Nevada
Contact:

Post by ButterflySoul » 2003-11-18 08:09

frmHub.lstPermBan.AddItem(curUser.IP()) '<-- IP Banned
'<-- Nick banned... if i find the instructions
frmHub.DoEventsForMe
CurUser.Disconnect()
anyone have them? please, please, gimme
There is no nick ban under NMDCH. Only RyalthDCH, (older versions of) SBHub, and SDCH offer native nickbans to VBS scripters, in one single neat instruction.
Under NMDCH you have to cheat a bit around and find your own way to manage it:
- Some scripts use an extrenal text file, load it in a dictionary and match it against the username in the userconnected sub. The inconvenient of this method is that the ban is enforced late in the login process, but it allows for neat tricks (like baning a partial Nick sequence, instead of the exact nick). This is the method used in Zeus, for example.

- Some scripts register the nick, but don't give the password to its owner, effectively preventing them from entering the hub (unless they somehow manage to find the pass). The inconvenient of this method is that your reged user's list ends up cluttered with ban entries. However, the ban is enforced very early in the login process. This method is used in General Bot for example.

- Finally some scripts use the second method, but in combination with a database. This allows them to track additional info about users (like last IP, last login date, etc) and to add extra flags marking the difference between a regular reged user, a banned user, and even additional user types, such as VIP for example. The inconvenient of this method is that you need a minimum of DB knoledge, but it's a great way to avoid all the clutter in hub reg list (well, actually, the hub's reg list is just as cluttered, but you have a second place -the DB- where it's unluttered and easy for your scripts to request the list of only the OPs, only the banned people, etc). This method is used in Aphrodite, for example.
[CoZ] Children of Zeus
-----
Shadows DC Hub - VBS and JS scripting at their best

Locked