Switch from xkcdpass to a very simple diceware

This commit is contained in:
SG
2023-05-08 18:04:19 +02:00
parent 575568772a
commit 634c513c8c
2 changed files with 21 additions and 5 deletions

18
transmat/diceware.py Normal file

File diff suppressed because one or more lines are too long

View File

@@ -2,11 +2,11 @@
import asyncio, websockets
import sys, os, base64, argparse, json, pickle
from xkcdpass import xkcd_password as xp
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from progress.bar import Bar
import diceware
VERSION_NUMBER="0.1.1"
@@ -94,7 +94,6 @@ async def send_encrypted_msg(ws, k, data):
await send_msg(ws, json.dumps(msg))
async def main():
WS_RELAY_SERVER = "wss://transmat.exocortex.ru"
parser = argparse.ArgumentParser()
@@ -102,7 +101,6 @@ async def main():
arg_group.add_argument('--receive', '--recv', action='store_true', help='Receive a file from the remote party (mutually exclusive with --send and --relay)')
arg_group.add_argument('--send', type=str, help='Send a file to the remote party (mutually exclusive with --receive and --relay)')
arg_group.add_argument('--version', action='store_true', help="Show version")
#arg_group.add_argument('--relay', action='store_true', help='Run as a Relay server (mutually exclusive with --receive and --send)')
parser.add_argument('--server', type=str, help="Specify the Relay server URL (ignored with --relay)")
parser.add_argument('--password', type=str, help="Specify the shared password (for --receive)")
args = parser.parse_args()
@@ -112,8 +110,8 @@ async def main():
role = 'receive'
password = args.password
if args.send and args.password is None:
wordlist = xp.generate_wordlist(wordfile = xp.locate_wordfile(), min_length = 5, max_length = 9)
password = xp.generate_xkcdpassword(wordlist, numwords=4, delimiter = "-", case='capitalize')
#password = xp.generate_xkcdpassword(wordlist, numwords=4, delimiter = "-", case='capitalize')
password = diceware.generate_passphrase(4)
passwd_part = f"--password {password}"
if args.receive and args.password is None:
print("Error: --password required when receiving files.")