Sunday, September 13, 2009

Free SFTP, FTP and SCP client for Windows

Found this fantastic FTP and Telnet application: WinSCP.

Its homesite is at:

It has some really nice functions like right-click to get to file properties and many other time-saving features. Brilliant program for Linux terminal work!

Thursday, September 10, 2009

Testing NewCS using CCcam as a Client in a Virtual Machine

Note: This is a continuation of:

I wanted to test NewCS with a client application outside the NewCS Virtual Machine (VM).

After looking around the web I found a client that would make for a relatively simple, but thorough test. The application is CCcam (in client mode). This powerful application requires a Linux o/s and can be configured to poll a local or IP-addressed newcamd server (ie NewCS).

The method I used to set this up is as follows:

- Using the VirtualBox (VB) 'Export' command, export your previously created ClarkConnect5 VM (ie make a copy)
- Import this copy back into VB and give it a different name and also a different IP address (either by leasing an IP on your router, or setting a new IP manually in the CCcam VM. Also make sure your CCcam VM has a unique MAC address)
- Install CCcam on to the newly created CC5 VM
- Configure CCcam to act as your newcamd client
- Boot your NewCS VM and and start NewCS (with a smartcard inserted)
- Open a NewCS Telnet window in Win7
- Boot your CCcam VM and start CCcam

On the NewCS Telnet window you should see NewCS run through its initialisation and then see CCcam request and log into NewCS. If you open a CCcam browser window you will see the card details are passed down to CCcam as a client of NewCS. If this happens then the test is successful and NewCS is definitely working as a card server.

Here is an extract from the NewCS log file:
Card Inserted
[ 17:20:23 ] [ Loader ] Card xxxx on port /dev/ttyS0 ready
[ 17:20:27 ] [ Newcamd ] new connection from on socket 9
[ 17:20:27 ] [ Newcamd:15000 ] Connection from
[ 17:20:27 ] [ Newcamd:15000 ] User user1 logged in, client: CCcam
[ 17:20:27 ] [ Newcamd:15000 ] Command E3 from user1 len 3
[ 17:20:27 ] [ Newcamd:15000 ] Sending Card Information to user1:
[ 17:20:27 ] [ Newcamd ] ProvID 0 Key xxxxxx on caid xxxx type 0
[ 17:20:27 ] [ Newcamd ] ProvID 0 Key xxxxxx on caid xxxx type 1

Excellent CCcam/ClarkConnect tutorial here (access requires registration):
Many thanks
to kapzas and the Eurocardsharing Forum for this.

Sunday, September 6, 2009

NewCS CardDetect observation with Jaycar Reader

Just tried a little test.

- Set carddetect=yes in newcs.xml.
- Started up NewCS without card and let it run through its startup sequence
- Observed activity via Telnet (Reset of course had failed on init)
- Inserted a plastic card into reader slot so that carddetect switch active
- NewCS then tried to carry out a card init, failed, tried again, failed, repeat....
- If I pulled the plastic card out then the sequence stopped, inserting card starts sequence again.

Why is this good? It means your NewCS server PC can startup fully without a card. As soon as you insert your card it will initialise it/self ready for serving. Kinda cool if you need to move your card between your STB and PC (PC does not need to be rebooted).

NOTE: The Jaycar Reader has had the CardDetect Invert Mod carried out.

Thursday, September 3, 2009

NewCS on a Sun VirtualBox

NEWCS on a Sun VirtualBox

Hardware/Software Configuration:

- Standard x86 PC (eg: P4 Springdale Chipset)
- Jaycar Serial Card Reader (in Phoenix modes). Mods: CardDetect Invert, Schottky Diode Mod
- N.D.S S.k.y NZ Card

- Host (the O/S that loads when you power up the PC): Win7
- Virtual PC Emulator: Sun VirtualBox
- Guest (the O/S running in Virtual Mode): ClarkConnect5 (CC5)
- NewCS V1.67RC1: Used for passing a legal card key
- ACamd V0610: Used for decrypting the DVB streams
- PuTTY (telnet/SSH client): Used for issuing terminal commands in CC5
- CoreFTPlite (FTP client): Used for uploading files to CC5

Why Use A Virtual Machine?

- Allows any O/S (within reason) to be used with NewCS
(important as NewCS is no longer supported in Windows)
- Allows separation to be maintained between the CS Server and the rest of the PC
(useful when 'experimenting')
- Allows the CS Server to simulate a separate PC
(useful if this is your ultimate goal)
- Its another interesting PC challenge to get under your belt.

