add "-0" mode: no codes, no auth, fixed channel

Like roulette but with forward security.
This commit is contained in:
Brian Warner 2015-04-09 23:06:57 -05:00
parent 5f35fcee61
commit 819a37476b
5 changed files with 28 additions and 2 deletions

View File

@ -14,6 +14,9 @@ def receive_file(args):
transit_receiver = TransitReceiver(args.transit_helper)
r = Receiver(APPID, args.relay_url)
if args.zeromode:
assert not args.code
args.code = "0-"
code = args.code
if not code:
code = r.input_code("Enter receive-file wormhole code: ",

View File

@ -10,6 +10,9 @@ def receive_text(args):
from ..blocking.transcribe import Receiver, WrongPasswordError
r = Receiver(APPID, args.relay_url)
if args.zeromode:
assert not args.code
args.code = "0-"
code = args.code
if not code:
code = r.input_code("Enter receive-text wormhole code: ",

View File

@ -16,6 +16,9 @@ def send_file(args):
transit_sender = TransitSender(args.transit_helper)
i = Initiator(APPID, args.relay_url)
if args.zeromode:
assert not args.code
args.code = "0-"
if args.code:
i.set_code(args.code)
code = args.code
@ -24,8 +27,11 @@ def send_file(args):
other_cmd = "wormhole receive-file"
if args.verify:
other_cmd = "wormhole --verify receive-file"
if args.zeromode:
other_cmd += " -0"
print("On the other computer, please run: %s" % other_cmd)
print("Wormhole code is '%s'" % code)
if not args.zeromode:
print("Wormhole code is '%s'" % code)
print()
if args.verify:

View File

@ -10,6 +10,9 @@ def send_text(args):
from ..blocking.transcribe import Initiator, WrongPasswordError
i = Initiator(APPID, args.relay_url)
if args.zeromode:
assert not args.code
args.code = "0-"
if args.code:
i.set_code(args.code)
code = args.code
@ -18,8 +21,11 @@ def send_text(args):
other_cmd = "wormhole receive-text"
if args.verify:
other_cmd = "wormhole --verify receive-text"
if args.zeromode:
other_cmd += " -0"
print("On the other computer, please run: %s" % other_cmd)
print("Wormhole code is: %s" % code)
if not args.zeromode:
print("Wormhole code is: %s" % code)
print("")
if args.verify:

View File

@ -57,12 +57,16 @@ sp_restart.set_defaults(func=cmd_server.restart_server)
p = subparsers.add_parser("send-text", description="Send a text mesasge",
usage="wormhole send-text TEXT")
p.add_argument("--code", metavar="CODE", help="human-generated code phrase")
p.add_argument("-0", dest="zeromode", action="store_true",
help="enable no-code anything-goes mode")
p.add_argument("text", metavar="TEXT", help="the message to send (a string)")
p.set_defaults(func=cmd_send_text.send_text)
# CLI: receive-text
p = subparsers.add_parser("receive-text", description="Receive a text message",
usage="wormhole receive-text [CODE]")
p.add_argument("-0", dest="zeromode", action="store_true",
help="enable no-code anything-goes mode")
p.add_argument("code", nargs="?", default=None, metavar="[CODE]",
help=dedent("""\
The magic-wormhole code, from the sender. If omitted, the
@ -74,6 +78,8 @@ p.set_defaults(func=cmd_receive_text.receive_text)
p = subparsers.add_parser("send-file", description="Send a file",
usage="wormhole send-file FILENAME")
p.add_argument("--code", metavar="CODE", help="human-generated code phrase")
p.add_argument("-0", dest="zeromode", action="store_true",
help="enable no-code anything-goes mode")
p.add_argument("filename", metavar="FILENAME", help="The file to be sent")
p.set_defaults(func=cmd_send_file.send_file)
@ -91,6 +97,8 @@ p.add_argument("--overwrite", action="store_true",
output file already exists, the program will refuse to
overwrite it."""),
)
p.add_argument("-0", dest="zeromode", action="store_true",
help="enable no-code anything-goes mode")
p.add_argument("code", nargs="?", default=None, metavar="[CODE]",
help=dedent("""\
The magic-wormhole code, from the sender. If omitted, the