Created
July 18, 2018 23:46
-
-
Save silverNitrateIon/08a318a60965909a1ce5f3c1608e0e49 to your computer and use it in GitHub Desktop.
Ruby Network Security Tool
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
#!/usr/bin/env ruby | |
require 'socket' | |
loop { | |
puts " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= " | |
puts "Network Hacking Tool" | |
puts "Press 1 to initialize a honeypot server" | |
puts "Press 2 to run a port scan against a host" | |
puts "Press 99 to exit program" | |
print ">>> " | |
yes_no = gets.chomp | |
case yes_no | |
when "1" | |
system("clear") | |
puts " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= " | |
puts " Server Online " | |
puts " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= " | |
sleep(5) | |
system("clear") | |
server = TCPServer.new 80 | |
file = File.read('index.html') | |
while session = server.accept | |
session.puts file | |
puts " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= " | |
reciv = session.recv(1000).to_s | |
remotePort, remoteIp = Socket.unpack_sockaddr_in(session.getpeername) | |
puts "User IP --> ""#{remoteIp}" | |
puts "User's Port --> " "#{remotePort}" | |
puts reciv | |
session.close | |
end | |
when "2" | |
system("clear") | |
puts "This is NOT a range scanner!" | |
puts "=-=-=-=-=-=-=-=-=-=-=-" | |
puts "Enter the host target" | |
print ">>> " | |
host_target = gets.chomp | |
puts "Enter target port" | |
print ">>> " | |
port_target = gets.chomp | |
port = ARGV[0] || port_target | |
host = ARGV[1] || host_target | |
begin | |
socket = TCPSocket.new(host, port) | |
status = "open" | |
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT | |
status = "closed" | |
end | |
puts "Port #{port} is #{status}. " | |
when "99" | |
abort("Good Bye!") | |
end | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment