tomb

the crypto undertaker
git clone git://parazyd.org/tomb.git
Log | Files | Refs | README | LICENSE

commit 5e8db49701e04a7400a8ca3048516ea18fc5a30b
parent 42ae73d727f8215ce3c1ad1a6fb4911501378876
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:
Mextras/tomber/tomber/test.py | 14+++++++-------
Mextras/tomber/tomber/tomber.py | 26+++++++++++++-------------
2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/extras/tomber/tomber/test.py b/extras/tomber/tomber/test.py @@ -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 @@ -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""" @@ -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() diff --git a/extras/tomber/tomber/tomber.py b/extras/tomber/tomber/tomber.py @@ -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: @@ -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']) @@ -83,7 +83,7 @@ def tlock(tombfile, keyfile, passphrase): tombfile, '-k', keyfile, - '--unsecure-dev-mode', + '--unsafe', '--tomb-pwd', sanitize_passphrase(passphrase), '--no-color']) @@ -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', @@ -128,7 +128,7 @@ def tresize(tombfile, keyfile, passphrase, newsize): tombfile, '-k', keyfile, - '--unsecure-dev-mode', + '--unsafe', '--tomb-pwd', sanitize_passphrase(passphrase), '-s', @@ -145,7 +145,7 @@ def tbury(keyfile, passphrase, imagefile): 'bury', '-k', keyfile, - '--unsecure-dev-mode', + '--unsafe', '--tomb-pwd', sanitize_passphrase(passphrase), imagefile, @@ -161,7 +161,7 @@ def texhume(keyfile, passphrase, imagefile): 'exhume', '-k', keyfile, - '--unsecure-dev-mode', + '--unsafe', '--tomb-pwd', sanitize_passphrase(passphrase), imagefile, @@ -177,7 +177,7 @@ def tpasswd(keyfile, newpassphrase, oldpassphrase): 'passwd', '-k', keyfile, - '--unsecure-dev-mode', + '--unsafe', '--tomb-pwd', sanitize_passphrase(newpassphrase), '--tomb-old-pwd', @@ -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)