當前位置: 首頁>>代碼示例>>Python>>正文


Python tds.MSSQL屬性代碼示例

本文整理匯總了Python中impacket.tds.MSSQL屬性的典型用法代碼示例。如果您正苦於以下問題:Python tds.MSSQL屬性的具體用法?Python tds.MSSQL怎麽用?Python tds.MSSQL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在impacket.tds的用法示例。


在下文中一共展示了tds.MSSQL屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: proto_args

# 需要導入模塊: from impacket import tds [as 別名]
# 或者: from impacket.tds import MSSQL [as 別名]
def proto_args(parser, std_parser, module_parser):
        mssql_parser = parser.add_parser('mssql', help="own stuff using MSSQL", parents=[std_parser, module_parser])
        dgroup = mssql_parser.add_mutually_exclusive_group()
        dgroup.add_argument("-d", metavar="DOMAIN", dest='domain', type=str, help="domain name")
        dgroup.add_argument("--local-auth", action='store_true', help='authenticate locally to each target')
        mssql_parser.add_argument("-H", '--hash', metavar="HASH", dest='hash', nargs='+', default=[], help='NTLM hash(es) or file(s) containing NTLM hashes')
        mssql_parser.add_argument("--port", default=1433, type=int, metavar='PORT', help='MSSQL port (default: 1433)')
        mssql_parser.add_argument("-q", "--query", dest='mssql_query', metavar='QUERY', type=str, help='execute the specified query against the MSSQL DB')
        mssql_parser.add_argument("-a", "--auth-type", choices={'windows', 'normal'}, default='windows', help='MSSQL authentication type to use (default: windows)')
        mssql_parser.add_argument("--no-bruteforce", action='store_true', help='No spray when using file for username and password (user1 => password1, user2 => password2')
        mssql_parser.add_argument("--continue-on-success", action='store_true', help="continues authentication attempts even after successes")

        cgroup = mssql_parser.add_argument_group("Command Execution", "options for executing commands")
        cgroup.add_argument('--force-ps32', action='store_true', help='force the PowerShell command to run in a 32-bit process')
        cgroup.add_argument('--no-output', action='store_true', help='do not retrieve command output')
        xgroup = cgroup.add_mutually_exclusive_group()
        xgroup.add_argument("-x", metavar="COMMAND", dest='execute', help="execute the specified command")
        xgroup.add_argument("-X", metavar="PS_COMMAND", dest='ps_execute', help='execute the specified PowerShell command')

        psgroup = mssql_parser.add_argument_group('Powershell Obfuscation', "Options for PowerShell script obfuscation")
        psgroup.add_argument('--obfs', action='store_true', help='Obfuscate PowerShell scripts')
        psgroup.add_argument('--clear-obfscripts', action='store_true', help='Clear all cached obfuscated PowerShell scripts')

        return parser 
開發者ID:byt3bl33d3r,項目名稱:CrackMapExec,代碼行數:26,代碼來源:mssql.py

示例2: execute

# 需要導入模塊: from impacket import tds [as 別名]
# 或者: from impacket.tds import MSSQL [as 別名]
def execute(self, host, port='3306', user='', password='', query='select @@version'):

    fp, _ = self.bind(host, port, user, password)

    with Timing() as timing:
      fp.query(query)

    rs = fp.store_result()
    rows = rs.fetch_row(10, 0)

    code, mesg = '0', '\n'.join(', '.join(map(str, r)) for r in filter(any, rows))
    return self.Response(code, mesg, timing)

# }}}

# MSSQL {{{
# I did not use pymssql because neither version 1.x nor 2.0.0b1_dev were multithreads safe (they all segfault) 
開發者ID:lanjelot,項目名稱:patator,代碼行數:19,代碼來源:patator.py

示例3: __init__

# 需要導入模塊: from impacket import tds [as 別名]
# 或者: from impacket.tds import MSSQL [as 別名]
def __init__(self, address, port=1433, rowsPrinter=DummyPrint()):
        tds.MSSQL.__init__(self,address, port, rowsPrinter)
        self.resp = None 
開發者ID:joxeankoret,項目名稱:CVE-2017-7494,代碼行數:5,代碼來源:mssqlrelayclient.py

示例4: proto_logger

# 需要導入模塊: from impacket import tds [as 別名]
# 或者: from impacket.tds import MSSQL [as 別名]
def proto_logger(self):
        self.logger = CMEAdapter(extra={
                                        'protocol': 'MSSQL',
                                        'host': self.host,
                                        'port': self.args.port,
                                        'hostname': 'None'
                                        }) 
開發者ID:byt3bl33d3r,項目名稱:CrackMapExec,代碼行數:9,代碼來源:mssql.py

示例5: print_host_info

# 需要導入模塊: from impacket import tds [as 別名]
# 或者: from impacket.tds import MSSQL [as 別名]
def print_host_info(self):
        if len(self.mssql_instances) > 0:
            self.logger.info("MSSQL DB Instances: {}".format(len(self.mssql_instances)))
            for i, instance in enumerate(self.mssql_instances):
                self.logger.highlight("Instance {}".format(i))
                for key in instance.keys():
                    self.logger.highlight(key + ":" + instance[key]) 
開發者ID:byt3bl33d3r,項目名稱:CrackMapExec,代碼行數:9,代碼來源:mssql.py

示例6: create_conn_obj

# 需要導入模塊: from impacket import tds [as 別名]
# 或者: from impacket.tds import MSSQL [as 別名]
def create_conn_obj(self):
        try:
            self.conn = tds.MSSQL(self.host, self.args.port, rowsPrinter=self.logger)
            self.conn.connect()
        except socket.error:
            return False

        return True 
開發者ID:byt3bl33d3r,項目名稱:CrackMapExec,代碼行數:10,代碼來源:mssql.py


注:本文中的impacket.tds.MSSQL屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。