Switch from xkcdpass to a very simple diceware
This commit is contained in:
18
transmat/diceware.py
Normal file
18
transmat/diceware.py
Normal file
File diff suppressed because one or more lines are too long
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
import asyncio, websockets
|
import asyncio, websockets
|
||||||
import sys, os, base64, argparse, json, pickle
|
import sys, os, base64, argparse, json, pickle
|
||||||
from xkcdpass import xkcd_password as xp
|
|
||||||
from cryptography.fernet import Fernet
|
from cryptography.fernet import Fernet
|
||||||
from cryptography.hazmat.primitives import hashes
|
from cryptography.hazmat.primitives import hashes
|
||||||
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
|
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
|
||||||
from progress.bar import Bar
|
from progress.bar import Bar
|
||||||
|
import diceware
|
||||||
|
|
||||||
|
|
||||||
VERSION_NUMBER="0.1.1"
|
VERSION_NUMBER="0.1.1"
|
||||||
@@ -94,7 +94,6 @@ async def send_encrypted_msg(ws, k, data):
|
|||||||
await send_msg(ws, json.dumps(msg))
|
await send_msg(ws, json.dumps(msg))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
WS_RELAY_SERVER = "wss://transmat.exocortex.ru"
|
WS_RELAY_SERVER = "wss://transmat.exocortex.ru"
|
||||||
parser = argparse.ArgumentParser()
|
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('--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('--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('--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('--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)")
|
parser.add_argument('--password', type=str, help="Specify the shared password (for --receive)")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@@ -112,8 +110,8 @@ async def main():
|
|||||||
role = 'receive'
|
role = 'receive'
|
||||||
password = args.password
|
password = args.password
|
||||||
if args.send and args.password is None:
|
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}"
|
passwd_part = f"--password {password}"
|
||||||
if args.receive and args.password is None:
|
if args.receive and args.password is None:
|
||||||
print("Error: --password required when receiving files.")
|
print("Error: --password required when receiving files.")
|
||||||
|
|||||||
Reference in New Issue
Block a user