PicoTorrent; a BitTorrent client without the bloat.

Remember the good old days when BitTorrent clients were just exactly that; BitTorrent clients? Nowadays BitTorrent clients are packed with loads of unnecessary features. Take uTorrent for example; it started as a lightweight BitTorrent client, but nowadays is bloated with features such as streaming but also advertisements. Roughly the same happened to qBittorrent, so I switched to Baretorrent. Sadly development of Baretorrent stopped in 2013 and is getting outdated in terms of encryption protocols, hence I started looking for an alternative and behold; PicoTorrent, the true lightweight BitTorrent Client. Basically it’s an updated version of Baretorrent; It has no unnecessary features, no advertisements, IPv6 support and it’s open-source!

Get it here: http://www.picotorrent.org/

TeamSpeak Server 3.0.13 not starting? Install Visual Studio 2015 run-time (x86)!

Recently I encountered issues starting my TeamSpeak server after updating it from version 3.0.11.4 to 3.0.13.6.; it would immediately crash with a blank error log.
Apparently TeamSpeak Server 3.0.13 onwards requires the 32-bit Visual C++ Redistributable for Visual Studio 2015 to be installed. Yes, the 32-bit variant, even if your OS is 64 bit. So, should you encounter immediate server crashes after updating your TeamSpeak server to version 3.0.13, try downloading and installing the 32-bit variant of Visual Studio 2015 run-time from here: https://www.microsoft.com/en-us/download/details.aspx?id=48145

PS. In case you missed the release notes of TeamSpeak Server 3.0.12, as of that version, the server binaries file names do NOT contain platform suffixes any more. They’re all called “ts3server” now, so don’t forget to delete the old/obsolete binary including the platform suffix from your TeamSpeak Server installation folder (else it will crash as well…)

How to schedule a PHP script in Plesk for Windows using cronjob/crontab

Nowadays it’s dead easy to schedule a PHP script as a cronjob/crontab in Plesk Onyx for Windows. However, in the previous versions, Plesk did not supply a sample syntax for scheduled tasks. Most examples found on the interwebs assume that you’re running Plesk on Linux, but if you are like me and run Plesk on Windows, that syntax is just plain wrong.

This small ‘note to self post’ shows how to correctly schedule a PHP script in Plesk for Windows for those of you who are still running an older version of Plesk :)

Step 1. Open Plesk and search for Scheduled Tasks

Step 2. Create a new cronjob/crontab as shown above. Adjust the parameters to your liking. In this example, I’ve scheduled the particular .php script to run every 5 minutes of each day of the week.

Step 3. You’re done! In the end, your finished cronjob/crontab should look like in the image above. If desired, you can also run it on demand by clicking Run Now.

HostsMan: Pi-hole without the pi (DNS-based adblocker)

If you’re tired of AdBlock Plus slowing down your browser and you don’t have a spare Raspberry Pi lying around to run Pi-hole, HostsMan is a great alternative that runs on Windows. One way to keep malware and advertisements outside is to block the servers that serve this content. This can be done by adding the IP numbers of these machines into the hosts file and redirect them to ‘localhost’. Updating the hosts is time-consuming and prone to errors, but this is when HostsMan comes into play. This free program can retrieve current lists of websites known to serve advertisements and malware and combine with the existing hosts file. Furthermore, it checks the hosts file for incorrect, duplicate or malicious entries. It also features a built-in editor and can be used to empty the DNS cache.

Download link: http://www.abelhadigital.com/hostsman

Unlike AdBlock Plus, however, HostsMan doesn’t make it obvious which hosts file sources you subscribe to. Enabling all of them sounds like a good idea, but doing so hoses some functionality such as social sharing bookmarklets. For information on which sources to use in HostsMan, visit: https://jdrch.wordpress.com/2014/11/03/which-sources-to-use-in-hostsman/

Also, for a comparison of AdBlock Plus and HostsMan, visit: https://jdrch.wordpress.com/2014/11/05/the-best-way-to-block-ads-adblock-plus-vs-a-custom-hosts-file-hostsman/

Microsoft Azure Tips & Tricks

Recently I’ve started to play around with Azure, Microsoft’s cloud. In this blogpost, I’ll be sharing some of my initial findings, which might prevent you from making the same rookie mistakes as I did ;)

