-
How To Crack a Master Lock Using Python
Posted on August 30th, 2008 2 commentsMy landlord recently built storage lockers in our basement, and I dug through my junk drawer to find an old combination Master Lock to secure mine. I had forgotten the combination. Not to worry, as it’s not too hard to crack one if you have about 10 minutes to try up to 100 different combinations using this technique:
- Set the dial to 0.
- Pull up and maintain pressure as if you’re trying to open the lock.
- Let up just enough pressure to let the dial turn until it stops.
- Wiggle the dial back and forth. It will have one number’s-width of play in it, and it will either move from one whole number to the next or from one number’s half-position to the next number’s half-position. For example, it will move from 3.5 to 4.5. In that case the number we want is 4. Ignore positions where it “straddles” a half number, like if it moves between 3 and 4.
- There are 5 of these numbers. Write them down. All of them except one will end with the same digit, e.g.: 2, 12, 22, 27, 32. The one that doesn’t fit this pattern, 27 in this case, is the last number in the combination.
The first 60 seconds of this video demonstrates the technique to find the numbers:
This Python script makes it pretty quick to list the 100 possible combinations once you’ve isolated the last number using the above technique:
masterlock.py:
import sys
last = int(sys.argv[1])
remainder = last % 4
first = [remainder]
while first[-1] < 36:
first.append(first[-1] + 4)
if remainder == 0:
second = [2]
elif remainder == 1:
second = [3]
elif remainder == 2:
second = [0]
elif remainder == 3:
second = [1]
while second[-1] < 36:
second.append(second[-1] + 4)
for f in first:
for s in second:
print f, s, last
Just pass the script the last number in the combination, and it will spit out a list of all 100 possible combinations, like so:
python masterlock.py 7Of course, this shows that combination Master Locks are really only secure if someone can’t spend 10 minutes messing around with your padlock without getting caught. And it means that if you have ten minutes, and something to write with and on, you can open someone else’s padlock. Don’t be a jerk.
I haven’t confirmed this, but I’ve heard that Master Lock redesigned their locks within the last couple years so that this trick doesn’t work anymore. My padlock was purchased before that.
I know that my padlock really isn’t protecting my stuff very well, but considering that the storage locker “walls” are made of chicken wire, the padlock isn’t the weak part of the system. The lock’s just there as a deterrent to keep my (hopefully) honest neighbors out of my stuff.
2 responses to “How To Crack a Master Lock Using Python”

-
How very MacGuyver of you. Can you make a bomb out of a thong and fishing line as well?










Jess September 2nd, 2008 at 11:09