File: general_notes.txt

package info (click to toggle)
pwman3 0.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 636 kB
  • sloc: python: 3,421; makefile: 215; sh: 61; javascript: 6
file content (123 lines) | stat: -rw-r--r-- 3,250 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# 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

# update version on the server

update the version numer
restart the service pwman.app

# 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))