; HennesScript IP/DNS UNMASKER
; Written by GiDeoN

#getmaskWHO off
raw 352:*: {
  haltdef
  if ($isNmasked($4)) { echo -s 0,12 Unmasked >0,1> $4  | echo -s 15× }
  if ($dialog(DLGhsu)) {
    DLGmsg Error|Close HSU first
    ;RC
    halt
  }
  if (($left($4,1) == x) && ($right($4,1) isletter)) {
    xUnmask $6 $4
  }
  elseif (($left($4,1) isnum) && ($right($4,1) == X)) {
    xUnmask2 $6 $4
  }
  halt
  ;RC
}
raw 315:*: {
  haltdef
  .disable #getmaskwho
  halt
}
#getmaskWHO end


;RC
dialog DLGunmask {
  title "Unmasker : Written by GiDeoN "
  option dbu
  size -1 -1 193 97
  icon $icodir(users.ico), 0 noborder
  box "IP/DNS Unmasker", 2, 5 5 181 73
  button "Cancel", 3, 155 81 29 14,cancel
  text "Nick:", 4, 10 15 17 7
  text "Host:", 5, 10 25 17 7
  edit "", 6, 30 15 54 10,read ,autohs
  ;RC
  edit "", 7, 30 25 54 10,read ,autohs
  box "Unmasker proces...", 8, 10 40 169 34
  edit "xxxxx.host.com", 9, 70 55 72 10,left ,read ,autohs
  edit "7", 10, 55 55 14 10,center ,read
  radio "", 11, 15 55 8 8,disable
  radio "", 12, 25 55 9 8,disable
  radio "", 13, 35 55 0 8
  radio "", 14, 35 55 10 8,disable
  text "Copyright © 2000-2001 HennesScript", 15, 5 85 147 7,disable
  ;RC
  button "Kopieren", 16, 145 55 29 11
}

