Browse Source

more robust

1.4
clowwindy 12 years ago
parent
commit
8b2f26c08e
  1. 12
      encrypt.py
  2. 4
      local.py

12
encrypt.py

@ -60,7 +60,11 @@ def init_table(key, method=None):
encrypt_table = ''.join(get_table(key))
decrypt_table = string.maketrans(encrypt_table, string.maketrans('', ''))
else:
Encryptor(key, method) # make an Encryptor to test if the settings if OK
try:
Encryptor(key, method) # make an Encryptor to test if the settings if OK
except Exception as e:
logging.error(e)
sys.exit(1)
def EVP_BytesToKey(password, key_len, iv_len):
@ -88,9 +92,15 @@ method_supported = {
'aes-192-cfb': (24, 16),
'aes-256-cfb': (32, 16),
'bf-cfb': (16, 8),
'camellia-128-cfb': (16, 16),
'camellia-192-cfb': (24, 16),
'camellia-256-cfb': (32, 16),
'cast5-cfb': (16, 8),
'des-cfb': (8, 8),
'idea-cfb': (16, 8),
'rc2-cfb': (8, 8),
'rc4': (16, 0),
'seed-cfb': (16, 16),
}

4
local.py

@ -179,11 +179,11 @@ if __name__ == '__main__':
elif key == '-m':
METHOD = value
encrypt.init_table(KEY, METHOD)
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-8s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S', filemode='a+')
encrypt.init_table(KEY, METHOD)
try:
server = ThreadingTCPServer(('', PORT), Socks5Server)
logging.info("starting server at port %d ..." % PORT)

Loading…
Cancel
Save