Adds -u to the connect command

git-svn-id: file:///home/svn/framework3/trunk@9788 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-07-12 03:15:45 +00:00
parent a5786cdc64
commit 37f4783d55
1 changed files with 16 additions and 9 deletions

View File

@ -55,6 +55,7 @@ class Core
"-P" => [ true, "Specify source port." ],
"-S" => [ true, "Specify source address." ],
"-s" => [ false, "Connect with SSL." ],
"-u" => [ false, "Switch to a UDP socket." ],
"-w" => [ true, "Specify connect timeout." ],
"-z" => [ false, "Just try to connect, then return." ])
@ -258,6 +259,7 @@ class Core
srcaddr = nil
srcport = nil
ssl = false
udp = false
cto = nil
justconn = false
aidx = 0
@ -288,6 +290,9 @@ class Core
when "-w"
cto = val.to_i
aidx = idx + 2
when "-u"
udp = true
aidx = idx + 1
when "-z"
justconn = true
aidx = idx + 1
@ -341,7 +346,8 @@ class Core
end
begin
sock = Rex::Socket::Tcp.create({
klass = udp ? ::Rex::Socket::Udp : ::Rex::Socket::Tcp
sock = klass.create({
'Comm' => comm,
'Proxies' => proxies,
'SSL' => ssl,
@ -388,7 +394,7 @@ class Core
end
# Network -> Console
n2c = Thread.new(sock, cout, c2n) do |input, output, cthr|
n2c = ::Thread.new(sock, cout, c2n) do |input, output, cthr|
while true
begin
res = input.read(65535)
@ -404,12 +410,13 @@ class Core
c2n.join
rescue Interrupt
rescue ::Interrupt
c2n.kill
n2c.kill
end
sock.close if not sock.closed?
sock.close rescue nil
infile.close if infile
true