First of all, compared to other cloud providers such as Vultr and Digital Ocean, Azure is quite expensive. However, should you have a MSDN account, you might be eligible for free Azure credit up to $150 per month! For more information, visit https://azure.microsoft.com/en-us/pricing/member-offers/msdn-benefits-details

The Azure control panel might be overwhelming at first, but it’s pretty intuitive once you start using it. Basically the workflow is from left to right, i.e. if you click on an option, a new screen opens to the right.

Image credit: http://pumpingco.de/your-own-game-server-on-azure-create-a-dedicated-counter-strike-server/

So without further ado, here’s my list of top tips & tricks for Azure rookies:

  • VMs are automatically allocated a dynamic WAN (‘internet facing IP address’) in order to communicate with the internet. This causes the IP address to change when you stop and start the VM, for example using auto-start/auto-stop as described above. You can specify a DNS domain name label for a public IP resource, which creates a mapping for domainnamelabel.location.cloudapp.azure.com to the public IP address in the Azure-managed DNS servers. For instance, if you create a public IP resource with contoso as a domainnamelabel in the West US Azure location, the fully-qualified domain name (FQDN) contoso.westus.cloudapp.azure.com will resolve to the public IP address of the resource. This is particularly helpful in case of using a dynamic IP address.
    Should you not want this, you can assign a static IP to the VM. However, you cannot specify the actual IP address assigned to the public IP resource. Instead, it gets allocated from a pool of available IP addresses in the Azure location the resource is created in. For more information, visit: https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-ip-addresses-overview-arm

    It’s possible to delete the VM and preserve the static IP address, for example to assign to another/new VM. In order to do so, do not delete the entire resource group that is associated with the IP address. Instead, shutdown the VM, then delete the NIC associated with the static IP you want to preserve. Then delete all other components in the resource group except for the IP you want to preserve. Please do note that IP addresses cannot change resource groups, so in order to re-use the IP address, you need to create a new VM (or load balancer) in the same resource group as the IP address.
  • VMs in a DevTest lab are deployed without a Network Security Group (also known as a firewall) within Azure. They only come with the default Windows Firewall running on the machine itself. Should you want a NSG/Firewall within Azure as well, you can deploy one yourself in the same resource group and assign it to the VNet of the VM you created in the DevTest lab. Please do note that this requires you to forward ports in twofold; one time within the VM itself in the Windows Firewall and the second time from within the NSG/Firewall in the Azure portal.


    Image credit: http://pumpingco.de/your-own-game-server-on-azure-create-a-dedicated-counter-strike-server/

    This is also the case with normal VMs (i.e. VMs that are not created in a DevTest lab) as they come with a NSG/firewall by default.
  • Azure offers two types of storage disks: SSD (Premium storage) and conventional HDD (Standard storage). SSD disks come in 3 sizes, 128GB, 256GB, 512GB. HDD disks have a flexible/user chosen size which can vary up to 1TB. You need to create a software RAID in order to get a large volume/disk.
    Premium Storage supports DS-series, DSv2-series, GS-series, and Fs-series VMs. You can use both Standard and Premium storage disks with Premium Storage supported of VMs. But you cannot use Premium Storage disks with VM series which are not Premium Storage compatible (for example the A-series or Av2-series).
    If you’re using standard storage, you’ll only be charged for the data you’re storing. Let’s say you created a 30 GB VHD but storing only 1 GB of data in it, you will only be charged for 1 GB. All empty pages are not charged.
    HOWEVER, if you’re using SSD (premium storage) you pay for the FULL SSD disk regardless of how much data you stored and empty pages are charged… so it becomes expensive pretty quick. For more information, visit https://azure.microsoft.com/nl-nl/blog/azure-premium-storage-now-generally-available-2/ and https://docs.microsoft.com/en-us/azure/storage/storage-premium-storage
  • Azure Storage provides the capability to take snapshots of your VMs. In order to take snapshots of your VM, you need a Recovery Services vault. A Recovery Services vault is an entity that stores all the backups and recovery points you create over time. The Recovery Services vault also contains the backup policy applied to the protected files and folders.
    Previously, when you created a backup vault you had the option to select locally redundant storage (LRS) or geo-redundant storage (GRS). This has now changed and you do not have the option during the vault creation.

    Now, by default, your vault will be created in a GRS, which costs (way) more than LRS (almost double!). If you want to switch to LRS, you must do so after the vault has been created but PRIOR to registering any items to the vault. You cannot switch the storage type of your Vault after you registered any items to it! To do this, simply access the Configure tab of your backup vault and change the replication from the default of GRS to LRS. Don’t forget to click Save…

    For more information, visit: https://docs.microsoft.com/en-us/azure/backup/backup-configure-vault

  • When you create a VM in Windows Azure you are provided with a temporary storage automatically. This temporary storage is “D:” on a Windows VM and it is “/dev/sdb1” on a Linux VM and is used to save the system paging file. This temporary storage must not be used to store data that you are not willing to lose, as there is no way to recover any data from the temporary drive. The temporary storage is present on the physical machine that is hosting your VM. Your VM can move to a different host at any point in time due to various reasons (hardware failure etc.). When this happens your VM will be recreated on the new host using the OS disk from your storage account. Any data saved on the previous temporary drive will not be migrated and you will be assigned a temporary drive on the new host. Because this temporary storage drive is present on the physical machine which is hosting your VM, it can have higher IOPS and lower latency when compared to the persistent storage like data disk. The temporary storage provided with each VM has no extra cost associated with it for storage space as well as for transactions. For more information, visit: https://blogs.msdn.microsoft.com/mast/2013/12/06/understanding-the-temporary-drive-on-windows-azure-virtual-machines/
    If your application needs to use the D drive to store data, you can to use a different drive letter for the temporary disk. However, you cannot delete the temporary disk (it’ll always be there), you can only assign it a different drive letter. For instructions on how to do so, visit https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-classic-change-drive-letter

