Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
x86senniral authored Feb 24, 2024
1 parent d4882bd commit dbe369a
Show file tree
Hide file tree
Showing 12 changed files with 730 additions and 0 deletions.
57 changes: 57 additions & 0 deletions Abuse_IPDB.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import requests
from prettytable import PrettyTable
import socket
from Colors import get_color

# Get site IP
def resolve_url_to_ip(url):
try:
domain = url.split('//')[-1].split('/')[0]
ip_address = socket.gethostbyname(domain)
return ip_address
except socket.gaierror:
return None


def check_ip_reputation(api_key, ip_address):
url = 'https://api.abuseipdb.com/api/v2/check'
headers = {
'Accept': 'application/json',
'Key': api_key
}
params = {
'ipAddress': ip_address,
'maxAgeInDays': '90'
}
response = requests.get(url, headers=headers, params=params)
if response.status_code == 200:
result = response.json()
data = result['data']

# Create a table
table = PrettyTable()
table.field_names = ["Attribute", "Value"]
table.add_row(["IP Address", data['ipAddress']])
table.add_row(["Is Public", data['isPublic']])
table.add_row(["IP Version", data['ipVersion']])
table.add_row([f"{get_color('RED')}Is Whitelisted{get_color('RESET')}", data['isWhitelisted']])
table.add_row(["Abuse Confidence Score", data['abuseConfidenceScore']])
table.add_row(["Country Code", data['countryCode']])
table.add_row(["ISP", data['isp']])
table.add_row(["Domain", data['domain']])
table.add_row(["Is Tor", data['isTor']])
table.add_row([f"{get_color('RED')}Total Reports{get_color('RESET')}", data['totalReports']])
table.add_row(["Num Distinct Users", data['numDistinctUsers']])
table.add_row(["Last Reported At", data['lastReportedAt']])

return table
else:
print(f"Error: HTTP {response.status_code} - {response.reason}")

def check_IP_AbuseIPDB(api_key,url):
ip_address = resolve_url_to_ip(url)
if ip_address:
print(f"Resolved IP Address: {ip_address}")
return check_ip_reputation(api_key,ip_address)
else:
return "Unable to resolve IP address."
61 changes: 61 additions & 0 deletions AsciiArt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from Colors import get_color

def logo():
lg = """
─────────█▄██▄█
█▄█▄█▄█▄█▐█┼██▌█▄█▄█▄█▄█
███┼█████▐████▌█████┼███
█████████▐████▌█████████
"""
print(lg)

def Serpent():
lg = """
▄▄▀█▄───▄───────▄
▀▀▀██──███─────███
░▄██▀░█████░░░█████░░
███▀▄███░███░███░███░▄
▀█████▀░░░▀███▀░░░▀██▀
"""
print(lg)

def EYS():
lg = f"""{get_color('ORANGE')}
⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⢠⡆⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠈⣷⣄⠀⠀⠀⠀⣾⣷⠀⠀⠀⠀⣠⣾⠃⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢿⠿⠃⠀⠀⠀⠉⠉⠁⠀⠀⠐⠿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣤⣤⣶⣶⣶⣤⣤⣄⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣠⣶⣿⣿⡿⣿⣿⣿⡿⠋⠉⠀⠀⠉⠙⢿⣿⣿⡿⣿⣿⣷⣦⡀⠀⠀⠀
⠀⢀⣼⣿⣿⠟⠁⢠⣿⣿⠏⠀⠀⢠⣤⣤⡀⠀⠀⢻⣿⣿⡀⠙⢿⣿⣿⣦⠀⠀
⣰⣿⣿⡟⠁⠀⠀⢸⣿⣿⠀⠀⠀⢿⣿⣿⡟⠀⠀⠈⣿⣿⡇⠀⠀⠙⣿⣿⣷⡄
⠈⠻⣿⣿⣦⣄⠀⠸⣿⣿⣆⠀⠀⠀⠉⠉⠀⠀⠀⣸⣿⣿⠃⢀⣤⣾⣿⣿⠟⠁
⠀⠀⠈⠻⣿⣿⣿⣶⣿⣿⣿⣦⣄⠀⠀⠀⢀⣠⣾⣿⣿⣿⣾⣿⣿⡿⠋⠁⠀⠀
⠀⠀⠀⠀⠀⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠁⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠛⠿⠿⠿⠿⠿⠿⠛⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢰⣷⡦⠀⠀⠀⢀⣀⣀⠀⠀⠀⢴⣾⡇⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣸⠟⠁⠀⠀⠀⠘⣿⡇⠀⠀⠀⠀⠙⢷⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠻⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀
{get_color('RESET')}"""
print(lg)


def MGGL():
lg = """
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠾⠛⢉⣉⣉⣉⡉⠛⠷⣦⣄⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠋⣠⣴⣿⣿⣿⣿⣿⡿⣿⣶⣌⠹⣷⡀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⠁⣴⣿⣿⣿⣿⣿⣿⣿⣿⣆⠉⠻⣧⠘⣷⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡇⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⠈⠀⢹⡇⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⢸⣿⠛⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⠀⠀⢸⡇⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣷⠀⢿⡆⠈⠛⠻⠟⠛⠉⠀⠀⠀⠀⠀⠀⣾⠃⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣧⡀⠻⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⠃⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢼⠿⣦⣄⠀⠀⠀⠀⠀⠀⠀⣀⣴⠟⠁⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣦⠀⠀⠈⠉⠛⠓⠲⠶⠖⠚⠋⠉⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣾⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣾⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀NoPhish⠀⠀⠀
⠀⢀⣄⠈⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
"""
print(lg)
12 changes: 12 additions & 0 deletions Colors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def get_color(color_name):
colors = {
"RESET": "\033[0m",
"RED": "\033[91m",
"GREEN": "\033[92m",
"YELLOW": "\033[93m",
"BLUE": "\033[94m",
"PURPLE": "\033[95m",
"CYAN": "\033[96m",
"ORANGE": "\033[38;5;208m"
}
return colors.get(color_name.upper(), "\033[0m")
37 changes: 37 additions & 0 deletions GoogleSafeBrowsing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import requests
from prettytable import PrettyTable
from Colors import get_color

# Google Save Browsing
def check_with_google_safe_browsing(url, api_key):
api_url = "https://safebrowsing.googleapis.com/v4/threatMatches:find"
payload = {
"client": {
"clientId": "NoPhish",
"clientVersion": "1.0"
},
"threatInfo": {
"threatTypes": ["MALWARE", "SOCIAL_ENGINEERING"],
"platformTypes": ["ANY_PLATFORM"],
"threatEntryTypes": ["URL"],
"threatEntries": [{"url": url}]
}
}
params = {'key': api_key}
response = requests.post(api_url, params=params, json=payload)
if response.status_code == 200:
matches = response.json()
return matches
else:
return None

def display_google_safe_browsing_results(url, api_key):
result = check_with_google_safe_browsing(url, api_key)
if result and result.get('matches'):
table = PrettyTable()
table.field_names = [f"{get_color('RED')}Threat Type{get_color('RESET')}", "Platform Type", "URL", "Cache Duration"]
for match in result['matches']:
table.add_row([match['threatType'], match['platformType'], match['threat']['url'], match['cacheDuration']])
print(table)
else:
print("No threats detected by Google Safe Browsing.")
111 changes: 111 additions & 0 deletions NoPhish.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
from Colors import get_color
from UrlCheck import checkURL,check_ip_reputation
import os
from AsciiArt import logo, Serpent, EYS, MGGL
from UrlCheck import abuse_ipdb_api

def Introduction():
clear_screen()
Intro = f"""{get_color('BLUE')}
▒█▄░▒█ █▀▀█ ▒█▀▀█ ░▀░ █▀▀ █░░█
▒█▒█▒█ █░░█ ▒█▄▄█ ▀█▀ ▀▀█ █▀▀█
▒█░░▀█ ▀▀▀▀ ▒█░░░ ▀▀▀ ▀▀▀ ▀░░▀
{get_color('RESET')}\
By: CmdSNR
Version: 1.5 [ BETA ]
{get_color('RED')}NOTE: Some APIs might have daily limits.{get_color('RESET')}{get_color('GREEN')}\nUse command "manual" to receive everything you need to know about how to use the scanner.{get_color('RESET')}
Use "help" to display the help commands all over again.
Use "clear" to clear the screen.
"""
print(Intro)
#time.sleep(5)
CommandLine()


"""
------------------- ESSENTIALS -------------------
"""

