mIRC Home    About    Download    Register    News    Help

Print Thread
#114549 15/03/05 10:40 AM
Joined: Mar 2004
Posts: 540
A
Armada Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Mar 2004
Posts: 540
Ok first off my idea, Im writing a script that looks at Clients connecting disconnecting and nickchanges, to watch for certain masks, nicks, idents or hosts, its up to the user, this is meant for opers yes and I have the code prettying much finished, well the backside, I just need help on how to match IP's or ideas. Heres the code I have
Code:
 
Dialog OperAlert {
  Title "OperAlert"
  Size -1 -1 374 414
  Tab "Add", 1, 6 9 358 360, 
  Tab "View/Del", 2
  Box "Add", 4, 16 38 335 321,  tab 1
  Box "Mask", 5, 26 53 239 44,  tab 1
  ;What to watch
  Edit "NickName!Ident@HostMask/IP", 6, 34 69 221.946308724832 19,  tab 1
  Box "Options", 7, 26 98 302 155,  tab 1
  Box "Akill On Site", 8, 33 111 107 65,  tab 1
  ;Prompt To akill
  Radio "Yes", 9, 41 125 89 17,  tab 1
  Radio "No", 10, 41 151 89 17,  tab 1
  ;Note for alerts
  Box "Note:", 11, 32 184 289 45,  tab 1
  Edit "Note on alert", 12, 37 200 277.38255033557 19,  tab 1
  ;Add Alert
  Button "Add", 13, 27 261 89 23,  tab 1
  ;Clear Forms
  Button "Clear", 14, 27 319 89 23,  tab 1
  ;Export to file
  Button "Export", 15, 126 261 89 23,  tab 1
  ;Import from file
  Button "Import", 16, 130 319 89 23,  tab 1
  ;Close dialog
  Button "Close", 17, 139 379 89 23, ok
  ;List of alerts
  List  18, 19 41 332 239,  tab 2
  ;Delete alert
  Button "Remove", 19, 16 307 89 23,  tab 2
  ;View
  Button "View", 21, 145 306 89 23,  tab 2
  ;Modify said alert
  Button "Modify", 20, 264 306 89 23,  tab 2
}
;Adding Alert
on *:dialog:OperAlert:sclick:13: {
  var %operalert.add = $did(OperAlert,6)
  if ($did(OperAlert,9).state == 1) && ($did(OperAlert,10).state == 0) {
    var %operalert.add = %operalert.add $+ ¿ $+ 1
  }
  if ($did(OperAlert,9).state == 0) && ($did(OperAlert,10).state == 1) {
    var %operalert.add = %operalert.add $+ ¿ $+ 0
  }
  if ($did(OperAlert,9).state == 0) && ($did(OperAlert,10).state == 0) {
    var %operalert.akill $?!="Akill on site?"
    if (%operalert.akill == $false) {
      var %operalert.add = %operalert.add $+ ¿ $+ 0
    }
    if (%operalert.akill == $true) {
      var %operalert.add = %operalert.add $+ ¿ $+ 1
    }
  }
  var %operalert.add = %operalert.add $+ ¿ $+ $did(OperAlert,12).text
  write OperAlert.txt %operalert.add
}
;Changing Tabs
on *:dialog:OperAlert:sclick:2: {
  did -r $dname 18
  var %x = 1
  var %y = $lines(OperAlert.txt)
  while (%x <= %y) {
    did -a $dname 18 $read(OperAlert.txt,%x)
    inc %x
  }
}
;Delete Entry
on *:dialog:OperAlert:sclick:19: {
  var %tmp_read_tmp = $read(operalert.txt, w, $did(operalert,18).seltext)
  write -dl $+ $readn operalert.txt
  did -r $dname 18
  var %x = 1
  var %y = $lines(OperAlert.txt)
  while (%x <= %y) {
    did -a $dname 18 $read(OperAlert.txt,%x)
    inc %x
  }
}
;;;;Snotices
on *:SNOTICE:*** Notice -- Client connecting*:{
  if ($7 = port) { 
    ;echo -s  $9 $right($gettok($10,1,64),-1) $left($gettok($10,2,64),-1)
    if ($operalertcheck($9).nick !== $null) { 
      echo -s $operalertcheck($9).nick
    }
    if ($operalertcheck($right($gettok($10,1,64),-1)).ident !== $null) { 
      echo -s $operalertcheck($right($gettok($10,1,64),-1)).ident
    }
    if ($operalertcheck($left($gettok($10,2,64),-1)).host !== $null) { 
     echo -s $operalertcheck($right($gettok($10,1,64),-1)).host
    }
  } 
  else { 
    ;echo -s $8 $right($gettok($9,1,64),-1) $left($gettok($9,2,64),-1)
    if ($operalertcheck($8).nick !== $null) { 
      echo -s $operalertcheck($9).nick
    }
    if ($operalertcheck($right($gettok($9,1,64),-1)).ident !== $null) { 
      echo -s $operalertcheck($right($gettok($10,1,64),-1)).ident
    }
    if ($operalertcheck($left($gettok($9,2,64),-1)).host !== $null) { 
     echo -s $operalertcheck($right($gettok($10,1,64),-1)).host
    }

  }
  haltdef
}
alias operalertcheck {
  ;Nick $gettok(%operalert_read,1,$33)
  ;Ident $gettok($gettok(%operalert_read,1,64),2,33)
  ;Host $gettok($gettok(%operalert_read,2,64),1,191)
  var %y = $lines(operalert.txt)
  var %x = 1
  if ($prop == ident) {
    while (%x <= %y) {
      var %operalert_read = $read(operalert.txt,%x)
      if ($1 == $gettok($gettok(%operalert_read,1,64),2,33)) {
        return $gettok(%operalert_read,3,191)
      }
      inc %x
    }
  }
  if ($prop == nick) {
    while (%x <= %y) {
      var %operalert_read = $read(operalert.txt,%x)
      if ($1 == $gettok(%operalert_read,1,33)) {
        return $gettok(%operalert_read,3,191)
      }
      inc %x
    }
  }
  if ($prop == host) {
    while (%x <= %y) {
      var %operalert_read = $read(operalert.txt,%x)
      if ($1 == $gettok($gettok(%operalert_read,2,64),1,191)) {
        return $gettok(%operalert_read,3,191)
      }
      inc %x
    }
  }
}
 

