tMerge pull request #239 from reiven/master - tomb - the crypto undertaker
 (HTM) git clone git://parazyd.org/tomb.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 5e8db49701e04a7400a8ca3048516ea18fc5a30b
 (DIR) parent 42ae73d727f8215ce3c1ad1a6fb4911501378876
 (HTM) Author: Jaromil <jaromil@dyne.org>
       Date:   Wed, 11 Jan 2017 14:36:40 +0100
       
       Merge pull request #239 from reiven/master
       
       Update tomber in extras for v2.2+
       Diffstat:
         M extras/tomber/tomber/test.py        |      14 +++++++-------
         M extras/tomber/tomber/tomber.py      |      26 +++++++++++++-------------
       
       2 files changed, 20 insertions(+), 20 deletions(-)
       ---
 (DIR) diff --git a/extras/tomber/tomber/test.py b/extras/tomber/tomber/test.py
       t@@ -15,12 +15,13 @@ class tomberTester(unittest.TestCase):
                self.keyfile2 = '.'.join([self.pid, '2ndkey'])
                self.exhumedkey = '.'.join([self.pid, 'exhumed'])
                self.mountpath = './tmptomb'
       +        os.mkdir(self.mountpath)
                # generate a passphrase with spaces
                self.passphrase = str(randrange(2 ** 64)).replace("", " ")[1:-1]
                self.passphrase2 = str(randrange(2 ** 64))
                self.imagefile = '.'.join([self.pid, 'jpg'])
                copyfile(
       -            '/'.join([os.path.dirname(__file__), 'test.jpg']),
       +            '/'.join([os.path.dirname(os.path.abspath(__file__)), 'test.jpg']),
                    self.imagefile)
        
            @classmethod
       t@@ -30,7 +31,7 @@ class tomberTester(unittest.TestCase):
                os.unlink(self.keyfile2)
                os.unlink(self.imagefile)
                os.unlink(self.exhumedkey)
       -        rmtree(self.mountpath)
       +        rmtree(self.mountpath, ignore_errors=True)
        
            def test_01_dig(self):
                """ Dig a tomb of 10mb"""
       t@@ -90,15 +91,15 @@ class tomberTester(unittest.TestCase):
                        self.keyfile,
                        self.tombfile,
                        self.keyfile2,
       -                self.passphrase,
       -                self.passphrase2
       +                self.passphrase2,
       +                self.passphrase
                        )[0]
                    )
        
            def test_11_slam(self):
                """ Slam open tombs """
       -        topen(self.tombfile, self.keyfile, self.passphrase2, self.mountpath)
       +        topen(self.tombfile, self.keyfile2, self.passphrase, self.mountpath)
                self.assertTrue(tslam()[0])
        
        if __name__ == '__main__':
       -    unittest.main()
       -\ No newline at end of file
       +    unittest.main()
 (DIR) diff --git a/extras/tomber/tomber/tomber.py b/extras/tomber/tomber/tomber.py
       t@@ -32,7 +32,7 @@ def execute(cmd):
            """
            Execute given cmd. return boolean based on exit status and error string
            """
       -    p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
       +    p = Popen(cmd.split(), stdout=PIPE, stderr=PIPE)
            stdout, stderr = p.communicate()
            p_status = p.wait()
            if p_status == 0:
       t@@ -65,7 +65,7 @@ def tforge(keyfile, passphrase, force=False):
            cmd = ' '.join(['tomb',
                'forge',
                keyfile,
       -        '--unsecure-dev-mode',
       +        '--unsafe',
                '--tomb-pwd',
                sanitize_passphrase(passphrase),
                '--no-color'])
       t@@ -83,7 +83,7 @@ def tlock(tombfile, keyfile, passphrase):
                tombfile,
                '-k',
                keyfile,
       -        '--unsecure-dev-mode',
       +        '--unsafe',
                '--tomb-pwd',
                sanitize_passphrase(passphrase),
                '--no-color'])
       t@@ -102,7 +102,7 @@ def topen(tombfile, keyfile, passphrase, mountpath=False):
                tombfile,
                '-k',
                keyfile,
       -        '--unsecure-dev-mode',
       +        '--unsafe',
                '--tomb-pwd',
                sanitize_passphrase(passphrase),
                '--no-color',
       t@@ -128,7 +128,7 @@ def tresize(tombfile, keyfile, passphrase, newsize):
                tombfile,
                '-k',
                keyfile,
       -        '--unsecure-dev-mode',
       +        '--unsafe',
                '--tomb-pwd',
                sanitize_passphrase(passphrase),
                '-s',
       t@@ -145,7 +145,7 @@ def tbury(keyfile, passphrase, imagefile):
                'bury',
                '-k',
                keyfile,
       -        '--unsecure-dev-mode',
       +        '--unsafe',
                '--tomb-pwd',
                sanitize_passphrase(passphrase),
                imagefile,
       t@@ -161,7 +161,7 @@ def texhume(keyfile, passphrase, imagefile):
                'exhume',
                '-k',
                keyfile,
       -        '--unsecure-dev-mode',
       +        '--unsafe',
                '--tomb-pwd',
                sanitize_passphrase(passphrase),
                imagefile,
       t@@ -177,7 +177,7 @@ def tpasswd(keyfile, newpassphrase, oldpassphrase):
                'passwd',
                '-k',
                keyfile,
       -        '--unsecure-dev-mode',
       +        '--unsafe',
                '--tomb-pwd',
                sanitize_passphrase(newpassphrase),
                '--tomb-old-pwd',
       t@@ -193,14 +193,14 @@ def tsetkey(oldkeyfile, tombfile, newkeyfile, newpassphrase, oldpassphrase):
            """
            cmd = ' '.join(['tomb',
                'setkey',
       -        oldkeyfile,
       -        tombfile,
                '-k',
                newkeyfile,
       -        '--unsecure-dev-mode',
       -        '--tomb-pwd',
       -        sanitize_passphrase(newpassphrase),
       +        oldkeyfile,
       +        tombfile,
       +        '--unsafe',
                '--tomb-old-pwd',
       +        sanitize_passphrase(newpassphrase),
       +        '--tomb-pwd',
                sanitize_passphrase(oldpassphrase),
                '--no-color'])
            return execute(cmd)