psyBNC 2.1
----------

This program is useful for people who cannot be on irc all the time.
Its used to keep a connection to irc and your irc client connected.

Being installed on a shell with a permanently connected machine you stay
connected as long you want or until the program crashes *g*

Due to the fact this programm allows multiple Users at the same time (just
change MAX_USER in the source to get less or more possible Users) you can also 
trade kinds of connections with other people running only one backgroundtask 
at all. Thats very interesting by using shells which prohibit more than 
one backgroundtask.

Remember, sometimes admins also care about traffic, traffic by one client
connected to irc is approx. 170 MBytes of traffic per month.

If you would have connected 10 clients and it gets 1.7GB of traffic it also may
become serious to your shell :)

psyBNC2.0 has been completely rewritten in memory Management. Until Version 1.2
the user structures had been held constant available. From Version 2.0
every structure will be created on demand. Also files will be only read once
to improve performance.

psyBNC2.1 has been completely rewritten in socket management. Up to Version 2.0.2
every socket was single selected for socket action. From 2.1 on, a select appears
once, then all sockets will be processed. This enhances performance on a big
amount of connections rapidly and lets them being processed without any lag.
Also, psyBNC2.1 has bee structurized. psyBNC1.0 was meant as pipe only, and
it grew in the meantime.

The OVERVIEW:
-------------

a.) Compiling
b.) setting up

What is psyBNC capable of ?

1.) It stays connected when you disconnect
2.) It allows Full Online Administration, the only thing you will have
    to set up before starting is your port where the demon should
    listen (standard is set to 31337. arent we cool ?)
3.) It allows VHOSTS. It also allows the usage of VHOSTS on linked
    bouncers, if the admin declared the link to your bouncer as
    relaylink.
4.) It allows you to set bans on the client
5.) It allows you to set Users who could get op from the bounce matched
    by password and hostname.
6.) It allows you to set Hosts and Passwords to clients, where the
    bounce could get ops from, if it once get disconnected or you
    just want to automize that process even when you are connected.
    Also, it allows the automatic connection build to eggdrop and
    getting ops from those (see bot-dcc).
7.) Its absolutely floodproof due to the fact it has no responses at
    all.
8.) Its hack proof (as far as i can say *g*)
    It has no backdoors.
9.) It allows a partyline on the bounce (a channel named &partyline)
    or querying specified Users on the bounce (prefixed User-Login with $),
    also on linked bouncers.
10.)It supports full logging of Messages and traffic (channel traffic
    included into Version 2.1).
11.)It supports linking to other bouncers. This allows a shared partyline
    of those, who are using psyBNC.
12.)It allows multiple connections of one Client to different irc-servers
    and networks. So you just can be connected to ircnet and efnet with
    only one client programm running on your home box.
13.)It has inbuild password-encryption. Changed to blowfish on version 2.1.
14.)It allows the automatic linkage of a user to eggdrop bots using
    a dcc session.
    The traffic to/from the bot will be managed by querying to the 
    added botname with a leading '-'.
15.)It has connection and talk encryption. 
    Connection Encryptions are being build on internal connected bouncer 
    networks. If a client supports the psyBNC encryption sockets, also 
    the link between client and server host can be encrypted. 
    See www.psychoid.lam3rz.de for a client for unix/linux and a client 
    for Windows (courtesy of [-MaX-]). Connection encryption
    keys need to be setup on both sides of the connection. 
    
    After the keys where set, a symetric encrypted bouncer connection is build.
    Symetric encryption is done using the blowfish and IDEA algorithm.
    If you need a stronger encryption, theres also a RSA-Keyhandshake
    unsupported version available.
    Talk encryption is only done by symtric ciphers, you have to set your
    encryption password local, also your partner(s) on irc who want
    to talk encrypted. Keys have to match for right decryption. You can
    set different keys also to users or channels.

16.)It has a translation module.
    Did you ever want to talk to someone from italy without using
    a dictionary ? Well, psybnc has (from Version 2.1) a translator
    for talk inbuild. Currently supported are:
    
	- english to italian
	- english to german
	- english to portugese
	- english to french
	- french to english
	- german to english
	- portugese to english
	- french to english
	
    You just need to set a language to a channel or person, then you will
    receive messages both in the native language and in the language you
    selected to translate to. Same vice versa, the text you send to him
    will be translated to his native language (and also shown to you how
    it was translated).
    Keep in mind: You need to talk CLEAR to get it translated.
    Example:
    
        Hello i am happy to meet you
	
    would have a nice chance to get translated.
    
        Yo Ey eye em h3ppee tew m33t yaw
	
    wont have any chance.
    
    How does it work ? Well, simple. It simulates a browser request to
    http://babelfish.altavista.com. And then processes the result. :)
    See p_translate.c for more details :)
    
    (Someone got a polish or slovenian dictonary ? *g*)
    
