# Path: mwscan/settings.py
# CACHEDIR = os.path.expanduser('~/.cache/mwscan')
# LAST_RUN_FILE = os.path.join(CACHEDIR, 'last_run')
# DEFAULT_EXCLUDEFILE = os.path.expanduser('~/.config/mwscan/excludes')
# CODE_EXT = ('php', 'phtml', 'js', 'jsx', 'html', 'php3', 'php4', 'php5', 'php7', 'sh', 'ini')
# 
# Path: mwscan/ruleset.py
# def strip_last_url_path(url):
# def last_url_path(url):
#     def __init__(self, **kwargs):
#     def find_whitelist_in_rawrules(self, rawrules):
#     def get_rules(self):
#     def get_whitelist(self):
#     def transform_rules(self, rawrules):
#     def _get_cache_filename(self, url):
#     def _get_cache_timestamp_content(self, cachefile):
#     def _httpget(self, url):
#     def get(self):
#     def _recursive_fetch(self, url):
#         def include(match):
#     def get_rules(self):
#     def transform_rules(self, rawrules):
# class RulesProvider:
# class Files(RulesProvider):
# class NBS(RulesProvider):
# class Magemojo(RulesProvider):
# class Magesec(RulesProvider):
# class Mwscan(RulesProvider):
# class MageHost(RulesProvider):


import os
import re
import sys
import argparse
import logging
import hashlib
    import psutil
from functools import partial
from mwscan import settings
from mwscan.ruleset import providers

    if args.whitelist:
        with open(args.whitelist) as fh:
            whitelist.update(re.findall('[a-z0-9]{40}', fh.read()))

    logging.debug("Loaded {0} yara rules and {1} whitelist entries".format(
        len(list(iter(rules))),
        len(whitelist),
    ))

    exclude_patterns = load_exclude_patterns(args.excludefile)

    excluded_last=None
    if args.newonly:
        excluded_last=load_last_run_results(args.path)

    find_cb = partial(log_find, excluded=excluded_last, show_sha1=args.checksum)

    targets = find_targets(args.path,
        required_extensions=args.req_ext,
        exclude_patterns=exclude_patterns,
        follow_symlinks=args.followsymlinks
        )

    infected, whitelisted = scan_files(targets, rules, whitelist, find_cb)

    if args.newonly:
        write_last_run_results(args.path, infected)



# Path: mwscan/settings.py
# CACHEDIR = os.path.expanduser('~/.cache/mwscan')
# LAST_RUN_FILE = os.path.join(CACHEDIR, 'last_run')
# DEFAULT_EXCLUDEFILE = os.path.expanduser('~/.config/mwscan/excludes')
# CODE_EXT = ('php', 'phtml', 'js', 'jsx', 'html', 'php3', 'php4', 'php5', 'php7', 'sh', 'ini')
# 
# Path: mwscan/ruleset.py
# def strip_last_url_path(url):
# def last_url_path(url):
#     def __init__(self, **kwargs):
#     def find_whitelist_in_rawrules(self, rawrules):
#     def get_rules(self):
#     def get_whitelist(self):
#     def transform_rules(self, rawrules):
#     def _get_cache_filename(self, url):
#     def _get_cache_timestamp_content(self, cachefile):
#     def _httpget(self, url):
#     def get(self):
#     def _recursive_fetch(self, url):
#         def include(match):
#     def get_rules(self):
#     def transform_rules(self, rawrules):
# class RulesProvider:
# class Files(RulesProvider):
# class NBS(RulesProvider):
# class Magemojo(RulesProvider):
# class Magesec(RulesProvider):
# class Mwscan(RulesProvider):
# class MageHost(RulesProvider):


# Path: mwscan/scan.py
import os
import re
import sys
import argparse
import logging
import hashlib
    import psutil
from functools import partial
from mwscan import settings
from mwscan.ruleset import providers


    if args.whitelist:
        with open(args.whitelist) as fh:
            whitelist.update(re.findall('[a-z0-9]{40}', fh.read()))

    logging.debug("Loaded {0} yara rules and {1} whitelist entries".format(
        len(list(iter(rules))),
        len(whitelist),
    ))

    exclude_patterns = load_exclude_patterns(args.excludefile)

    excluded_last=None
    if args.newonly:
        excluded_last=load_last_run_results(args.path)

    find_cb = partial(log_find, excluded=excluded_last, show_sha1=args.checksum)

    targets = find_targets(args.path,
        required_extensions=args.req_ext,
        exclude_patterns=exclude_patterns,
        follow_symlinks=args.followsymlinks
        )

    infected, whitelisted = scan_files(targets, rules, whitelist, find_cb)

    if args.newonly:
        write_last_run_results(args.path, infected)



if __name__ == '__main__':