SMS DOS: Cellphone Denial Of Service via text messages

A while ago I wondered how well modern cellphones could handle a flood of text messages. So I created a simple python program to test just that. The program works by sending emails to a SMS Gateway which will forward the message to the phone in the form of a text message.

I tested my program on two devices, my modern HTC Incredible running Android and my aging LG Chocolate dumb-phone. The results where surprising! After starting the program my HTC Incredible froze after receiving the first 20 messages. A battery pull was required to get it to respond. The second it finished booting it froze again! I was only able to make it respond by stopping my program and rebooting the phone. After it boot it froze again while catching up on all the messages that where sent.

My LG Chocolate was another story. While it never froze, it did make the phone almost impossible to use. 10 times a second it would display a notification of the new message. But after about 100 messages it just stopped. My program was still sending them but the phone stopped receiving them. I’m not sure if this was done by the phone itself or something on the carrier’s end.

I am releasing the source of this program in case others find it interesting. I claim no responsibility for any damage done by this program. Use at your own risk on devices you own!

Source Code at GitHub

SMS DOS requires PyQt4 for the GUI, it can be installed HERE.


Run the Windows Command Prompt in Full Screen

Have you ever wanted to run the windows command prompt but realize that for some reason Microsoft has limited it to be at most 80 characters wide? Well, there is a way to bypass that limitation. After opening the command prompt run the Windows Management Instrumentation Command-line by issuing the command: wmic. Then make the cmd window full screen or re-size it to the desired size. Then exit wmic by using the exit command. you should now be in the Windows command prompt with a windows of whatever size you desire!

The sequences of commands should look like this:

cmd
wmic
[resize window now]
exit

I have tested, and can confirm that this works on both Windows XP and Windows 7.


The Great Blog Reboot of 2012

Hello World 2.0!

I have (reluctantly) made the decision to migrate my blog from my custom made PHP CMS to WordPress. While I like the customizability, flexibility, and lightweightness of my own CMS, I was getting to a point where I wanted new abilities and was too interested working on other more interesting projects to code them. So, I migrated to WordPress. All posts previous to this one where from my old blog, which can still be found HERE.


LDAP Authentication for Cakephp

This article is going to help you using LDAP to authenticate users rather than relying on a users table with a password column. I will be assuming you will be using cakephp 1.3 and that you have completed Auth and/or ACL setup on your application similar to the ACL tutorial on the cakephp book.