Why Use Windows 7 at all?

- Many Geekzone (GZ) posts point to W7 Media Center (W7MC) panning out to be a MC that just works (with some NZ-centric tweaks). I'm sure all the other MC's also work well to varying degrees, however its fairly much acknowledged (by GZ posters) that W7MC is the easiest path to a HTPC that can record and playback all the NZ broadcast streams thrown at it.


All hardware is connected to the W7 PC. The PC is running W7, however the NewCS box in above is running inside a Linux Virtual Machine (VM).


- all your hardware (cardreader, DVB-S cards, network, etc) is installed and working correctly on your W7 PC.

Downloads (all are donation or free):
- Virtual PC Emulator: Sun VirtualBox
- Guest (the O/S running in Virtual Mode): ClarkConnect5 (CC5)
- NewCS V1.67RC1: Used for passing a legal cards keys.
Extract: newcs.i686 & newcs.xml
Rename: newcs.i686 to newcs.x86
- ACamd V0610: Used for decrypting the DVB streams
- PuTTY (telnet/SSH client): Used for issuing terminal commands in CC5
- CoreFTPlite (FTP client): Used for uploading files to CC5


1) Virtual Box
Download and install Sun VirtualBox for windows (VirtualBox 3.0.4 for Windows hosts)
From memory there were no gotchas with this install on to W7. I downloaded the manual and printed parts of it as a reference.

2) Create a Virtual Machine
Using the VBox GUI create a new Virtual Machine (VM)
Tips: I used the following settings (a lot of these are default values) -

Name: ClarkConnectVM (can be anything)
O/S: Red Hat (Note: CC5 is based on the RedHat distro)

Base Memory: 512MB
Processors: 1
Boot Order: CD/DVD-ROM, Hard Disk
VT-x/AMD-V: Enabled
Nested Paging: Disabled

Video Memory: 128MB
3D Acceleration: Enabled
Remote Display Server Port: 3389

Hard Disks
IDE Primary Master: ClarkConnectVM.vdi (Normal, 8.00GB)

Host Drive: E: (but point this to your ClarkConnect iso when 'installing' CC5)

Not Mounted

Host Driver: Windows DirectSound
Controller: ICH AC97

Adapter 1: PCnet-Fast III (Bridged adapter, your PC's network card)
(I had some problems with networking. Default setting was NAT but that gave me problems so I went to a Bridged configuration)
Note: You can view the virtual MAC address as well.

Serial Ports
Port 1: COM1, Host Device (COM1)

Device Filters: 0 (0 active)

Shared Folders

3) Install your Guest O/S (CC5)

a) Download the ClarkConnect Community Edition ISO image
(note: no need to burn to CD, VM has some magic for iso's)

b) Set the VBox VM CD/DVD-ROM to 'see' the CC5 iso as a CD

c) Start your new VM Guest (ie: this is the same as powering up the VM 'PC')
You will see a SUN 'BIOS' come up, the VM will boot from virtual CD and you will be asked to select as follows:
- Select: Language
- Select: Keyboard (US)
- Select: Install Method (Local CDrom)
- Select: Install Type (Install)
- To proceed: Type - "ClarkConnect"
- System Mode: Standalone Mode - No Firewall
- Specify LAN IP: Manual Config or Dynamic if your Router supports leased IP by MAC address.
(My router does so I set dynamic and then leased IP: using the VM assigned MAC)

- Nameserver IP: Your router gateway IP (eg:
- Set the System Root Password > write it down!!
- Partitioning: Use Default
- Select Software Modules: Definitely need FTP, I selected most of them.

d) When the install is complete, you will be presented with a login screen. Login with your new root password created above. There are a number of options in here but you should be done for now. Use the Shutdown option and shutdown. Then start up again and your new CC5 should boot all the way up. If you have set a manual IP you are done for now. If dynamic you have two options:
i) My favourite - login to your router and look at your DHCP clients, one of them should be CC5.
Note the IP of this DHCP client

ii) Also good - Alt+F2 will drop you into a CC5 terminal, login as root and issue the command: "ifconfig". This is like the Win "ipconfig" - it will show your IP.

e) Now minimise the CC5 window, minimise the VirtualBox window.

4i) Guest O/S (CC5) Setup - User Account

