2005-12-17 06:46:23 +00:00
|
|
|
#!/usr/bin/env ruby -I. -I../../lib
|
2005-04-21 06:32:24 +00:00
|
|
|
|
|
|
|
require 'DemoClient'
|
|
|
|
require 'Rex/Socket/Parameters'
|
|
|
|
|
|
|
|
host = ARGV[0] || '127.0.0.1'
|
|
|
|
port = ARGV[1] || '12345'
|
|
|
|
client = DemoClient.new(host, port).client
|
|
|
|
|
|
|
|
# Create a parameter representation class based on the perl-style hash
|
|
|
|
# elements
|
|
|
|
params = Rex::Socket::Parameters.new(
|
|
|
|
'PeerHost' => '128.242.160.3',
|
2005-04-22 03:42:23 +00:00
|
|
|
'PeerPort' => 25,
|
2005-04-21 06:32:24 +00:00
|
|
|
'Proto' => 'tcp')
|
|
|
|
|
|
|
|
# Create the socket for this connection
|
|
|
|
socket = client.net.socket.create(params)
|
|
|
|
|
|
|
|
# Send GET / HTTP/1.0
|
2005-04-22 03:42:23 +00:00
|
|
|
socket.send("HELO hick.org\r\n")
|
2005-04-21 06:32:24 +00:00
|
|
|
|
2005-04-22 03:42:23 +00:00
|
|
|
data = socket.recv
|
|
|
|
|
|
|
|
puts "#{data}"
|
|
|
|
|
|
|
|
socket.send("QUIT\r\n")
|
|
|
|
|
|
|
|
socket.sock.shutdown(1)
|
|
|
|
|
|
|
|
while ((data = socket.recv) != nil)
|
2005-04-21 06:32:24 +00:00
|
|
|
puts "#{data}"
|
|
|
|
end
|
|
|
|
|
2005-04-22 03:42:23 +00:00
|
|
|
puts "Finished"
|
|
|
|
|
|
|
|
#while (1)
|
|
|
|
# select nil, nil, nil, 5
|
|
|
|
#end
|