403Webshell
Server IP : 39.106.62.82  /  Your IP : 216.73.217.128
Web Server : nginx/1.14.1
System : Linux iz2ze1m0zmp2dk5c3j5ap5z 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /bin/mysqlmetagrep
#!/usr/bin/python
#
# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#

"""
This file contains the metagrep utility which allows users to search metadata.
"""

import os.path
import re
import sys

from mysql.utilities.common.tools import check_python_version
from mysql.utilities.command.grep import ObjectGrep, OBJECT_TYPES
from mysql.utilities.common.tools import check_connector_python
from mysql.utilities.common.options import (add_regexp, setup_common_options,
                                            add_format_option,
                                            add_character_set_option,
                                            get_ssl_dict,
                                            check_password_security)
from mysql.utilities.exception import UtilError

# Check Python version compatibility
check_python_version()

# Check for connector/python
if not check_connector_python():
    sys.exit(1)

if __name__ == '__main__':
    # Setup the command parser and setup server, help
    parser = setup_common_options(os.path.basename(sys.argv[0]),
                                  "mysqlmetagrep - search metadata",
                                  "%prog --server=user:pass@host:port:socket "
                                  "[options] pattern", True)

    # Add character set option
    add_character_set_option(parser)

    # Setup utility-specific options:
    parser.add_option("-b", "--body",
                      dest="check_body", action="store_true", default=False,
                      help="search the body of routines, triggers, and "
                           "events as well")

    def quote(string):
        """Quote a string
        """
        return "'" + string + "'"

    # Add some more advanced parsing here to handle types better.
    parser.add_option(
        '--search-objects', '--object-types',
        dest="object_types", default=','.join(OBJECT_TYPES),
        help=("the object type to search in: a comma-separated list of one or "
              "more of: {0}".format(', '.join([quote(obj_type)
                                               for obj_type in OBJECT_TYPES])))
    )

    # Add regexp
    add_regexp(parser)

    parser.add_option(
        "-p", "--print-sql", "--sql",
        dest="print_sql", action="store_true", default=False,
        help="print the statement instead of sending it to the server")
    parser.add_option(
        "-e", "--pattern",
        dest="pattern",
        help="pattern to use when matching. Required if the pattern looks "
             "like a connection specification.")
    parser.add_option(
        "--database",
        dest="database_pattern", default=None,
        help="only look at objects in databases matching this pattern")

    # Output format
    add_format_option(parser, "display the output in either grid (default), "
                      "tab, csv, or vertical format", "grid")

    options, args = parser.parse_args()

    # Check security settings
    check_password_security(options, args)

    _LOOKS_LIKE_CONNECTION_MSG = """Pattern '{pattern}' looks like a
    connection specification. Use --pattern if this is really what you
    want"""

    _AT_LEAST_ONE_SERVER_MSG = """You need at least one server if you're
    not using the --sql option"""

    _NO_SERVERS_ALLOWED_MSG = """You should not include servers in the
    call if you are using the --sql option"""

    # A --pattern is required.
    if not options.pattern:
        parser.error("No pattern supplied.")

    # Check that --sql option is not used with --server, and --server are
    # supplied if --sql is not used.
    if options.print_sql:
        if options.server is not None and len(options.server) > 0:
            parser.error(_NO_SERVERS_ALLOWED_MSG)
    else:
        if options.server is None or len(options.server) == 0:
            parser.error(_AT_LEAST_ONE_SERVER_MSG)

    object_types = re.split(r"\s*,\s*", options.object_types)

    try:
        command = ObjectGrep(options.pattern, options.database_pattern,
                             object_types, options.check_body,
                             options.use_regexp)
        if options.print_sql:
            print(command.sql())
        else:
            ssl_opts = get_ssl_dict(options)
            command.execute(options.server, format=options.format,
                            charset=options.charset, ssl_opts=ssl_opts)
    except UtilError:
        _, err, _ = sys.exc_info()
        sys.stderr.write("ERROR: {0}\n".format(err.errmsg))
        sys.exit(1)
    except:
        _, details, _ = sys.exc_info()
        sys.stderr.write("ERROR: {0}\n".format(details))
        sys.exit(1)

    sys.exit()

Youez - 2016 - github.com/yon3zu
LinuXploit