-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
21 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,69 @@ | ||
require 'socket' | ||
require 'ipaddr' | ||
require 'os' | ||
require 'colorize' | ||
require 'time' | ||
puts | ||
puts | ||
|
||
puts ''' | ||
▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄ | ||
█ █ █ █ █ █ █ █ █ | ||
█ █ ▄ █ █ █ █ █ ▄▄▄▄▄█▄ ▄█ | ||
█ █ █▄█ █ █ █ █ █ █▄▄▄▄▄ █ █ | ||
█ █ ▄▄▄█ █ █▄▄▄█ █▄▄▄▄▄ █ █ █ | ||
█ █ █ █ █ █▄▄▄▄▄█ █ █ █ | ||
█▄▄▄█▄▄▄█ █▄▄▄▄▄▄▄█▄▄▄█▄▄▄▄▄▄▄█ █▄▄▄█ | ||
▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄ | ||
█ █ █ █ █ █ █ █ █ | ||
█ █ ▄ █ █ █ █ █ ▄▄▄▄▄█▄ ▄█ | ||
█ █ █▄█ █ █ █ █ █ █▄▄▄▄▄ █ █ | ||
█ █ ▄▄▄█ █ █▄▄▄█ █▄▄▄▄▄ █ █ █ | ||
█ █ █ █ █ █▄▄▄▄▄█ █ █ █ | ||
█▄▄▄█▄▄▄█ █▄▄▄▄▄▄▄█▄▄▄█▄▄▄▄▄▄▄█ █▄▄▄█ | ||
∼∼https://github.com/suchsoak/IP_List_Ruby∼∼ | ||
suchsoak | ||
~~v:1.0.2~~ | ||
∼∼https://github.com/suchsoak/IP_List_Ruby∼∼ | ||
suchsoak | ||
~~v:1.0.3~~ | ||
''' .colorize(:blue) | ||
|
||
if OS.windows? | ||
puts | ||
puts "------------" | ||
puts "Put The IP" | ||
puts | ||
IP = gets.chomp | ||
puts | ||
puts "IP: #{IP}".colorize(:red) | ||
puts | ||
puts "IP: #{IP}".colorize(:blue) | ||
puts "------------" | ||
puts | ||
puts "Put The Final IP" | ||
puts | ||
IP_2 = gets.chomp | ||
puts | ||
puts "Final IP: #{IP_2}".colorize(:red) | ||
puts "Final IP: #{IP_2}".colorize(:blue) | ||
puts | ||
puts "------------" | ||
sleep(5) | ||
|
||
system("cls") | ||
|
||
def scan_ips(start_ip, end_ip, port_list) | ||
(IPAddr.new(start_ip)..IPAddr.new(end_ip)).each do |ips| | ||
port_list.each do |port| | ||
begin | ||
socket = TCPSocket.new(ips.to_s, port) | ||
puts "\t\t\t\t\t", "|#{ips}| \t |#{port}|".colorize(:green) | ||
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, IO::TimeoutError, IPAddr::InvalidAddressError | ||
rescue Interrupt | ||
service = get_service_name(port) | ||
puts "\t\t\t\t\t", "|#{ips}| \t |#{port}" "\t #{service}|".colorize(:green) | ||
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, IO::TimeoutError, IPAddr::InvalidAddressError | ||
rescue Interrupt | ||
puts "\nScript Interrupt".colorize(:red) | ||
exit | ||
end | ||
end | ||
end | ||
end | ||
|
||
#port_list = [1, 21, 22, 23, 25, 53, 80, 110, 135, 139, 143, 443, 445, 993, 995] | ||
port_list = 1..65535 | ||
|
||
puts | ||
|
||
scan_ips(IP, IP_2, port_list) | ||
|
||
elsif OS.linux? | ||
puts "------------" | ||
puts "Put The IP" | ||
puts | ||
IP = gets.chomp | ||
puts | ||
puts "IP: #{IP}".colorize(:red) | ||
puts | ||
puts "------------" | ||
puts "Put The Final IP" | ||
puts | ||
IP_2 = gets.chomp | ||
puts | ||
puts "Final IP: #{IP_2}".colorize(:red) | ||
puts | ||
puts "------------" | ||
sleep(5) | ||
|
||
system("clear") | ||
|
||
def scan_ips(start_ip, end_ip, port_list) | ||
(IPAddr.new(start_ip)..IPAddr.new(end_ip)).each do |ips| | ||
port_list.each do |port| | ||
begin | ||
socket = TCPSocket.new(ips.to_s, port) | ||
puts "\t\t\t\t\t", "|#{ips}| \t |#{port}|".colorize(:green) | ||
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, IO::TimeoutError, IPAddr::InvalidAddressError | ||
rescue Interrupt | ||
def get_service_name(port) | ||
`getent services #{port}`.strip.split(' ')[0] | ||
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, IO::TimeoutError, IPAddr::InvalidAddressError | ||
rescue Interrupt | ||
puts "\nScript Interrupt".colorize(:red) | ||
exit | ||
end | ||
end | ||
end | ||
end | ||
|
||
#port_list = [1, 21, 22, 23, 25, 53, 80, 110, 135, 139, 143, 443, 445, 993, 995] | ||
port_list = 1..65535 | ||
|
||
puts | ||
|
||
scan_ips(IP, IP_2, port_list) | ||
else | ||
puts "Operating system does not support!" | ||
end |