mirror of
https://github.com/r4sas/PBinCLI
synced 2025-03-12 13:21:27 +00:00
add servers list with random selection (closes #48)
Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
parent
afd2d58c61
commit
5dfe8dd9ea
@ -88,6 +88,7 @@ def main():
|
||||
send_parser.add_argument("--auth-pass", default=argparse.SUPPRESS, help="Basic authorization password")
|
||||
send_parser.add_argument("--auth-custom", default=argparse.SUPPRESS, help="Custom authorization header in JSON format")
|
||||
##
|
||||
send_parser.add_argument("-R", "--random-server", default=argparse.SUPPRESS, help="Comma-separated list of servers with scheme, randomly chosen to to send paste to (default: None)")
|
||||
send_parser.add_argument("-L", "--mirrors", default=argparse.SUPPRESS, help="Comma-separated list of mirrors of service with scheme (default: None)")
|
||||
send_parser.add_argument("-v", "--verbose", default=False, action="store_true", help="Enable verbose output")
|
||||
send_parser.add_argument("-d", "--debug", default=False, action="store_true", help="Enable debug output. Includes verbose output")
|
||||
@ -146,6 +147,7 @@ def main():
|
||||
# default configuration
|
||||
CONFIG = {
|
||||
'server': 'https://paste.i2pd.xyz/',
|
||||
'random_server': None,
|
||||
'mirrors': None,
|
||||
'proxy': None,
|
||||
'expire': '1day',
|
||||
@ -190,8 +192,13 @@ def main():
|
||||
if key in args_var:
|
||||
CONFIG[key] = args_var[key]
|
||||
|
||||
# Re-validate PrivateBin instance URL
|
||||
CONFIG['server'] = validate_url_ending(CONFIG['server'])
|
||||
# Set server and re-validate instance URL
|
||||
if CONFIG['random_server']:
|
||||
import random
|
||||
url_arr = CONFIG['random_server'].split(',')
|
||||
CONFIG['server'] = validate_url_ending(random.choice(url_arr))
|
||||
else:
|
||||
CONFIG['server'] = validate_url_ending(CONFIG['server'])
|
||||
|
||||
if args.debug:
|
||||
print("Whole configuration:\n{}\n".format(CONFIG))
|
||||
|
Loading…
x
Reference in New Issue
Block a user