BitTorrent Server [Part III]

by nealbailey 30. August 2010 20:43

The following guide will walk you through the process of installing a free Windows XP BitTorrent server on your network where all users can share and manage their torrents. All torrent traffic on the network is limited to the torrent server machine and blocked everywhere else. Torrent downloads are stored on a file server (NAS) so all other users can easily get to their downloads and other users can see what has been downloaded. The server is setup to run in headless mode (no keyboard or monitor).

 

WebUI

Why not use Linux? 

I always try to use Linux as much as humanly possible for personal server projects but its just not the right tool for this job. In order to use the uTorrent WebUI in Linux you have to run it in WINE and after too much time trying to figure out how to get uTorrent to run as a daemon (in single user mode - rc2.d & up), I have given up on that idea and moved on.

 

Windows XP is NOT Free 

Let me start off by saying that I do not know the legality of 'micro-XP' operating systems so I cannot say if using the technique I describe below is morally or legally ethical so I will just say that if custom micro-XP builds are not legal then Microsoft needs a licensing model to offer them because they are awesome!

 

BitTorrent Server HOW-TO

  1. Download and install TinyXP Rev10 (custom micro Windows XP SP3)
  2. After the install is complete fix the Windows firewall bug in this build:
    • Start > Run > cmd.exe
    • winmgmt /regserver
  3. Configure a Static IP address:
    • Start > Network Connections
    • Right-click 'Local Area Connection' > Properties
    • Click 'Internet Protocol (TCP/IP)' and then the Properties button
    • Set a static IP address/DNS based on your router settings
  4. Temporarily Map Shared Drive (if storing downloads on a network share)
    • Start > Run > cmd
    • net use Y: \\ServerName\ShareName /PERSISTENT:NO
  5. Install uTorrent v2.0.4 (don't install the ask.com spyware and uncheck the option to start on system startup)
  6. Setup WebUI Server
    • Open the uTorrent properties: Options > Preferences > WebUI
    • Set setting: username = admin
    • Set setting: password = password
    • Set setting: alternate port = 3000
  7. Configure BitTorrent Connections
    • Open the uTorrent properties: Options > Preferences > Connection
    • Incoming connections use port = 29300 (if your ISP throttles torrent traffic)
    • You will need to edit your router port forwarding settings if you use a custom port (as we are doing)
  8. Configure Downloads Location (if storing downloads on a network share)
    • Open the uTorrent properties: Options > Preferences > Directories
    • Check the box: Put new downloads in: set this to the mapped share you want downloads saved in.
  9. Configure XP auto-login (machine IS NOT a member of a domain)
    • Start > Run > cmd.exe
    • control userpasswords2
    • Clear the "Users must enter a user name and password to use this computer" check box, and then click Apply.
    • In the Automatically Log On window, type the password in the Password box.
    • Click OK to close the Automatically Log On window, and then click OK.
  10. Configure XP auto-login (machine IS a member of a domain)
    • Refer to the registry script in the next section to configure auto-login for domain members.
  11. Create login script
    • We need a login script to download the IP blocklists, map the share, and start uTorrent each time the machine boots.
    • Refer to the login script in the next section to configure the script for your machine.
    • Place a shortcut to your script in the Start Menu > Startup folder so it runs each time the machine starts up.

 

Windows XP Auto-Login Registry Script (The machine is a member of a domain)

If the TinyXP server machine is a member of a domain and there is no domain group policy applied to prevent it, you can still configure the machine to auto-login. However, it requires that you save your password in the registry in plain-text so if you decide to do this... please, please.. don't auto-login an administrator account!

Create a new file called autologin.reg and add these lines into it. Be sure to enter a valid account name and password in the rows below.

 

Windows Registry Editor Version 5.00
		
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"DefaultUserName"="Developer"
"DefaultPassword"="MyC@zyP@$$word!"
"AutoAdminLogon"="1"

 

Run this script as an administrator to save the settings. The next time the machine is rebooted it will automatically login with this account.

 

Windows XP Login Script

We have chosen to use a login script so we can do some additional work before we start the bittorrent server. Particularly we want to map the network share (where our downloads are being stored), download the newest block lists (this blocks known bad users from connecting to us), and of course we want to start the torrent server web site.

Before continuing download a copy of my uTorrentBlackListupdater script. Create a new folder: c:\Program Files\uTorrentBlacklist and save all the files in the script folder (in the download) into this folder.

Now, create a new file in My Documents, called startup.cmd and create a shortcut from it to the Start Menu > Startup folder. This will ensure the script is run each time the user logs in. Copy the following lines of code into the file and save it.

@echo off

:: The drive letter to map
SET drive=Y:

:: The server & share to map
SET share=\\baileyfs01\Files

:: The blacklist script
SET UpdateBlackList=NO
SET blacklist=c:\progra~1\uTorrentBlacklist\uTorrentBLupdater.js

:: The utorrent install location
SET utorrent=c:\progra~1\utorrent\utorrent.exe

:: Offset; Wait (seconds) specified time to begin
SET WAIT=10

GOTO Main

:Main
         :: Ghetto-ass sleep
	ping 127.0.0.1 -n 2 -w 1000 > nul
	ping 127.0.0.1 -n %WAIT% -w 1000> nul

	NET USE %drive% %share% /PERSISTENT:NO
	IF ERRORLEVEL 1 GOTO ErrMap
	IF %UpdateBlackList% == YES cscript /nologo %blacklist%
	start %utorrent%
	echo Done. Server is ready for use.

:ErrMap
	echo An error occurred. Quiting. 

Be sure to change the variables at the top of the script to reflect your environment.

 

That's It!

Well that's all there is to it. We have used a tiny Windows XP build to create a headless torrent server for our network! You can log into the server from the url: http://IpAddressOfServer:3000/gui/

 

Tags: ,

Networking

Jump Start a PC With a Screwdriver

by nealbailey 23. August 2010 22:45

So what do you do when you have a motherboard that you need to put in a new case but you don't have it's pinout guide and the printings on the board are in a foreign language or use some bizarre numbering scheme? Well, my friends, this is when you have to go MacGyver on it and jump start it with a screw driver! Take a small flat head screw driver and go through each row of pins and you will eventually end up on the right pinset, which will close the circuit and start the PC.

 

Having now found the power switch pins, you can wire the case switch wiring to the correct pins

 

And you can now use the old motherboard in your new case.

 

 

 

Tags: ,

MP3CMS v2.1 RC1 Finally Available!

by nealbailey 2. August 2010 22:11

It'a been a long road getting to this point. After dozens of code refactors, exhaustive editing, and several people working tirelessly for the last few months in their free time I am proud to finally be able to announce that we have reached a stage in development where things are stable enough to put out a release candidate. There are a mountain of fixes and new features which you can read about here and here. Probably the most exciting thing we have done in a while is our new Desktop Edition, which is available in x86 and x64 releases. The desktop edition doesn't require a server or any difficult IIS configuration procedures; you just have to run an installer like any other application.

 

We're super excited about this release and I hope all of you check out the online demo (music playback is disabled as are the admin features) and let us know what you guys think!

 

Tags:

MP3-CMS

Sync Music From MP3-CMS to Your iPod

by nealbailey 6. May 2010 23:16

I had some time this week to work on my labor of love, MP3-CMS. After hacking my iPod's firmware to run Rockbox, a free and open source hardware mp3 player user interface, I decided to develop a synchronization mechanism between handheld mp3 players and the MP3-CMS. This tiny script uses your exported "My_Star_Ratings.csv" file (from the Playlists section) to sync music file rated 3, 4, or 5 stars to your music player.

 

If using Rockbox

  • Log into the MP3-CMS server and navigate to the Playlists section.
  • Click the link, Export My Star Ratings (.CSV)

 

  • Save the My_Star_Ratings.csv file to the root of your player
  • Unzip the iPodSync.zip archive to the root of your player so your folder looks like the one below
  • Run _sync.hta to start the application

 

  • Click the Run Sync button to start the sync.

 

 

Non-Rockbox Players

For non-rockbox mp3 players, you can use any folder on your computer to sync to and then configure your player's software to watch the directory. This way, anytime you run a new sync using the script your player's software will automatically sync to the hardware player.

The script copies songs in the CMS to your local path where the tracks are rated 3-5 stars and it renames them in this format %ARTIST% - %ALBUM% - %TITLE%.mp3. If the album has a folder.jpg cover art file then it will be copied to \.rockbox\albumart\%ARTIST%-%ALBUM%.jpg

 

DOWNLOAD:  iPodSync.zip (75.38 kb)

 

Tags: ,

MP3-CMS

Create a Linux Subversion Repository for Windows Clients

by nealbailey 6. April 2010 14:54

This guide will walk you through creating a subversion server source control repository which can be used to version files (source code, documents, etc, etc). You can browse the repository with Mozilla FireFox, Google Chrome, etc. We will install the svn server on a Ubuntu v9.10 (Minimal System) Linux server. Our end users are developers using Windows XP, Windows Vista, and Windows 7.

 

Part 1: Apache-SVN Server Installation

The steps in the following section are performed on a newly installed Ubuntu 9.10 Minimal Server installation.

 

STEP 1: Setup Static IP Address

# Backup network settings
  $ sudo cp /etc/network/interfaces /etc/network/interfaces.old
  $ sudo nano /etc/network/interfaces

# Edit network config. Edit lines:
  auto eth0
  iface eth0 inet dhcp

# and change them to (something like) the following:
  auto eth0
  iface eth0 inet static
  address 192.168.2.[PickANumberFrom1to254]
  netmask 255.255.255.0
  gateway 192.168.2.252
  broadcast 192.168.2.255

# Save the file, and then restart networking:
  $ sudo /etc/init.d/networking restart

 

STEP 2: Install Apache & Subversion Servers


$ sudo apt-get install apache2 libapache2-svn subversion subversion-tools

 

STEP 3: Create Source Code Store

The folder you create here is the physical location the code is stored on the server. I have a backup hard disk (/dev/sdb) mounted on /home, so I have created my repository in this location.

 

 $ sudo mkdir -p /home/svn/repo

 

STEP 4: Configure Apache SVN Module

This step can be a bit tricky. Be sure you restart apache after making these changes. If Apache throws an error restarting then you have not done this correctly.

 

$ sudo nano /etc/apache2/mods-available/dav_svn.conf

# Uncomment these settings:
<Location /svn>
DAV svn
SVNParentPath /home/svn/repo
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd

# Add this line directly below the line above (require login for read & write)
Require valid–user
</Location>

 

STEP 5: Create Users

This step is for adding web users to the system. NOTE: be sure to only use the -c switch for the first user, to prevent the file from being written over each time you add a user.

  
$ sudo htpasswd -cm /etc/apache2/dav_svn.passwd firstUser
$ sudo htpasswd -m /etc/apache2/dav_svn.passwd secondUser

 

STEP 6: Create Initial Repostiory

Next, we are going to create our first repository and assign the correct permissions for it.

 

# Create initial repository:
$ sudo svnadmin create /home/svn/repo/<repoName>

# Assign Ownership to Apache (so we can write to it from the http)
$ sudo chown www–data:www–data –R /home/svn/repo/<repoName>
$ sudo chmod –R 770 /home/svn/repo/<repoName>

 

STEP 7: Port Assignment/Validation

If you run more than one web server but only have a single internet IP address then you may wish to change the IP address that Apache listens on so your router can forward apache traffic into the network on a port other than 80. Below are the steps for configuring Apache to listen on port 8888:

 
# Assign Port (if needed)
$ sudo /etc/apache2/ports.conf

# Add this line below Listen 80:
Listen 8888



Restart Apache: to apply all the changes in Steps 1-7, you must restart Apache:

  $ sudo /etc/init.d/apache2 restart

 

Apache should now be setup and working. To test it navigate to: http://ServerIPAddress/svn/<repoName>

 

Part 2: Using Subversion in Windows

The steps in the following section are performed on a windows workstation which will use our apache-svn server for source control.

 

STEP 1: Install subversion client

Download and install the TortoiseSVN client application. You will be required to reboot. Following the reboot you will notice a new set of right click shell links in your context menu for tortioseSVN.

 

STEP 2: Create/Get Source Controlled Folder

I typically have 2 primary directories under source control in the Visual Studio 2008/Projects directory; TFS and SVN. Team Foundation Server projects are stored in the TFS\<projectName> folder and Subversion projects are stored in the SVN\<repoName> folder.

 

  • Create a new folder: <repoName> which will store all of your SVN-controlled code files.
  • Right-click on the <repoName> folder and select SVNCheckout.
  • Enter the path to your repository (e.g. http://ServerIpAddress/svn/<repoName>). This will sync the client and workstation.

 

Create 3 new folders within your <repoName> folder. Call these folders: branches, tags, and trunk. Copy all the files you want to version into the trunk folder.

You are now ready to begin committing code to the repository, unless you are using Windows 7 (or you have the enhanced Indexing Service installed through Microsoft Update).

 

STEP 3: Fix Windows 7 x64 Indexing Bug (which causes reporitory fs corruption)

If you try to commit or update to the repository in Windows 7 you will likely get this error:
Can't move '.svn/tmp/entries' to '.svn/entries': The file or directory is corrupted and unreadable.

 

This is due to the Microsoft Windows Indexing Service attempting to seize a handle to the files subversion is controlling in it's internal/hidden .svn directories. To fix this bug you have to either wait for Windows 7 SP1, or disable the Indexing Service for the folder containing your SVN files (see below)

 

  1. Click the start menu button, then click in the 'Search programs and files' text box
  2. Type in “windows index”.
  3. Click on “Indexing Options” that should come up in the search.
  4. When the Indexing Options box comes up, Click on the Modify button.
  5. In the indexed locations dialog box, uncheck the root folder where subversion is managing files.

 

Bug info: http://tortoisesvn.tigris.org/faq.html#cantmove2
Bug info: http://serverfault.com/questions/72561/64-bit-tortoisesvn-on-windows-7-says-file-or-directory-is-corrupted-and-unreadab

 

STEP 4: Set MIME-TYPE and Commit Code

If you do not plan on viewing your checked-in source code directly within you web browser you can skip to comitting your code into subversion. If you do plan on allowing users to view versioned code directly in the web browser then you will have to set the MIME-TYPE property on each file you wish for apache to serve up as plain-text. If you do not do this then the directory structure will be viewble but any file you click will bring up a download dialog box.

 

Set the MIME-TYPE property to text/plain

In our sample, we are checking in a collection of shared scripts. We want to view these scripts directly in the browser, so we need to set the mime-type on all of them. To do this we perform a search in windows to list all *.vbs files in our <repoName> folder. When the search is complete, we highlight all the files and right click > TortoiseSVN > Properties.

 

 

 

In the properties dialog box select the property name: svn:mime-type and enter text/plain.

 

 

Commit the code to Subversion

Finally, we are ready to commit our code to subversion. to do this, all you have to do is right-click on the <repoName> root folder and select SVNCommit.

 

 

 

Tags: , ,

Linux | Networking

Create a Headless VMWare Server with Linux

by nealbailey 2. April 2010 16:06

The following guide will walk you through creating a headless (no monitor, mouse, or keyboard) VMWare Server which is used to host virtual machines on a network. For this guide I am using Ubuntu Linux v9.10 (Karmic Koala) server edition. This solution is based on running a tiny, leightweight Linux operating system to act as the host. The solution is software based, and as such, it will incur a certain degree of performance degradation compared to a bare-metal solution such as VMWare ESX Server. I encourage you to investigate the free VMWare ESXi product, if your hardware supports it. We are using Linux for this effort as Linux supports nearly every possible hardware configuration.

Once completed, this solution will provide you with an entire server farm hosted on a single computer. For developers, home users, and small businesses, you just can't beat it!

 

 

Step 1: Download & Install host operating system

 

  • Download and burn the Ubuntu Linux Server ISO image to CD.
  • Boot to the CD on your host server. At the startup screen hit the F4 key and select the 'Minimal System Install' option.
  • Accept all the defaults in the installation until the installation is complete.

 

Step 2: Update Linux install

Once the OS is loaded and you are logged into the terminal, update the system with the following commands. This is important because after this you will no longer update this server (updates will break VMWare Server).

 

$ sudo apt-get install vim-nox
$ sudo apt-get update
$ sudo apt-get upgrade


Step 3: Set Static IP Address

This step will set a static IP Address on the server so we know what to connect to.

 

# Backup network settings
$ sudo cp /etc/network/interfaces /etc/network/interfaces.old
$ sudo vim /etc/network/interfaces

# Edit network config. Edit lines:
auto eth0
iface eth0 inet dhcp

# and change them to (something like*) the following:
auto eth0
iface eth0 inet static
address 192.168.2.5 # change this to your IP
netmask 255.255.255.0 # for all class 'C' subnets
gateway 192.168.2.252 # change this to your router IP
broadcast 192.168.2.255 # change this to your upper subnet range

# Save the file, and then restart networking:

$ sudo /etc/init.d/networking restart

 

Step 4: Install OpenSSH Server

This step will install an SSH server so we can access the terminal from remote clients.

 

  $ sudo apt-get install openssh-server openssh-client

 

After SSH has installed, download PuTTY on your remote workstations. From this point forward, you can disconnect the monitor, mouse, and keyboard and perform the rest of the installation over the remote SSH terminal using PuTTY.

 

Step 5: Install FTP Server

This step will install a file transfer protocol (FTP) server on the host. FTP provides us a way to transfer very large files (like VMDK) over the network reliably.

 

# Fetch/Install FTP daemon
$ sudo apt-get install vsftpd

# First, you’ll want to make a backup copy of the vsftpd.conf file:
  $ sudo cp /etc/vsftpd.conf /etc/vsftp.conf.old

# Next, open up a text editor to make changes to the vsftpd.conf file:
  $ sudo vim /etc/vsftpd.conf

# Change anonymous_enable=YES To this: anonymous_enable=NO

# Uncomment these settings:
  local_enable=YES
   write_enable=YES

# Restart the vsftpd service with this command:
  $ sudo /etc/init.d/vsftp restart

 

The settings above will allow local user accounts on the host to log into the machine over FTP and have full control of their home directory.

 

Step 6: Install Samba Server (Optional)

The following step will enable windows computers to access the host server using the windows UNC network convention (\\ServerIP\Share). Samba is not reliable for transferring large files but it's a nice luxery to have. Only install this if you need samba file sharing services.


# Fetch/Install Samba packages:
  $ sudo apt-get install samba smbfs

# Next, configure homw shares:
  $ sudo vim /etc/samba/smb.conf

# Change the workgroup line:
  workgroup = [WindowsWorkgroup]

# Next, uncomment the security line and add another as follows:
  security = user
  username map = /etc/samba/smbusers

# Find the share definitions section and match the following:
  [homes]
  comment = Home Directories
  browseable = yes
  read only = no
  create mask = 0755
  directory mask = 0755

# Save the file and then set up the samba user password:
  $ sudo smbpasswd -a <WindowsUsername>

# Create the file /etc/samba/smbusers 
$ sudo vim /etc/samba/smbusers

# Add User to file
system_username = "WindowsUsername"

# Restart the Samba service:
  $ sudo /etc/init.d/samba restart

# Try out the access from your windows PC \\ServerName\Username.

 

Step 7: Install VMWare Server v2.0.2.x

The following step will install and configure VMWare Server v2.0.2, which will host our virtual server farm.

 

# Install pre-requisites
$ sudo apt-get install linux-headers-`uname -r` build-essential xinetd

# If previous VMWare is installed (or previous install failed) delete bad files
$ sudo rm -rf /usr/lib/vmware/modules/

# Download VMWare Server tarball
http://www.vmware.com/download/server/getserver.html

# SSHfs, Samba, or FTP the tarball to your Linux server
\\ServerIp\UserName

# Create directory for virtual machines
$ mkdir ~/virtualMachines

# Move tarball into virtual machine directory
$ mv *.gz ~/virtualMachines

# Extract & delete tarball
$ cd virtualMachines
  $ tar -xzvf VMware-server-2.0.2-203138.i386.tar.gz
  $ rm *.gz

# Download/unpack repair script (works for VMWare Server v.2.0.1 & v2.0.2)
$ cd vmware-server-distrib
  $ wget  http://www.ubuntugeek.com/images/vmware-server.2.0.1_x64-modules-2.6.30.4-fix.tgz
  $ tar -xzvf vmware-server.2.0.1_x64-modules-2.6.30.4-fix.tgz
   
# Run installer perl script
# Accept all defaults, Do not run the /usr/bin/vmware-config.pl script when asked
$ sudo ./vmware-install.pl

# Run the repair script
$ sudo sh vmware-server.2.0.1_x64-modules-2.6.30.4-fix.sh
$ sudo rm -rf /usr/lib/vmware/modules/binary

# Run the config script
  $ sudo /usr/bin/vmware-config.pl

# Accept all defaults, when prompted for an administrative user enter your user name
# The current administrative user for VMware Server  is ''. 
# Would you like to specify a different administrator? [no] yes
System_UserName

 

Step 8: Logging into VMWare Infrastructure Server

To connect to your new VMWare Server open a web browser and connect to https://ServerIP:8333. You will receive a certificate error or a blank screen. If you receive a certificate error, then add the server to your browser's list of trusted sites and import the certificate. If you receive a tinted blank page then you'll have to delete every VMWare certificate in your browser's certificate store.

 

I have posted a mirror of this article on ubuntuforums.org.

 

Tags: , ,

Linux | Networking | Virtualization

C# Desktop RSS News Ticker

by nealbailey 11. January 2010 16:48

I actually finished this project many years ago, back in 2003-2004 (originally in VB.NET v1.0!). Reviewing all my source code a little while ago I came across this old project. It still worked great but it had some memory leak issues so I spent a few hours refactoring the original code base to C#.

 

 

Refer to the code-project article for full source code.

The code is really simple. It uses the RSS.NET library to enumerate the RSS feeds specified in the settings.ini file and append them all in a StringBuilder. The tricky part is figuring out how to make a nested label in a panel control scroll seamlessly with no screen flicker.

When the RSS enumerator has fetched the feeds and fed them back to the TextBox control, we set the label's Text property:

private void textBox1_TextChanged(object sender, System.EventArgs e)
{
   this.label1.Text = this.textBox1.Text;
}

 

There is a Timer control, which re-positions the Label control on the panel on each Tick event:

 

private void timer1_Tick(object sender, System.EventArgs e)
{
   this.label1.Left = this.label1.Left - 1;
   if (this.label1.Left + this.label1.Width < 0)
   {
      this.label1.Left = this.panel1.Width;
   }
}

 

That's basically all that's needed to create the stock ticker effect; a Timer, a Textbox, a label, and a Panel.

 

DOWNLOAD - BaileyRss_News_Ticker.zip (108.13 kb)

Note: The download is ONLY the program (reuires .NET 2.0+). Go to Code-Project for the source code.

 

Tags: , ,

Code

Zip Each File In a Folder Into It's Own Archive

by nealbailey 8. January 2010 23:29

One of the biggest annoyances with 7zip (a great free Zip utility) is a feature it lacks (which is included in WinRar) where you can highlight all the files in a folder and zip each file into it's own archive. For example, rather than creating one huge zip file to store my source code, I prefer to zip each folder into its own archive and move them to my backup file server. Having to zip each folder one at a time is incredibly tedious and time consuming for me.

I have developed a very simple JavaScript utility which allows you to compress each file in a path, or each folder in a path into it's own zip file. The code is pretty simple stuff and it relies on the 7z.exe (redistributable) command line utility. I have created a package for download that has everything you need. You can run the tool at the command line or you can edit the included Go.cmd batch script and put in the path to work and run that by double clicking it. 

DOWNLOAD - ZipBatch.zip (340.00 kb)

 

/* ======================================================================
NAME: 7zBatch - Batch Zip Utility
AUTHOR: Nealosis
DATE  : 1/8/2010
COMMENT: Zip Files & Folders into seperate archives
========================================================================= */


if (WScript.Arguments.Count() < 1) {
    WScript.Echo("Usage: 7zbatch.js [path] [action]");
    WScript.Echo("Example: cscript 7zbatch.js c:\temp\emulators\NES /files");
    WScript.Echo("");
    WScript.Echo("Action: /files - zip all files in a path in a seperate archive");
    WScript.Echo("Action: /folders - zip all folders in a path in a seperate archive");
    WScript.Quit();
}

var _strPath = WScript.Arguments.Item(0);
var _strAction = WScript.Arguments.Item(1);

var _objFso = new ActiveXObject("Scripting.FileSystemObject");
var _objShell = new ActiveXObject("WScript.Shell");
var _dir = _objFso.GetParentFolderName(WScript.ScriptFullName);

var _7zexe = _dir + "\\7z.exe";
var _7zparms = " a -bd -tzip -mx=9 ";

Main();

function ZipFiles(path){
    var objFolder = _objFso.GetFolder(path);
    var files = new Enumerator(objFolder.Files);
    for (; !files.atEnd(); files.moveNext()){
        var objFile = _objFso.GetFile(files.item());
        var zipper = _objFso.GetFile(_7zexe);

        WScript.Echo("Zipping File: " + objFile.ShortPath);
        _objShell.Run(zipper.ShortPath + _7zparms + "\"" + objFile.Path + "\"" + ".zip " + objFile.ShortPath, 0, true);
    }
}

function ZipFolders(path){
    var objFolder = _objFso.GetFolder(path);
    var fols = new Enumerator(objFolder.SubFolders);
    for (; !fols.atEnd(); fols.moveNext()){
        var objFol = _objFso.GetFolder(fols.item());
        var zipper = _objFso.GetFile(_7zexe);

        WScript.Echo("Zipping Folder: " + objFol.ShortPath);
        _objShell.Run(zipper.ShortPath + _7zparms + "\"" + objFol.Path + "\"" + ".zip " + objFol.ShortPath, 0, true);
    }
}

function Main(){
    WScript.Echo("");
    WScript.Echo("7zbatch Started - Nealosis 2009");
    switch (_strAction)
    {
        case "/files":
            ZipFiles(_strPath);
            break;
        case "/folders":
            ZipFolders(_strPath);
            break;   
    }
    WScript.Echo("Tasks Completed.");
}

 

Tags: , ,

Code

Auto-Update uTorrent Ban lists

by nealbailey 6. January 2010 18:58

uTorrent, the bitTorrent client, integrates seamlessly with P2P blacklists to block machines connected in a bitTorrent swarm from connecting to your machine if they are on the banlist. Ban lists are extremely helpful for blocking machines who are interested in violating your privacy by monitoring your actions or by targetting advertising to you based on your downloading habits. There are a lot of products developed exclusively to provide this protection, for example PeerGuardian, which acts like a dedicated firewall to block connections, but they require seperate installation and constant administration. If you don't use one of these products then you're left hunting the internet for current black lists to import into uTorrent.

This morning I whipped up a tiny JavaScript that will automatically download and update uTorrent with the most recent black lists: 

Using the tool is extremely simple, you just double click the UpdateBlocklist.cmd file and the script will do its magic. You should run this as a Windows scheduled task once a week or you can run it periodically whenever you feel the need to update your ban lists. At present there are about 270,000 IP addresses on the ban list. 

DOWNLOAD - uTorrent_block_updater.zip (567.07 kb)

 

Engine Source Code

/* ======================================================================
NAME: uTorrent Blocklist Updater
AUTHOR: Nealosis
DATE: 1/6/2010
COMMENT: Blocks bad people from connecting to you in a bitTorrent swarm.
========================================================================= */


var _oFso = new ActiveXObject("Scripting.FileSystemObject");
var _oShell = new ActiveXObject("WScript.Shell");
var _appData = _oShell.SpecialFolders("AppData");
var _uTorrentAppData = _appData + "\\uTorrent";
var _bListL = _uTorrentAppData + "\\ipfilter.dat";

/* The internet location of the most recent ban/blocklist */
var _bListR = "http://emulepawcio.sourceforge.net/nieuwe_site/Ipfilter_fakes/ipfilter.dat";

main();

function main() {
    WScript.Echo("");
    WScript.Echo("Nealosis.com P2P Banlist Updater");
    WScript.Echo("=======================================");
    WScript.Echo("");
   
    if (isInstalled()) {
        BackupBlocklist();
        DoUpdate();
    }
    else {
        WScript.Echo("uTorrent is not installed. Good bye!");
    }
}

function isInstalled() {
    if (_oFso.FolderExists(_uTorrentAppData)) {
        return true;
    }
    return false;
}

function BackupBlocklist() {
    if (_oFso.FileExists(_bListL)) {
        WScript.Echo("Local blocklist found, backing it up.");
        _oFso.CopyFile(_bListL, _bListL + ".bak", true);
        _oFso.DeleteFile(_bListL);
    }
    else {
        WScript.Echo("Local blocklist not found.");
    }   
}

function WGETPath() {
    var path = _oFso.GetParentFolderName(WScript.ScriptFullName);
    return path + "\\wget.exe";
}

function DoUpdate() {
    WScript.Echo("Downloading latest blocklist, this may take a few minutes.");
   _oShell.Run("\"" + WGETPath() + "\" -r --tries=3 " + _bListR + " -O \"" + _bListL + "\"", 1, true);
    WScript.Echo("Blocklist downloaded, restart uTorrent to apply latest bans.");
    WScript.Sleep(5000);
}

 

 

Tags: , , ,

Code

Building an XBMC HTPC [Windows 7]

by nealbailey 5. January 2010 19:08

So my house was struck by lightning a few months back and it zapped all the network (NIC) cards in all the devices in my house. This was particularly devistating for my XBOX, which my wife and I used every day for years. The XBOX was hard modded with an Xecuter 3 chip and it was running XBOX Media Center as its dashboard. With the XBOX out of commission I set out to create a PC based media center to replace the XBOX. Of course I could have just bought a used XBOX on Ebay for $30 and re-chipped it but the XBOX can't run High Definition video or Blu-rays so we decided early on to go ahead with building a dedicated HTPC. 

Below you can see the HTPC running on the 52" Plasma TV in the living room. 



The process of getting everything setup and running correctly was not easy. After about a week of trial and error I have finally gotten everything setup and running properly (including HD/Blu-ray playback). I have created a step-by-step checklist/guide for building an HTPC.

The topics covered are:

  • Choosing a Nettop PC
  • Choosing a Remote Control
  • Choosing a NAS Server
  • Installation/Configuration of XBMC
  • Installation/Configuration of MCE Remote
  • Installation/Configuration of EventGhost
  • Automating HTPC login & XBMC Startup
  • HD Playback with DXVA/CUDA
  • Installation/Configuration of MPC-HC
  • Configuring Shared Folders

 

DOWNLOAD - XBMC-Basic-Setup-Guide-W7.zip

Tags: , ,

HTPC

Powered by BlogEngine.NET 1.6.0.0
Theme by Extensive SEO