Monday, August 20, 2012

IP 9258 HTTP Parsing Problems

Hi!

Warning: technical dump.

I've recently had the opportunity to work with the IP Power 9258 PDU. It's actually quite nice in many ways, but its HTTP query string and header parsing have a few terrible bugs in them.

Header field names ("User-agent" in "User-agent: my-super-browser") should be case insensitive. This PDU requires both "User-agent" and "Authorization" to be capitalized.

Query parameters are normally delimited with "&". The PDU expects "+", though between "cmd" and "p6x" you can use &.

Query parameters are also supposedly order-independent. This lovely device requires "delay" to be first (if present) and to be followed with the "+" delimiter. Using "&" will put the port in an unusable state, further testing required.

curl is your friend, the AHR2 module for Node.js is not...for now. Fixen are in the pipes.

Wednesday, August 15, 2012

Shadows

*slam*

From the frightening whirl of the ether he impacted the floor, and with a lurch reality settled around him and sealed the gap through which he'd come.

Fate liked doing this. She tended to land him in places where help was needed, but they were usually strange, alien places. Now it was his turn to get off the--well, floor, judging by its smoothness--figure out where he was, and solve the puzzle(s) set before him.

As usual, he was unharmed and still had his full tool belt from the work site. Fate was not always kind--he'd once saved a race of arthropods from destruction while...less than tastefully clothed. Turns out clothing was a mark of evil in their society, so in a way she had still been kind.

Looking around, he noticed that it was a well-lit room. The dead lack of ambient noise hinted at a deep, underground installation, and he was curious just where he was... Seven smooth, space-age-style doors lined one wall while the opposite wall was, oddly enough, smooth-hewn stone. From the strata and the temperature he was quite some distance down. A few curious-looking machines stood idle at one end of the room; earth-movers by the grinder-conveyor belt face and the tracked bottom, though the machinery that followed the grinding head was quite mysterious. It was big enough he found it hard to imagine how it had gotten in here--likely sealed in as construction progressed.

He walked to each door in sequence. As he approached, they opened revealing more door-lined walls, vast, orderly rows of segments of much larger machines, one completely empty room with a tiny sign in the back: "Lost + Found." Seeing that little danger was visible, he became more bold and started opening doors in more rapid succession, covering vast swaths of ground until he discovered one of the original doors was locked. Realizing what a locked door meant--danger--he immediately started examining the door for weaknesses.

The doorframe was smooth, and the sensor that triggered the door itself was nowhere in evidence. No tool he had would fit into the crack, and nothing in his belt would so much as scratch the surface, so he tucked away the door's location and moved on.

The next door was a junk room. He stepped in and just about fell off a cliff--the room was huge! Hundreds of little trinkets sat around, some of them gleaming in the randomly-placed lights around the chamber. There were doors in the ceiling and floor, junk was haphazardly welded to segments of the walls, the walls were outright broken in a few places, and nothing was in use. The cavernous room felt dead. Again taking note of which door he had been in, he stepped back out.

The last door was odd. It slid open hesitantly, as if something were nervous about letting him in. This, like the sealed door, was intriguing, so he stepped cautiously into the largest library he'd ever seen--well, it felt like a library. Massive shelves ran all the way up to the arched roof, lit by magnificent crystal chandeliers.

The shelves were empty.

The place felt alive somehow, too. Shadows clung to the edges of the pillars and shelves, seeming to spite the lights. As he wandered around and past the first layer of shelving, he noticed strange things: cobwebs, moving shadows, books that weren't books hovering just on the edge of existence. Occasionally one of the outside walls was broken by another of the sealed doors, and he tried with less and less vigor to pry them open. Other breaks in the shelves were normal doors, behind which was a motley mix of library shelves and more doors (sic). Each room was well-lit in the middle, but the shadows hung around the outside, seemingly right on the brink of destruction.

Finally, he found it. In the back of the deepest room he found a broken wall. Shelves still clung to it, but their disarray only highlighted the wall protruding from itself.

Finding a crowbar and hammer in his kit, he discovered that the shelves cleared away easily. The fissure was just wide enough to give his tools purchase, and he began the slow process of prying the panel out.

Several minutes later, the crack was wide enough to slip through. Behind it was pitch black, so he fetched out his flashlight. All he could discover was that the floor was stone--the same as in the root node he had started in. He wriggled in.

The room was dark, but the shadows were natural. Cobwebs hung, partially obscuring the piles of boxes and crates that filled the room leaving narrow paths to walk through. Clearing the spiders' testament of time back, he found that the crates were labelled--some were old records of the library's operation, some were marked with periods of older history, and some were completely unmarked. Some of the crates were styled like the doors, while others fit better with the library's decor. It was a strange place. Crates were aging, and occasionally somewhere in the distance one would groan and collapse under the weight of its neighbors.

After what seemed forever (and about sixteen armfuls of discarded cobweb and three pyrotechnic urges) later, he found an open space with a single chair, a small end table, and a book. A sudden chill ran down his spine, and he took a step into the open space. The reluctant feeling from the library's entrance was met with an angry, dismal feeling and an argument began. He took another step. The argument felt more heated, and the sadder of the two seemed to be winning. As he arrived at the chair, he looked down at the book. It was beautifully gilt, with deep red leather wrapping its covers and bearing its title. Before he could make out the characters, the hesitant feeling yanked the table and book out of reality, and the angry feeling started condensing into a dark, elegant lady with a cold face sitting in the chair.

"I see you've been exploring the library, Amadaeus. I hope to help you find what you are looking for."

Thursday, August 2, 2012

Little Tech Tricks

As this doesn't fit my usual genre of blog post, here is your fair warning: this is another of my technical posts. :)

So I've recently switched to a Mac Mini in one of my spheres of influence. It's been challenging; missing or stolen keyboard shortcuts still miff me, but several things have worked well for me:
  1. Mou. This is a Markdown editor for Macs (OS X). I have tried about a dozen in Linux, Windows, and OS X and this one takes the cake, kicks butte, `sudo rm -rf /`, and any other superlative expressions of high marks you wish to contribute. It's shiny. It does real syntax highlighting. It isn't cross-platform. :( Above all, though, it scrolls with you as you type!!! Now, as you're typing notes in class or composing a blog post, you can see what you're typing rather than scrolling back to the bottom after every change you make.
  2. I play with hardware. This means that I need to use serial communications fairly often, and Macs kind of suck in this department. Windows and Linux both know that a standard USB COM port is; BSD/OSX needs to be told. For the most common of these, FTDI provides their own solution. It works rather well. If you don't want to go through the effort, OSX lets you attach any USB device to a Linux virtual machine (I like VirtualBox) and let a real operating system do the dirty work. (This works for charging the Motorola W755 phone on macs and for reading EXT2/3-formatted USB devices as well.) Remember to install the Guest Additions.
  3. EXT2 R/O access: MacFuse combined with fuse-ext2 will at least get you started.
  4. iTerm2. If you do any amount of work on a terminal, iTerm2 is here to save you from xterm and Terminal. One problem; several standard keyboard shortcuts are AWOL. Lucky for you, ShadowFiend and his commenters have been gracious enough to show the world how to fix this.
  5. BetterTouchTool. This is how I got enough gestures and taps (middle click anyone?) working to be somewhat productive once again on OS X.
  6. IRC. Several programs exist that fill this need; I'm enjoying Colloquy at present.
  7. Google Calendar/iCal integration.
Also, I've had the opportunity to set up and modify several servers in a professional capacity of late, and a couple of articles I found are worth mentioning, if anything for my future benefit.
  1. HTTP Basic authentication. There is a simple Perl command that generates encrypted passwords. (A better article exists but was not found by me.) While Basic Auth is a terrible choice for strong security, it has many handy little uses and this makes administering those a bit easier.
  2. How to get an SSH Key's fingerprint. Useful when lots of little keys are running around nekked. 'Nuf said.
I hope you find something here useful. Happy Thursday!