mirror of
https://github.com/r4sas/PBinCLI
synced 2025-03-12 13:21:27 +00:00
parent
7413bad322
commit
46149f868b
@ -58,6 +58,10 @@ proxy=http://127.0.0.1:3128
|
||||
| no_check_certificate | False | True / False |
|
||||
| no_insecure_warning | False | True / False |
|
||||
| compression | zlib | zlib / none |
|
||||
| auth | None | `basic`, `custom` |
|
||||
| auth_user | None | Basic authorization username |
|
||||
| auth_pass | None | Basic authorization password |
|
||||
| auth_custom | None | Custom authorization headers in JSON format, like `{'Authorization': 'Bearer token'}` |
|
||||
|
||||
# Usage
|
||||
|
||||
|
12
README.rst
12
README.rst
@ -116,6 +116,18 @@ List of OPTIONS available
|
||||
* - compression
|
||||
- zlib
|
||||
- zlib / none
|
||||
* - auth
|
||||
- None
|
||||
- ``basic``\ , ``custom``
|
||||
* - auth_user
|
||||
- None
|
||||
- Basic authorization username
|
||||
* - auth_pass
|
||||
- None
|
||||
- Basic authorization password
|
||||
* - auth_custom
|
||||
- None
|
||||
- Custom authorization headers in JSON format, like ``{'Authorization': 'Bearer token'}``
|
||||
|
||||
|
||||
Usage
|
||||
|
@ -32,6 +32,16 @@ class PrivateBin:
|
||||
|
||||
self.session, self.proxy = _config_requests(settings)
|
||||
|
||||
if settings['auth']:
|
||||
if settings['auth'] == 'basic' and settings['auth_user'] and settings['auth_pass']:
|
||||
self.session.auth = (settings['auth_user'], settings['auth_pass'])
|
||||
elif settings['auth'] == 'custom' and settings['auth_custom']:
|
||||
from json import loads as json_loads
|
||||
auth = json_loads(settings['auth_custom'])
|
||||
self.headers.update(auth)
|
||||
else:
|
||||
PBinCLIError("Incorrect authorization configuration")
|
||||
|
||||
def post(self, request):
|
||||
result = self.session.post(
|
||||
url = self.server,
|
||||
|
@ -69,6 +69,12 @@ def main():
|
||||
send_parser.add_argument("--no-check-certificate", default=argparse.SUPPRESS, action="store_true", help="Disable certificate validation")
|
||||
send_parser.add_argument("--no-insecure-warning", default=argparse.SUPPRESS, action="store_true",
|
||||
help="Suppress InsecureRequestWarning (only with --no-check-certificate)")
|
||||
## Authorization options
|
||||
send_parser.add_argument("--auth", default=argparse.SUPPRESS, action="store",
|
||||
choices=["basic", "custom"], help="Server authorization method (default: none)")
|
||||
send_parser.add_argument("--auth-user", default=argparse.SUPPRESS, help="Basic authorization username")
|
||||
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("-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")
|
||||
@ -88,6 +94,12 @@ def main():
|
||||
get_parser.add_argument("--no-check-certificate", default=argparse.SUPPRESS, action="store_true", help="Disable certificate validation")
|
||||
get_parser.add_argument("--no-insecure-warning", default=argparse.SUPPRESS, action="store_true",
|
||||
help="Suppress InsecureRequestWarning (only with --no-check-certificate)")
|
||||
## Authorization options
|
||||
get_parser.add_argument("--auth", default=argparse.SUPPRESS, action="store",
|
||||
choices=["basic", "custom"], help="Server authorization method (default: none)")
|
||||
get_parser.add_argument("--auth-user", default=argparse.SUPPRESS, help="Basic authorization username")
|
||||
get_parser.add_argument("--auth-pass", default=argparse.SUPPRESS, help="Basic authorization password")
|
||||
get_parser.add_argument("--auth-custom", default=argparse.SUPPRESS, help="Custom authorization header in JSON format")
|
||||
##
|
||||
get_parser.add_argument("-v", "--verbose", default=False, action="store_true", help="Enable verbose output")
|
||||
get_parser.add_argument("-d", "--debug", default=False, action="store_true", help="Enable debug output")
|
||||
@ -102,6 +114,11 @@ def main():
|
||||
delete_parser.add_argument("--no-check-certificate", default=argparse.SUPPRESS, action="store_true", help="Disable certificate validation")
|
||||
delete_parser.add_argument("--no-insecure-warning", default=argparse.SUPPRESS, action="store_true",
|
||||
help="Suppress InsecureRequestWarning (only with --no-check-certificate)")
|
||||
delete_parser.add_argument("--auth", default=argparse.SUPPRESS, action="store",
|
||||
choices=["basic", "custom"], help="Server authorization method (default: none)")
|
||||
delete_parser.add_argument("--auth-user", default=argparse.SUPPRESS, help="Basic authorization username")
|
||||
delete_parser.add_argument("--auth-pass", default=argparse.SUPPRESS, help="Basic authorization password")
|
||||
delete_parser.add_argument("--auth-custom", default=argparse.SUPPRESS, help="Custom authorization header in JSON format")
|
||||
##
|
||||
delete_parser.add_argument("-v", "--verbose", default=False, action="store_true", help="Enable verbose output")
|
||||
delete_parser.add_argument("-d", "--debug", default=False, action="store_true", help="Enable debug output")
|
||||
@ -128,7 +145,11 @@ def main():
|
||||
'output': None,
|
||||
'no_check_certificate': False,
|
||||
'no_insecure_warning': False,
|
||||
'compression': None
|
||||
'compression': None,
|
||||
'auth': None,
|
||||
'auth_user': None,
|
||||
'auth_pass': None,
|
||||
'auth_custom': None
|
||||
}
|
||||
|
||||
# Configuration preference order:
|
||||
|
Loading…
x
Reference in New Issue
Block a user