Hostmask Bans

Hostmask Bans



Internet Protocol (IP)

Every internet user is identified by an IP address.
An IP address can appear as numeric ( or alphanumeric (



Some chatservers are able to hide and replace their users IP addresses with a cloaked (masked) IP which could looks like this:
"F634A706.B8C81357.42359B54.IP" where the last part (".42359B54.IP") is the domain part.

Cloaked IPReal IP numericReal IP alphanumeric


IRC Hostmask

A full IRC hostmask contains the nick, ident and an IP, they are separated by an exclamation mark (!) and an at (@).
The exclamation mark separates the nick from the ident (nick!ident), the at separates the ident from the IP (nick!ident@IPaddress).
The separators are always used in a ban and they always stay on the same place, the nick/ident separator ! on the left, the ident/IP separator @ on the right.

A full hostmask looks like this: nick!ident@IPaddress

Full hostmask with a numeric IP: hereIam!ircuser@
Full hostmask with an alphanumeric IP: tea4two!
Full hostmask with a cloaked IP: flippo!hello@F634A706.B8C81357.42359B54.IP



The question mark (?) replaces one character.
The asterisk (*) replaces a string of characters (a sequence of characters).

The asterisk (*) will mostly be used in a ban.


Basic Bans

A full IRC hostmask contains five parts and looks like this: nick!ident@IPaddress
Sometimes the ident part is called "user" or "username", IPaddress is also called "host" or "host.domain".

A ban always contains five parts:
1. nick
2. !
3. ident
4. @
5. IPaddress

Part 2 (the nick/ident separator !) and part 4 (the ident/IPaddress separator @) always stay on the same place, they don't change and they don't move around.
Because we will always use the separators ! and @ in a ban, the easiest way is to build your ban around the separators.
The parts we don't want to use in a ban we replace with an asterisk (*).

So lets pick a victim to test our bans with :)
Lets say the full hostmask of our victim is: Johnny!whatever@F634A706.B8C81357.42359B54.IP

To ban Johnny's full hostmask we would use the command: > /mode #channel +b Johnny!whatever@F634A706.B8C81357.42359B54.IP

To ban the nick "Johnny" we replace the ident and IPaddress with an asterisk (*): > /mode #channel +b Johnny!*@*
(note: the separators stay on the same place).

To ban Johnny's ident "whatever" we replace the nick and IPaddress with an asterisk (*): > /mode #channel +b *!whatever@*

To ban Johnny's IP address "F634A706.B8C81357.42359B54.IP" we replace the nick and ident with an asterisk (*): > /mode #channel +b *!*@F634A706.B8C81357.42359B54.IP

To ban both the ident "whatever" and IP "F634A706.B8C81357.42359B54.IP" we only have to use a wildcard for the nick: > /mode #channel +b *!whatever@F634A706.B8C81357.42359B54.IP

Nick BanJohnny!*@*johnny!*@*
Ident Ban*!whatever@**!whatever@*
IP Ban*!*@F634A706.B8C81357.42359B54.IP*!*@F634A706.B8C81357.42359B54.IP
Nick/IP BanJohnny!*@F634A706.B8C81357.42359B54.IPjohnny!*@F634A706.B8C81357.42359B54.IP
Ident/IP Ban*!whatever@F634A706.B8C81357.42359B54.IP*!whatever@F634A706.B8C81357.42359B54.IP


Nick Bans

Nick bans are mostly used to remove a bad nick from a channel.

Lets use our test candidate Johnny again to explain different nick bans :)
First we would use the basic nick ban to ban Johnny's nick.
> /mode #channel +b Johnny!*@*
This will ban the nickname Johnny only and will not affect other users with nicknames like "johnnytheman", "heyjohnnyhey" or "iamjohnny".

Johnny returns into the channel with the nickname "Johnny1".

There are three ways to ban this one:
1. Use a basic nick ban again. > /mode #channel +b Johnny1!*@*
This will only ban the nick Johnny1, but we already know he is smart, he most likely will return with the nick Johnny2.

2. With the use of a question mark wildcard ? to replace the one character after the nick: > /mode #channel +b Johnny?!*@*
This means all Johnny nicks with one character after it are banned (Johnny1, Johnny2, JohnnyH, JohnnyX, Johnny_ etc.).

3. "Lock" the right side of the nick ban with an asterisk (*): > /mode #channel +b Johnny*!*@*
This means all Johnny nicks with one or more characters after it are banned (Johnny4, Johnny10, johnnytheman, johnnyboy, johnny^^^ etc.).

Johnny is smarter than we think, changes his nick again and returns with the nick SmartJohnny.
He can do this because we only "locked" the right side of the nick ban with a * (Johnny*!*@*) so he couldn't use any characters after the Johnny nick but he still can use characters in front of the nick.
So now we can "lock" the nickname on the left side too with a * in front of the nick as well after the nick: > /mode #channel +b *Johnny*!*@*
which will affect all nicknames with the word "johnny" in it (heyjohnny, Johnny1, SmartJohnny, [Johnny], ^^Johnny, MeJohnnyBoy etc).

Nick BansAffects
Johnny!*@*Bans the nick "Johnny" only
Johnny?!*@*Bans all "Johnny" nicks with one character after it.
Johnny*!*@*Bans all "Johnny" nicks with (a string of) characters after it.
*Johnny*!*@*Bans every nick with the word "johnny" in it.


Ident Bans

Our Johnny is still being a nuisance and we have two innocent users in the channel with the nicks "sweetjohnny" and "JohnnyInnocent" (rrright!), we then could ban Johnny's ident.

