Wednesday, April 26, 2017

Spoofing a Hardware MAC address on MacOS

This post was going to be a note to myself, but then I figured it might be useful to other people.  So, now there's extra description of what's going on.

There you are at the hotel bar, where the wifi has a captive portal.  You want to get your Arduino or Raspberry PI or ZipIt Z2 or something on the wifi, but there's no way you're going to get it to login to a captive portal on its own.  No problem.  Have your MacBook pretend to be the hapless device for long enough to login to the captive portal, and then make your MacBook go back to being itself.  The captive portal doesn't know the difference, and will think your other device is already logged in when it tries to associate.

Open the Terminal app on your Mac.  Run `ifconfig` to see what your wireless adapter's official MAC address is -- it's the "ether" line -- and make a note of it if you don't feel like rebooting later.

  ifconfig en0

Now, set your MacBook's MAC address to whatever your other device's MAC address is ... down the interface ... and up the interface

  sudo ifconfig en0 ether 00:1D:04:01:02:03
  sudo ifconfig en0 down
  sudo ifconfig en0 up

Reconnect to that hotel wifi network -- which will think you're the other device -- and login to the captive portal.

Then, restore your Mac to its proper MAC address -- which you noted when you first ran the `ifconfig` command -- or if you didn't bother reading that part of the instructions, reboot your Mac to restore it to its original MAC address.  However you do it, make sure your Mac stops pretending to be the other device.

  sudo ifconfig en0 ether 00:88:65:01:62:01
  sudo ifconfig en0 down
  sudo ifconfig en0 up

All set.  The other device should be able to associate without needing to login to the captive portal, because your Mac already logged in, pretending to be it.

Monday, March 27, 2017

Cloning a VingCard "Original" punch-hole keycard

This is the most interesting hotel key you've never seen.  It's space-age, and hails from a time where tossing plastic in a landfill involved no thought for the future.  One word.  Are you listening Benjamin?  Plastics.

This is the original asymmetric key-pair.  Hotels order a stack of keys, that consist of a programming side, and a "guest" side.  The staff use a conventional brass key to open the door.  Once open, they slip the programming end into the back of the lock, and it programs the lock for the corresponding "guest" portion.  You snap it apart, hand the opening part to the guest, and toss the programming side in the trash.  The programming side can't open the door, and the opening side can't be guessed from knowing the programming side.  (Okay not a likely reality with today's computing power, but back then quite possible.)

Flawless security!  And it's from the future!  So let's see if I can copy one.

Looking over a patent for a device that can detect the pin configuration currently configured, it appears that the key, when inserted, selectively pushes up some ball bearings allowing a plate to move freely.  That's about all I can figure out.  So, is it the holes, or the lack of holes that's important?  Maybe it's both.

Well, gift cards are only a little thinner than this thing, and I can cut one down to the right width.  So I "borrow" an empty gift card from a local purveyor of coffee.  Drop the key on top of it, trace the outline and holes with a sharpie, and take a pair of small, pointy scissors to it.

Nope.  Looks like at the very least, the not-holes are significant.

Fine.  Be that way.  But, I live in the future, too.  I put a request for bids up on People Per Hour, including pictures of the card, and ask what a professional will charge me to send a ready-to-print 3D representation of it.  The answer?  $120.  And that's only because the person had a one-hour minimum.

A day later, and I've got the file in-hand.  Upload to thingiverse, enter my credit card, pick a swanky color.  And a couple days later it arrives.

It works!

So far I've only seen this sort of key once.  It was a building that used to be a hotel, and then I think it became a residential hotel, and now it's mostly apartments with art school students packed in, two per two-hundred square foot efficiency unit.

Not cheap, to copy those things.  But for an art student who's perpetually losing their key, it could come in handy.  The building charges fifty dollars each, to replace these antiques.  And they can't help you at four AM, when you realize you lost it.  Having a spare on-hand might be worth it.

Charging a ZipIt Z2 off USB

I love my little ZipIt Z2.  I don't always make room for it in my bag, and it was annoying me to cart around yet another adapter.  Taking a look at the back of the adapter, though ... five volts, you say?  1.2 Amps?  That sounds a lot like what USB provides!

And it turns out it works.  I chopped the barrel connector off the one end, and cannibalized one of the million USB cables I've accumulated in my life.  Twist them together to test -- solder them once I've got the polarity right -- and I'm all set.  Now it can travel with me, with one less accessory.