PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /opt/sharedrads/oldrads/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : //opt/sharedrads/oldrads/string_search_url |
#!/opt/imh-python/bin/python3 """Scan for first mention of string from URL, including scripts and databases""" import sys import logging from argparse import ArgumentParser from strace_tools import strace_url import rads __author__ = "Daniel K" __email__ = "danielk@inmotionhosting.com" LOGGER = logging.getLogger(__name__) TEXT = "" def set_logging(is_quiet, verbosity, output_file): '''Setup the logging in a separate function''' if is_quiet: logging_level = logging.CRITICAL else: if verbosity is None: logging_level = logging.ERROR elif 1 == verbosity: logging_level = logging.WARNING elif 2 == verbosity: logging_level = logging.INFO elif 3 == verbosity: logging_level = logging.DEBUG else: logging_level = logging.DEBUG if output_file: rads.setup_logging(path=output_file, loglevel=logging_level) else: rads.setup_logging( path=None, loglevel=logging_level, print_out=sys.stderr ) def parse_args(): '''Parse command line arguments''' parser = ArgumentParser(description=__doc__) parser.add_argument( "-v", "--verbose", action='count', help="Print verbose output. May be added multiple times.", ) parser.add_argument( "-q", "--quiet", action='store_true', help="Do not output logging. Overrides -v.", ) parser.add_argument( "-o", "--output", action='store', type=str, default=None, help="Output logging to the specified file.", ) parser.add_argument( 'search', metavar='SEARCH', type=str, help="String to search for." ) parser.add_argument('url', metavar='URL', type=str, help="URL to scan.") args = parser.parse_args() if args.url is None: print("URL not given") sys.exit(1) set_logging(args.quiet, args.verbose, args.output) return args.search, args.url def search_for_text(command, line, strace_handler, additional_data=None): '''Search for string in data''' if 'data' in additional_data: if TEXT in additional_data['data']: print(additional_data['filename']) def main(): '''Main function for scan_url''' (search, url) = parse_args() callbacks = {} global TEXT TEXT = search callbacks['read'] = search_for_text callbacks['write'] = search_for_text for result in strace_url(url, callbacks, False): if result is not None: print(result) if __name__ == "__main__": main()