Monday, September 22, 2008

SQL Injection? No, I don't like needles, thanks.

Okay, so I like to read a lot. Like.. a lot. So I was reading Advanced SQL Injection In SQL Server Applications about a week after I read Google Hacks. The little lightbulb went off. Could it really be that easy? Could it?

In less time than it took to write this post, google (inurl:select inurl:where inurl:from) gave me 460 pages of results. About 20% or so look vulnerable to injection attack. A slightly modified query gives 496 matches for unprotected, non-passworded, wide open hey-look-it-is-Christmas phpMyAdmin sites.

O
M
G

I had to get that out of my system. I'm better now.

-Ellie

Wednesday, August 20, 2008

Funambol

A little more than a year ago, I wrote about ScheduleWorld, a free and open source place to sync Contacts and Calendars with a wireless device. The technology worked, but the setup was painful.

Fast forward to today. Another open source company, Funambol, has stepped up to the plate, pointed to center field, and driven the ball out of the park. I was able to setup a FREE account on my.funambol.com and sync my Sprint PocketPC in under 10 minutes. If all you wanted to do was backup your contacts and calendar, you'd be done. ...And it will push-sync your email too! That's right.. all the parts of a blackberry enterprise server that you use, compatible with a multitude of handsets, for free. And it you don't trust Funambol with your data, they'll give you the server software. For free.

But wait, there is more.

A "normal" user would pop in the Outlook plugin, enter the funambol username and password and be done.

As a "not-normal" linux person, I used SyncEvolution (free, open source, not made by funambol). It wasn't terribly difficult, but the config files would likely scare off any novice users. It let me push my contacts/calendar from Evolution. These instructions were really helpful, with one correction and one addendum. The "stable" and "main" in the apt repository line are lowercase and case sensitive. Also, step 6 didn't apply to me as I used the default calendar, note, and address book names.

But wait, there is more.

I flipped the phone's funambol client to scheduleworld, pulled those contacts down, flipped it back to funambol, and uploaded them.

The moment of truth..

It worked.

I now have all my contacts from my original blackberry, the treo, evolution, Outlook on my old Pc, all on my phone!

Thank you Funambol. the portal site is awesome... It is fast, responsive, pretty, and feature rich. The outlook, windows mobile, and blackberry plugin clients work great.

Thank you Funambol, and thank you open source.

-ellie

Wednesday, July 16, 2008

Exposing the Dealer Text box on Pokerstars.

There are several threads floating around various forums from people trying to build poker bots with varying degrees of success. Inevitably they get stuck trying to get input from the poker software. The dealer boxes have all of the information in an easily regular-expression-ed pattern, but the control won't give up the text. Some have turned to OCR, and that works ok, but there has to be a better way.

Pokerstars is my particular favorite, so they get to be the guinea pig. I wrote the Support department, and they said they didn't have any APIs. They also pointed me quite firmly to the the Terms of Service which specifically permits data collection and specifically forbids the use of auto-playing bots.

So now, on to the puzzle.

First, the easy approach. Fire up WinSpy++ or Winspector and browse around the Pokerstars window. The Textbox of interest has a funny class name, AFX:4200:something. That's about it. When we watch the messages in and out of the window there are just a bunch of WM_PAINT messages. The application doesn't leak a lot of information on this approach.

Interesting. All that window does is WM_PAINT, redrawing the window. That means it has to be a graphical window, a bitmap of text, that just _looks_ like a control. Very Very sneaky Mr. Stars, very sneaky.

Time for another Tool, PEView. PeView decodes the PE format of the binary, and reveals the libraries and Functions the application is importing. Scanning the list, it looks like pretty standard stuff. GDI32.dll, the kernel, User32... some others. Looking through the list, we only care about functions with "text" in the name. These are in the DLLs GDI32 and User32.

Now if only there was a way to override and trap every call to those libraries and dig around for our text. Following the aforementioned example, we'd want that to be a free tool, and available within the first page of Google results. ;) Enter WinAPIOverride Running the inspector we attach to Pokerstars and monitor the calls for GDI, the graphics library. In there we can see the application creating Display components, bitmaps, and generating those paint messages, but no Dealer Text. Reloading and monitoring the User functions is much more interesting. Ah-ha! There they are big as day. The Pokerstars dealer messages are all created using the DrawText function. Minimized, maximized, they are all there.

So that is how Pokerstars does it, they create a bitmap of what the textbox looks like off screen, and then show the bitmap. To get it out, all you have to do is write an API hook for the USER32 dll and IPC those messages over to your application. For a simple hook, Take a look at this CodeProject article on dead simple API hooking. Looking at the source, you would only have to change about 7 lines (6 for the functions and 1 to make it hook Pokerstars.exe) in it to expose all of the Pokerstars text where any application can reach it. Magic. ;)

I need a copy of Visual Studio to I finish this, but the hard part is done. :(

Thanks for a fun Puzzle.

Elizabeth Greene

Tuesday, July 15, 2008

Installing DPPI EZ-GP Smartlist Accelerator on a Terminal Server

Data Presentation Products (DPPI) makes this great product called EZ-GP Smartlist Accelerator for Microsoft Dynamics Great Plains. It makes exporting Smartlists from GP an order of magnitude faster, and it intelligently formats them for printing too. Unfortunately, it doesn't work out of the box on a terminal server. Here is how to make it work.

Note: The software requires GP to load a chunk file, so everyone does have to close the GP application briefly.
  1. Login to the terminal server as a server admin
  2. Run change user /install
  3. Run the installer
  4. Open GP
  5. Answer "Yes" to the "Would you like to include new Code?" prompt.
  6. Run a Smartlist
  7. Export the Smartlist to verify Ez-GP is working.
  8. Register EZ-GP. * (Skip this if you are using the Free Trial, Obviously. )
  9. Close Excel and GP.
  10. Move the x:\documents and settings\yourname\DPPI folder to x:\Program Files\DPPI
  11. Give the users permissions to the x:\Program Files\DPPI folder.
  12. Open Regedit
  13. Navigate to Hkey_Local_Machine\Software\DPPI\TabFileParse
  14. Update the InstallFolder to x:\Program Files\DPPI\Xcelerator
  15. Update the WorkDirectory to F:\Program Files\DPPI\Xcelerator\Work
  16. Run change user /execute
  17. All done, test it as an unpriviledged user.
For the permissions, full control of the directory works. That could be tightened up, but determining the minimum permissions required is beyond the scope of this post.

Good Luck, and please comment if this article helped you.

-Elizabeth Greene