ipserver.configs module

IpServer’s Module Index

class Constant

Bases: object

APP_BOTTOM_DESC = 'command examples:\n  ipserver --mode=TCP --port=8001\n  ipserver --mode=SSL --port=8443\n\n  ipserver --port=8002 --forwarding=google.com:80\n  ipserver --port=8002 --forwarding=tcp://google.com:80\n  ipserver --port=8002 --forwarding=ssl://google.com:443\n\n  ipserver --port=8002 --restrict_allow="192.168.2.10;192.168.10.0/24"\n  ipserver --port=8002 --restrict_deny="192.168.10.101;192.168.10.102"\n\n  ipserver --port=8001 --mode=HTTP\n  ipserver --port=8002 --mode=HTTP --http_opt=INTERACTIVE\n\n  ipserver --port=8002 --mode=HTTP --http_opt=FILE\n  ipserver --http_file=./ --port=8002\n  ipserver --http_file=1 --port=8002\n  ipserver --http_file_upload=1 --port=8002\n\n  ipserver --mode=HTTP --http_opt=APP --port=8002\n  ipserver --http_app=./examples/public-sample/ --port=8002\n  ipserver --http_app=1 --port=8002\n\n  ipserver --mode=HTTP --http_opt=INFO --port=8002\n\n  ipserver --mode=HTTP --http_opt=FORWARDING --forwarding=https://www.amazon.com --port=8002\n  ipserver --http_forwarding=https://www.amazon.com --port=8002\n\n  ipserver --port=8002 --http_file=./ --http_digest_auth=.htdigest\n  ipserver --port=8002 --http_file_upload=./ --http_digest_auth="admin:123456"\n  ipserver --port=8002 --http_app=1 --http_digest_auth="admin:d71fa85bc0ded05215b28dfd8ca14112"\n\n  ipserver --port=8001 --quiet\n\n  ipserver --conf=ipserver.json\n  ipserver --conf=ipserver.json --quiet\n\n  ipserver --port=8001 --verbose=2\n  ipserver --port=8001 --debug\n\ndocuments:\n  Documentation site: https://deer-hunt.github.io/ipserver/\n  PyPI: https://pypi.org/project/ipserver/\n  Github: https://github.com/deer-hunt/ipserver/\n'
APP_DESCRIPTION = '`ipserver` is simple server on "TCP, UDP, SSL, HTTP, HTTPS" for debugging or network investigation. It supports interactive mode and forwarding, and can run Python program over HTTP or any other protocol.'
APP_NAME = 'ipserver'
CONF_FILE = 'ipserver.json'
DIRECTION_RECEIVE = 2
DIRECTION_SEND = 1
DUMPFILE_DIR = 'dumpfiles'
HTTP_APP = 'APP'
HTTP_DIGEST_REALM = 'digest'
HTTP_FILE = 'FILE'
HTTP_FILE_CMD = 'ipcmd'
HTTP_FILE_MIMES = {'': 'text/plain', '.sh': 'text/plain'}
HTTP_FILE_UPLOAD = 'file-upload'
HTTP_FORWARDING = 'FORWARDING'
HTTP_INFO = 'INFO'
HTTP_INTERACTIVE = 'INTERACTIVE'
HTTP_MD5_SALT = 'ipsalt'
HTTP_MODES = ['HTTP', 'HTTPS']
HTTP_OPTIONS = ['http_path', 'http_digest_auth', 'enable_file_upload']
HTTP_PASS = 'PASS'
HTTP_STATIC_FILES = '\\.(html?|css|js|jpe?g|png|gif|svg|webp|woff2?|ttf|otf|ico|xml|json|txt|md|pdf|mp4|mp3|webm|avi|mov|docx?|xlsx?|pptx?)$'
INPUT_BASE64 = 'BASE64'
INPUT_BINARY = 'BINARY'
INPUT_HEX = 'HEX'
INPUT_NONE = 'NONE'
INPUT_TEXT = 'TEXT'
LOG_FILE = 'ipserver.log'
MODE_HTTP = 'HTTP'
MODE_HTTPS = 'HTTPS'
MODE_SSL = 'SSL'
MODE_TCP = 'TCP'
MODE_UDP = 'UDP'
OUTPUT_BASE64 = 'BASE64'
OUTPUT_BINARY = 'BINARY'
OUTPUT_HEX = 'HEX'
OUTPUT_NONE = 'NONE'
OUTPUT_TEXT = 'TEXT'
PYPI_NAME = 'ipserver'
QUIET_INTERVAL = 30
QUIET_STARTING_MSG = 'Starting IpServer in quiet mode...'
RECV_BUF_SIZE = 65565
SSL_CONTEXTS = {'sslv3': 'PROTOCOL_SSLv3', 'tls1.0': 'PROTOCOL_TLSv1', 'tls1.1': 'PROTOCOL_TLSv1_1', 'tls1.2': 'PROTOCOL_TLSv1_2', 'tls1.3': 'PROTOCOL_TLSv1_3'}
SSL_OPTIONS = ['ssl_context', 'ssl_keypath', 'ssl_certfile', 'ssl_keyfile']
class Config

Bases: object

