Skip to content

Instantly share code, notes, and snippets.

View rommelfs's full-sized avatar

Sascha Rommelfangen rommelfs

  • http://www.circl.lu
  • Germany
View GitHub Profile
@rommelfs
rommelfs / domaininfo.sh
Last active August 29, 2015 13:56
one-shot tool for generating info about host and IP
#!/bin/bash
INPUT="$1"
if [[ `which faup; echo $?` == 1 ]]
then
echo " [x] Error: faup not installed! (git clone https://github.com/stricaud/faup.git)"
exit 3
fi
if [ -z "$INPUT" ]
then
echo " [x] Error: host missing!"
@rommelfs
rommelfs / xa-add-comment.sh
Last active December 25, 2015 06:49
add comments to file in metadata to be indexed by spotlight (OS X centric)
#!/bin/bash
FILENAME="$1"
OLDCOMMENT="`mdls -r -nullMarker "" -n kMDItemFinderComment \"$FILENAME\"`"
echo "Old comment: $OLDCOMMENT"
while read LINE
do
COMMENT="$OLDCOMMENT $LINE"
done
echo "Updated comment: $COMMENT"
PATH=`pwd`
@rommelfs
rommelfs / xa-add.sh
Last active December 25, 2015 06:49
add information about file into metadata of file to be indexed by spotlight (OS X centric)
#!/bin/bash -x
FILENAME="$1"
echo "Collecting attributes for $FILENAME" &&\
HASHMD5=`md5 "$1" | cut -d"=" -s -f2|tr -d " "` &&\
echo -e "MD5\t\t$HASHMD5" &&\
HASHSHA1=`shasum "$1" | cut -d" " -f 1` &&\
echo -e "SHA1\t\t$HASHSHA1" &&\
SHA2ALGOS="224 256 384 512" &&\
HASHSHA2_224=`shasum -a 224 "$1"|cut -d" " -f1` &&\
echo -e "SHA2-224\t$HASHSHA2_224" &&\