XDCC IRC bot guide
An XDCC bot is a fairly easy and automatic way to share files, once you've configured it and gotten it running. As an added bonus, being IRC-based makes it naturally casual-resistant.
System & software requirements:
- A Linux server (preferably)
- Adequate upload speeds
- Adequate HDD space
- Iroffer mod Dinoex
- PuTTY (for connecting to your server)
- FileZilla (SFTP file uploading)
- nginx (optional)
Acquiring a server
You can run this on your home computer and connection, but for convenience's sake, it's probably easier to get a cheap VPS, both for uptime and network speeds. Since the actual XDCC bot software is very lightweight, the main requirements are the available HDD space and bandwidth. That narrows the search to for example the following:
RamNode
RamNode is a well established VPS provider in the low end VPS scene, and their cheapest plan at $15 per year comes with 80 GB of storage. This site is running on one for example. They have four US locations and one in Netherlands. Referral link, if you want to use one (I get a bit of credit if you buy one of their plans).
Update: as of April 2016, RamNode has discontinued their 128 MB RAM plan. The 256 MB plan comes with 120 GB space at $8 per quarter, but it might not be the most cost-effective one since you're paying for extra RAM, which you don't strictly need just for running an XDCC bot. Still, the increased bandwidth (1 TB) might be worth it for you, depending on the popularity of your bot.
Time4vps
A very good-looking offer on paper. They have a very low-cost storage VPS plan at 0.99-1.99 € per month, depending on your billing cycle, with a whopping 512 GB of HDD space (512 MB RAM, 2 TB bandwidth, 100 Mbps port speed).
The XENStorage - 100G plan at dr.Server looks decent, priced at $20 per year. Haven't tested personally.
You can lurk for deals at the following places if you're interested in a bit of server shopping:
- Low End Box and Low End Talk offers
- Lowendserv - LEBYearlyDeals (also has low end dedicated server deals)
- LowEndStock
If you're looking to serve a large amount of files, dedicated servers in general come with more HDD space. Cheap dedicated server providers are for example Kimsufi (sub-brand of OVH) and Online.net. Bandwidth from these two is also basically unmetered, as in no monthly transfer limits.
Setting up your server
The first thing you'll want to do after acquiring one is to secure it and set it up. I'm assuming here that you'll be using Ubuntu as your OS.
Security:
Setting up a Server - /g/wikiQuick checklist:
- Non-root user with sudo privileges
- SSH login only with a key
- Install fail2ban
- sudo apt-get fail2ban should be enough without any further configuration.
After this, update the software in your server.
sudo apt-get update && sudo apt-get upgradeIroffer Dinoex
The actual software handling the file transfers, pack listing et cetera is Iroffer. We'll be using a modified version of the original Iroffer software called Iroffer Dinoex, since the original was last updated in 2005. If you want to use the inbuilt packlisting, you can do a bit of extra tinkering at this point to make the result more user friendly. Download the iroffer-dinoex-snap.tar.gz
version, it fixes a few listing related bugs.
Installation of iroffer mod Dinoex under Linux as a User
Install the requirements with the following line, the ones in the linked instructions don't work as they are on Ubuntu 14.04:
sudo apt-get install make gcc libc-dev libcurl4-openssl-dev libgeoip-dev libssl-dev ruby librubyI'd also recommend you to install some HTTP server software to serve the packlist to others in .txt form. Optional, but convenient for for example indexing purposes for XDCC parsers.
sudo apt-get install nginxYou also need to grant permissions to your user for Iroffer to be able to write the file into the html directories.
cd /usr/share/nginx/sudo chown your_username html
Otherwise the instructions are fairly straightforward (copy and paste the lines as you're told).
You can run the bot in background mode, where you'll have to control it via sending it messages in IRC.
cd && cd iroffer && ./iroffer -b mybot.config
Alternatively, you can run it in screen. If you haven't got it on your system, do the following:
sudo apt-get install screenscreen -r iroffer
cd && cd iroffer && ./iroffer mybot.config
Press ctrl a -> d to detach yourself from the screen and logout.
Autostart
Occasionally your server might go down due to your or the provider's actions. You can set Iroffer to automatically start after boot by doing the following:
crontab -eAdd the following line at the bottom, replacing username with your user name:
@reboot /home/username/iroffer/./iroffer -b /home/username/iroffer/mybot.config
Save and exit.
Ctrl + oCtrl + x
Configuring the bot
All the configuration for the XDCC bot is done via the mybot.config file. Edit it with nano mybot.config. A few useful things to remember, although you should go through the entire file to customize it the way you want:
- User information
- user_nick: the name the bot will appear in IRC.
- user_realname
- Find "# 1st Network" and delete all of the listed servers except Rizon. Either use some IRC channel of your own, or simply don't join any. Downloading from the bot works anyway.
- xdcclistfile /usr/share/nginx/html/bot.txt
- Optional - do this if you've installed nginx.
- Uncomment (remove #) http_index /? to show your pack listing publicly via the inbuilt system
- Uncomment autoadd_time to automatically scan for uploaded files to add to the pack list.
- autoadd_dir /home/username/dir/
- The directory where the bot will check for newly added files at certain interwals.
- autoadd_time
- daily/weekly/monthly limits
- Calculate this one carefully to not end up over the monthly transfer limit of your server provider. Going over can cause unnecessary extra expenses.
Using the bot
Iroffer is quite low maintenance after setting it up. The software will automatically scan for new files to add automatically to the packlist, which it will update by itself. You can either download files directly to the autoadd folder (wget), or upload files there via SFTP (FileZilla).
You can share the bot packlist with others by linking them to either the inbuilt packlisting site of Iroffer (server_ip_address:8000) or by linking them to the separate text file listing, if enabled (server_ip_address/bot.txt). The latter can be indexed by XDCC parsing sites for example. If you want something easier to memorize than an IP address, look into FreeDNS.
If the bot is running in background mode (-b switch used when starting it), you can forcefully stop it either by sending it an admin command in IRC (be sure to check whether you're whitelisted properly in mybot.config) or by killing the process via the OS:
pkill irofferIf you're running the bot in screen, you can just reattach yourself to the screen and input admin commands directly.
screen -r irofferCtrl + a -> d - to deattach after you're done.
Advanced
The inbuilt HTML packlisting (server_ip_address:port_number) uses a bit outdated technology, and you might find that the automatic copying to clipboard doesn't work in modern browsers. We can make this a bit more user friendly, by editing the source code.
Do the following before compiling the program (./Configure & make):
cd iroffer-dinoex-3.30cd src
nano dinoex_http.c
Find the following line:
"<a href=\"javascript:ToClipboard('/msg %s xdcc send %u');\">%s</a>",
And change it to:
"<a href=\"#\" onclick='javascript:prompt(\"Paste this into your IRC client:\",\"/msg %s XDCC SEND %u\")'>%s</a>",
Now proceed to compile the program as instructed in the official guide. The listing will now, instead of attempting to copy to clipboard, create a small window for you to copy the line from.