searchip from connect output

Moderator: GeekShed.Net Staff

searchip from connect output

Postby Zorg » Wed Oct 09, 2019 8:25 pm

OK.. i have nice broken down simplified connect / nick change / quit / version script running for some new staff so they dont overwhelmed by the main services scroll but i'm looking for a standalone section please to run from the connection side so that we can do a whowas based from the connecting ip and it shows the last 10 nicks used on that ip please.
the script i am looking for is to be triggered in #ops via the command .searchip .. output from the bot to go into channel
Code: Select all
on ^*:snotice:*:{
if (Client connecting isin $1-) {
    window -nek @Connecting
    aline -hp  @Connecting 4 $+ $1- at $time on $date on $network
    msg #mastercontrol 6CONN $4 at $time and their ip is $6
    CTCP $4 Version
    haltdef
  }
 if (Client exiting isin $1-) {
    window -nek @Exiting
    aline -hp  @Exiting 4 $+ $1- at $time on $date on $network
    msg #mastercontrol 12QUIT $4
    haltdef
  }
if (changed their nickname isin $1-) {
    window -nek @cnick
    aline -hp  @cnick 4 $+ $1- at $time on $date on $network
    msg #mastercontrol 4NICK $2 changed nick to $9
    haltdef
  }
}
on 1:CTCPREPLY:VERSION*:/msg #mastercontrol,#version 3VERSION $nick : $2-


The above code is what i am using atm... the output looks a bit like this [19:06] 6CONN emmak at 19:06:40 and their ip is [12.34.56.78]

I dont know if the following code will help.. but i use this for showing the last 10 connections from a whowas as well as showing ip from a whois. it might be easier to add to this than code new ???
Code: Select all
raw 311:*: {
  .msg #ops $2 $+ 's whois ID: $+($3,@,$4) and Real Name is: $6- | halt
}
raw 314:*: {
  ;.msg #ops $2 $+ 's whowas ID: $+($3,@,$4) and Real Name was: $6-
  if ($hasActiveSearch(314,$2)) {
    haltdef
    sendToUser $numeric $2 10 $2 $+ 's whowas ID: $+($3,@,$4) and Real Name was: $6-
  }
}

raw 406:*: {
  if ($hasActiveSearch(314,$2)) {
    haltdef
    sendToUser 314 $2 $2 $+ 's whowas information could not be found
  }
}

raw 369:*: {
  if ($hasActiveSearch(314,$2)) {
    haltdef
    removeRawUser 314 $2
  }
}

on *:text:*:#ops: {
  if ($nick isop $chan) && ($regex($1-,/(^|\s)(.idshow?w?s?\s\S+)/i)) {
    tokenize 32 $regml(2) | whois $2
  }
  if ($nick isop $chan) && ($regex($1-,/(^|\s)(.lastid?d?s?\s\S+)/i)) {
    addRawUser 314 $2 $nick
    if (!$hasActiveSearch(314,$2)) tokenize 32 $regml(2) | whowas $2
  }
}

;/addRawUser [rawEventId] [searchTerm/searchForUser] [searchByUser]
alias -l addRawUser {
  var %search = $2, %user = $3, %table = $+(event_search_table_,$1), %table2 = event_search_max
  if (!$hget(%table)) .hmake %table 2
  if (!$hget(%table2)) .hmake %table2 2
  if ($len($hget(%table,%search))) hadd %table %search $addtok($hget(%table,%search),%user,9)
  else hadd %table %search %user
  if (!$hget(%table2,$+($1,_,$2))) hadd event_search_max $+($1,_,$2) 0
}

;/removeRawUser [rawEventId] [searchTerm/searchForUser]
alias -l removeRawUser {
  var %search = $2, %table = $+(event_search_table_,$1), %table2 = event_search_max
  if ($len($hget(%table,%search))) {
    hdel %table %search
    if ($len($hget(%table2,$+($1,_,%search)))) {
      hdel %table2 $+($1,_,%search)
    }
  }
}

;$hasActiveSearch([rawEventId],[searchTerm/searchForUser])
alias -l hasActiveSearch {
  return $len($hget($+(event_search_table_,$1),$2))
}

;/sendToUser [rawEventId] [searchTerm/searchForUser] [max] [message] (0 for no max)
alias -l sendToUser {
  var %search = $2, %table = $+(event_search_table_,$1)
  if ($len($hget(%table,%search))) {
    var %table2 = event_search_max, %item = $+($1,_,%search)
    if ($len($hget(%table2, %item)) && ($hget(%table2, %item) < $3 || $3 == 0)) {
      hinc %table2 %item
      if ($3 == $hget(%table2, %item)) hdel %table2 %item
      var %users = $hget(%table,%search)
      while ($len(%users)) {
        .msg $gettok(%users,1,9) $4-
        %users = $deltok(%users,1,9)
      }
    }
  }
}
raw 312:*: {
  if ($hasActiveSearch(314,$2)) haltdef
Zorg
 
Posts: 4
Joined: Mon Jul 13, 2015 8:06 pm

Re: searchip from connect output

Postby Zorg » Sat Oct 19, 2019 11:03 am

posting a bump on this thread as i see there has been alot of views and i know there are a good few excellent coding brains out there on this site whom i hold in high regard
Zorg
 
Posts: 4
Joined: Mon Jul 13, 2015 8:06 pm


Return to Script help

Who is online

Users browsing this forum: No registered users and 1 guest