CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/external/source/metsvc/test.rb
Views: 11766
1
#!/usr/bin/ruby
2
3
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib'))
4
5
require 'openssl'
6
require 'rex'
7
8
require 'rex/post/meterpreter'
9
10
ip = ARGV.shift() || exit
11
port = ARGV.shift() || 31337
12
13
if (ip == nil || port == nil)
14
puts "Syntax: test.rb <ip> [port]\n"
15
exit
16
end
17
18
sock = TCPSocket.new(ip, port)
19
20
puts "* Initializing Meterpreter"
21
22
meterp = Rex::Post::Meterpreter::Client.new(sock)
23
24
puts "* Loading Stdapi"
25
26
meterp.core.use('Stdapi')
27
28
puts "* System info:"
29
30
p meterp.sys.config.sysinfo
31
32
puts "* Closing socket"
33
34
meterp.sock.close
35
36