{"id":420,"date":"2017-02-13T18:33:02","date_gmt":"2017-02-13T17:33:02","guid":{"rendered":"http:\/\/www.nax.cz\/?p=420"},"modified":"2017-02-13T18:33:02","modified_gmt":"2017-02-13T17:33:02","slug":"find-password-for-your-certificate-using-python","status":"publish","type":"post","link":"https:\/\/nax.cz\/?p=420","title":{"rendered":"find password for your certificate using python"},"content":{"rendered":"<p>Happens sometimes that you have some certificate encrypted by some simple password. And then when you really need it, you cannot remember what was that simple password. Here is a very simple script, which can help you in such situation<\/p>\n<pre>\n#!\/usr\/bin\/python\nimport itertools\nimport subprocess\n\na = [1,2,3,4,5,6,7,8,9]\n\nfor i in xrange(0,len(a)+1):\n     l = list(itertools.permutations(a,i))\n     for i in l:\n       pw = ''\n       for ch in i:\n         pw = pw + str(ch)\n       print pw\n       try:\n         subprocess.check_call([\"openssl\",\"pkcs12\",\"-info\",\n                 \"-in\", \"cert.pfx\", \"-passin\", \"pass:%s\"%pw])\n       except subprocess.CalledProcessError as e:\n         if e.returncode > 1:\n           raise e\n       else:\n         print \"Solution found! %s\"%pw\n         sys.exit(0)\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Happens sometimes that you have some certificate encrypted by some simple password. And then when you really need it, you cannot remember what was that simple password. Here is a very simple script, which can help you in such situation #!\/usr\/bin\/python import itertools import subprocess a = [1,2,3,4,5,6,7,8,9] for i in xrange(0,len(a)+1): l = list(itertools.permutations(a,i)) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,39],"tags":[],"class_list":["post-420","post","type-post","status-publish","format-standard","hentry","category-python","category-scripting-unix-sw-computers"],"_links":{"self":[{"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/posts\/420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nax.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=420"}],"version-history":[{"count":0,"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/posts\/420\/revisions"}],"wp:attachment":[{"href":"https:\/\/nax.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nax.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nax.cz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}