Exemplo n.º 1
0
def convert_dbs():
    gpg = gnupg.GPG()
    gpg.encoding = 'utf-8'

    for dbname in DATABASE_NAMES:
        with open(dbname, 'rb') as f:
            dbpassphrase = getpass('Type passphrase for "{}": '.format(dbname))
            sql = gpg.decrypt_file(f, passphrase=dbpassphrase).data

        if sql:
            with open(dbname, 'wb') as f:
                new_crypt_sql = encrypt_symmetric(key=hash_(dbpassphrase),
                                                  plaintext=sql)
                f.write(new_crypt_sql)
        else:
            print 'Bad passphrase!'
Exemplo n.º 2
0
def convert_dbs():
    gpg = gnupg.GPG()
    gpg.encoding = 'utf-8'

    for dbname in DATABASE_NAMES:
        with open(dbname, 'rb') as f:
            dbpassphrase = getpass('Type passphrase for "{}": '.format(dbname))
            sql = gpg.decrypt_file(f, passphrase=dbpassphrase).data

        if sql:
            with open(dbname, 'wb') as f:
                new_crypt_sql = encrypt_symmetric(key=hash_(dbpassphrase),
                                                  plaintext=sql)
                f.write(new_crypt_sql)
        else:
            print 'Bad passphrase!'
Exemplo n.º 3
0
    OTHER_NICK = 'x'
    winlock = threading.Lock()
    transferlock = threading.Lock()
    cryptlock = threading.Lock()
    screen_needs_update = False
    HOST = '127.0.0.1'
    PORT = 50000
    mkey = getpass('What is the masterkey (format: NNN-xxxx)? ')

    if mode == '-s':
        axolotl = Axolotl(NICK,
                          dbname=OTHER_NICK + '.db',
                          dbpassphrase=None,
                          nonthreaded_sql=False)
        axolotl.createState(other_name=OTHER_NICK,
                            mkey=hash_(mkey),
                            mode=False)
        tor_process = tor(TOR_SERVER_PORT, TOR_SERVER_CONTROL_PORT,
                          '/tmp/tor.server', '')
        hs, cookie, onion = ephemeralHiddenService()
        print 'Exchanging credentials via tor...'
        if credentialsSend(mkey, cookie,
                           b2a(axolotl.state['DHRs']).strip(), onion):
            pass
        else:
            sys.exit(1)
        print 'Credentials sent, waiting for the other party to connect...'
        with socketcontext(socket.AF_INET, socket.SOCK_STREAM) as s:
            s.bind((HOST, PORT))
            s.listen(1)
            conn, addr = s.accept()
Exemplo n.º 4
0
    OTHER_NICK = 'x'
    winlock = threading.Lock()
    transferlock = threading.Lock()
    cryptlock = threading.Lock()
    screen_needs_update = False
    HOST = '127.0.0.1'
    PORT=50000
    mkey = getpass('What is the masterkey (format: NNN-xxxx)? ')

    if mode == '-s':
        axolotl = Axolotl(NICK,
                    dbname=OTHER_NICK+'.db',
                    dbpassphrase=None,
                    nonthreaded_sql=False)
        axolotl.createState(other_name=OTHER_NICK,
                           mkey=hash_(mkey),
                           mode=False)
        tor_process = tor(TOR_SERVER_PORT,
                          TOR_SERVER_CONTROL_PORT,
                          '/tmp/tor.server',
                          '')
        hs, cookie, onion = ephemeralHiddenService()
        print 'Exchanging credentials via tor...'
        if credentialsSend(mkey,
                           cookie,
                           b2a(axolotl.state['DHRs']).strip(),
                           onion):
            pass
        else:
            sys.exit(1)
        print 'Credentials sent, waiting for the other party to connect...'