17.)psyBNC2.1 is modular. If you want to disable modules, just edit the
    config.h to disable features as like CRYPT, TRANSLATE or PARTYCHANNEL.
18.)psyBNC allows Hostrestrictions
    A file named psbnc.hosts keeps all Hosts which may connect to your
    bouncer. Remember, that also linkhosts need to be added.

c.) Contact me for suggestions
d.) Credits

(a) Ths Program was only tested on Linux, freebsd and SunOs. 
    I only support usage of this code on linux, but maybe with enough 
    feedback for other platforms.
    Unpack it with tar -xzvf psyBNC2.1.tar.gz

    Edit the config.h File to fit your needs of functionality.

    Compile it using make followed by your operating system.
    Example:
	make linux-i86
    or
	make sunos-sparc
    If you want to delete compiled objects and the compiled libs,
    do 
	make clean
    after you compiled the bouncer. Be sure to do that, if you
    run psyBNC on a host you arent sure about :)

    psyBNC2.1 is compiled static to prevent libcall sniffing.

(b) The only thing it needs is psybnc.ini in its app. Directory.
    Theres only one entry needed, on [SYSTEM] you need to add or alter PORT=xxxx
    to your needs. Then the bounce can be started, all other things will be done
    online on the bounce. The first User who connects the bounce then will
    become first admin.

(1) Once you added a server to connect to, the bounce will try to stay connected
    until your server goes down or the bounce shell server has problems.

(2) Commands for Online Administration are:
    /BHELP			-> The command overview
    /BWHO			-> lists all current Users of the bounce
   */ADDUSER login :realname	-> adds a new User
   */DELUSER login		-> deletes the specified User
   */BKILL login                -> Kills a user on the bounce (does not delete)    
    /PASSWORD [network~]newpass	-> changes your current Password
    /JUMP [network~]		-> Jumps to next Server in List
    /ADDSERVER [network~] irc.serv.er :port
				-> Adds a new IRC Server to your IRC-Server List
    /DELSERVER [network~] # (Number)       
				-> Removes the corresponding Server Number in
    /LISTSERVERS [network~]	-> Lists all Servers you added
   */REHASH			-> rehashes the proxy. Kills all connections.
   */MADMIN			-> Declares a user as admin
   */UNADMIN			-> takes Admin rights from User
    /BQUIT [network~]		-> Quits the client from IRC, stays disconnected until
    /BCONNECT [network~]        -> removes Quit and tries to reconnect
    /SETAWAY [network~]text	-> sets away text (if whoised, shows the text)
    /SETAWAY [network~]		-> disables away text
    /SETAWAYNICK [network~]nick	-> sets away nick. Is changed to, when you leave
    /SETAWAYNICK [network~]	-> disables nickchange on leave
    /SETLEAVEMSG [network~]text	-> sets leave message. It will be posten when you leave.
    /SETLEAVEMSG [network~]	-> disables leave message
    /SETUSERNAME [network~] :name
				-> sets the username (real name)
    /ACOLLIDE [network~] 0|1    -> 0=disable acollide 1=enable it (default)
    /SOCKSTAT			-> Displays the list of open sockets, how
				   much bytes gone in and out, if encrypted, in
				   which state, since when open and other infos.
    
