Skip to content

Instantly share code, notes, and snippets.

View knez's full-sized avatar

Nikola Knežević knez

View GitHub Profile
@knez
knez / dotnet_resource_extract.py
Created May 3, 2024 12:26
Dump dotnet resources
import sys
import dnfile
"""
Dump all raw byte .NET resources
"""
def dump(res_name, res_data):
print(f"[+] Dumping resource '{res_name}'")
with open(res_name, 'wb') as f:
@knez
knez / zutto_dekiru.py
Created June 14, 2023 15:36
Zutto Dekiru Deobfuscator
"""
Deobfuscate Zutto Dekiru shellcode encoder
Example:
48 31 ED xor rbp, rbp
DA CB fcmove st, st(3)
54 push rsp
66 BD 17 01 mov bp, 117h
41 5C pop r12
66 41 81 E4 90 F1 and r12w, 0F190h
48 BA 06 E0 BB DD CA C2 8A 0C mov rdx, 0C8AC2CADDBBE006h ; xor constant
import os
import sys
'''
Decodes PST encoded .txt attachments from Exchange Mailbox
RULE: WEBSHELL_ASPX_Exchange_Encoded_Mailbox_Attachment_Aug21
'''
def decode(payload):
mpbbCryptFrom512 = [
@knez
knez / backup.sh
Created September 22, 2019 20:28
Backup
#!/bin/bash
# Backup /home to gdrive
rclone -v -L sync ~ remote: --exclude "Downloads/**" \
--exclude ".*{/**,}" \
--exclude "Music/**"
@knez
knez / fetch.sh
Last active September 18, 2019 18:07
#!/bin/bash
# user defined variables
#-----------------------
SAVEDIR="Downloads"
SONGLIST="list.txt"
#-----------------------
check_error() {
# if last command failed
@knez
knez / list-apps.sh
Created August 19, 2019 12:19
List all user-installed packages (Debian/Ubuntu)
#!/bin/bash
# Lists all user-installed packages
logfile="/var/log/apt/history.log"
logs="zcat $logfile.*.gz | cat - $logfile"
regex="^Commandline: (apt|apt-get) +install +\K( *(\w+-?)+)+"
packages=$(eval $logs | grep -oP "$regex" | tr -s ' ' '\n' | sort -u)
for pkg in $packages;
@knez
knez / HexToWIF.java
Last active August 11, 2019 18:24
Bitcoin HEX private key to WIF
import java.util.Arrays;
import java.security.MessageDigest;
/**
* Converts a 64 characters long hex private key
* into a base58 WIF private key (starts with a '5')
*/
public class HexToWIF
{
public static byte[] getExtendedKey(String s)