|
|
2df90d4 |
diff -up ./roca/detect.py.color ./roca/detect.py
|
|
|
2df90d4 |
--- ./roca/detect.py.color 2018-03-02 09:29:08.000000000 -0500
|
|
|
2df90d4 |
+++ ./roca/detect.py 2018-09-10 13:31:01.730876815 -0400
|
|
|
2df90d4 |
@@ -1,4 +1,4 @@
|
|
|
2df90d4 |
-#!/usr/bin/env python
|
|
|
2df90d4 |
+#!/usr/bin/python3 -s
|
|
|
2df90d4 |
# -*- coding: utf-8 -*-
|
|
|
2df90d4 |
|
|
|
2df90d4 |
"""
|
|
|
2df90d4 |
@@ -43,7 +43,10 @@ from functools import reduce
|
|
|
2df90d4 |
import json
|
|
|
2df90d4 |
import argparse
|
|
|
2df90d4 |
import logging
|
|
|
2df90d4 |
-import coloredlogs
|
|
|
2df90d4 |
+try:
|
|
|
2df90d4 |
+ import coloredlogs
|
|
|
2df90d4 |
+except:
|
|
|
2df90d4 |
+ coloredlogs = None
|
|
|
2df90d4 |
import base64
|
|
|
2df90d4 |
import hashlib
|
|
|
2df90d4 |
import sys
|
|
|
2df90d4 |
@@ -62,8 +65,17 @@ from math import ceil, log
|
|
|
2df90d4 |
LOG_FORMAT = '%(asctime)s [%(process)d] %(levelname)s %(message)s'
|
|
|
2df90d4 |
|
|
|
2df90d4 |
|
|
|
2df90d4 |
+
|
|
|
2df90d4 |
logger = logging.getLogger(__name__)
|
|
|
2df90d4 |
-coloredlogs.install(level=logging.INFO, fmt=LOG_FORMAT)
|
|
|
2df90d4 |
+if coloredlogs:
|
|
|
2df90d4 |
+ coloredlogs.install(level=logging.INFO, fmt=LOG_FORMAT)
|
|
|
2df90d4 |
+else:
|
|
|
2df90d4 |
+ logging.basicConfig(
|
|
|
2df90d4 |
+ stream=sys.stdout,
|
|
|
2df90d4 |
+ level=logging.INFO,
|
|
|
2df90d4 |
+ format='%(asctime)s %(message)s',
|
|
|
2df90d4 |
+ datefmt='%Y%b%d %H:%M:%S'
|
|
|
2df90d4 |
+ )
|
|
|
2df90d4 |
|
|
|
2df90d4 |
|
|
|
2df90d4 |
#
|
|
|
2df90d4 |
@@ -2242,7 +2254,7 @@ class RocaFingerprinter(object):
|
|
|
2df90d4 |
parser = self.init_parser()
|
|
|
2df90d4 |
self.args = parser.parse_args()
|
|
|
2df90d4 |
|
|
|
2df90d4 |
- if self.args.debug:
|
|
|
2df90d4 |
+ if self.args.debug and coloredlogs:
|
|
|
2df90d4 |
coloredlogs.install(level=logging.DEBUG, fmt=LOG_FORMAT)
|
|
|
2df90d4 |
|
|
|
2df90d4 |
self.work()
|
|
|
2df90d4 |
diff -up ./roca/detect_tls.py.color ./roca/detect_tls.py
|
|
|
2df90d4 |
--- ./roca/detect_tls.py.color 2018-03-02 09:29:08.000000000 -0500
|
|
|
2df90d4 |
+++ ./roca/detect_tls.py 2018-09-10 13:32:52.850351651 -0400
|
|
|
2df90d4 |
@@ -1,4 +1,4 @@
|
|
|
2df90d4 |
-#!/usr/bin/env python
|
|
|
2df90d4 |
+#!/usr/bin/python3 -s
|
|
|
2df90d4 |
# -*- coding: utf-8 -*-
|
|
|
2df90d4 |
|
|
|
2df90d4 |
"""
|
|
|
2df90d4 |
@@ -21,7 +21,6 @@ Script requirements:
|
|
|
2df90d4 |
import sys
|
|
|
2df90d4 |
import argparse
|
|
|
2df90d4 |
import logging
|
|
|
2df90d4 |
-import coloredlogs
|
|
|
2df90d4 |
from ssl import get_server_certificate
|
|
|
2df90d4 |
from roca.detect import RocaFingerprinter
|
|
|
2df90d4 |
|
|
|
2df90d4 |
@@ -151,7 +150,16 @@ class RocaTLSFingerprinter(object):
|
|
|
2df90d4 |
Init command line parser
|
|
|
2df90d4 |
:return:
|
|
|
2df90d4 |
"""
|
|
|
2df90d4 |
- parser = argparse.ArgumentParser(description='ROCA TLS Fingerprinter')
|
|
|
2df90d4 |
+ parser = argparse.ArgumentParser(
|
|
|
2df90d4 |
+ formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
|
2df90d4 |
+ description='''ROCA TLS Fingerprinter
|
|
|
2df90d4 |
+
|
|
|
2df90d4 |
+Reads from one or more text files that contain a newline-separated list of
|
|
|
2df90d4 |
+address:port entries. Example:
|
|
|
2df90d4 |
+
|
|
|
2df90d4 |
+ github.com:443
|
|
|
2df90d4 |
+ google.com:443
|
|
|
2df90d4 |
+ internal.example.com:8080''')
|
|
|
2df90d4 |
|
|
|
2df90d4 |
parser.add_argument('--debug', dest='debug', default=False, action='store_const', const=True,
|
|
|
2df90d4 |
help='Debugging logging')
|
|
|
2df90d4 |
@@ -187,7 +195,6 @@ class RocaTLSFingerprinter(object):
|
|
|
2df90d4 |
self.roca.args.indent = self.args.indent
|
|
|
2df90d4 |
|
|
|
2df90d4 |
if self.args.debug:
|
|
|
2df90d4 |
- coloredlogs.install(level=logging.DEBUG)
|
|
|
2df90d4 |
self.roca.args.debug = True
|
|
|
2df90d4 |
|
|
|
2df90d4 |
self.work()
|
|
|
2df90d4 |
diff -up ./setup.py.color ./setup.py
|
|
|
2df90d4 |
--- ./setup.py.color 2018-03-02 09:29:08.000000000 -0500
|
|
|
2df90d4 |
+++ ./setup.py 2018-09-10 13:31:01.727876775 -0400
|
|
|
2df90d4 |
@@ -8,10 +8,8 @@ version = '1.2.12'
|
|
|
2df90d4 |
# Please update tox.ini when modifying dependency version requirements
|
|
|
2df90d4 |
install_requires = [
|
|
|
2df90d4 |
'cryptography>=1.2.3',
|
|
|
2df90d4 |
- 'setuptools>=1.0',
|
|
|
2df90d4 |
'six',
|
|
|
2df90d4 |
'future',
|
|
|
2df90d4 |
- 'coloredlogs',
|
|
|
2df90d4 |
'pgpdump',
|
|
|
2df90d4 |
'python-dateutil',
|
|
|
2df90d4 |
]
|