def Mann():
mann = ['Get Started','Fix Errors','Required APIs & How To Get Them']
manual = {

}
print(f"{get_color('GREEN')}For the Manual use numbers to select a specific options.{get_color('RESET')}")
for index,content in enumerate(mann):
print(f'{index + 1}. {content}\n')
try:
user_input = int(input('Select option: '))
match user_input:
case 1:
print('Visit https://www.nrelm.com/nophish for full details.')
case 2:
print("Visit: https://github.com/sytaxus/NoPhish/issues | if you don't see your issue there, please open a ticket and be as specific as possible.")
case 3:
print('Visit https://www.nrelm.com/nophish for full details.\nRequired APIs:\n\n1. Google Safe Browsing API : https://developers.google.com/safe-browsing/v4/get-started \n\n2. Rapid API (Exerra):https://rapidapi.com/Exerra/api/exerra-phishing-check/ \n\n3. IpQualityScore API: https://www.ipqualityscore.com/documentation/proxy-detection-api/overview \n\n4. AbuseIPDB API: https://www.abuseipdb.com/api.html \n\n5. Url.io API: https://urlscan.io/docs/api/ \n\n6. VirusTotal API: https://www.virustotal.com/ \n')
except Exception as e:
print(f'Error: {e}')


def CommandLine():
commands_Available = ['Scan For Phishing', 'Manual', 'Check IP Reputation', 'Help', 'Clear', 'Exit']

command_keys = {
'manual':2,
'help':4,
'clear': 5,
'exit': 6
}

print('Select the option of choice.')
for index, command in enumerate(commands_Available):
print(f"{index + 1}. {command}")

while True:
userinput = input(f"{get_color('BLUE')}NoPish >{get_color('RESET')} ").strip().lower()
if userinput.isdigit():
choice = int(userinput)
elif userinput in command_keys:
choice = command_keys[userinput]
else:
print("Invalid command. Please enter a number or a recognized command.")
continue

if choice == 1:
clear_screen()
logo()
print(checkURL())
elif choice == 2:
clear_screen()
MGGL()
Mann()
elif choice == 3:
clear_screen()
EYS()
ip_address = input('Enter IP Address to check: ')
result = check_ip_reputation(abuse_ipdb_api,ip_address)
print(result)
elif choice == 4:
clear_screen()
Introduction()
for index, command in enumerate(commands_Available):
print(f"{index + 1}. {command}")
elif choice == 5:
clear_screen()
elif choice == 6:
print("Exiting...")
break
else:
print("Invalid option. Please select a valid number or command.")

def clear_screen():
# Check if the operating system is Windows
if os.name == 'nt':
_ = os.system('cls')
# Otherwise, it's assumed to be Unix/Linux
else:
_ = os.system('clear')


if __name__ == "__main__":
Introduction()
47 changes: 47 additions & 0 deletions RapidAPIs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from prettytable import PrettyTable
import requests
from Colors import get_color

"""
EXERRA API
REQUIRES HTTP:// / HTTPS://
"""

def format_url_for_exerra(url):
if not url.startswith(('http://', 'https://')):
url = 'https://' + url
return url

def check_exerra_phishing(original_url,api_key):
url = format_url_for_exerra(original_url)
api_url = "https://exerra-phishing-check.p.rapidapi.com/"
querystring = {"url": url}
headers = {
"X-RapidAPI-Key": api_key,
"X-RapidAPI-Host": "exerra-phishing-check.p.rapidapi.com"
}

response = requests.get(api_url, headers=headers, params=querystring)
data = response.json()

exerra_table = PrettyTable()
exerra_table.field_names = ["Attribute", "Value"]

status = data.get('status', 'N/A')
is_scam = data.get('data', {}).get('isScam', 'N/A')
domain = data.get('data', {}).get('domain', 'N/A')
detection_type = data.get('data', {}).get('detection', {}).get('type', 'N/A')

exerra_table.add_row(["Status", status])
exerra_table.add_row(["Domain", domain])
exerra_table.add_row([f"{get_color('RED')}Is Scam?{get_color('RESET')}", is_scam])
exerra_table.add_row(["Detection Type", detection_type])

return exerra_table

"""
openSQUAT API
"""

Loading

0 comments on commit dbe369a

Please sign in to comment.