asked on
#!/usr/bin/ruby
require 'rubygems'
require 'socket'
require 'net/ssh'
$file = ARGV[0]
$port = ARGV[1]
$address = ""
$result = ""
if ARGV.length != 2
puts "Usage: #{$0} <ip address list file> <port>"
exit 0
end
if !($file && FileTest.exists?("#{$file}"))
puts "Invalid input filename detected."
puts "Please ensure the filename is correct, the file exists, and is not just a single IP address."
exit 1
end
File.open("#{$file}", "r") do |infile|
while (line = infile.gets)
if line =~ /(\b(?:\d{1,3}\.){3}\d{1,3}\b)/
$address = line.chomp!
end
begin
t = TCPSocket.open("#{$address}", "#{$port}")
rescue
puts "#{$address}:#{$port} -- closed"
next
else
puts "#{$address}:#{$port} -- open"
t.close
end
cmd = "./findrpc #{$address} | grep #{$port}"
$result = `"#{cmd}"`
puts "#{$result}"
end
infile.close
end
ASKER
ASKER
ASKER
#! /usr/bin/perl
print "192.168.49.5:135"
ASKER
Software is any set of instructions that directs a computer to perform specific tasks or operations. Computer software consists of programs, libraries and related non-executable data (such as documentation). Computer software is non-tangible, contrasted with computer hardware, which is the physical component of computers. Software written in a machine language is known as "machine code". However, in practice, software is usually written in high-level programming languages than machine language. High-level languages are translated into machine language using a compiler or interpreter or a combination of the two.
TRUSTED BY