on *:dialog:DLGunmask:sclick:3: {
  set %xStop 1
  .timer -m 1 500 { .disable #xUnmask | .enable #normalwho }
}

on *:dialog:DLGunmask:sclick:16: {
  ;RC
  clipboard $did(DLGunmask,9)
}

alias xUnmask {
  set %xStop 0
  set %xProc 1
  set %xNick $1
  set %xChar 48
  .enable #xUnmask
  ;RC
  .disable #normalwho
  set %x.DNS $right($2-,$calc($len($2-) - $len($gettok($2-,1,46))))
  set %x.Len $len($gettok($2-,1,46))
  set %x.Len2 $calc($len($gettok($2-,1,46)) - 1)
  dialog -md DLGunmask DLGunmask
  did -ra DLGunmask 9 $str(x,%x.Len) $+ $right($2-,$calc($len($2-) - $len($gettok($2-,1,46))))
  did -ra DLGunmask 6 $1
  did -ra DLGunmask 7 $2-
  did -ra DLGunmask 10 0
  ;RC
  did -c DLGunmask 11
  ;  echo -a %x.DNS
  .raw who * $+ $chr(%xChar) $+ %x.DNS
}

alias xNext {
  if (%xStop) { .disable #xUnmask | .enable #normalwho |halt }
  inc %xChar 1
  if (%xChar == 58) { set %xChar 97 }
  ;RC
  if (%xChar == 123) { set %xChar 45 }
  if (%xChar == 47) {   set %xStop 1
    .timer -m 1 500 { 
    .disable #xUnmask | .enable #normalwho }
    DLGmsg Unmasker|Unmasker Error: kan de host niet unmasken
    halt
  }
  .enable #xUnmask
  .disable #normalwho
  ;RC
  .raw who * $+ $chr(%xChar) $+ %x.DNS
  did -ra DLGunmask 10 $chr(%xChar)
  did -ra DLGunmask 9 $str(x,%x.Len2) $+ $chr(%xChar) $+ %x.DNS
  if (%xProc == 3) { set %xProc 0 }
  inc %xProc 1
  if (%xProc == 1) { did -c DLGunmask 11 | did -u DLGunmask 12 | did -u DLGunmask 14 }
  if (%xProc == 2) { did -c DLGunmask 12 | did -u DLGunmask 11 | did -u DLGunmask 14 }
  if (%xProc == 3) { did -c DLGunmask 14 | did -u DLGunmask 11 | did -u DLGunmask 12 }
}
;RC

#xUnmask off

raw 352:*: {
  if (%xStop) { .disable #xUnmask | .enable #normalwho |halt }
  haltdef
  ;  echo -s 4 $1-
  if ($6 == %xNick) {
    ;    echo -s 0,1 Found 
    ;RC
    set %xFound 1
  }
  halt
}

; END OF LIST

raw 315:*:{ 
  if (%xStop) { .disable #xUnmask | .enable #normalwho |halt }
  ;RC
  haltdef
  if (%xFound) {
    set %xFound 0 
    set %x.DNS $right($2,$calc($len($2) - 1))
    set %xChar 47
    xNext $right($2,$calc($len($2) - 1))
    ;    echo -s 0,1 $right($2,$calc($len($2) - 1)) 
    dec %x.Len2 1
    did -ra DLGunmask 9 $str(x,%x.Len2)) $+ $right($2,$calc($len($2) - 1))
    ;RC
    halt
  }
  ;  echo -s 12 $1-
  if (%x.Len == $len($gettok($right($2,$calc($len($2) - 2)),1,46))) {
    did -ra DLGunmask 7 $right($2,$calc($len($2) - 2))
    did -ra DLGunmask 9 $right($2,$calc($len($2) - 2))
    dialog -t DLGunmask Unmasken Gereed.
    did -c DLGunmask 11 
    did -c DLGunmask 12
    ;RC
    did -c DLGunmask 14 
    DLGmsg Unmasker|Unmasken Gereed.
    .disable #xUnmask
    .enable #normalWho
    halt
  }
  ;  echo -s $right($2,$calc($len($2) - 2))
  xNext
  halt
  ;RC
}
#xUnmask end

alias xUnmask2 {
  set %xStop 0
  dialog -md DLGunmask DLGunmask
  set %xProc 1
  set %xNick $1
  set %xChar 48
  ;RC
  did -ra DLGunmask 6 $1
  did -ra DLGunmask 7 $2-
  did -ra DLGunmask 10 0
  did -c DLGunmask 11
  .enable #xUnmask2
  .disable #normalwho
  set %x.DNS $gettok($2,1,46) $+ . $+ $gettok($2,2,46) $+ . $+ $gettok($2,3,46) $+ .
  set %x.Len $len($gettok($2-,4,46))
  set %x.Len2 $calc($len($gettok($2-,4,46)) - 1)
  ;RC
  did -ra DLGunmask 9
  ; echo -a %x.DNS
  .raw -q who $replace(%x.DNS,.,?) $+ $chr(%xChar) $+ *
}

alias xNext2 {
  if (%xStop) { .disable #xUnmask2 | .enable #normalwho | halt }
  inc %xChar 1
  if (%xChar == 58) { 
    ;RC
    set %xStop 1
    .timer -m 1 500 { .disable #xUnmask | .enable #normalwho }
    DLGmsg Unmasker|Unmasker Error: kan de host niet unmasken
    halt
  }
  .enable #xUnmask2
  .disable #normalwho
  .raw who $replace(%x.DNS,.,?) $+ $chr(%xChar) $+ *
  did -ra DLGunmask 10 $chr(%xChar)
  ;RC
  did -ra DLGunmask 9 $replace(%x.DNS,?,.) $+ $chr(%xChar) $+ $str(x,%x.Len2)
  if (%xProc == 3) { set %xProc 0 }
  inc %xProc 1
  if (%xProc == 1) { did -c DLGunmask 11 | did -u DLGunmask 12 | did -u DLGunmask 14 }
  if (%xProc == 2) { did -c DLGunmask 12 | did -u DLGunmask 11 | did -u DLGunmask 14 }
  if (%xProc == 3) { did -c DLGunmask 14 | did -u DLGunmask 11 | did -u DLGunmask 12 }
}

#xUnmask2 off
;RC

raw 352:*: {
  if (%xStop) { .disable #xUnmask2 | .enable #normalwho | halt }
  haltdef 
  ;  echo -s 4 $1-
  if ($6 == %xNick) {
    ;    echo -s 0,1 Found 
    set %xFound 1
  }
  ;RC
  halt
}

; END OF LIST

raw 315:*:{ 
  if (%xStop) { .disable #xUnmask2 | .enable #normalwho | halt }
  haltdef
  if (%xFound) {
    ;RC
    set %xFound 0 
    if (%x.Len == $calc($len($gettok($2,4,63)) - 1)) {
      did -ra DLGunmask 7 $replace($left($2,$calc($len($2) - 2)),?,.) $+ $chr(%xChar)
      did -ra DLGunmask 9 $replace($left($2,$calc($len($2) - 2)),?,.) $+ $chr(%xChar)
      dialog -t DLGunmask Unmasken Gereed.
      bow
      did -c DLGunmask 11 
      did -c DLGunmask 12
      did -c DLGunmask 14 
      ;RC
      DLGmsg Unmasker|Unmasken Gereed.
      .disable #xUnmask2
      .enable #normalWho
      halt
    } 
    set %x.DNS $left($2,$calc($len($2) - 1))
    set %xChar 47
    xNext2 $left($2,$calc($len($2) - 1))
    ;    echo -s 0,1 $left($2,$calc($len($2) - 1)) 
    ;RC
    dec %x.Len2 1
    did -ra DLGunmask 9 $replace(%x.DNS,?,.) $+ $chr(%xChar) $+ $str(x,%x.Len2)
    halt
  }
  ;  echo -s 12 $1-
  ;  echo -s $left($2,$calc($len($2) - 2))
  xNext2
  halt
}
;RC
#xUnmask2 end
