Thursday, June 9, 2011

Using the OmniKey CardMan 5321/5325 in BackTrack 5

Although BackTrack is great, sometimes it needs some fudging to get everything you want working correctly. Its understandable... If you want to use the OmniKey CardMan 5321 in BackTrack 5, follow these steps. I did this all in a VM.

First download the omnikey drivers:


root@bt:~# tar -zxvf ifdokrfid_lnx_i686-
root@bt:~# cd ifdokrfid_lnx_i686-
root@bt:~# ./install

and you should see:

root@bt:~# ./install

Installing HID Global OMNIKEY RFID Smartcard reader driver ...

PCSC-Lite found: /usr/sbin/pcscd
Copying ifdokrfid_lnx_i686- to /usr/lib/pcsc/drivers ...

Installation finished!

So thats the standard installation, but its likely, it wont work. to test try this:

root@bt:~# pcscd
root@bt:~# /pentest/rfid/RFIDIOt/ -L
PCSC devices:
    No: 0               OMNIKEY CardMan 5x21 00 00

If the output of looks like that (only one reader being shown), you'll have to do a little more work. The RFID interface isnt actually showing, instead its just the smartcard reader. The problem/resolution is identified in the README, but i wrote a script to speed up the process:

root@bt:~# ./
PCSC-Lite found: /usr/sbin/pcscd
Found drop dir: /usr/lib/pcsc/drivers
Backing up Info.plist
Line Numbers:
        ProductID:  238
        0x5321: 275
        VendorID: 105
        FriendlyName: 371
        General: 37
        VendorID: 142
        FriendlyName: 408
Deleting all the lines!

Now one more time:

root@bt:~# pcscd
root@bt:~# /pentest/rfid/RFIDIOt/ -L
PCSC devices:
    No: 0               OMNIKEY CardMan 5x21 00 00
    No: 1               OMNIKEY CardMan 5x21 00 01

That looks better, now pcscd is using the Omnikey Driver


Here's  ./

root@bt:~# cat usb/

# quick script to make the omnikey cardman work with bt5
# by brad antoniewicz
killall -9 pcscd

localpcsc=`which pcscd`
if [ "${localpcsc}" != "" ]; then
 echo "PCSC-Lite found: ${localpcsc}"
 dropdir=`$localpcsc -v | grep usbdropdir | sed 's/^.*usbdropdir=\(.*\) .*$/\1/' | cut -f1 -d' '`
 echo "Found drop dir: $dropdir"

cd "$dropdir/ifd-ccid.bundle/Contents"
LINE_PRODID=`grep -n "ifdProductID" $INFO_FILE | cut -d: -f 1`
LINE_0x5321=`grep -n 0x5321 $INFO_FILE | cut -d: -f 1`
LINE_VEND=`grep -n "ifdVendorID" $INFO_FILE | cut -d: -f 1`
LINE_FRIEND=`grep -n "ifdFriendlyName" $INFO_FILE | cut -d: -f 1`

if [[ -n $LINE_PRODID && -n $LINE_0x5321 && -n $LINE_VEND && -n $LINE_FRIEND ]]; then
 echo "Backing up $INFO_FILE"
 cp $INFO_FILE $INFO_FILE.backup
 echo -e "Line Numbers:"
 echo -e "\tProductID:  $LINE_PRODID"
 echo -e "\t0x5321: $LINE_0x5321"
 echo -e "\tVendorID: $LINE_VEND"
 echo -e "\tFriendlyName: $LINE_FRIEND"
 echo -e "Offsets:"
 OFFSET=$(($LINE_0x5321 - $LINE_PRODID))
 echo -e "\tGeneral: $OFFSET"
 echo -e "\tVendorID: $OFFSET_VEND"
 echo -e "\tFriendlyName: $OFFSET_FRIEND"

 echo "Deleting all the lines!"
 echo -i $LINE_0x5321' d'
 echo -i
sed -i $LINE_0x5321' d;'$OFFSET_VEND' d;'$OFFSET_FRIEND' d;' $INFO_FILE
 echo "Could not find a critical line in $INFO_FILE"

 echo "PCSC-Lite is not found in current path!"
 echo "Retry with appropriate user or go visit"
 echo ""
 echo "and install the latest version of pcsc-lite."


  1. Hello

    in first Thank you for your indication

    i follow your indication and it put me a syntaxe error in ligne 20
    if [[ -n $LINE_PRODID && -n $LINE_0x5321 && -n $LINE_VEND && -n $LINE_FRIEND ]]; then

    &amp dont look to be understand.

    Please could you help me
    Thank you for your support

  2. You need to make sure you are running that script with "bash", not "dash" or some other crappy shell. You'll get that error from the use of "[[" with dash. -Josh

  3. Updated blog post: