@Wims: You can ban the realname on UnrealIRCd.
Code:
/mode #chan +b ~r:Realname


@EasyObserver: I've written something for this before, maybe you could use it.
Code:
menu Channel,Nicklist,Menubar,Status {
  -
  Real name Checker
  .$iif($timer(.Recheck),$style(1)) Enable:.timer.Recheck $iif($timer(.Recheck),off,1 %RN.Delay GetName.Checker)
  .-
  .Set Real names:set %RN.Check $$input(Separated by semi-colon,e,Real name checker,%RN.Check)
  .Exception?:var %ex = $$input(Separated by semi-colon,e,Exception list,%RN.Exception) | $iif(%ex != $null,set,unset) %RN.Exception %ex
  .-
  .Set Delay $+($chr(40),$iif(%RN.Delay != $null,every $v1 $+ s,Not set yet),$chr(41)):set %RN.Delay $$?="Enter a number from 1 to 60"
  .-
  .$iif(%RN.Wise == 1,$style(1)) Use Wise Method:set %RN.Wise $iif(%RN.Wise == 1,0,1) | unset %RN.Last
  -
}

on !@*:Join:#:{ GetName $nick }

alias -l GetName {
  if ($1) && ($timer(.Recheck)) {
    if (!$hget(GetName)) { hmake GetName }
    if (!$hget(GetName,$1)) { hadd -m GetName $1 !@! }
  }
}

alias GetName.Checker {
  if (%RN.Delay == $null) { set %RN.Delay 1 }
  if (%RN.Wise == 1) && (%RN.Last != $null) goto Jump
  var %x = 1
  while ($hget(GetName,%x).item) {
    var %item = $hget(GetName,%x).item
    if ($hget(GetName,%item) == !@!) {
      .enable #WhoisHalt
      set %RN.Last -u60 %item
      !whois %item %item
      break
    }
    inc %x
  }
  :Jump
  .timer.Recheck 1 %RN.Delay GetName.Checker
}

alias -l TakeAction {
  if ($1) {
    var %x = $hget(GetName,$1)
    if ($wildtok(%RN.Check,%x,0,59)) { 
      if ($wildtok(%RN.Exception,%x,0,59)) goto Jump
      var %i = 1
      while ($comchan($1,%i)) { ban -k $v1 $1 2 You're not welcome! | inc %i }
      :Jump
      hdel GetName $1
      unset %RN.Last
    }
  }
}

#WhoisHalt off
raw *:*:{
  if ($istok(307 310 311 312 313 317 318 319 330 338 379 378 318 401,$numeric,32)) haltdef
  if ($numeric == 311) { hadd -m GetName $2 $strip($6-) | TakeAction $2 }
  elseif ($numeric == 318) { .disable #WhoisHalt }
  elseif ($numeric == 401) && ($hget(GetName,$2).item) { hdel GetName $2 }
}
#WhoisHalt end


I should mention that this kind of ban totally depends on the IRCd that the target server is running. This will only work on UnrealIRCd based networks.
(Although this code can be used on any IRCd, since it doesn't use ~r:. It just checks for realname that you specified in its settings using /whois.)


Nothing...