4
5
6
7
8
9
10
11
12
13
14
15
16
17
...
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
|
* © AGPLv3
* $ cc -O4 kpw.c -okpw [-D_CLIPBOARD]
* - D_CLIPBOARD enables kpw to automatically
* copy passwords to the clipboard. it does
* this by attempting to execute a sequence
* of binaries, and then writing the password
* to STDIN of the binary that succeeds.
* ? generates passwords
* → kpw is unlikely to be portable to non-POSIX
* systems, but should run fine on Linux as well
* as BSDs with getrandom() support.
* → kpw has the following dependencies:
* - libsodium
* ! for getrandom() to work with the version of
................................................................................
ptbuf [ptlen];
struct dbrecord rec;
bad d;
if((d = dbnext(db, &rec, ctlen,
pub, priv, ctbuf, ptbuf)) != ok) return d;
if(strncmp(target, rec.acct.ptr, rec.acct.len) == 0) {
/* found a matching record; determine
* what to do to the fucker */
alert(a_debug, "found target record");
found = true;
if (op == delpw) continue;
password pwbuf;
|
|
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
|
* © AGPLv3
* $ cc -O4 kpw.c -okpw [-D_CLIPBOARD]
* - D_CLIPBOARD enables kpw to automatically
* copy passwords to the clipboard. it does
* this by attempting to execute a sequence
* of binaries, and then writing the password
* to STDIN of the binary that succeeds.
* - D_SAVEKEY enables kpw to store the database
* key in persistent memory between invocations,
* leading to quicker decryption and access
* times. only available on systems with SYSV
* shared memory.
* ? generates passwords
* → kpw is unlikely to be portable to non-POSIX
* systems, but should run fine on Linux as well
* as BSDs with getrandom() support.
* → kpw has the following dependencies:
* - libsodium
* ! for getrandom() to work with the version of
................................................................................
ptbuf [ptlen];
struct dbrecord rec;
bad d;
if((d = dbnext(db, &rec, ctlen,
pub, priv, ctbuf, ptbuf)) != ok) return d;
if(strlen(target) == rec.acct.len && strncmp(target, rec.acct.ptr, rec.acct.len) == 0) {
/* found a matching record; determine
* what to do to the fucker */
alert(a_debug, "found target record");
found = true;
if (op == delpw) continue;
password pwbuf;
|