Friday, December 04, 2009

metasploit xmlrpc stub

# xmlrpc interface to metasploit

import xmlrpclib
import socket
import telnetlib
from xml.dom import minidom

tn = telnetlib.Telnet("127.0.0.1",55553)
s = tn.get_socket()

params = ( 'msf', 'test' )
tuple_params = tuple([params])

xmlrpccall = xmlrpclib.dumps(params, 'auth.login',None,'UTF-8')
i = xmlrpccall.replace('\n','')

tn.write(i+"\n\0")
data = s.recv(2048)

data = data.replace('\n\0','')
#print data
n = minidom.parseString(data)


print n.toxml()
print n.childNodes[0].toxml()
print n.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[1].childNodes[0].firstChild.data

No comments: