searchkick - no private messages - scripting question

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

searchkick - no private messages - scripting question

Post by InnerCity » 2003-10-05 18:40

this is the original searchkick of gadget, i am running a modified version to kick users with all kinds of films and music

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
if i register the bot...

Code: Select all

  frmHub.RegisterBotName cStr(sBotName)
  tmrScriptTimer.Interval=60000
  tmrScriptTimer.Enabled=True
  iOff=False
then no private messages is sending to the user that have the prohibited files
i have been running 3 months in this way, loosing users cos they didnt know the reason of kicks, and i would like to know the reason of this scripting question, why if the bot is registered the instructions for private messages doesnt work? need a different syntax?
Hi hi hoo

Locked