a) Open a browser (eg: IE8) and browse to https://the.IP.of.Guest:81
(in my example:

b) Click through the warnings of doom ('Connection Not Trusted' etc)
c) Login, Username: Root, Password: you wrote it down above
d) Language: default English
e) Network: Standalone Mode No Firewall
f) Register: As you like
g) Time Zone: Godz Own ;-)
h) Domain: Can just leave as is ("clarkconnect.lan") or change if you like
i) Organisation: Real Data or space-fillers
j) Finish: Again you will probably get dire messages, just click-through.

4ii) Guest O/S (CC5) Setup - Dashboard

a) Continuing to use the browser window, Open the Tab "Account Manager"
b) Click to add users "+Add"

Username: "bob" (make one up),
First Name: "Bob" (make one up),
Last Name: "Bobber" (make one up),
Password: "bobword" (make one up)
Verify: "password" (repeat password just entered)
Write down the Username and Password. These will be used for FTP file uploading.
d) Click on the tab "+Add"
e) Open tab "Software" and "FTP"
f) FTP configuration set to "1" not to "30" and click "Update" tab
g) Set these two to:
Status -Running ('Start')
On boot - Automatic ('To Auto')
h) That's the Dashboard done. You can logout now.

5) Transfer NewCS files to Guest using FTP Client

a) For this we will use CoreFTPLite (or your fav).
Open CoreFTPLite and enter:
- Host:
the.IP.of.Guest (eg:
- User Name: The Name you created under Dashboard (bob)
- Password: The Password you entered above (bobword)
Now connect to the CC5 server
b) Transfer the newcs files extracted earlier to your newly created user account
(TIP: location will be: /home/'username' (bob in my case))

6) Setting newcs files for use in CC5 using PuTTY

a) For this we will use PuTTY.

Open/Login PuTTY with:
Host: IP.of.Guest (eg:
- User: root
- Password: (the password you set in 3c (you wrote it down))

b) Create directory's and copy files to these directorys:

cd /var
mkdir /var/bin
(you should now see bin)
cd /home/Username (4ii c eg: bob)
(should see the FTP'd files: newcs.xml, newcs.x86)
cp newcs.x86 /var/bin
cp newcs.xml /etc
cd /var/bin
(should see newcs.x86)
chmod 755 newcs.x86
(should now go from the colours white to green)

c) Edit the newcs.xml file to your card reader (newcs.xml config is a project by itself!):

nano /etc/newcs.xml
(CC5 editor starts, note the ctrl characters at the bottom)
(remember to save your changes)

d) Linking the "libcrypto" file newcs expects to the actual
"libcrypto" CC5 file:

cd /lib
ln -sf

e) Start NewCS

cd /var/bin
(depending on your newcs.xml settings you should see NewCS startup)

f) Optional: NewCS auto-start

nano /etc/rc.d/rc.local
You will see a line like: "touch" and so on. Under that line is a lot of empty space. Write next line exactly under that "touch" line)

(Save the changes)

7) Methods for logging/viewing NewCS from your Host

Depending on your newcs.xml file settings here are some ways to see what's going on:

a) PuTTY
- Start your CC5 VM
- Login with PuTTY just as you did in 6a)
- Start NewCS with this command (assumes NewCS is not auto-started):
cd /var/bin

- On your PuTTY terminal/console you will see the debug script

b) Browser (assumes NewCS is already running either manually or auto-start)
- Using IE or other browser enter:
http: the.IP.of.Guest:httpd_port_set_in_newcsxml (eg:
- User: httpd_user_set_in_newcsxml (eg: admin)
- Password:
httpd_password_set_in_newcsxml (eg: password)
This is kinda cool as you can actually make changes to your newcs.xml file thru your browser, plus see keys and all sorts of cool stuff.

c) Telnet (simple logger)
- Host: IP.of.Guest, port: tcp_port_set_in_newcsxml (eg:, port 1001)
You will see any activity related to NewCS, eg: browser logins

d) Logfile
If you set your newcs.xml file to log 'debug' to a logfile then you can pull this down with CoreFTPlite.
Tip: In your newcs.xml file set your logfile to your user directory.
Ie:/home/usename_4ii_c ("bob" in 4ii C above).
This makes it easy to get access to the logfile.

8) Method for starting CC5 as a non-GUI on your Host

a) Create a desktop shortcut of the command prompt
(copy the Start>All Programs>Accessories "C:\" icon
command prompt shortcut and drag this copy to the desktop)

