from requests import get
import json
class colors:
BLACK = "\033[0;30m"
RED = "\033[0;31m"
GREEN = "\033[0;32m"
BROWN = "\033[0;33m"
BLUE = "\033[0;34m"
PURPLE = "\033[0;35m"
CYAN = "\033[0;36m"
LIGHT_GRAY = "\033[0;37m"
DARK_GRAY = "\033[1;30m"
LIGHT_RED = "\033[1;31m"
LIGHT_GREEN = "\033[1;32m"
YELLOW = "\033[1;33m"
LIGHT_BLUE = "\033[1;34m"
LIGHT_PURPLE = "\033[1;35m"
LIGHT_CYAN = "\033[1;36m"
LIGHT_WHITE = "\033[1;37m"
BOLD = "\033[1m"
FAINT = "\033[2m"
ITALIC = "\033[3m"
UNDERLINE = "\033[4m"
BLINK = "\033[5m"
NEGATIVE = "\033[7m"
CROSSED = "\033[9m"
END = "\033[0m"
ESC = '\x1b'
url = 'http://ipinfo.io/json'
response = get(url)
data = json.loads(response.text)
city = data['city']
region = data['region']
country = data['country']
organization = data['org']
timezone = data['timezone']
ip = data['ip']
#print(RED+BOLD+"IP:", BLACK+ip)
#print(RED+BOLD+"City:", BLACK+city)
#print(RED+BOLD+"Region:", BLACK+region),
#print(RED+BOLD+"Country:", BLACK+country)
#print(RED+BOLD+"Organization:", BLACK+organization)
#print(RED+BOLD+"Timezone:", BLACK+timezone)
import requests
from bs4 import BeautifulSoup
import sys
import os
from datetime import datetime
def validIPAddress(IP):
"""
:type IP: str
:rtype: str
"""
def isIPv4(s):
try:
return str(int(s)) == s and 0 <= int(s) <= 255
except:
return False
def isIPv6(s):
if len(s) > 4:
return False
try:
return int(s, 16) >= 0 and s[0] != '-'
except:
return False
if IP.count(".") == 3 and all(isIPv4(i) for i in IP.split(".")):
return "IPv4"
if IP.count(":") == 7 and all(isIPv6(i) for i in IP.split(":")):
return "IPv6"
return "Neither"
reqview = requests.get('http://ip-api.com/json/').json()
ipsaya = reqview['query']
isp = reqview['as']
country = reqview['country']
region_name = reqview['regionName']
city = reqview['city']
timezone = reqview['timezone']
endpoint = f"https://scamalytics.com/ip/{ipsaya}"
IPresult = validIPAddress(f"{ipsaya}")
try:
r = requests.get(endpoint)
htmlresponse = r.text
soup = BeautifulSoup(htmlresponse, 'html.parser')
coderet = soup.find_all(class_="panel_title high_risk")
finalstuff = str(coderet)
amb = str(finalstuff.split("">")[1].split("</")[0])
coderet = str(soup.find_all(class_="panel_body"))
coderet1 = str(soup.find_all(class_="score"))
print('=====================================')
print('\033[1;31mIP Address Fraud Info\033[0;0m')
print('=====================================')
print('\033[1;31mIP\t\033[0;0m: ' + ipsaya)
print('\033[1;31mISP\t\033[0;0m: ' + isp)
print('\033[1;31mCity\t\033[0;0m: ' + city)
print('\033[1;31mRegion\t\033[0;0m: ' + region_name)
print('\033[1;31mCountry\t\033[0;0m: ' + country)
print('\033[1;31mTimezone\033[0;0m: ' + timezone)
print('=====================================')
print('\033[1;31mFraud Info\033[0;0m')
print(amb + ' ' + coderet1.replace('[<div class="score">','').replace('</div>]','/100'))
print("")
except:
try:
if (finalstuff.find("private IP address.")):
print("The IP Address you provided is local and not a public one. Please refer to https://www.h3xed.com/web-and-internet/whats-the-difference-between-external-and-local-ip-addresses for more info")
else:
print("Connection Error, This program needs internet to function.")
except:
print("Unknown Error Occurred, Possibly Network Restrictions.")
output script diatas sebagai berikut
=====================================
IP Address Fraud Info
IP : 34.90.112.156
ISP : AS396982 Google LLC
City : Groningen
Region : Groningen
Country : Netherlands
Timezone: Europe/Amsterdam
Fraud Info
Low Risk Fraud Score: 4/100