Right now im just echoing to see if Im acheiving what I want, the file looks like
Random!java@127.0.0.1¿0¿Note on alert
or can Look like Random!*@*¿0¿Note on alert, now I dont want the asterik setting off all ips but I want it to try to match only if theres something like 127.0.0.* or a host *.pool82189.interbusiness.it just curious for ideas and general clean up for what I have

#114550 16/03/05 12:09 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
mIRC offers two efficient ways of matching a full address against a list of wildcards.
  • Suppose you had the following entries in your userlist, you could use $ulist([color:blue]nick!user@host, akill, 1)[/color] to retrieve the first matching wildcard (if any), and $ulist([color:blue]nick!user@host, akill, 1).info[/color] to retrieve the information (akill reason) associated with it.

    Code:
    [color:green]akill:[/color][color:blue]*!*mooscript@*[/color]     [color:purple]insane script[/color]
    [color:green]akill:[/color][color:blue]*!~*@*.verizon.net[/color] [color:purple]botnet[/color]
    [color:green]akill:[/color][color:blue]nicebot!*@*[/color]        [color:purple]harassing bot[/color]
  • Suppose you had a hashtable named "akill" with the following content, you could use $hfind([color:green]akill, nick!user@host, 1, W)[/color] to retrieve the first matching wildcard (if any), and $hget([color:green]akill, $hfind(akill, nick!user@host, 1, W))[/color] to retrieve the data (akill reason) associated with it.

    Code:
    table: [color:green]akill[/color]
    item               data
     
    [color:blue]*!*mooscript@*[/color]     [color:purple]insane script[/color]
    [color:blue]*!~*@*.verizon.net[/color] [color:purple]botnet[/color]
    [color:blue]nicebot!*@*[/color]        [color:purple]harassing bot[/color]


Link Copied to Clipboard