b) Right click your new shortcut and go to 'properties'

c) Set the target directory ("Start in:") to: "C:\Program Files\Sun\xVM VirtualBox\"
Set the target ("Target:") to:
C:\Windows\System32\cmd.exe /k VBoxHeadless.exe --startvm name_of_your_cc5_guest
C:\Windows\System32\cmd.exe /k VBoxHeadless.exe --startvm ClarkConnectVM

d) Apply/OK

Now when you double-click this shortcut it will start VirtualBox and also start CC5. You won't be able to tell when it is ready (other than CPU usage), however its ready when you can login with PuTTY as root.

Tip: To stop NewCS Process:
- If in the terminal that you used to start NewCS - Scroll up to see the Process Number created.
Use this number in the following command: kill xxxx (where 'xxxx' is the process number)
- If you cannot see the Process Number, or have just logged in then run:
ps ax_grep newcs (please replace _ with: "shift+\" - I can't post the vertical bar character)
kill xxxx (xxxx is the process found above)

Tip: To do an orderly shut down of CC5 do this:

- Login as root (with PuTTY)
- Issue the command: shutdown -h now

VirtualBox and CC5 will now sit in the background acting as a NewCS Server. In headless mode it boots up into CC5 in less than a minute (on my old PC) and doesn't use many CPU cycles.

Hope this helps others. It looks complicated (and it kinda is!) but follow through the steps and you should be good to go.

BIG THANKS to kapzas over on Eurocardsharing forum for allowing me to use his/her ClarkConnect How-To!!!

Please let me know if I made any typos or other mistakes.

Thursday, August 20, 2009

NewCS 1.65 error screensaves (for reference)

Plastic card inserted screenshot (so card detect active but no comm)

No power on the Reader screenshot

No card inserted screenshot

Tuesday, August 18, 2009

NewCS 1.20 (RC13)

Here is a printscreen of a successful 1.20 card load:

Wednesday, August 12, 2009

HTPC info dump

Re: FIXED What causes pixilation on a Satellite feed?

Arrh fixed it, basically there is a virtual tuner created by DVBlink which can be seen in 7MC so you need to change its priority to normal and then change the DVB-S (actual) tuner to use first or highest priority, I had them both set to highest priority meaning they were conflicting and causing nasty pixiliation!! This setting is found in DVBviewer under the hardware tab if anyone is having the same issue.



Acamd works with the native interface in DVBViewer so you don't need anything else in the Plugins folder, just Acamd and its files. If you are using SoftCSA get rid of it and most of your problems should disappear. The includes ffcsa or whatever its called.

I use a fresh install of DVBViewer in its own directory ie c:\DVBViewer1 & c:\DVBViewer2 for the second tuner.

When you install each one make sure you select PROGRAM DIRECTORY for the preferences. This makes each instance standalone. This is also critical to making dual tuners work, otherwise both copies share the same preferences, which is likely to cause havoc.

Also in each DVBViewer make sure you select all the devices that aren't being used to DO NOT USE under Options/Hardware. You should only select 1 tuner for each one, and it should be PREFERRED.


...You just need to adjust the cardclient.conf in Acamd with your IP address, the username/password and the provider id 096A.

Notepad is fine. Just remove the hash from the newcamd line at the bottom and put in your settings.

When your client tries to access a scrambled channel it should connect to NewCS and you'll see a client logon message.

Just one gotcha. Each client connection must use a different username for it to work. So for instance I've got two cards which are set up to allow 3 encrypted sessions each so I use 6 usernames total. These are set up in the NewCS config file which is again a notepad thing.


Protecting pay TV transmissions

Secret key encryption and smart cards are used for example in pay TV applications. Sometimes this is referred to as "conditional access" television. Television programs (usually premium movies, football or soccer matches and adult content) are encrypted using a secret key. To make it difficult for Eve to obtain this key, the secret key is changed every few minutes or sometimes even every few seconds. This way, even if Eve can successfully use a brute force attack to guess the key, she only has a very small portion of the television program. Alice has a set-top box and a smart card that allows her to decrypt the television programs. The set-top box passes the decrypted television program on to the television. Originally these boxes were designed to be placed on top of the television set, hence the name.

Special messages, called Entitlement Control Messages (ECMs), are sent along with the program. These messages contain the secret keys. Of course the ECMs themselves are also encrypted, this time using a key stored on the smart card. Alice's set-top box receives the ECMs and passes them on to the smart card. The smart card decrypts the ECMs and extracts the secret keys contained therein. This allows the set-top box to decrypt the television program.

The keys needed to decrypt the ECMs can be programmed on the smart card in advance. By regularly changing these keys, Alice is forced to purchase a new smart card every month or so. If Eve manages to make a copy of the smart card, or to extract the keys from it, she will only be able to watch the programs for the rest of that particular month.

Another option is to regularly send out so-called Entitlement Management Messages (EMMs) that contain the keys needed to decrypt the ECMs. The EMMs themselves are then encrypted with keys stored on the smart card. The service provider then every month simply sends out a new EMM. This provides much greater flexibility, and Alice does not have to go to the store every month. Every smart card can now have a different key. The service provider sends out different EMMs for all the smart cards in the system. Every EMM thus is readable only by one smart card. If the service provider thinks a particular smart card has been copied illegally, he simply does not send out a new EMM for that particular smart card.


Tuesday, August 11, 2009


NewCS files:

Configuration example from a Geekzone user:
(Note: Final working file name needs to be 'newcs.xml')

ACamd files:

Configuration example from a Geekzone user:
(Note: Final working file name needs to be 'cardclient.conf')

Tuesday, June 30, 2009

PC Fan Controller

While looking into building my first mini-ITX PC, I found the two motherboards of choice (Intel DG45FC & Zotec 9300 ITX) had problems with fan control. I therefore decided to build fan controllers to allow standalone analogue fan control.

In searching the net for ideas I found cpemma's excellent site which went offline shortly after I found it (don't you hate it when that happens!). I did however read enough to decide I liked the Micrel Low-Dropout Adjustable Regulator (MIC2941ABT) and this became the basis of my controller.

