123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- # Work in progress
- enc = CryptoEngine.get() in ui/cli.py (L:940)
- is called before the db is even set !
- when priniting nodes, decrypt is first called by:
- this initializes CryptoEngine instance,
- and sets the following instance properties:
- - _callback
- - _instance
- - _keycrypted
- - _timeout
- - _cypher
- this initialization asks the user for the decryption key
- of the database.
- the action that user does called the respective db function which
- returns an ENCRYPTED STRING!,
- which is then given to decryption via nodes.py or tags.py which do the
- actual decryption on each decrypted string returned from the DB.
- for example print_node:
- initializing a _db instance, then we call _db.open()
- calling do_print(10) calls _db.getnodes([i]) at this point
- the database is still not decrypted ... e.g. _cypher is still empty
- when _db.getnodes([i]) is done node inside print_node is containing
- alot of encrypted string.
- now print_node will be called, at which point the different methods
- of node instance will decrypt their respective string:
- e.g. get_username(self) instide nodes.py:
-
- self._username -> OexYH7vT/WVpXO0ZBM93RF/l8+o8/QU8ykgDB4qY8+BxBaKylAOeJWEQ+edjpLTU\n
- enc = CryptoEngine.get()
- enc.decrypt(self._username) -> nahum.oz@gmail.com
- to see this in work:
- insert
- import ipdb; ipdb.set_trace()
- to def getnodes(self, ids) in "pwman/data/drivers/sqlite.py.
- continue to pwman3/pwman/ui/cli.py(382) self.print_node(node[0])
- and then step into this function.
- continue further into def print_node(self, node) inside pwman3/pwman/ui/cli.py,
- finally you should step into:
- node.get_username()
- # New features to implement:
- 1. Password expiry date - register password date, remind when password is about to expire.
- 2. Make new passwords according to user defined rules.
- # build the package with
- python setup.py sdist
- # upload
-
- twine upload dist/pwman.tar.gz
-
- # db ... https://github.com/coleifer/peewee
- http://sqlobject.org/
- http://www.sqlalchemy.org/
-
- # when developing pwman3 you might be using a debugger. if so add the following
- pre-commit hook to your .git/ :
- $ cat .git/hooks/pre-commit
- #!/bin/bash
- VAR=$(git diff --cached | grep "\+*import i*pdb; i*pdb.set_trace")
- if [ ! -z "$VAR" ]; then
- echo "You've left a BREAK POINT in one of your files! Aborting commit..."
- exit 1
- fi
- make test || exit 1
- exit 0
- ### testing :
- Each class should have at least 95% coverage.
- Each module should be tested as a stand alone with:
- foo.py
- test_foo.py
- The test module test_foo.py should contain at the bottom:
- if __name__ == '__main__':
-
- # prepare everything for testing
- try:
- unittest.main(verbosity=2)
- except SystemExit:
- # clean everything after test was run
- You should be able to run the module testing with:
- $ python -m pwman.tests.test_foo
- But you should also run the tests as part of a larger scheme with:
- from test_foo import TestFoo
- ...
- ...
- loader = unittest.TestLoader()
- suite = unittest.TestSuite()
- suite.addTest(loader.loadTestsFromTestCase(DBTests))
|