That’s it for now!

How to: MikroTik Hairpin NAT with dynamic WAN IP for dummies

About half a year ago, I bought a Mikrotik RouterBoard RB962UiGS-5HacT2HnT hAP AC (Phew! What a mouthful!). It’s a great router, or should I say routerboard, which has more features I could ever wish for… maybe even too many!

Nevertheless, out of the box, I was unable to visit my local NAS/Webserver using the WAN IP from my local network. After a quick Google DuckDuckGo search, I discovered that this requires a so-called ‘Hairpin NAT’. Basically, it reroutes all traffic sent to your WAN IP from your local network, back to (a specific IP address in) your local network. Graphically, it looks like this:

serveimage
See the arrow which, with a little bit of imagination, looks like a hairpin? Hence the name…anyway, let’s continue!

However, the issue with most Hairpin NAT configurations you find online is that it requires you to have a static WAN IP, which I don’t have. Additionally, most tutorials use the terminal, whereas I prefer the graphical interface of Winbox. Therefore, I figured out how to setup a Hairpin NAT in combination with a dynamic WAN IP using Winbox myself and since ‘sharing is caring’, here’s how to do it:

  1. Connect to your Mikrotik using Winbox
  2. Select IP –> Firewall from the menu
    mikrotik1
  3. Make sure that the default ‘defconf: masquerade’ rule is on top, which looks as follows:
    mikrotik2
  4. Add a new rule as follows, name it ‘Hairpin NAT’, which looks as follows (replace 192.168.88.0/24 with your own local network IP range):
    mikrotik3
  5. Add another rule. This rule will contain the IP and port you are trying to reroute. For example, lets say I want to connect to my local NAS running on IP 192.168.88.50 and port 1337 using my WAN IP, my rule would look like this:
    mikrotik4
    Don’t forget the exclamation mark in front of the Destination Address!
    Protip: You can add more ports in the same rule. Just split ranges with dashes like this: 1330-1337 and multiple ports with commas like so: 80,443,1330-1337
  6. Done! You should now be able to access your NAS/Webserver using your WAN IP from your local network. Feel free to add more rules to your liking, but remember, the order is important. So first the ‘defconf: masquerade’ rule, then the ‘Hairpin NAT’ rule and then all other rules :)
    mikrotik5

FREE automatic backup solution for Windows (Live) Mail and Outlook?

