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/python3 | |
# Linux Ubuntu Gnome | |
# Correction for Pyperclip | |
# Copy info to clipboard without installing anything | |
from gi.repository import Gtk, Gdk | |
def copy_to_clipboard(msg): | |
''' Copy `msg` to the clipboard ''' |
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
import socket | |
def is_valid_ipv4_address(address): | |
''' Verify IP Address Validity ''' | |
try: | |
socket.inet_pton(socket.AF_INET, address) | |
except AttributeError: # no inet_pton here, sorry | |
try: | |
socket.inet_aton(address) |
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
import socket | |
def checkBlacklist(domain): | |
''' Check if domain is listed "dbl.spamhaus.org" ''' | |
rCode = '' | |
rTXT = {"127.0.1.2": "spam domain", | |
"127.0.1.4": "phish domain", | |
"127.0.1.5": "malware domain", | |
"127.0.1.6": "botnet C&C domain", |
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
import subprocess | |
def returnDNS(domain): | |
''' Return DNS servers of a domain ''' | |
proc = subprocess.Popen(["dig +short +time=2 -t ns " +domain], | |
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | |
(out, err) = proc.communicate() | |
return sorted(out.decode('utf-8').split()) |
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
import requests | |
api_key = "XXX" #Google API | |
cse_id = "XXX" #Search engine ID | |
q = "information" | |
def google_query(q, api_key, cse_id): | |
''' Use Google custom search without google-api-python-client''' | |
rData = [] |
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
estados_uf = ['AC', 'AL', 'AP', 'AM', 'BA', 'CE', 'DF', 'ES', | |
'GO', 'MA', 'MT', 'MS', 'MG', 'PA', 'PB', 'PR', | |
'PE', 'PI', 'RJ', 'RN', 'RS', 'RO', 'RR', 'SC', | |
'SP', 'SE', 'TO'] | |
estados_dict = {'AC': 'Acre', 'AL': 'Alagoas', 'AP': 'Amapá', | |
'AM': 'Amazonas', 'BA': 'Bahia', 'CE': 'Ceará', | |
'DF': 'Distrito Federal', 'ES': 'Espírito Santo', | |
'GO': 'Goías', 'MA': 'Maranhão', 'MT': 'Mato Grosso', | |
'MS': 'Mato Grosso do Sul', 'MG': 'Minas Gerais', |