(3) The Bounce allows VHOSTS, Commands used for that are:    
    /VHOST [network~] [LINK #] :your.vhost.com       
				-> sets your desired VHost
    /VHOST			-> erases the Vhost, standard ip would be used

(4) You can set Bans that will also be set if you are off
    /ADDBAN [network~][#chan] reason :host
				-> Adds a new ban with specified Hostmask
    /DELBAN [network~] # (Number)		
				-> Removes a corresponding Ban shown in
    /LISTBANS [network~]	-> Lists the Bans you set

(5) You can specify Users who could get op from your bounce by msging them
    in the from eggdrop known way (op password #channel).
    /ADDOP [network~][#chan] pass :host	
				-> Adds a new User with given Password
    /DELOP [network~]# (Number)	-> Deletes a user corresponding to
    /LISTOPS [network~]		-> Lists all Users

    Also autoop was added in psyBNC2.1. Be sure to use this function with
    care, because spoofing is still possible on most of the ircnetworks.

    /ADDAUTOOP [network~][#chan] :host
				-> Adds a User to the autoop list
    /DELAUTOOP (Number)		-> Deletes an added Autoop from
    /LISTAUTOOPS		-> Lists the added autoop-Entrys				

(6) If the bounce got disconnected, the client will rejoin the channels on reconnect.
    In this Case, it will perform ASKOP, msging "op password #channel" to an added
    client. If you added a bot-dcc connection, you also can request op from
    the bot. You can administrate the list using following commands:
    /ADDASK [network~][#chan] pass :host or -botname
				-> Adds a Hostmask to get Op from with password
    /DELASK [network~]# (number)-> removes a host to ask op from, number from
    /LISTASK [network~]		-> List of hostmasks and passwords to Ask Op.

    If you want to add an addask from a bot-dcc, there is no need to
    support a password in /ADDASK.

    Adding a bot op request for a dcc linked bot, would be like the
    following example:
    
    /ADDASK #blah :-botnick

    If you established a connection to a bot using the /ADDDCC command,
    there will be no password sent via irc. That way is recommended.

(7) As long your client isnt connected, the bounce will NOT answer any ctcp Querys

(8) Well, as long you dont use too dumb passwords *g*
    Passwords get encrypted using a hash created on compiling time.
    The source makesalt.c creates a file called salt.h, which keeps
    the needed encryption salts. Be sure to move the salt.h File to
    a safe place after you compiled the bouncer. Authentification passwords
    which dont need to be enciphered, are stored as blowfish crypt-by-key
    passwords.

(9) The Partyline can be accessed by Querying the nick $$. Everything
    you post to $$ will be shown to all other users on the bounce and
    on all other linked bouncers.

    If you want to query a user on the bounce, just do a query on $login, that
    would address the bounce user. If you did link other bouncers to your
    bouncer, you can query other users on other bouncer-users by doing a
    query to $login@bouncer.

(10)Everything gets logged. Every connect and disconnect. If you arent connected
    to your bounce, all queries will be logged to your private log.
    Commands for the Connection Log are:
   */PLAYMAINLOG		-> Displays the connection logs
   */ERASEMAINLOG		-> Erases the connection logs
    Commands for Messagelogs are:
    /PLAYPRIVATELOG [network~]	-> Displays all querys
    /ERASEPRIVATELOG [network~]	-> Erases your logged queries.
    Commands for the Trafficlog are:
    /ADDLOG [network~] #channel/person :filter
				-> Allows you an source and filter
				   to log from. Example:
				   /ADDLOG #blah :*
				   would log everything on #blah.
    /DELLOG [network~] (Number) -> Deletes a source and filter shown from
    /LISTLOG [network~]		-> Lists the logentrys
    /PLAYTRAFFICLOG source fromdate fromtime todate totime :filter
				-> plays the trafficlog recorded
				   you can also specify another filter as
				   in /addlog to filter more special entrys
    /ERASETRAFFICLOG 		-> erases the traffic log, starts new.
    
    Some notes about Traffic-Logging:
    - be sure to set filters. Your shell/machine would log every traffic
      on a filter *. Typical filters would be JOIN, PART or KICK, to
      monitor all joins, parts or Kicks.
    - You have to care about the fact, that you have got enough space
      free on your shell to traffic log. Be sure to erase your Trafficlog
      as often as possible.
    - Traffic logging raises processor usage. Be sure to check the usage
      if you are going to log any event. And buy a new hd, if you only
      got 500mbyte :)

(11)It is possible to link your bouncer to others and to link other bouncers
    to yours. That allows a shared off-irc partyline and sharing of resources
    as like vhosts. Commands for linking are:
   */NAMEBOUNCER name		-> set the name of your bouncer
                                   to identify it in the network.
				   This has to be done before
				   adding links.
   */LINKTO :host:port		-> adds a host and port of another
                                   psyBNC, where your bouncer should
				   link to.
   */LINKFROM name :host:port	-> adds a bouncer, its host and its
                                   port that could link to your bouncer.
    /LISTLINKS			-> lists all added links in the network.
   */DELLINK number		-> deletes the link with the number
                                   corresponding to LISTLINKS.
   
   */RELAYLINK number		-> allows users from the added link
                                   to relay link to your bouncer using
				   associated vhosts of your machine.    

(12)The bouncer allows the using of multiple irc sessions for one
    client. Its possible to be on ircnet, efnet and other
    networks by using one client only. 
    
    Before using this feature, read the following restrictions, which
    result from the usage of this feature:
    
    - You will always see yourself having the nick of the main
      network, even, if the bouncer needed to change your
      nick on the secondary network. Check, which nick your
      client is using on the other network. Maybe your nick
      was used, so the bouncer had to change it.
    - Every channel and user will be tokened with the network
      handle. If you want to join a channel on the network,
      you would have to give a command as like
               /JOIN #EfNet~#Talk
      or you would need to use commands as like
               /QUERY EfNet~Joe
      instead of /QUERY joe. You got the clue ?
    
    Commands for multiple networking are:
    /ADDNETWORK name		-> adds a network to your client
    /DELNETWORK name		-> removes a network from your client
    /LISTNETWORKS		-> Lists the networks associated
				   to your client.
				 
    If you want to administrate the network specifics, you will
    have to use the commands already described above including the
    network token. Examples:
    
    /ADDOP EfNet~#talk password :*!*joe@*.blah.net
    /ADDDCC EfNet~lamebot lamer lamepass :ip3.blah.bleh.net:31337
    /ADDSERVER EfNet~irc.lame.org :6667
    
    You need to add a server for your network. It wont connect until
    you did.    
    You need to establish own dcc connections for every network
    if you want to use this feature. Thats logical, bots
    cant be on multiple networks :).
    
    The multinetworking can make problems in rejoining and resolving
    channel names. This is done asynchron, and its possible the
    client gets NAMES of both network for two different channels
    at the same time. Maybe mIRC acts funny :>.

(13)I added password encryption. Its a self made two-way
    password encryption and therefore crackable with some effort.
    Be sure to move the salt.h File created after compiling from
    your shell to your home box or another safe place you totally
    controll. If someone gets the salt.h File, he can decrypt
    all your passwords. If not, its much harder.
    From psybnc2.1 authentifications passwords are encrypted
    using blowfish.

(14)You can establish dcc connections to bots from the bouncer.
    This is for special usage with bots. It will send your
    login and password right after it connected to the bot
    for the login session. After your client joined the bots
    partyline successfully, it can ask for op from the bot.
    Commands for bot-dcc sessions are:
    
    /ADDDCC [network~]botname user password :host:port
				-> adds a new bot-dcc session
    /DELDCC [network~]number	-> deletes the previous
				   added dcc session, get the number
				   from
    /LISTDCC [network~]		-> lists all dcc connections

    The partyline of the bot will be queried to/from the botname
    prefixed by a '-'. Example:

    /QUERY -lamebot
    
    would set your query to the bots partyline.
    
    If you want to get op from the bot automatically, just do:
    
    /ADDASK #channel :-botname
    
    The bouncer would send the op query to the bots partyline then
    instead of querying to the irc client matching its hostname.
    This is recommended. Querying to other eggdrops is insecure
    because of possible spoofed clients who got op by takeover.
        
(15)Talk encryption
    Talk encryption was being introduced to annoy all those
    sniffing kiddies and to protect your privacy on irc.
    
    You need to set a password for a channel or person you are
    querying with. That is done via:
    
    /ENCRYPT [network~] password :channel/user
    
    Example:
    
    /ENCRYPT #leet :nothingbutapassword
    
    Your counterpart would have to do it vice versa. If you adress
    a channel, every person on the channel has to have the key.
    
    /DELENCRYPT (Number) 	-> deletes an entry for encryption from
    /LISTENCRYPT		-> Lists all encryption adresses and passwords.
    
    Also normal irc clients can request an encrypted connection. Clients
    for this purpose are ready on www.psychoid.lam3rz.de. Specifications
    can be requested from me (mail to psychoid@lam3rz.de).

    Bouncer-Links can be encrypted using:
    SETLINKKEY linknumber :key		-> sets the initial key for
					   the link. needs to be done
					   on linkfrom and linkto of this
					   link.
    User Connections can be crypted using:
    SETUSERKEY user :key		-> sets the encryption key
					   for the user, if admin, or
					   for yourself, if no user is
					   given. You need a special
					   client to relay between your
					   IRC-Program and the bouncer.
					   This can be found at
					   www.psychoid.lam3rz.de.
    
    * This functionality needs CRYPT defined before compiling.
      It's set enabled in standard, so just remove it from config.h
      if you dont use it.

(16)Translating
    psyBNC allows you to set a user or channel as translation source/dest.
    So, everything you type, will be automatically translated to the
    language your counterpart talks. Same is with the text they talk,
    it also will be translated.
    
    Commands for this purpose are:
    
    /ADDTRANSLATE [network~]#channel/user :language-from language-to
    
    language can be:
	    en_de
	    en_it
	    en_fr
	    en_pt
	    de_en
	    it_en
	    fr_en
	    pt_en
    
    Examples:
    
    /TRANSLATE #bayern :de_en en_de
    
    Result would be, you would get both the german text spoken on #bayern 
    as also the english text.
    
    In return, everything you would type in english to #bayern, would be 
    posted in german to the channel.
    
    You can remove a Translation by:
    
    /DELTRANSLATE (Number)
    
    from the list displayed by
    
    /LISTTRANSLATE.

    * This functionality needs -DTRANSLATE defined before compiling.
      It's set enabled in standard, so just remove it from config.h
      if you dont use it.
    
(17)Modular structure
    Up to 2.1, psybnc was a single source code. I decided to part it into
    different sections. That allows you to remove a functionality from
    the config.h, if you dont need it (improves performance and decreases
    memory usage).
    
    This has to be done before Compilation.
    The following defines mean the follow functionality:
    
    CRYPT		-> allows encrypted connections, talk encryption
     BLOWFISH		-> chooses blowfish as symetric cipher
     DIDEA		-> chooses idea as symetric cipher
     
     You can only set BLOWFISH OR IDEA. Not both at the same time.
     The bouncer also will understand the other crypting, but it will
     use the selected encryption on sending data.
     
    PARTYCHANNEL	-> Enables the partychannel instead of the old $$
    TRANSLATE		-> Enables the translator.
    PROXYS		-> Allows you to use external proxys (socks, wingate etc.)
    TRAFFICLOG		-> Allows you to log traffic.
    
    Possibly you are not interested in privacy, so disabling Crypting.
    Or you dont want a translation module, so just disable it.
    Or you loved the old $$ as partytalk :) Well, set this flag to
    return to acient times.
    
(18)Host allows
    With psyBNC2.1 you will get the File psbnc.hosts. Those allows you
    to change Hosts which are allowed to connect. Standard is set to *, every
    host may connect.
    
    You can change that settings by:
    
    /ADDALLOW (Host)	-> Adds a host which is allows to connect
    /DELALLOW (Number)	-> Deletes an entry from
    /LISTALLOW		-> Lists the allowed Hosts
    
    A Host may be entered with matchcodes.
    Examples:
    
    /ADDALLOW dialup*.bleh.net
    
    or
    
    /ADDALLOW *.somewhere.org
    
    Also the bouncers which want to link have to be added.

  (*) preceded Commands may be only used by admins

About Channels:

      #chan entrys are optional, if no chan is entered, the used
      command will be taken to all channels.

      Do not use [#chan] but #chan. The brackets only show its optional.

About Networks:

      network~ entrys are optional. If no network is given,
      your standard server connection will be adressed.
      
      Do not use [network~] but network~, the brackets only show
      also here that its just optional.

About the Partyline:

      In Version 2.1, the old $$-partyline was changed to an
      internal bouncer channel. This channel is not existent on irc.
      You cannot kick, ban, op or set any modes there. But you can
      set the topic, which is also broadcasted to the restnetwork.
      
      The channel is defined by the name &partyline.
      
    * This functionality needs -DPARTYCHANNEL defined before compiling.
      It's set enabled in standard, so just remove it from config.h
      if you dont use it. If you remove this define, you will keep on using
      $$ as partyline.


The Statement Hostmask may be a already from bots and irc known Hostmask
(for example *!*bleh@*.fuck.net).. be sure always using Hostnames, and never
Nicks only (dumb would be blah!*@*). The statement Host has to be
a fully valid hostname. The bouncer needs to get its ip, it has to
connect that.

(c) Contact me: psychoid@ircnet, channels #sex, #sex.ger and #flirtcafe
		psychoid@lam3rz.de
		psychoid@gmx.net

		http://www.psychoid.lam3rz.de

(d) Credits

    match.c	by Chris Fuller
    RSAref	by RSA Laboratories, RSA Data Security
		   (RSA is NOT supported in the standard version due
		    to problems on different endian systems)
    Blowfish	by Bruce Schneier
    IDEA	by ascom ltd, switzerland
        
    Helptexts	by [DRACON]

    Windows
    Crypt 
    Client	by [-MaX-]
    
    Webpage 	by coke
    
    Hosting	by PLATo
    
There is given absolutely NO WARRANTY of functionality. I am not responsible
if anything gets screwed. Read the GNU-Public license which is included.

have fun,
psychoid / tCl