Backing up Windows (Live) Mail and Outlook automatically to a NAS or cloud storage provider can be a pain. A simply robocopy does not suffice, as the .PST file will be in use when the client is opened. Luckily there are some free tools out there that can help you automate this task for you.

For Windows (Live) Mail:
http://www.priotecs.com/en/windows-mail-backup/

For Outlook:
http://www.safepstbackup.com/

Statsgen2

[Update 9-1-2017]  The statsgen.co.uk domain name got dropped because it wasn’t renewed. As of today, I’m the new owner of statsgen.co.uk to continue the legacy.

I’m currently in the process of migrating our Call of Duty 2 servers from Linux to Windows. Why? Well, I made a small oopsy which would take me a long time to fix, so I decided to migrate the COD2 servers to Windows, but let’s not go into details. If you must know, my /boot directory was full so I had to clean it up. Accidentally, I deleted the wrong kernel files, so the server didn’t want to boot anymore. Of course I could fiddle around with the rescue option my VPS had, but I was a bit tired of messing around with the command-line.

Anyway, we used to run our Call of Duty 2 servers before on Windows as well, back in 2010. The main advantage of running your COD2 servers on Windows is that you can use Statsgen2, a free statistics generator. Of course one can also use Statsgen2 with your COD2 servers running on Linux. You would just have to (automatically) FTP the logfiles over to your Windows box running Statsgen, but that would require 2 servers, which is silly. So naturally during the migration I decided to go and download statsgen2 from its official website statsgen.co.uk, just to find out that the website no longer exists :-(

Almost every link I tried on Google was dead, but in the end I managed to download a clean copy of statsgen2.zip. Those of you who have used statsgen2 in the past know that you need more than just the program itself; Without the imagepacks, your stats website will look like crap. Finding a working link to the imagepacks turned out to be a real pain in the ass. I couldn’t find a working link anywhere, so I had to use my reverse engineering skills to download the images from stats pages created by statsgen2 in the past. Basically what I did was search on Google for clans still hosting an (old) statsgen2 generated stats page and used DownThemAll to download all images on their stats pages. Doing so, I managed to recreate complete imagepacks for Call of Duty, Call of Duty 2, Call of Duty 4, Call of Duty 5, Wolfenstein: Enemy Territory and the base images (i.e. Home button etc).

According to the official website, archived by web.org, I am still missing the files for other games like MOHAA and Enemy Terrirory: QuakeWars but this was the best I could do. At least you have the files for the complete Call of Duty series and the program itself to get you started J Should you have these files, please email me so I can put them up for everyone else to download.


Statsgen 2 is a Statistics Generators for Call Of Duty 1/2/4/5, MOHAA, Spearhead, Wolfenstein/Enemy Territory and Quake Wars. Statsgen automatically downloads the server logfiles, processes them using a flexible template system, and then transmits the resultant webpages to the webserver. Templating allows the pages produced to be very flexible to fit in with the style of your clan website. Additionally, it can send messages to your game servers stating who are the top scorers (COD1, COD2, COD4, QuakeWars).

Download:

Latest Statsgen2 Release:
Version 1.9.3 (23 November 2009) – statsgen2.zip

Image packs:
Basic Statsgen Images – Required for all server types – statsgen2images.zip
COD 5 Specific Images – Supplied by Odin – cod5images.zip
COD 4 Specific Images – cod4images.zip
COD 2 Specific Images – cod2images.zip
COD 1 Specific Images – cod1images.zip
Wolfenstein: Enemy Territory Specific Images – wolfensteinimages.zip

Unzip the contents and upload them to the root of your statsgen2 output folder of your webserver.
Note: I am still missing the imagepacks for other games like MOHAA and Enemy Terrirory: QuakeWars but this was the best I could do. Should you have these files, please email me so I can put them up for everyone else to download.

Upgrade files:
No idea what these are for, but I saved them just in case. Personally I’ve never used/needed them.
cod5images.ini
cod4images.ini
cod2images.ini
cod1images.ini
mohaaimages.ini
quakewarsimages.ini
wolfensteinimages.ini

Custom Templates:
ArcadeKnight’s CoD2 Template

Installation:

Consult the included README.txt for a quick installation guide. Consult the detailed documentation, which can be found in the help.zip, for more information.
To get you started, it basically comes down to this:

– Create a directory statsgen2 and unzip its contents
Contents should include:
statsgen2.exe
help.zip
libmySQL.dll – This is a library used to connect to MySQL databases (Note: A MySQL compatible template is not included! I could not find a working download link)
statsgen2.ini
readme.txt
upgrade.ini – Upgrade files, used when upgrading from an older statsgen version to the latest one (Never used it myself).

– Run statsgen2.exe – On first run various files / directories will be created including the default templates. This can take a while, please be patient.

– Click on Run –> First Time Configuration – Again, this can take a while. DO NOT CANCEL THIS OR INSTALLATION WILL NOT COMPLETE

– Setup statsgen2 to your liking, upload the corresponding imagepack and you’re done!

Statsgen2 is even compatible with Windows Server 2012 R2! Just make sure to run it in compatibility mode (XP SP2/SP3) with Administrator privileges.
Additionally, I also had to hack together this .bat file, which basically just deletes the database before the stats are parsed. Else, my webpage would have missing data. Deleting the database before the statistics are parsed ensures the database is completely rebuilt from the start instead of being appended, which apparently gives issues on Windows Server 2012 R2. I’ve scheduled this .bat file using Windows Task Scheduler to be run before the stats are parsed:

taskkill /F /IM statsgen2.exe
del “D:\statsgen2\statsgen2.db”
“D:\statsgen2\statsgen2.exe”
exit

Disclaimer:

Statsgen2 is created by Shaun Jackson – nazarine666@hotmail.com
I’ve mailed Shaun and requested permission to re-host the files. Sadly I never received a reply. It’s a great shame as many still use it since no one has created anything near as good.

How to: “Fix” Perflib Error 1008

For the past three days, I’ve been trying to fix several Perflib errors that were appearing in my Event Viewer. The errors cycled through like this:

The Open Procedure for service “BITS” in DLL “C:\Windows\System32\bitsperf.dll” failed
The Open Procedure for service “ESENT” in DLL “C:\Windows\system32\esentprf.dll” failed
The Open Procedure for service “Lsa” in DLL “C:\Windows\System32\Secur32.dll” failed
The Open Procedure for service “MSDTC” in DLL “C:\Windows\system32\msdtcuiu.DLL” failed

They all had Event ID 1008 and Perflib as source. The only difference was it’s service- and DLL name.

bits_error

Apart from these errors appearing in my Event Viewer, I didn’t notice anything strange with my computer; Everything was working like it should, so I had no idea what this could be causing and what (according to Windows) wasn’t working like it should. After a quick Google search, I found out that the error itself isn’t a big deal; It’s just saying it can’t collect performance data.

That was the easy part. Getting red of the errors is a whole different story. These errors got me technically stumped, as I’ve tried virtually every solution you can find on the web to no avail:

– I ran a virus scan as well as a malware scan, without success.
– I ran a chkdsk, without success.
– I ran sfc /scannow, without success.
– I ran lodctr /r, without success.
– I ran Microsoft’s SystemFileChecker tool to repair missing or corrupted system files, without success.
– I removed and reinstalled the BITS, ESENT, LSA and MSDTC service without success.

This was driving me nuts. Since the error itself wasn’t really a big deal, I decided to disable the performance counters for the services that Windows was unable to collect performance data for. This can be achieved by using Extensible Counter List which can be downloaded here: http://download.microsoft.com/download/win2000platform/exctrlst/1.00.0.1/nt5/en-us/exctrlst_setup.exe
After downloading and installing Extensible Counter List, go to C:\Program Files (x86)\Resource Kit and run Exctrlst.exe as Administrator.
Next, find the service(s) in the list that Windows reports it is unable to collect performance data for and uncheck ‘Performance Counters Enabled’ for each service.

extensiblecounterlist

Although this doesn’t solve the initial problem why the errors are occurring, at least it helps you to get rid of them from Event Viewer (a.k.a. symptom treatment)…. But since the errors themselves aren’t a big deal, you should be fine.

How to: Fix an unbootable Intel SSD suffering from the 8MB bug

A friend of mine was having issues booting his laptop. The BIOS recognized his SSD, an Intel SSD sa2bw120g3a, but Windows was nowhere to be found. Even bootable partition and hard drive managers showed no sign of the SSD. This got me thinking that the SSD was dead, which was odd, as the BIOS was still recognizing it.

Several minutes of Googling lead me into the right direction; My friend’s SSD was suffering from the 8MB bug that was discovered in (almost all) Intel SSD firmwares, back in July 2011. As my friend never encountered issues with his SSD and wasn’t up to date about this fact, he never updated his SSD’s firmware, which could have prevented this bug from happening.

The 8MB bug is caused by an unexpected power loss under specific conditions. This will reduce the capacity of the SSD to 8MB and change the serial number to “BAD_CTX 0000013x”. Once this error occurs, no data on the SSD can be accessed and the user cannot write to or read from the SSD. The only way to get the SSD back to work is to erase it. That’s right, all data on the drive is permanently lost.

Some people have been able to start from scratch by wiping the drive’s contents with utilities such as HDDErase and Parted Magic but this only works if your SSD is not ‘frozen’. And since my friend has all the luck in the world, sure enough his SSD was frozen. Fixing a frozen Intel SSD suffering from the 8MB bug requires a more technical approach but it’s no rocket science once you know what you have to do. So, let’s get started!

You need:
– Hiren’s Boot CD / USB: http://www.hirensbootcd.org/hbcd-v132/
Update 21-11-2016: Mini Linux was removed from recent Hiren’s Boot CD versions. The last Hiren’s Boot CD to include Mini Linux is version 13.2 which you can download from the link above (scroll all the way down).
– Physical access to your SSD (i.e. open up your computer case)

1. Insert Hiren’s Boot CD / USB into your computer and boot from it.

2. Select ‘Mini Linux’ from the menu and hit Enter.

3. Once Linux has loaded, right click on the wallpaper and select ‘Xterm

4. A command prompt / terminal should open. Enter the following command to get a list of all available harddrives in your computer:

 fdisk –l

Locate your Intel SSD in the list and take a note of the device name, for example /dev/sda

5. Type the command:

 sudo hdparm -I /dev/sdX

where  sdX  is your SSD device.
This command will just print out some info about the drive. If you see in the output this: Serial Number: BAD_CTX that confirms that you are hit by this bug.
If at the Security section it reads frozen you CANNOT continue, you have to use a workaround to eliminate the freeze before you can continue:
Unplug and then replug the SATA data cable of your Intel SSD while the system is still powered on. So, leave your computer powered on, open up your case, locate the SATA data cable of your Intel SSD, unplug it and then replug it. This should unfreeze your SSD.

6. Type the command:

 sudo hdparm --user-master u --security-set-pass SOMEPASS /dev/sdX

Again /dev/sdX is your SSD drive, and SOMEPASS is a password you want to set for the SSD. (This password doesn’t lock the SSD or anything similar, it is just needed for these low-level dealing with the SSD.) We will need that SOMEPASS later on, so remember it/write it down. (But after the secure erase this password will be reset anyway so it is not important in the longterm.)

7. Check the drive again:

 sudo hdparm -I /dev/sdX

Now it should say enabled and not frozen at the security section:Security:
Master password revision code = 65534
supported
enabled
not     locked
not     frozen
not     expired: security count
supported: enhanced erase

8. Type the command:

 sudo hdparm --user-master u --security-erase SOMEPASS /dev/sdX

This issues the secure erase command. Again /dev/sdX is your SSD, SOMEPASS is the password set before. The completion of this operation can take a few minutes. After this your SSD should be functional, if not, try again with this command:

 sudo hdparm –user-master u –security-erase-enhanced SOMEPASS /dev/sdX

This latter command takes much more time (30-40 minutes) and you will have to reset the password (with step 4.) before running it because SOMEPASS is likely already reset by the previous command.

9. After this check the drive again

 sudo hdparm -I /dev/sdX

The BAD_CTX thing should be gone and your drive should be functional. You can now reinstall your O/S. After all this don’t forget to update the firmware of our SSD using Intel SSD Toolbox to prevent the bug from happening again in the future.

Source & Credits: http://askubuntu.com/questions/409684/image-or-reset-broken-ssd