Because we want to control the logging in of the user ourselves and not leave it to the cake magic we need to override the auth component. To do this copy your auth.php from your CAKE_CORE/controllers/components/ to your APP/controllers/components/ folder. Next open it up and fine the login function. It should be around like 684. Once you find it comment out everything inside the function (but leave the function intact. It should look something like this:

function login($data = null) {
    /*$this->__setDefaults();
    $this->_loggedIn = false;
    if (empty($data)) {$data = $this->data; }
    if ($user = $this->identify($data))
    { $this->Session->write($this->sessionKey, $user);
    $this->_loggedIn = true; }
return $this->_loggedIn;*/ }

Next open up your users controller and find your login function. Assuming you followed the guide or have implemented some basic auth you should have an empty login function.

I have written a LDAP helper that can easily be included as a LIB for Cakephp that will get some user data and validate the login, copy and paste it from below to APP/libs/ldap.php

<?php
class ldap{

    private $ldap = null;
    private $ldapServer = 'AD.domain.com';
    private $ldapPort = '389';
    public $suffix = '@domain.com';
    public $baseDN = 'dc=domain,dc=com';
    private $ldapUser = 'LDAPUser';
    private $ldapPassword = 'Pas5w0rd';

    public function  __construct() {
        $this->ldap = ldap_connect($this->ldapServer,$this->ldapPort);

        //these next two lines are required for windows server 03
        ldap_set_option($this->ldap, LDAP_OPT_REFERRALS, 0);
        ldap_set_option($this->ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
    }

    public function auth($user,$pass)
    {
        if (empty($user) or empty($pass))
        {
            return false;
        }
        @$good = ldap_bind($this->ldap,$user.$this->suffix,$pass);
        if( $good === true ){
            return true;
        }else{
            return false;
        }
    }

    public function __destruct(){
        ldap_unbind($this->ldap);
    }

    public function getInfo($user){
        $username = $user.$this->suffix;;
        $attributes = array('givenName','sn','mail','samaccountname','memberof');
        $filter = "(userPrincipalName=$username)";

        ldap_bind($this->ldap,$this->ldapUser.$this->suffix,$this->ldapPassword);
        $result = ldap_search($this->ldap, $this->baseDN, $filter,$attributes);
        $entries = ldap_get_entries($this->ldap, $result);

        return $this->formatInfo($entries);
    }

    private function formatInfo($array){
        $info = array();
        $info['first_name'] = $array[0]['givenname'][0];
        $info['last_name'] = $array[0]['sn'][0];
        $info['name'] = $info['first_name'] .' '. $info['last_name'];
        $info['email'] = $array[0]['mail'][0];
        $info['user'] = $array[0]['samaccountname'][0];
        $info['groups'] = $this->groups($array[0]['memberof']);

        return $info;
    }

    private function groups($array)
    {
        $groups = array();
        $tmp = array();

        foreach( $array as $entry )
        {
            $tmp = array_merge($tmp,explode(',',$entry));
        }

        foreach($tmp as $value) {
            if( substr($value,0,2) == 'CN' ){
                $groups[] = substr($value,3);
            }
        }

        return $groups;
    }
}
?>

Edit the variables at the tom of the file to reflect your setup.

Now we are going to make our Users->login function check the POST username and password against LDAP, and then if valid it will preform the login magic that auth used to do.

Fill your login function with this:

    function login() {
        App::import('Lib', 'ldap');
        if ($this->Session->read('Auth.User')) {
             $this->redirect(array('controller' => 'allocations', 'action' => 'index'));
        } elseif (!empty($this->data)) {
            $ldap = new ldap;
            if ($ldap->auth($this->Auth->data['User']['user'], $this->Auth->data['User']['password'])) {

                $userrow = $this->User->findByUsername($this->data['User']['user']);
                if (!$userrow) {
                    $ldap_info = $ldap->getInfo($this->data['User']['user']);
                    $this->data['User']['username'] = $this->data['User']['user'];
                    $this->data['User']['name'] = $ldap_info['name'];
                    $this->data['User']['group_id'] = 3; //sets the default group
                    $this->add();
                    $userrow = $this->User->findByUsername($this->data['User']['user']);
                }

                $user = $userrow['User'];

                $this->Auth->Session->write($this->Auth->sessionKey, $user);
                $this->Auth->_loggedIn = true;

                $this->Session->setFlash('You are logged in!');
                $this->redirect(array('controller' => 'allocations', 'action' => 'index'));
            } else {
                $this->Session->setFlash(__('Login Failed', true));
            }
        }
    }

To quickly summarize, it first checks to see if the user is logged in, if not, and post data is provided it will check the provided credentials with the LDAP Lib. If valid it then attempts to get the user from the users table, if the user does not exist it creates it with information provided from LDAP and defaults set in the function.

I built this to still work with a users table to allow relationships between other models and users. but it can be used without a users table, just remove the if(!$userrow) statement and the line before it.

NOTE: If you use a users table, you do not need, and should not have, a password column.

That should be it! You should now be using LDAP for user credential validation.


Picture Frame Tablet PC

Backstory

A few years ago when the local Circuit City was going out of business I decided to stop by to see if there where any good deals. Unfortunately most of their inventory was at a very low discount (if at all). However they where getting rid of some of their CRM and sales equipment. I picked up a 3M touch-panel LCD monitor for $20 or so, sold “as-is”. When I got home I realized that the LCD panel was only 800x600px, and had a broken back-light. I tried to get the touch panel working but for some reason it was not receiving power and I could not find any drivers for it. Into storage it went.

A few months later I dusted it off and decided to give it another try. I was able to find a way of providing 5v power to the controller board for the touch panel, and after much searching I found the drivers.

3M microtouch touchpanel

The Hardware

Once I got the driver, power to the board, and figured out its serial connection it was surprisingly easy to get working. Below you can see a picture and video of the touch panel wired up and working on a laptop.

touch panel wired to laptop

The next step was to remove the glass touch panel from the broken LCD. The glass was only held on by some very strong adhesive. After carefully removing it I tested it to make sure everything was still in good working order.

Testing the touchpanel on a laptopHello World on the touch panel

Now is when the fun starts! I picked up a picture frame that used a piece of glass the exact same size of the touch panel from a local arts and crafts store. I also found a old Pentium M laptop I would be modifying to use the touch panel on its screen with the picture frame.

Below you can see the touch panel in the picture-frame, and the laptop I would be using for this project with its screen removed and the touch-panel attached by its side.

Touch-panel in picture frametouch panel on laptop

I gutted the laptop of unneeded parts, such as the keyboard, mouse, DVD drive, and lots of other plastic bits that would be in the way or covered up. Then I reattached its screen backwards, so that when it folds down it faces up.

Laptop with backwards screen on hingelaptop with screen reversedlaptop with screen on backtesting the laptop with the touch panel again

I mounted the touch panel’s controller board where the DVD drive once was, and gave it 5v of power from the laptop’s USB ports. Below you can see the picture-frame resting on the laptop but not attached yet, and the wiring for the touch-panel.

picture frame on laptopTouch panel resting on laptop, not well connected yet/

Now for the inside wiring!

using USB for 5c DCInside of touch panel lapopusing hot gluelook at how nice it looks...

As you can see I used hot glue to hold the controller board in the optical drive bay. And all the wiring was looking good. I just needed a way to mount the touch-panel/picture frame to the rest of the laptop.

And here was my solution:

back of picture frame touch pca metal bracket

I would use these bent metal brackets I picked up at home depot to secure them together.

brackets being appliedEverything mounted

At this point everything was working great. I should probably mention what those blue wires are that you can see sticking out of it. They lead to the laptop’s power and standby buttons. Those buttons would normally be located right above the keyboard, however with this mod they are no longer assessable, so they will be relocated.

picture frame tablet pcpower and standby buttons

I mounted the power and standby buttons (seen above) on a piece of plastic from the LCD assembly. I placed it over the hole in the laptop where the outside of the DVD drive was.

This concludes the hardware portion of this mod.

the finished picture frame tablet pc

The Software

To make the interface more touch friendly I installed RockerDock to make launching application nicer.

Also since there is no longer a keyboard I used the Touch-It Virtual Keaboard to replace key input. I like this keyboard because it can hide easily and not take up any screen real estate when you need it.

If anyone reading this needs the driver for their 3M MT7 touch panel, or If I ever need the link for the driver, here is that too: http://solutions.3m.com/wps/portal/3M/en_US/TouchSystems/TouchScreen/CustomerSupport/TouchScreenDrivers/

In addition to the utilities above, I also Installed XBMC, which acts as a perfect picture displaying software. and with UPNP/DNLA I can control it from my phone, and even wirelessly display photos from my phone on it via my network.

If you want to see higher resolution copies of any of the photos in this article check out the Picasa gallery for it HERE.


Logitech Revue Unboxing

Google was nice enough to provide me with a free Google TV as part of their 10,000 free Google TVs for developers. Below is the unboxing, see the item descriptions.

IMAG0039.jpg

The Unopened box

IMAG0040.jpg

Back of the box

IMAG0042.jpg

Removing the top of the box relieves the keyboard.

IMAG0043.jpg

Removing the keyboard shows you the actual Revue itself.

IMAG0044.jpg

All of the contents of the Logitech Revue box: Revue, Keyboard/mouse, HDMI cable, Bower cables, IR Blaster, and a welcome card.

IMAG0045.jpg

The IR Blaster.The Revue also has 3 IR blasters built into it.

IMAG0046.jpg

Enjoy!

IMAG0047.jpg

The remote and Revue

IMAG0048.jpg

Rear ports.(from left to right)Pair button, HDMI in, 2x IR out, 2x USB, network, HDMI out, Optical audio out, power.

IMAG0050.jpg

The Application menu

IMAG0051.jpg

The Twitter app. Very basic

IMAG0052.jpg

OS Version/Info

IMAG0053.jpg

The Chrome web browser with search

IMAG0054.jpg

;) Yes, this is real.

This device looks promising, However I felt like it was lacking. But when Google Released the android app market for it in 2011 things should be much different. If you watched the entire sideshow you will notice that I already started tinkering with it ;)


