tristanlatr/WPWatcher

View on GitHub
Merge pull request #69 from tristanlatr/60---show_html-flag #270
tristanlatr authored d23ea199
complete00:00:23
Your first build completed successfully!

Congratulations

Your first build completed successfully!

See the Results

1
git clone
2
codeclimate validate-config
View output
codeclimate validate-config
No errors or warnings found in .codeclimate.json.
3
codeclimate prepare
View output
codeclimate prepare
4
builder pull-engines
View output
determining required images
docker pull codeclimate/codeclimate-radon:b695
b695: Pulling from codeclimate/codeclimate-radon
e00d546a75ad: Pulling fs layer
21f0a0866768: Pulling fs layer
cd9d3946aa16: Pulling fs layer
2e56add6654f: Pulling fs layer
6c87f215a2be: Pulling fs layer
c2b31566ca3d: Pulling fs layer
2e56add6654f: Waiting
6c87f215a2be: Waiting
c2b31566ca3d: Waiting
21f0a0866768: Verifying Checksum
21f0a0866768: Download complete
e00d546a75ad: Verifying Checksum
e00d546a75ad: Download complete
cd9d3946aa16: Verifying Checksum
cd9d3946aa16: Download complete
6c87f215a2be: Verifying Checksum
6c87f215a2be: Download complete
e00d546a75ad: Pull complete
c2b31566ca3d: Verifying Checksum
c2b31566ca3d: Download complete
21f0a0866768: Pull complete
2e56add6654f: Verifying Checksum
2e56add6654f: Download complete
cd9d3946aa16: Pull complete
2e56add6654f: Pull complete
6c87f215a2be: Pull complete
c2b31566ca3d: Pull complete
Digest: sha256:dfeb7edc634b4e2f851f3c788f7c21bd8bae097d4c66af722c76a6ba51121f98
Status: Downloaded newer image for registry.prod.codeclimate.net/codeclimate/codeclimate-radon:b695
5
structure
View output
12
Parser process id: 12
codeclimate-parser socket not present
waiting 1s...
6
duplication
View output
12
Parser process id: 12
codeclimate-parser socket not present
waiting 1s...
I, [2024-05-20T14:06:04.877058 #1]  INFO -- : Skipping file ./wpwatcher/syslog.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 15
    def __init__(self, conf: Dict[str, Any]):
                           ^
SyntaxError: invalid syntax


I, [2024-05-20T14:06:04.891116 #1]  INFO -- : Skipping file ./wpwatcher/daemon.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 21
    def __init__(self, conf: Config) -> None:
                           ^
SyntaxError: invalid syntax


I, [2024-05-20T14:06:04.901788 #1]  INFO -- : Skipping file ./wpwatcher/email.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 28
    def __init__(self, conf: Dict[str, Any]):
                           ^
SyntaxError: invalid syntax


I, [2024-05-20T14:06:04.903225 #1]  INFO -- : Skipping file ./wpwatcher/cli.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 22
    def main(_args: Optional[Sequence[Text]] = None) -> None:
                  ^
SyntaxError: invalid syntax


I, [2024-05-20T14:06:04.919632 #1]  INFO -- : Skipping file ./wpwatcher/db.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 26
    def __repr__(self) -> str:
                       ^
SyntaxError: invalid syntax


I, [2024-05-20T14:06:04.921431 #1]  INFO -- : Skipping file ./wpwatcher/wpscan.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 16
    UPDATE_DB_INTERVAL: timedelta = timedelta(hours=1)
                      ^
SyntaxError: invalid syntax


I, [2024-05-20T14:06:04.938836 #1]  INFO -- : Skipping file ./wpwatcher/__init__.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 18
    verbose: bool = False,
           ^
SyntaxError: invalid syntax


I, [2024-05-20T14:06:04.944861 #1]  INFO -- : Skipping file ./wpwatcher/config.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 29
    TEMPLATE_FILE: str = """[wpwatcher]
                 ^
SyntaxError: invalid syntax


I, [2024-05-20T14:06:04.953256 #1]  INFO -- : Skipping file ./wpwatcher/core.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 48
    def __init__(self, conf: Config):
                           ^
SyntaxError: invalid syntax


I, [2024-05-20T14:06:04.961989 #1]  INFO -- : Skipping file ./wpwatcher/site.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 18
    DEFAULT_SITE: Dict[str, Any] = {
                ^
SyntaxError: invalid syntax


I, [2024-05-20T14:06:04.970436 #1]  INFO -- : Skipping file ./wpwatcher/utils.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 17
    def remove_color(string: str) -> str:
                           ^
SyntaxError: invalid syntax


I, [2024-05-20T14:06:04.980646 #1]  INFO -- : Skipping file ./wpwatcher/report.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 29
    DEFAULT_REPORT: Dict[str, Any] = {
                  ^
SyntaxError: invalid syntax


I, [2024-05-20T14:06:05.000200 #1]  INFO -- : Skipping file ./wpwatcher/scan.py due to exception (CC::Engine::Analyzers::ParserError): `python2 /usr/src/app/lib/cc/engine/analyzers/python/parser.py` exited with code 1:
Traceback (most recent call last):
  File "/usr/src/app/lib/cc/engine/analyzers/python/parser.py", line 51, in <module>
    print(json.dumps(to_json(ast.parse(source))))
  File "/usr/local/python2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 38
    def __init__(self, conf: Config):
                           ^
SyntaxError: invalid syntax
7
bandit
bandit engine documentation
View output
[main]	INFO	profile include tests: None
[main]	INFO	profile exclude tests: None
[main]	INFO	cli include tests: None
[main]	INFO	cli exclude tests: None
[node_visitor]	INFO	Unable to find qualified name for module: setup.py
8
pep8
pep8 engine documentation
View output
.github/ wpwatcher/ docs/ setup.py
9
radon
radon engine documentation
View output
Running radon3...
10
sonar-python
sonar-python engine documentation
View output
INFO: Java 1.8.0_111-internal Oracle Corporation (64-bit)
INFO: Linux 4.4.0-1128-aws amd64
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/src/app/build/libs/sonarlint-core-2.17.0.899.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/src/app/build/libs/sonarlint-cli-2.1.0.566.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
INFO: Index files
INFO: Invalid character encountered in file '/code/docs/source/_static/reports-summary-wprs.png' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: Invalid character encountered in file '/code/docs/source/_static/wpwatcher-report.png' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: Invalid character encountered in file '/code/docs/source/_static/logo.png' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: 47 files indexed
ERROR: Unable to parse file: /code/wpwatcher/syslog.py
ERROR: Parse error at line 19 column 10:

   11: class SyslogOutput:
   12:     """
   13:     Send CEF messages based on reports. 
   14:     """
   15:     def __init__(self, conf: Dict[str, Any]):
   16: 
   17:         from rfc5424logging import Rfc5424SysLogHandler
   18: 
  -->          sh: Rfc5424SysLogHandler = Rfc5424SysLogHandler(
   20:             address=(conf["syslog_server"], conf["syslog_port"]),
   21:             socktype=getattr(socket, conf["syslog_stream"])

ERROR: Unable to parse file: /code/wpwatcher/daemon.py
ERROR: Parse error at line 28 column 21:

   25: = WPWatcherDaemonMode(conf)
   26:         self.pidfile = '/tmp/wpwatcher.daemon.pid.lock'
   27:         self.pidfilelock = FileLock(self.pidfile, timeout=1)
  -->          self._running: bool = False
   29:         self._stopping: bool = False
   30:         self._start_time: Optional[datetime] = None
   31: 
   32:     def loop(self,

ERROR: Unable to parse file: /code/wpwatcher/email.py
ERROR: Parse error at line 30 column 23:

   21: = "%Y-%m-%dT%H-%M-%S"
   22: 
   23: class EmailSender:
   24:     """
   25:     Handles the email nofification logic. 
   26:     """
   27: 
   28:     def __init__(self, conf: Dict[str, Any]):
   29: 
  -->          self.from_email: str = conf["from_email"]
   31:         self.smtp_server: str = conf["smtp_server"]
   32:         self.smtp_ssl: bool = conf["smtp_ssl"]
   33: 

ERROR: Unable to parse file: /code/wpwatcher/cli.py
ERROR: Parse error at line 25 column 8:

   18: 
   19: from wpscan_out_parse import format_results
   20: 
   21: 
   22: def main(_args: Optional[Sequence[Text]] = None) -> None:
   23:     """Main program entrypoint"""
   24: 
  -->      args: argparse.Namespace = get_arg_parser().parse_args(_args)
   26: 
   27: 
   28:     _init_log(args.verbose, args.quiet)
   29: 
   30: 
   31:     if args.template_conf:

ERROR: Unable to parse file: /code/wpwatcher/db.py
ERROR: Parse error at line 34 column 29:

   29: daemon: bool = False):
   30: 
   31:         if not filepath:
   32:             filepath = self._find_db_file(daemon=daemon)
   33: 
  -->          self.no_local_storage: bool = filepath == "null"
   35:         "True if the DB is disabled"
   36:         self.filepath = filepath
   37: 
   38:         self._data = ReportCollection()
   39:         self._data.extend(self

ERROR: Unable to parse file: /code/wpwatcher/wpscan.py
ERROR: Parse error at line 16 column 18:

    8: datetime, timedelta
    9: from wpwatcher import log
   10: from wpwatcher.utils import safe_log_wpscan_args, timeout
   11: 
   12: 
   13: API_WAIT_SLEEP = timedelta(hours=24)
   14: "24h"
   15: 
  -->  UPDATE_DB_INTERVAL: timedelta = timedelta(hours=1)
   17: "1h"
   18: 
   19: 
   20: INTERRUPT_TIMEOUT: int = 5
   21: "Send kill signal after 5 seconds when interrupting."
   22: 
   23: 
   24: class WPScanWrapper:
   25:     """
   26:     Process level wrapper for WPScan with a few additions: 
   27: 
   28:     - Auto-update the WPSCan database on interval 
   29:     - Supports multi-threading (update is done with a lock)
   30:     - Use a timeout for the scans, kills the process and raise error if reached
   31:     """
   32: 
   33: 
   34:     _NO_VAL = datetime

ERROR: Unable to parse file: /code/wpwatcher/config.py
ERROR: Parse error at line 29 column 17:

   13: .__version__ import __url__
   14: from wpwatcher.utils import parse_timedelta, safe_log_wpscan_args
   15: 
   16: 
   17: class Config(Dict[str, Any]): 
   18:     """
   19:     Dict-Like object.
   20: 
   21:     Use classmethods to create the config dict.
   22: 
   23:     Default values are applied to fields if not specified.
   24: 
   25:     If a value is deleted it will probably create a key error using `WPWatcher`.
   26:     """
   27: 
   28: 
  -->      TEMPLATE_FILE: str = """[wpwatcher]
   30: # WPWatcher configuration file
   31: # WordPress Watcher is a Python wrapper for WPScan that manages scans on multiple sites and reports by email
   32: # Options configurable with CLI args, see 'wpwatcher --help'
   33: # For more infos check %s
   34: 
   35: # WPScan configuration
   36: # wpscan_path=/usr/local/rvm/gems/default/wrappers/wpscan
   37: # wpscan_args=[ "--format", "json", "--random-user-agent" ]
   38: 
   39: # False positive string matches
   40: # false_positive_strings=["You can get a free API token with 50 daily requests by registering at https://wpvulndb.com/users/sign_up"]
   41: 
   42: # Sites (--url or --urls)
   43: # wp_sites=   [ {"url":"exemple.com"}, {"url":"exemple2.com"} ]
   44: 
   45: # Notifications (--send , --em , --infos , --errors , --attach , --resend)
   46: send_email_report=No
   47: email_to=["you@domain"]
   48: 
   49: # send_infos=Yes
   50: # send_errors=Yes
   51: # send_warnings=No
   52: # attach_wpscan_output=Yes
   53: # resend_emails_after=5d
   54: # email_errors_to=["admins@domain"]
   55: # use_monospace_font=Yes
   56: 
   57: # Email server settings
   58: from_email=WordPressWatcher@domain.com
   59: smtp_server=mailserver.de:587
   60: smtp_auth=Yes
   61: smtp_user=me@domain
   62: smtp_pass=P@assw0rd
   63: smtp_ssl=Yes
   64: 
   65: # Sleep when API limit reached (--wait)
   66: # api_limit_wait=Yes
   67: 
   68: # Daemon settings (recommended to use --daemon)
   69: # daemon=No
   70: # daemon_loop_sleep=12h
   71: 
   72: # Output (-q , -v)
   73: # log_file=/home/user/.wpwatcher/wpwatcher.log
   74: # quiet=Yes
   75: # verbose=Yes
   76: # wpscan_output_folder=/home/user/.wpwatcher/wpscan-results/
   77: 
   78: # Custom database (--reports)
   79: # wp_reports=/home/user/.wpwatcher/wp_reports.json
   80: 
   81: # Exit if any errors (--ff)
   82: # fail_fast=Yes 
   83: 
   84: # Number of asynchronous WPScan executions (--workers)
   85: # asynch_workers=5
   86: 
   87: # Follow main redirection when WPScan fails (--follow)
   88: # follow_redirect=Yes
   89: 
   90: # Scan timeout
   91: # scan_timeout=5m
   92: 
   93: # Syslog settings
   94: # syslog_server=
   95: # syslog_port=514
   96: # syslog_stream=SOCK_STREAM
   97: # syslog_kwargs={"enterprise_id":42, "msg_as_utf8":true, "utc_timestamp":true}
   98: 
   99: """ % (
  100:         __url__
  101:     )
  102: 
  103: 
  104:     DEFAULT_CONFIG: Dict[str, str] = {
  105:         "wp_sites": "null",
  106:         "false_positive_strings": "null",
  107:         "wpscan_path": "wpscan"

ERROR: Unable to parse file: /code/wpwatcher/core.py
ERROR: Parse error at line 59 column 23:

   54: =conf["verbose"], quiet=conf["quiet"], logfile=conf["log_file"])
   55: 
   56:         self._delete_tmp_wpscan_files()
   57: 
   58: 
  -->          self.wp_reports: DataBase = DataBase(filepath=conf["wp_reports"], daemon=conf['daemon'])
   60: 
   61: 
   62:         conf.update({"wp_reports": self.wp_reports

ERROR: Unable to parse file: /code/wpwatcher/site.py
ERROR: Parse error at line 18 column 16:

    5: .parse import urlparse
    6: from typing import Iterable, Dict, Any
    7: 
    8: 
    9: class Site(Dict[str, Any]):
   10:     """
   11:     Dict-Like object to store site config. 
   12: 
   13:     >>> Site(url="exemple.com", wpscan_args=["--verbose"])
   14:     {'url': 'http://exemple.com', 'wpscan_args': ['--verbose'], 'email_to': [], 'false_positive_strings': []}
   15:     
   16:     """
   17: 
  -->      DEFAULT_SITE: Dict[str, Any] = {
   19:         "url": "",
   20:         "email_to": [],
   21:         "false_positive_strings": [],
   22:         "wpscan_args": [],
   23:     }
   24: 

ERROR: Unable to parse file: /code/wpwatcher/utils.py
ERROR: Parse error at line 38 column 23:

   36:         def __init__(self, bucket: queue.Queue) -> None:                           
   37:             threading.Thread.__init__(self)
  -->              self.result: Any = None
   39:             self.bucket: queue.Queue = bucket                           
   40:             self.err: Optional[Exception] = None
   41: 
   42:         def run(

ERROR: Unable to parse file: /code/wpwatcher/report.py
ERROR: Parse error at line 29 column 18:

    6: from wpwatcher import log
    7: from wpscan_out_parse.parser.base import Parser
    8: class ScanReport(Dict[str, Any]):
    9:     """
   10:     Dict-Like object to store and process scan results.
   11: 
   12:     Keys:
   13: 
   14:     - "site"
   15:     - "status"
   16:     - "datetime"
   17:     - "last_email"
   18:     - "error"
   19:     - "infos"
   20:     - "warnings"
   21:     - "alerts"
   22:     - "fixed"
   23:     - "summary"
   24:     - "wpscan_output"
   25:     - "wpscan_parser"
   26: 
   27:     """
   28: 
  -->      DEFAULT_REPORT: Dict[str, Any] = {
   30:         "site": "",
   31:         "status": "",
   32:         "datetime": None,
   33:         "last_email": None,
   34:         "error": "",
   35:         "infos"

ERROR: Unable to parse file: /code/wpwatcher/scan.py
ERROR: Parse error at line 48 column 17:

   42: ["wpscan_path"],
   43:             scan_timeout=conf["scan_timeout"],
   44:             api_limit_wait=conf["api_limit_wait"],
   45:             follow_redirect=conf["follow_redirect"], )
   46: 
   47: 
  -->          self.mail: EmailSender = EmailSender(conf)
   49: 
   50: 
   51:         self.interrupting: bool = False
   52: 
   53:         self.scanned_sites: List[Optional[str]] = []

INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.868s
INFO: Final Memory: 6M/295M
INFO: ------------------------------------------------------------------------