-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathip.rb
53 lines (49 loc) · 1.87 KB
/
ip.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#! /usr/bin/env ruby
require "net/http"
require "json"
class String
def red; "\e[31m#{self}\e[0m" end
def green; "\e[32m#{self}\e[0m" end
def brown; "\e[33m#{self}\e[0m" end
def blue; "\e[34m#{self}\e[0m" end
def magenta; "\e[35m#{self}\e[0m" end
def cyan; "\e[36m#{self}\e[0m" end
def gray; "\e[37m#{self}\e[0m" end
end
if nil != ARGV[0]
ip = ARGV[0]
p ip
url = URI.parse("http://ip-api.com/json/#{ip}")
req = Net::HTTP::Get.new(url.to_s)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
re1 = JSON.parse(res.body)
re1.each_pair do |shark, index|
puts "[+] ".green+"#{shark} ".magenta+"=> #{index}".cyan
sleep 0.2
end
else
system("cls")
puts '''
-------- ----------- -------- ---- ---- ------------ --------
******** ************ ******** ***** **** ************ **********
---- --- --- ---- ------ ---- ---- ---- ----
**** ************ **** ************ ************ *** ***
---- ----------- ---- ------------ ------------ --- ---
**** **** **** **** ****** **** **** ****
-------- ---- -------- ---- ----- ---- ----------
******** **** ******** **** **** **** ******** '''.cyan
print "\n Enter Your ip Target : ".green
ip = $stdin.gets.chomp
url = URI.parse("http://ip-api.com/json/#{ip}")
req = Net::HTTP::Get.new(url.to_s)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
re1 = JSON.parse(res.body)
re1.each_pair do |shark, index|
puts "[+] ".green+"#{shark} ".magenta+"=> #{index}".cyan
sleep 0.2
end
end