PHPRepo

This is about a piece of software I wrote over a year ago to fit a need I had at the time. It probably will not receive any updates but I have released the source to anyone is free to do as they please with it.

Background

PHPRepo is a PHP CMS for managing Debian package repositories. A while ago I wanted to start my own repository for some of my own packages, so I looked for an easy way to do this. I found none. At the time the only way to run and manage a Debian package repository was through apt at the command line, and since at the time I was learning PHP I decided to write my own software to fill this void. Thus I created PHPRepo. PHPRepo has very minimal requirements and can work alongside an existing repository that is managed with apt.

Installation

Installation is as easy as it gets for a PHP app. There are no databases to configure, as it used the Debian repository files as its database. Simply upload the phprepo files to the root of your web-server and edit the config file with a user name and password you wish to use.

Also, if you want the ability to manage the repository in addition to view it in your web browser then make sure the user on your server that the web-server is running under has read and write permission to the repository files.

Screenshot Tour

My screenshots are for a repository that already has a few packages in it. If you are making a repository from scratch you will not be able to see as much.

PHPrepo main screen

Above is the main screen. You can see a tree list structure of all of your repositories, components, and architectures.

PHPrepo repository list

Above you can see the list of all repositories on the system.

PHPRepo repository detail

Clicking on a repository brings you to the repository page; shown above. It will list all of the packages in the repository.

