From ccacef155611a1cd87299b86a76311a2551e88ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=B4=E5=A8=83=E9=85=B1?= Date: Tue, 17 Jan 2017 20:53:54 +0800 Subject: [PATCH] fix bug & update usage --- mujson_mgr.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/mujson_mgr.py b/mujson_mgr.py index 46ab3e1..8881431 100644 --- a/mujson_mgr.py +++ b/mujson_mgr.py @@ -25,7 +25,7 @@ class MuJsonLoader(object): self.json = json.loads(l) def save(self, path): - if self.json: + if self.json is not None: output = json.dumps(self.json, sort_keys=True, indent=4, separators=(',', ': ')) with open(path, 'a'): pass @@ -107,7 +107,7 @@ class MuMgr(object): up = {'enable': 1, 'u': 0, 'd': 0, 'method': "aes-128-ctr", 'protocol': "auth_aes128_md5", 'obfs': "tls1.2_ticket_auth_compatible", - 'transfer_enable': 1125899906842624} + 'transfer_enable': 9007199254740992} up['passwd'] = self.rand_pass() up.update(user) @@ -190,26 +190,26 @@ def print_server_help(): print('''usage: python mujson_manage.py -a|-d|-e|-c|-l [OPTION]... Actions: - -a ADD add/edit a user - -d DELETE delete a user - -e EDIT edit a user - -c CLEAR set u/d to zero - -l LIST display a user infomation or all users infomation + -a ADD add/edit a user + -d DELETE delete a user + -e EDIT edit a user + -c CLEAR set u/d to zero + -l LIST display a user infomation or all users infomation Options: - -u USER the user name - -p PORT server port - -k PASSWORD password - -m METHOD encryption method, default: aes-128-cfb - -O PROTOCOL protocol plugin, default: auth_sha1_v4 - -o OBFS obfs plugin, default: tls1.2_ticket_auth_compatible - -G PROTOCOL_PARAM protocol plugin param - -g OBFS_PARAM obfs plugin param - -t TRANSFER max transfer for G bytes, default: 1048576, can be float point number - -f FORBID set forbidden ports. Example (ban 1~79 and 81~100): -f "1-79,81-100" + -u USER the user name + -p PORT server port (only this option must be set if add a user) + -k PASSWORD password + -m METHOD encryption method, default: aes-128-ctr + -O PROTOCOL protocol plugin, default: auth_aes128_md5 + -o OBFS obfs plugin, default: tls1.2_ticket_auth_compatible + -G PROTOCOL_PARAM protocol plugin param + -g OBFS_PARAM obfs plugin param + -t TRANSFER max transfer for G bytes, default: 8388608 (8 PB or 8192 TB) + -f FORBID set forbidden ports. Example (ban 1~79 and 81~100): -f "1-79,81-100" General options: - -h, --help show this help message and exit + -h, --help show this help message and exit ''')