Johnny's full hostmask is "Johnny!whatever@F634A706.B8C81357.42359B54.IP", "whatever" is the ident part.
A basic ident ban on "whatever" then would be: *!whatever@* which will only ban users with the ident "whatever".

Oh no, Johnny brought some floodbots into the channel all using the same ident with numbers like "whatever322", "whatever983", "whatever821" etc.

1. Use the one character wildcard "?": > /mode #channel +b *!whatever???@*
Bans the ident "whatever" with 3 characters after it, every question mark replaces one character (whatever313, whateverlol, whateverabc, whatever--- etc.).

2. "Lock" the right side of the ident ban: > /mode #channel +b *!whatever*@*
Bans the ident "whatever" with (a string of) characters after it (whateverdude, whatever31235, whateverpfft, whatever-abc etc.).

3."Lock" both left and right side of the ident ban: > /mode #channel +b *!*whatever*@*
Bans all users using an ident with the word "whatever" in it (yeahwhatever, boowhateverhoo, whywhatever45, whateverX etc.).

Ident BansAffects
*!whatever@*Bans only the users using the ident "whatever".
*!whatever???@*Bans all users using the ident "whatever" with 3 characters after it.
*!whatever*@*Bans users using the ident "whatever" with (a string of) characters after it.
*!*whatever*@*Bans all users using an ident with the word "whatever" in it.


IP Bans

A basic IP ban looks like this: *!*@F634A706.B8C81357.42359B54.IP

Again five parts:
1. the first * replaces the nick
2. nick/ident separator !
3. second * replaces ident
4. ident/IP separator @
5. IP

Johnny's cloaked IP is *!*@F634A706.B8C81357.42359B54.IP, his real IP is *!*@
> /mode #channel +b *!*@F634A706.B8C81357.42359B54.IP
Bans Johnny's cloaked IP *!*@F634A706.B8C81357.42359B54.IP (*!*@ host+domain.

> /mode #channel +b *!*@*.B8C81357.42359B54.IP
Bans the two last parts of Johnny's cloaked IP *!*@*.B8C81357.42359B54.IP (*!*@134.54.36.*) part host+domain.
Here we replace the first part of the IPaddress with an asterisk (*).

> /mode #channel +b *!*@*.42359B54.IP
Bans the last part of Johnny's IP *!*@*.42359B54.IP (*!*@134.54.*) which is the domain part.
Here we replace the first two parts of the IPaddress with an asterisk (*).
The same result we get when we would ban it like this: "*!*@*.*.42359B54.IP".
Always be carefull with domain bans, lots of users use the same domain, a ban like this could be too broad!.


Extended Bans

Extended bans are neat, but they need some extra attention.
Before using bans like this it's handy to check the users whois info first: > /whois Johnny
(1)* [Johnny] (whatever@F634A706.B8C81357.42359B54.IP): Ten Four
(2)* [Johnny] is a registered nick
(3)* [Johnny] #newbies #chatroom #lamersRus
(4)* [Johnny] :IrCQ-Net
(5)* [Johnny] idle 00:01:26, signon: Fri Mar 7 09:25:22
(6)* [Johnny] End of WHOIS list.

What this tells us about Johnny:
(1)Nick: Johnny
    Ident: whatever
    IP: F634A706.B8C81357.42359B54.IP
    Realname: Ten Four
(2)Johnny's nick is registered and identified
(3)Johnny joined the channels #newbies, #chatroom and #lamersRus
(4)Johnny is connected to IrCQ-Net's server
(5)The last time Johnny typed was 1 min and 26 secs ago. He connected Friday March 7th at 09:25:22
(6)End of whois info

There are four different types of extended bans we can use:
Quiet ban ~q:
> /mode #channel +b ~q:*!*@F634A706.B8C81357.42359B54.IP
Johnny can still join the channel but he is unable to type, unless he has +v or higher.

Nickchange ban ~n:
> /mode #channel +b ~n:*!*@F634A706.B8C81357.42359B54.IP
Prevents Johnny from changing nicks over and over. Users matching these bans are unable to change nicks, unless they have +v or higher.

Channel ban ~c:
> /mode #channel +b ~c:#lamersRus
Users from channel #lamersRus are unable to join #channel, if the user is already in the channel s/he is unable to type.

Realname ban ~r:
Johnny's realname is "Ten Four". We can't ban a realname with spaces so or we could ban a part of the realname (*Ten*) or replace the space with an underscore (Ten_Four).

> /mode #channel +b ~r:Ten_Four
Bans everyone with the realname "Ten Four" or "Ten_Four", an underscore matches a space or underscore.

> /mode #channel +b ~r:*Ten_Four*
Bans everyone who has the word "Ten Four" or "Ten_Four" in their realname.

> /mode #channel +b ~r:Ten
Bans everyone with the realname "Ten".

> /mode #channel +b ~r:*Ten*
Bans everyone with the word "Ten" in the realname.



Exemption Bans

Exemption bans allow specific users in from domains that are banned from a channel.

> /mode #channel +b *!*@*.42359B54.IP
Bans all users with the domain ".42359B54.IP".

> /mode #channel +e *!*@F634A706.B8C81357.42359B54.IP
Allows this user to join #channel when domain ".42359B54.IP" is banned.


Ban Removal

> /mode #channel -b nick!ident@IPaddress
Removes a ban.

> /mode #channel -e nick!ident@IPaddress
Removes an exemption ban.

> /mode #channel -b ~q:nick!ident@IPaddress
Removes an extended ban.


Ban List

> /mode #channel b
Shows the ban list of the given channel.

> /mode #channel e
Shows the exemption list of the given channel.

changed July 13, 2011