After building a couple of test rigs the following circuit was settled on:

By including a NTC (negative temperature coefficient) resistor the voltage output varies depending of the temperature of the Rntc (the thermal sensor). I also included a facility for "sliding" the voltage output by including Radj. Parallel resistors were also added to linearise the response of Rntc and also to desensitise Radj.

This circuit results in a full-speed voltage of 11.6V and a low-speed voltage of 1.25V. The following graph shows a representation of both 5V/12V Voltages with respect to Temperature Vs. Radj:

This graph is also a design tool allowing the total Radj value to be selected for a given temperature range.

I also decided that there was no point in allowing the voltage to drop lower than 5V, as most fans would either stall or cause other problems at this low voltage. Utilisation of the PSU +5V line and a couple of Schottky diodes took care of this (these diodes only drop 0.2V).

Another facility I wanted to retain was the ability for the motherboard to continue to read the fan RPM. This was easily accomplished by feeding the Fan RPM line back out to the motherboard's fan RPM sense pin (referenced to Ground).

And finally I wanted this circuit to be housed in as small and neat a package as possible. This was accomplished by using a potting-box of 20x30x15mm and potting the circuitry when I sure it was working satisfactorily (potting still to be done).

Here is a picture of the "version II" circuit in test operation mounted (via double-sided tape) in my Soltek SFF (the controller is the black box in top left corner):

And here is a close up of the controller itself (the plug with exposed pins allows the controller to be plugged in to the PSU's floppy-drive power socket):

After leaving this running in my PC for a week I can report it works perfectly, complete with fan RPM feedback to the motherboard.

A list of materials for this project is as follows:

a) 20mm x 30mm x 15mm Potting Box (RS Components Stock No. 509-024)
b) Micrel Low-Dropout Regulator (RS Components Stock No. 254-383)
c) NTC Chip Resistor (RS Components Stock No. 247-7503)
d) Veroboard (strip board)
e) 2.54 Molex PCB Headers (Jaycar Electronics Cat No. HM-3413)
f) 47uF SMD (surface-mount to save space) Tantalum Capacitors (Jaycar Electronics Cat No. RZ-6574)
g) 0.22uF Monolithic Capacitor (Jaycar Electronics Cat No. RC-5494)
h) Various metal-film resistors
i) Ribbon-cable (HDD IDE cable "recycled")
j) A super-fine tip soldering iron and steady hand (as much of the soldering is done inside the potting box).

The next step is to "pot" the circuit and for this I will use a RS Components thermally conductive potting compound. This wil provide heatsinking for the Micrel voltage regulator, although in testing I had the controller running into three fans and the worst the regulator heated was to around 45 degree C.

I hope this post helps somebody :-)