Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Perl script to generate secrets and config data for BTsync

NAME

keygen-btsync - generate secrets and config data for BTsync

SYNOPSIS

keygen-btsync [options] [ path ... ]

Options:
  --ident               show identification
  --help                brief help message
  --man                full documentation
  --verbose             verbose information

OPTIONS

--help

Print a brief help message and exits.

--man

Prints the manual page and exits.

--ident

Prints program identification.

--verbose

More verbose information.

path

The path(s) to generate keys for.

DESCRIPTION

keygen-btsync will generate keys (secrets) and a sample config entry for each of the paths passed on the command line. If no paths are supplied it uses the current directory.

The output is intended to be cut, modified and pasted into your btsync configuration file. It will be similar to:

// RW, normal  ASOKXDMYPKQPEOZTLQSQSIRNSJZUS6AYC
// RO, normal  BA7K2Y6WR4NQDHBJ5DJNXCTNKMU6SDLN3
// RW, encrypt DSOKXDMYPKQPEOZTLQSQSIRNSJZUS6AYC
// RO, decrypt EO4VWGPVX2EZ37L275ZBOF3RTJG4OCJYOWFUKWJUDUVDA7RHT7DEFC4D5H4
// RO, secret  FO4VWGPVX2EZ37L275ZBOF3RTJG4OCJYO
{
  "secret"           : "ASOKXDMYPKQPEOZTLQSQSIRNSJZUS6AYC",
  "dir"              : "/home/jv/src/videotools",
  "use_relay_server" : false,
  "use_tracker"      : false,
  "use_dht"          : false,
  "search_lan"       : true,
  "use_sync_trash"   : true,
  "known_hosts"      :
  [
    "192.168.1.16:58291"
  ]
},

The first two secrets are the normal read-write and read-only secrets.

For the meaning of the encrypted secrets, see http://forum.bittorrent.com/topic/25823-generate-encrypted-read-only-secret-without-api-key/

AUTHOR

Johan Vromans <jvromans@squirrel.nl>

COPYRIGHT

This programs is Copyright 2014, Squirrel Consultancy.

This program is free software; you can redistribute it and/or modify it under the terms of the Perl Artistic License or the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment