Adds -u to the connect command
git-svn-id: file:///home/svn/framework3/trunk@9788 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
a5786cdc64
commit
37f4783d55
|
@ -55,6 +55,7 @@ class Core
|
||||||
"-P" => [ true, "Specify source port." ],
|
"-P" => [ true, "Specify source port." ],
|
||||||
"-S" => [ true, "Specify source address." ],
|
"-S" => [ true, "Specify source address." ],
|
||||||
"-s" => [ false, "Connect with SSL." ],
|
"-s" => [ false, "Connect with SSL." ],
|
||||||
|
"-u" => [ false, "Switch to a UDP socket." ],
|
||||||
"-w" => [ true, "Specify connect timeout." ],
|
"-w" => [ true, "Specify connect timeout." ],
|
||||||
"-z" => [ false, "Just try to connect, then return." ])
|
"-z" => [ false, "Just try to connect, then return." ])
|
||||||
|
|
||||||
|
@ -258,6 +259,7 @@ class Core
|
||||||
srcaddr = nil
|
srcaddr = nil
|
||||||
srcport = nil
|
srcport = nil
|
||||||
ssl = false
|
ssl = false
|
||||||
|
udp = false
|
||||||
cto = nil
|
cto = nil
|
||||||
justconn = false
|
justconn = false
|
||||||
aidx = 0
|
aidx = 0
|
||||||
|
@ -288,6 +290,9 @@ class Core
|
||||||
when "-w"
|
when "-w"
|
||||||
cto = val.to_i
|
cto = val.to_i
|
||||||
aidx = idx + 2
|
aidx = idx + 2
|
||||||
|
when "-u"
|
||||||
|
udp = true
|
||||||
|
aidx = idx + 1
|
||||||
when "-z"
|
when "-z"
|
||||||
justconn = true
|
justconn = true
|
||||||
aidx = idx + 1
|
aidx = idx + 1
|
||||||
|
@ -341,7 +346,8 @@ class Core
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
sock = Rex::Socket::Tcp.create({
|
klass = udp ? ::Rex::Socket::Udp : ::Rex::Socket::Tcp
|
||||||
|
sock = klass.create({
|
||||||
'Comm' => comm,
|
'Comm' => comm,
|
||||||
'Proxies' => proxies,
|
'Proxies' => proxies,
|
||||||
'SSL' => ssl,
|
'SSL' => ssl,
|
||||||
|
@ -388,7 +394,7 @@ class Core
|
||||||
end
|
end
|
||||||
|
|
||||||
# Network -> Console
|
# Network -> Console
|
||||||
n2c = Thread.new(sock, cout, c2n) do |input, output, cthr|
|
n2c = ::Thread.new(sock, cout, c2n) do |input, output, cthr|
|
||||||
while true
|
while true
|
||||||
begin
|
begin
|
||||||
res = input.read(65535)
|
res = input.read(65535)
|
||||||
|
@ -404,12 +410,13 @@ class Core
|
||||||
|
|
||||||
c2n.join
|
c2n.join
|
||||||
|
|
||||||
rescue Interrupt
|
rescue ::Interrupt
|
||||||
c2n.kill
|
c2n.kill
|
||||||
n2c.kill
|
n2c.kill
|
||||||
end
|
end
|
||||||
|
|
||||||
sock.close if not sock.closed?
|
|
||||||
|
sock.close rescue nil
|
||||||
infile.close if infile
|
infile.close if infile
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
Loading…
Reference in New Issue