1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-09-18 14:00:12 +02:00
metasploit-framework/dev/meterpreter/demo_socket.rb
Matt Miller 42e9b0945e added shutdown, tcp seems to work like a chizzamp
git-svn-id: file:///home/svn/incoming/trunk@2441 4d416f70-5f16-0410-b530-b9f4589650da
2005-04-22 03:42:23 +00:00

40 lines
729 B
Ruby
Executable File

#!/usr/bin/ruby -I. -I../../lib
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',
'PeerPort' => 25,
'Proto' => 'tcp')
# Create the socket for this connection
socket = client.net.socket.create(params)
# Send GET / HTTP/1.0
socket.send("HELO hick.org\r\n")
data = socket.recv
puts "#{data}"
socket.send("QUIT\r\n")
socket.sock.shutdown(1)
while ((data = socket.recv) != nil)
puts "#{data}"
end
puts "Finished"
#while (1)
# select nil, nil, nil, 5
#end