Whiplash IRC Client v1.4 Copyright (c) 1997-2001, Jonathan Zdziarski All Rights Reserved IRC OPS: Please read the section 'HOW TO TRACK AN IP' WHAT IS WHIPLASH? Whiplash is an IRC Client designed to run on a webserver, for the purpose of allowing an HTML Gateway to chat. I have provided this program initially as an edicational tool, but it has grown over the years to be a great customizable IRC client now used by thousands of website owners world-wide. If you do not have a file named LICENSE in this archive, you may download a new archive containing the license from http://www.nuclearelephant.com/. Regardless of whether or not you have read the license agreement, you are still bound to its terms of use, so please read it thoroughly. The code whiplash uses shows documented examples of the following PERL5 areas of programming: - Multipart/Mixed (e.g. Server Push) Streaming - Sys V Interprocess Communication (Shared Memory) - Socket Building and Management (using IO::Socket) - Using hashes to speak RFC - Using the SDBM Hash database - Signal and Process Management - Lexical Variable use Other mentionable (yet non-PERL related) items: - Usage of CCS/Style Definitions (for background text) - Javascript scrolling REQUIREMENTS: - Perl 5.0 or later - Some web server software (This was developed and tested under Apache) - Knowlege of file permissions and modes, and other general knowlege you will need to get these scripts moving. ALSO RECOMMENDED: - A unix system with a system shared memory queue facility - root privileges on your system (if you plan on using whiplash's ident encapsulator) TO INSTALL: I assume you've already uncompressed it since you're reading this. Make sure all .cgi files are executable (755 or whatever). Make sure the pidtable.* files are all writable by the web user (e.g. group writable, or owned by the web user), and the same for irc.log and the tables directory itself. Just install it in a directory that has execute permissions and is reachable via a HTTP request, and go to that directory. You may need to change the path to perl in all .cgi and .pl files to reflect the path to your copy of PERL 5. *NOTE* You will need to make sure that the directory you are putting it in has "Execute" permissions in your web server configuration..otherwise you will get plenty of errors. CONFIGURATION: The master configuration file is called '.config' you can edit some basic variables in this file (the file is commented with explanations) You can also configure most of the display colors, and some messages by editing the .rfc1459 file. The .rfc1459 file is a token/key flat file that is turned into a hash database by whiplash upon loading. PLEASE NOTE: This file contains necessary control characters. Only use an editor that supports control characters such as 'vi'. EDITING THE .rfc1459 FILE The .rfc1459 file has up to three fields, separated by the | character. KEY VALUE ---------- JOIN|* %HANDLE (%ADDRESS) has joined %CHAN The above value will be printed when the client receives a JOIN message from the server, for example. %HANDLE, %ADDRESS, %TO, %NICK, and %CHAN are tokens that will be replaced with the values of handle, hostname, nick to, your nick, and channel, before it is actually printed. Other tokens include %x% and %x where x = the parameter number. %x will be replaced by the parameter #x it receives from the server. %x% will be replaced by the parameter #x to the end of the line. Any keys that begin with a / are commands. You can modify and define your own commands easily... KEY SERVER CMD DISPLAY RESULTS -------------------------------------------------------------- /PIE|PRIVMSG %CHAN : ^AACTION throws a pie at %2|* %NICK throws a pie at %2^A In this example, if someone types /PIE, SERVE CMD will be sent to the server (Read your rfc dox), and DISPLAY RESULTS will be what is printed to the local client's screen. /JOIN and /PART do not exist in the .rfc1459 file because they have been internally coded into the software, so that you can toggle, through the .config file, whether or not joining/parting channels is allowed. Please note that ^A represents CTRL-A in the file. If you wish to add lines, you will need to learn how to insert control characters into your editor. In 'vi', you hit Control-V and then type th econtrol character to insert. I was going to make it interpolate control characters, but that causes problems with the translation of people who use ^ in messages or in their handles. CONTACTING ME This project is now defunct. No support is available. KNOWN BUGS (Told you it had some) - The scroll() command for netscape v3.0 is causing the screen to jump all over the place, and as makes it hard to chat. If there is some javascript way of determining the bottom if the window's pixel number (before the page is finished loading), or another way to scroll to the bottom of a window, please let me know. - Using the MSIE Userlist, if the socket control script (nph-irc.cgi) should load and attempt to update the userlist before the msie-userlist.html file loads (which happens occasionally over slow connections), javascript errors may be reported. I've added a small line in the javascript to test if self._fuserlist.document.all.text != null, however this only works in MSIE. In other cases, the script will report a 'Access Denied'. If anyone knows a way of turning off Javascript errors please let me know. Once the userlist loads, it will be updated the next time somebody joins/leaves/mode changes or by typing /NAMES to redisplay the userlist. A NOTE ON SHARED MEMORY/SYSV IPC: Shared Memory does not work on all platforms. It's been reported that it does not work on some BSD platforms, as most BSD platforms do not support Sys V IPC. I've thoroughly tested it under Solaris, and had no problems. Use the unix command 'ipcs' to take a look at your shared memory queue. It should also tell you whether or not shared memory is supported on your system. IF YOU DO NOT HAVE AN OPERATING SYSTEM THAT SUPPORTS SHARED MEMORY, you may either search for an extension to add it to your kernel, or you may set the $USE_SHMEM variable in .config to 0, which will cause whiplash to use plain textfiles in place of shared memory (Also set $MEMDIR). A NOTE ABOUT MEMORY LEAKS: In 1.2b1, there were several leaks generated by the fact that not all operating systems report a HUP or INT signal to the process if the user leaves the page or shuts down their browser. As a result, I added a small bit of code that reports each shared memory key, and pidfile of the script to a hash database (and will remove it from the database if the script's cleanup subroutine gets called). If it does not get called and the script dies, the program shmclean.pl reads through the database, tests all the pids, and removed the keys of the dead pids, deallocating the memory. This SOLVES ALL MEMORY LEAK PROBLEMS as far as this script is concerned. The shmcleanup.pl script is run every time login.cgi is run. If you use this code publically and have several people using whiplash, it would be advisable to remove it from login.cgi and run it as a cron job. HOW TO TRACK AN IP: Whiplash makes every effort to allow IRC OPS to be able to track down and ban abusers of whiplash using three different methods. Please take a moment to look at the output of a /WHOIS on a whiplash user... ** WHOIS: "Krioni" * Unknown (3466298169) (CE9B8339@elijah.jesuscafe.com) ** WHOIS: Krioni #CGI ** WHOIS: Krioni on irc-w.frontiernet.net (Frontier GlobalCenter IRC West Server ) ** WHOIS: Krioni 80 Seconds Idle ** End of WHOIS List ** METHOD 1: IDENTD: If the webmaster is running the IDENTD encapsulator that came with whiplash, the IP address of each user will be encapsulated into a hexadecimal form as their IDENT. The CE9B8339 as the IDENTD is a hexadeximal representation of the IP address the user is connecting from...for example... [CE] [9B] [83] [39] 206 . 155 . 131 . 57 As a result you can easily translate the IP and ban either the entire IP or their Class C...for example CE9B83*!*@elijah.jesuscafe.com or some variation thereof should ban anyone in that Class C. METHOD 2: 32-Bit IP Address: The 3466298169 in the first line of the WHOIS output is a 32-Bit representation of the user's IP address. This is displayed whether or not the webmaster is using the ident encapsulator. You can translate this address token into an actual IP address by using a /dns -h 3466298169 command. Unfortunately, this method does not allow you to ban as method 1 does, but does allow you to translate the IP. METHOD 3: CTCP: When you CTCP a whiplash user for USERINFO, it returns their full IP address. This is the easiest way to obtain it. HISTORY 1.4.1 - Fixed 'fixed-width' again; was set permanently to fixed-width (login.cgi fixed; index.html was midding a bracket) - /ME commands (and others) were not showing up on local screen 1.4 - Rewrite of variable structure; all variables now lexical (For use with mod_perl, fix memory leaks, etc) - Ported original Socket.pm code to use IO::Socket for better compatibility - Fixed several SDBM_File untie routines, which may speed up server or at least run irc processes with more resources - Added automatic registration process - Fixed 'fixed-width'; it was not working 1.3.3e - Documented Tracking/Banning methods - Renamed the IDENTD Spoofer to the IDENTD Encapsulator - better description and it prevents people from thinking it's designed to compromise security - Modified scrolling javascript to work on a Macintosh w/Netscape (still requires some tweaking) 1.3.3d - Added $IDENT_METHOD option allowing you to either send the person's nickname as their IDENT or the hex equivalent (e.g. CF1F58F8); the hex is very useful for IRCops who want to ban a whiplash user without banning the entire server. 1.3.3c - Replaced codes with mIRC color codes in the RFC file and in the source code. - Added control character parsing to the rfc file and output subroutine. (e.g. ^A is translated to a CONTROL-A, rather than having to have a control character hardcoded. Please be careful with case.) - Fixed a few more RFC's (KICK, INVITE, KILL) - Added @DISALLOWED_CHANNELS allowing you to block out certain channels from being joined (uses regex matching) - Used PERL5's hostname.pl rather than unix's directly (although they do just about the same thing) - Fixed a problem where the wrong long int was being reported to represent the user's IP address in WHOIS. 1.3.3 - Added IDENT Encapsulator (requires root privileges on server) - Implemented OUTGOING DCC CHAT Capabilities using IO::Socket Make sure you have a fully qualified, DNS confirmed hostname. - Moved pid and ident tables into the 'tables' directory 1.3.2 - Implemented DCC CHAT Capabilities (INCOMING ONLY). 1.3 (Release) - Now returns CTCP PING, USERINFO and VERSION. CLIENTINFO, FINGER, and other methods of CTCP can be easily implemented into the code, however have been left out because they're, for the most part, not used. PLEASE NOTE: CTCP USERINFO Returns the user's IP Address (for abuse handling purposes) - Added STYLE and COLOR CODE PROCESSING (mIRC Style). Since web browsers don't handle inverse fonts and inverse text well, reverse as well as reverse codes are ignored unless you have a browser > v4.0 that supports the