Skip to content

Instantly share code, notes, and snippets.

Shell scripts and one liners

Snippets, tips and tricks in no particular order. FOR ADVANCED USERS ONLY. Some of these one liners may be dangerous since they might delete files in loops. Please pay attention and make backups. :-)

rsync examples

Usage:

rsync --verbose --archive --recursive --checksum --prune-empty-dirs --stats --human-readable --safe-links source-path user@server:/destination-path/
Assuming you have a mimikatz dump named "mimikatz_dump.txt", I made these bash one-liners that will reformat the mimikatz output to "domain\user:password"
First, before using these parsers, run: "dos2unix mimikatz_dump.txt"
Mimikatz 1.0:
cat mimikatz_dump.txt | grep -P '((Utilisateur principal)|(msv1_0)|(kerberos)|(ssp)|(wdigest)|(tspkg))\s+:\s+.+' | grep -v 'n\.' | sed -e 's/^\s\+[^:]*:\s\+//' | sed -e 's/Utilisateur principal\s\+:\s\+\(.*\)$/\n\1/' | sort -u
Mimikatz 2.0 (unfortunately, you must "apt-get install pcregrep" because reasons):
@g11tch
g11tch / bash-one-liners.sh
Created October 7, 2016 18:19 — forked from macmladen/bash-one-liners.sh
BASH one-liners
## CHECKING HEADERS AND CERTIFICATE
# curl headers
curl -Iv https://example.com
# check certificate
openssl s_client -connect www.example.com:443
## FIXING FILES PERMISSIONS
# Remove Mac OS X Desktop Services Store files
find . -name ".DS_Store" -exec rm {} \;
# If you accidentally chmod -R 755 on everything revert files to 644
@g11tch
g11tch / Sublime 3 Config
Created October 7, 2016 18:08 — forked from tohuw/Sublime 3 Config
My Sublime Text 3 Config
{
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 500,
"auto_indent": true,
"auto_match_enabled": true,
"binary_file_patterns":
[
"*.woff",
"*.eot",
"*.ttf",
@g11tch
g11tch / web-servers.md
Created October 7, 2016 17:51 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@g11tch
g11tch / osx-for-hackers.sh
Created October 5, 2016 14:51 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'