# Safe Manipulation with Python.

Having been into lockpicking for a while it was inevitable that I’d have a go at manipulating a group 2 safe. This involves some graphing and thinking, two favourite things!

To make the plotting of the graph as thoughtless as possible, and as part of an ongoing attempt to learn python, I wrote the following:

``````# -*- coding: utf-8 -*-
"""
Created on Fri Dec 20 16:31:47 2019

@author: GravityKarma
"""
import matplotlib.pyplot as plt
import numpy as np
#finding minimum approach
datres = (abs(dat[:,2]-dat[:,1]))
lookup = datres.argmin()
mindex = dat[lookup,0]
#plotting axies
plt.xlabel('Combination number')
plt.ylabel('Contact point')
#plotting data
plt.plot(dat[:,0], dat[:,1],color='red', marker='1', linestyle='-',  linewidth=2, markersize=5 )
plt.plot(dat[:,0],dat[:,2],color='blue', marker='2', linestyle='-',  linewidth=2, markersize=5 )
#plotting line to show most likely gate
plt.axvline(x=mindex, color='k', linestyle='--', label='Probable gate')
plt.xticks(np.arange(min(dat[:,0]), max(dat[:,0])+5, 5.0))
#plot gridlines
plt.grid(b=True, which='major', color='darkgrey', linestyle='-')
plt.grid(b=True, which='minor', color='grey', linestyle='--')
plt.minorticks_on()
#plot legend
plt.legend()

# comment out minor gridlines and uncomment the following for xkcd style:
# plt.xkcd()
# uncomment to safe graph as picture
#plt.savefig('Manipulationchart.png')``````

This requires an an input, a .txt file with tab seporated values taken from reading your contact points. The data I have used for my example graphs is from a S&G 6741 model group 2 safe lock and looks like this: Once run through the script, the output is a graph with the closest approach marked automatically like this: if you want you can even make it look like it’s part of an xkcd comic: Next steps are to add some more data processing to identify other key points on the graph, eg. maximum difference points. Any thoughts/comments are welcome. I’m sometimes on discord: https://discord.gg/guq4D2Z