ARGUMENTS = {'bind': {'default': '0.0.0.0', 'help': 'Bind IP. e.g. 127.0.0.1, localhost, 0.0.0.0', 'metavar': '{string}', 'type': <class 'str'>}, 'conf': {'default': None, 'help': 'Load arguments from conf file by JSON. e.g.: ipserver.json ', 'type': <class 'str'>}, 'debug': {'action': 'store_true', 'default': False, 'help': '`--debug` is equivalent to `--verbose=3`.'}, 'dumpfile': {'action': 'store_true', 'default': False, 'help': 'Dump response data to files. Dir: `./dumpfiles/`'}, 'enable_file_upload': {'default': 0, 'help': 'Enable file-upload in FILE mode. 1: Overwrite 2: New create only', 'metavar': '{int}', 'type': <class 'int'>}, 'forwarding': {'default': None, 'help': 'Forward. e.g. Forward proxy.', 'metavar': '{string}', 'type': <class 'str'>}, 'http_app': {'default': None, 'group': 'shortcut', 'help': '`--http_app` is equivalent to `--mode=HTTP and --http_opt=APP`.', 'metavar': '{string}', 'type': <class 'str'>}, 'http_digest_auth': {'default': '', 'help': 'Enable digest authentication. Set authentication setting.\nFile: .htdigest\n"User/Raw: admin2:123456"\n"User/MD5: admin2:d71fab~~~~dfca14112"', 'metavar': '{string}', 'type': <class 'str'>}, 'http_file': {'default': None, 'group': 'shortcut', 'help': '`--http_file` is equivalent to `--mode=HTTP and --http_opt=FILE`.', 'metavar': '{string}', 'type': <class 'str'>}, 'http_file_upload': {'default': None, 'group': 'shortcut', 'help': '`--http_file_upload` is equivalent to `--mode=HTTP and --http_opt=FILE and --enable_file_upload=1`.', 'metavar': '{string}', 'type': <class 'str'>}, 'http_forwarding': {'default': None, 'group': 'shortcut', 'help': '`--mode=HTTP and --http_opt=FORWARDING`.', 'metavar': '{string}', 'type': <class 'str'>}, 'http_forwarding_convert_host': {'action': 'store_true', 'default': False, 'help': 'Convert hostname of content to `/` in HTTP forwarding.'}, 'http_opt': {'choices': ['INTERACTIVE', 'FILE', 'PASS', 'APP', 'INFO', 'FORWARDING'], 'default': 'FILE', 'help': 'Behaviors in HTTP option.', 'type': <method 'upper' of 'str' objects>}, 'http_path': {'default': './', 'help': 'HTTP public directory.', 'metavar': '{string}', 'type': <class 'str'>}, 'info': {'action': 'store_true', 'default': False, 'help': '`--info` is equivalent to `--verbose=2`.'}, 'input': {'choices': ['TEXT', 'BINARY', 'HEX', 'BASE64'], 'default': 'TEXT', 'help': 'Input format in interactive input. Default: TEXT', 'type': <method 'upper' of 'str' objects>}, 'log': {'default': None, 'help': 'Verbose log filename.', 'metavar': '{string}', 'type': <class 'str'>}, 'max_connections': {'default': 20, 'help': 'Max connections', 'metavar': '{int}', 'type': <class 'int'>}, 'mode': {'choices': ['TCP', 'UDP', 'SSL', 'HTTP', 'HTTPS'], 'default': 'TCP', 'help': 'Listening mode. Default: TCP', 'type': <method 'upper' of 'str' objects>}, 'output': {'choices': ['NONE', 'TEXT', 'BINARY', 'HEX', 'BASE64'], 'default': 'TEXT', 'help': 'Output format. Default: TEXT', 'type': <method 'upper' of 'str' objects>}, 'output_max': {'default': 2048, 'help': 'Max output bytes.', 'type': <class 'int'>}, 'output_target': {'choices': ['ALL', 'SEND', 'RECEIVE'], 'default': 'RECEIVE', 'help': 'Output target.', 'type': <method 'upper' of 'str' objects>}, 'port': {'default': 8000, 'help': 'Listen port.', 'metavar': '{int}', 'type': <class 'int'>}, 'quiet': {'action': 'store_true', 'default': 0, 'help': 'Hide to output message.'}, 'restrict_allow': {'default': None, 'help': 'Restrict except for allowed IP. e.g. 192.168.10.101;192.168.10.0/24', 'metavar': '{string}', 'type': <class 'str'>}, 'restrict_deny': {'default': None, 'help': 'Restrict specified IP. e.g. 192.168.10.101;192.168.10.0/24', 'metavar': '{string}', 'type': <class 'str'>}, 'ssl_certfile': {'default': '', 'help': 'SSL certfile name.', 'metavar': '{string}', 'type': <class 'str'>}, 'ssl_context': {'choices': ['SSLV3', 'TLS1.0', 'TLS1.1', 'TLS1.2', 'TLS1.3'], 'default': None, 'help': 'SSL context. [SSLv3, TLS1.0, TLS1.1, TLS1.2, TLS1.3]', 'type': <method 'upper' of 'str' objects>}, 'ssl_keyfile': {'default': '', 'help': 'SSL keyfile name.', 'metavar': '{string}', 'type': <class 'str'>}, 'ssl_keypath': {'default': '', 'help': 'Directory path for SSL key.', 'metavar': '{string}', 'type': <class 'str'>}, 'timeout': {'default': 30.0, 'help': 'Timeout. Default: 30.0', 'metavar': '{float}', 'type': <class 'float'>}, 'verbose': {'choices': [0, 1, 2, 3], 'default': 0, 'help': 'Verbose mode. [Level - 1:TRACE_ERROR, 2:INFO, 3:DEBUG]', 'type': <class 'int'>}, 'version': {'action': 'store_true', 'default': False, 'help': 'Show version information.'}}
ARGUMENTS_GROUP_NAMES = {'shortcut': 'Shortcut'}