Browse Source

style: optimize log output

master
dnomd343 2 years ago
parent
commit
6b99a181a7
  1. 8
      Tester/__init__.py
  2. 4
      test.py

8
Tester/__init__.py

@ -119,16 +119,16 @@ def loadCert(host: str = 'proxyc.net', remark: str = 'ProxyC'):
caKey = loadPath('proxyc_%s_ca_key.pem' % certFlag) caKey = loadPath('proxyc_%s_ca_key.pem' % certFlag)
cert = loadPath('proxyc_%s_cert.pem' % certFlag) cert = loadPath('proxyc_%s_cert.pem' % certFlag)
key = loadPath('proxyc_%s_cert_key.pem' % certFlag) key = loadPath('proxyc_%s_cert_key.pem' % certFlag)
logging.critical('Create self-signed certificate') logging.critical('Load self-signed certificate')
os.system('mkdir -p %s' % Settings['workDir']) # create work directory os.system('mkdir -p %s' % Settings['workDir']) # create work directory
logging.critical('Create CA certificate and key') logging.critical('Creating CA certificate and key...')
os.system(' '.join(['mad', 'ca'] + [ os.system(' '.join(['mad', 'ca'] + [
'--ca', caCert, '--key', caKey, '--ca', caCert, '--key', caKey,
'--commonName', remark, '--commonName', remark,
'--organization', remark, '--organization', remark,
'--organizationUnit', remark, '--organizationUnit', remark,
])) ]))
logging.critical('Signing certificate') logging.critical('Signing certificate...')
os.system(' '.join(['mad', 'cert'] + [ os.system(' '.join(['mad', 'cert'] + [
'--ca', caCert, '--ca_key', caKey, '--ca', caCert, '--ca_key', caKey,
'--cert', cert, '--key', key, '--cert', cert, '--key', key,
@ -136,7 +136,7 @@ def loadCert(host: str = 'proxyc.net', remark: str = 'ProxyC'):
'--organization', remark, '--organization', remark,
'--organizationUnit', remark, '--organizationUnit', remark,
])) ]))
logging.critical('Install CA certificate') logging.critical('Installing CA certificate...')
os.system('cat %s >> /etc/ssl/certs/ca-certificates.crt' % caCert) os.system('cat %s >> /etc/ssl/certs/ca-certificates.crt' % caCert)
Settings['host'] = host Settings['host'] = host
Settings['cert'] = cert Settings['cert'] = cert

4
test.py

@ -49,7 +49,7 @@ logging.critical('TEST ITEM: ' + ('all' if testItem is None else testItem))
logging.critical('FILTER: %s' % testFilter) logging.critical('FILTER: %s' % testFilter)
logging.critical('URL: ' + testUrl) logging.critical('URL: ' + testUrl)
logging.critical('THREAD NUMBER: %i' % threadNum) logging.critical('THREAD NUMBER: %i' % threadNum)
logging.critical('TEST START') logging.critical('-------------------------------- TEST START --------------------------------')
if testItem is not None: if testItem is not None:
Tester.test(Tester.entry[testItem], threadNum, testUrl, testFilter) Tester.test(Tester.entry[testItem], threadNum, testUrl, testFilter)
else: else:
@ -58,4 +58,4 @@ else:
continue continue
logging.critical('TEST ITEM -> ' + item) logging.critical('TEST ITEM -> ' + item)
Tester.test(Tester.entry[item], threadNum, testUrl, testFilter) Tester.test(Tester.entry[item], threadNum, testUrl, testFilter)
logging.critical('TEST COMPLETE') logging.critical('-------------------------------- TEST COMPLETE --------------------------------')

Loading…
Cancel
Save