Showing posts with label security. Show all posts
Showing posts with label security. Show all posts

Sunday, October 23, 2011

PocketStation Google Authenticator

Do you have a Google account and want to be more secure? Own a Sony PocketStation? Now you can use this device as a security token to login with 2-factor authentication on the Google site and even use it for logging into your linux machine using a PAM module.
It supports one key using the 30-second Time-based One-time Password algorithm. It's hashing up a secret key together with the current time to come to a 6 digit number. The small program takes up one memory block.

I used to collect handheld game devices and other gadgets. The PocketStation once caught my eye but could not easily find it here. It's a PlayStation-memory-card device with a small display that can run mini-games. It was supposed to be better than the Dreamcast VMU, which I owned already. The PocketStation has infrared, better CPU, better battery life, better software support, bettter looks.
When I went to Japan for holiday some year or two ago, I finally bought a 2nd hand PocketStation. I'm not playing so many games anymore, so it was just waiting for me to get a good idea and get the tools set up.
The idea was to use this device instead of my iPhone doing the authenticator part. Of course, malware on a phone would not be good anyway, but getting the key out of the authenticator app is a lot easier than hijacking a browser session. Also, switching between the authenticator and browser can take some while and has a risk of apps being closed when running out of memory. That sums up the risks of jailbroken iPhone I guess.
Anyways, with one small PocketStation app made, I could try to find other applications. One idea I just came up with is using the infrared as a replacement for an Apple remote and lock my MacBook using the iAlertU application.

Anyways, what I currently have for you:
Emulator screenshot.

YouTube video of real device.

Pre-compiled zip. (only need to add your key.)
Source-only zip.
More info in the readme contained in the zip files.

For programming the PocketStation,
1) I used an official Sony PS3 memory adapter. It's normally used to transfer old savegames into the PS3. For this, I used a program called MCRWwin.
There are other ways to do it but I have not investigated them yet:
2) Using and old hacked PlayStation and some save game editor homebrew application.
3) Use a different interface device, such as a parallel port. Check out the PSXGameEdit or PSX Memory Card Manager pages for more information.

edit, created sf project: https://sourceforge.net/p/pkauth

Tuesday, July 20, 2010

Static ARP script for OSX

For security reasons, you may wish to set a static ARP entry for your gateway. This script automates this step. Note that this doesn't prevent DHCP or MAC spoofing however.
The script runs whenever a network connection is made or broken by using the launchd feature to check a path for changes. In this case, I used resolv.conf.
The scripts determines the default gateway IP address and then keep trying to find the corresponding MAC address in the ARP table. Then it sets up the static ARP entry.
Two files are needed: one launchd configuration file and a shell script file. You need to give execute rights on the shell script with chmod +x. Copy the files in place and rename/edit the filenames. You need to restart to make the configuration active.

The contents of /Users/darkfader/static-arp.sh:

#!/bin/bash
# if the resolv.conf file was deleted, create an empty one to enable file watch again
touch /var/run/resolv.conf
while true; do
        IP=$(netstat -rn | grep -m 1 default | tr -s ' ' | cut -d' ' -f 2)
        if [ "$IP" == "" ]; then
                exit 0
        fi
        MAC=$(arp -an | grep -m 1 $IP | tr -s ' ' | cut -d' ' -f 4)
        if [ "$MAC" == "" ]; then
                sleep 1
                continue
        fi
        arp -S $IP $MAC
        exit 0
done

The contents of /Library/LaunchDaemons/net.darkfader.static-arp.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>net.darkfader.static-arp</string>
        <key>ProgramArguments</key>
        <array>
                <string>/Users/darkfader/static-arp.sh</string>
        </array>
        <key>QueueDirectories</key>
        <array/>
        <key>WatchPaths</key>
        <array>
                <string>/var/run/resolv.conf</string>
        </array>
</dict>
</plist>