mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2021
Posts: 48
R
Robert Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2021
Posts: 48
Can someone help me to update new version of this code to scan blacklist on file text when MyBot join channel, and automatic scan for blacklisted from globalkickdatabase.txt,in file text structure like this:

(1) (2) (3) (4) (5) (6)
[id: xxxx];<Nickname>;<ident>;<ip/host>;<#channel>;<reason kick>

Example: in file globalkickdatabase.txt i save per line

[id: 5678];NickName;uid405139;sven.users.undernet.org;#myroom;NickName is not welcome here any more
[id: 1234];NickTest;testident;10.20.30.40;#happy;NickTest is not welcome here
[id: 6789];Hithere;hithereident;my.host.org;#test;Are you hithere?
...........

I want Bot scan and check NickName and IDENT and IP/HOSTMASK when my Bot join channel:
1. Check NICKNAME (if found then ban NICKNAME and kick on <#channel> (5) with the <reason kick> (6) in file.txt structure above.)
2. Check IDENT (if found then ban IDENT and kick on <#channel>(5) with the <reason kick>(6) in file.txt structure above.)
3. Check IP/HOSTMASK if found then ban IP/HOSTMASK and kick on <#channel>(5) with the <reason kick>(6) in file.txt structure above.)

Here is code (made by Epic):
Code
;#####################################################################
;#   Name: Scan Joining Users (Beta dev 2)
;#   Author: Epic (epicnet@mail.ru, http://epicnet.ru)
;#   Idea: Robert
;#   Description: Scans for all blacklisted users who join channels, or when the bot reconnects to channels, it will scan all users on the channels.
;#   Note: You must create a file "globalkickdatabase.txt" in the mIRC root folder in this format for each line: [ID: 1234];*!*@Host;Reason kick
;#####################################################################

alias -l scanjoin_set {
  %sj_work = yes
  %sj_who_delay = 5000
  %sj_ban_time = 10800
  %sj_rem_nick = MyBotName
}
on *:JOIN:#:{
  if (!$read(SCANBLACKLISTONMEJOIN_CHAN.txt,ntw,$chan)) { return }
  scanjoin_set
  if (%sj_work == yes) {
    if ($nick == $me) {
      %scanjoin = on
      .timerSJWHOME $+ $chan -m 1 %sj_who_delay .who $chan
    }
  }
  else {
    var %ident $ial($nick).user
    var %host $ial($nick).host
    scanjoin $chan $nick %ident %host
  }
}

raw 352:*: if (%scanjoin == on) { scanjoin $2 $6 $3 $4 | haltdef }
raw 315:*: if (%scanjoin == on) { unset %scanjoin | haltdef }
alias -l scanjoin {
  if ($me !isop $1 && !$hget(scanjoin,stop)) {
    .echo -s For further actions, I need the rights of the channel operator:12 $1
    .hadd -mz scanjoin stop 30
    halt
  }
  var %chan $1
  var %nick $2
  var %ident $3
  var %host $4
  var %file = globalkickdatabase.txt
   if ($read(%file,ntw,$+(*,%ident,*))) {
    var %str $read(%file,$readn)
    if ($chr(35) == $left(%str,1)) goto next1
    tokenize 59 %str
    if ($+(*,%ident,*) iswm $2) {
      var %idban $1
      var %reason $3
      .ban $+(-u,%sj_ban_time) %chan $+($gettok($address(%nick,0),1,64),@*)
      .kick %chan %nick 04([Banned] (reason: %reason $+ ) %idban $+ )
      goto next2
    }
    : next1
  }
  if ($read(%file,ntw,$+(*,%host,*))) {
    var %str $read(%file,$readn)
    if ($chr(35) == $left(%str,1)) goto next2
    tokenize 59 %str
    if ($+(*,%host,*) iswm $2) {
      var %idban $1
      var %reason $3
      .ban $+(-u,%sj_ban_time) %chan $+(*!*@,$gettok($address(%nick,0),2,64))
      .kick %chan %nick 04([Banned] (reason: %reason $+ ) %idban $+ )
    }
    :next2 
  }
}

Thanks all for help and i hope receive the aswer with the new code version soon!!!!

Joined: Dec 2021
Posts: 36
T
Ameglian cow
Offline
Ameglian cow
T
Joined: Dec 2021
Posts: 36
Here is a simple blacklist script I am sure you can figure the rest out yourself.

Code
on *:join:#: {
    if ($nick == $me) { 
        .ial on | ialfill $chan 
         return 
    }
    if ($address isin %banlist. [ $+ [ $chan ] ]) { kick $chan $nick You are not welcome here }
}
on *:OP:#: {
    if ($opnick != $me) { return }
    .timer 1 5 /check_banned $chan
    ; I Put a delay on the check_banned incase you are opped before the /ialfill finishes.
}
alias -l check_banned {
    var %i = 1
    while ($ialchan(*,$$1,%i) {
         if ($ifmatch isin %banlist. [ $+ [ $chan ] ]) { kick $chan $nick You are not welcome here! }
   }
}
alias -l ban_nick {
  var %nick = $1
  var %chan = $2
  var %address = $ialchan(%nick,%chan,1)
  if (!%address) { return }
  if (%address in %banlist. [ $+ [ $chan ] ]) { return }
  set %banlist. [ $+ [ %chan ] ] = %banlist. [ $+ [ %chan ] ] %address
}
alias -l unban_nick {
  var %nick = $1
  var %chan = $2
  var %address = $ialchan(%nick,%chan,1)
  if (!%address) { return }
  set %banlist. [ $+ [ %chan ] ] $remove(%banlist. [ $+ [ %chan ] ], %address)
}
on *:SERVEROP:#: { }


. : Machine-Gun script named Bauderr with Trio-ircproxy.py :: .

Link Copied to Clipboard