hscan - Portscan em Pyhton
Publicado por henrique (última atualização em 18/01/2023)
[ Hits: 3.663 ]
Homepage: naotem.com
Portscan feito em Python. Um nmap simplificado.
#!/bin/python3
import socket, argparse
red = "\033[1;31m"
blue = "\033[1;34m"
cyan = "\033[1;36m"
green = "\033[0;32m"
reset = "\033[0;0m"
bold = "\033[;1m"
reverse = "\033[;7m"
branco = "\033[37m"
gray = "\033[0;37m"
orange = "\033[0;49;33m"
yellow = "\033[0;49;93m"
print("-" * 65)
print(yellow, """\n\n __ __ ______ ______ ______ __ __
/\ \_\ \ /\ ___\ /\ ___\ /\ __ \ /\ "-./ \
\ \ __ \ \ \___ \ \ \ \____ \ \ __ \ \ \ \-./\ \
\ \_\ \_\ \/\_____\ \ \_____\ \ \_\ \_\ \ \_\ \ \_\
\/_/\/_/ \/_____/ \/_____/ \/_/\/_/ \/_/ \/_/
\n""", reset)
def main():
parser = argparse.ArgumentParser(description='A portscanner in python does in a cursed of python ',)
parser.add_argument('-p', action='store', dest='port', help='porta')
parser.add_argument('-d', action='store', dest='domain', default='0.0.0.0', help='dominio')
parser.add_argument('-a', dest='all', default=False, required=False, help='portas padroes True ou False', choices=['True', 'False'])
parser.add_argument('-w', action='store', dest='wordlist', default='False', required=False, help='wordlist')
parser.add_argument('-t', action='store', dest='timeout', default='0.5', help='timeout')
arguments = parser.parse_args()
if arguments.all == 'True':
ports = (21, 22, 23, 25, 443, 445, 8080, 80, 3386, 139, 138)
for port in ports:
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.settimeout(float(arguments.timeout))
code = client.connect_ex((arguments.domain, int(port)))
if code == 0:
print(red, f'[*] {port} aberta'.title(), reset)
if arguments.wordlist != 'False':
arquivo = open(arguments.wordlist, 'r')
for port in arquivo:
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.settimeout(float(arguments.timeout))
code = client.connect_ex((arguments.domain, int(port)))
if code == 0:
print(red, f'[*] {port} aberta'.title(), reset)
if arguments.all != 'True' and arguments.wordlist == 'False':
try:
for ports in arguments.port.split(','):
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.settimeout(float(arguments.timeout))
code = client.connect_ex((arguments.domain, int(ports)))
if code == 0:
print(red,f'[*] {ports} aberta'.title(),reset)
except Exception as e:
print('Algo deu errado!')
if __name__ == '__main__':
main()
print('-' * 65)
Envio e recebimento de arquivos em Python
Cotação do Dólar e Euro e conversão para Real
EVOSIGN - Assinatura aleatória no Evolution
Cliente/Servidor Usando Python
Gentoo: detectando impressoras de rede e como fixar uma impressora por IP
Como o GNOME conseguiu o feito de ser preterido por outras interfaces gráficas
Gentoo binário em 2026: UEFI, LUKS, Btrfs e Systemd
Trabalhando Nativamente com Logs no Linux
Jogando Daikatana (Steam) com Patch 1.3 via Luxtorpeda no Linux
Por que sua empresa precisa de uma PKI (e como automatizar EMISSÕES de certificados via Web API)
Instalando NoMachine no Gentoo com Systemd (acesso Remoto em LAN)
Gentoo: Trocando wpa_supplicant pelo iwd no NetworkManager (Systemd)
Alterar conteúdo de dica [RESOLVIDO] (3)
Vou destruir sua infância:) (5)
Quando vocês pararam de testar distros? (23)