PHPrepo search

One very nice feature is the ability to search from a web browser.

PHPrepo add upload

If you choose to use PHPRepo to manager your repository, the above screen will allow you to add/upload packages to your repository. Simply select the file, distribution, and component. If the distribution or component that you want does not exist you can create it. All details about the package such as name, arch, etc are read from the deb file upon upload. Its like magic!

PHPRepo package view

If you click on a package you will be taken to the screen above. This page lets you view the details of the package. You can also manually downland the deb file, or a Maemo .install file. You can also manage the file by deleting its entry in the repository or by deleting the entry and remove the actual file from the server.

PHPRepo Delete file from repo

If you choose to delete a file you will see the above screen asking if you are sure.

PHPrepo Delete entire repository

The above screen is for deleting an entire repository, and all packages associated with it.

Conclusion

As stated before, I made this program over a year ago to fill a void. And I was rather surprised that nothing like this already existed. In any case the program and its source code can be downloaded from its project hosted at Google Code.

PHPRepo at Google Code


Wifi Radar

This is a highly directional super sensitive 802.11 G WiFi antenna. It was created using a used Direct TV satellite dish, weather proof container, a Hawking high-gain wireless antenna and some scrap parts. It is not a radar, it is just a cool name for this project. ;)

The Idea

The Hawking wireless card/antenna I used in this is already directional, but this gave it even more of a boost.

To get the most gain and to make the antenna the most effective use the parabolic equation to find the location of the focus in both the X and Y directions, this is where you want the wireless antenna to be, so that it will receive the strongest signal from the most angles.

The antenna will be enclosed in a weather proof container I for for free as a sample from OKW Enclosures.

The Construction

I used a rack adapter for some old ethernet switch to attach the enclosure to the end of the direct TV dish.

Container on Direct Tv dishEnclosure on dishweather proof enclosure on dish.

I mounted the wireless card inside the enclosure merely by adding a screw head for it to sit on.

Antenna and top of enclosure Screw head ready for mountingantenna mounted

I added a hole in the back for a usb cable to fit through and then sealed it up with hot-glue. Below you can see the finished product.

Final productCompleted wifi satellite dish with usb cableDish-in-a-box

Results

I used merageek’s inSSIDer 2 to test the gain of the antenna. inSSIDer 2 is a much needed replacement of the old war-driving software network stumbler. Comparing the signal strength of both using my new antenna and not I got about 10db of gain. I was hoping for more but it is still nice. And even with only 10db of gain, I was able to go from picking up 2 wireless networks to at least 20, depending on which way I aimed the antenna.

I would also like to mention another piece of software called Ekahau HeatMapper. While this software is not useful with this antenna design it can be useful making out signal strength of a building or neighborhood. Its fun to play with.