mirror of https://github.com/hak5/omg-payloads.git
52 lines
1.6 KiB
Bash
52 lines
1.6 KiB
Bash
#!/bin/bash
|
|
usage () {
|
|
echo -e "OMGLoggerDecoder is used to decode raw key strokes acquired by OMGLogger.\n"
|
|
echo -e "Usage: \nDecode captured log:\t[./OMGLoggerDecoder -f <Logfile> -m <mode> -o <output file>]";
|
|
echo -e "\nOptions:"
|
|
echo -e "-f\tSpecify Log file."
|
|
echo -e "-m\tSelect Mode(normal|informative)"
|
|
echo -e "-o\tSpecify Output file."
|
|
echo -e "-h\tFor this banner."
|
|
}
|
|
while getopts o:m:f:h: flag
|
|
do
|
|
case "${flag}" in
|
|
o) output=$OPTARG ;;
|
|
m) mode=$OPTARG ;;
|
|
f) filename=$OPTARG ;;
|
|
h) help=$OPTARG ;;
|
|
*)
|
|
usage
|
|
exit 1
|
|
esac
|
|
done
|
|
|
|
if [ -z "$output" ] && [ -z "$filename" ]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
if [ -z "$filename" ]; then
|
|
echo -e "OMGLoggerDecoder: Missing option \"-f\"(Log file not specified).\nUse \"-h\" for more information." >&2
|
|
exit 1
|
|
fi
|
|
if [ -z "$output" ]; then
|
|
echo -e "OMGLoggerDecoder: Missing option \"-o\"(Output file not specified).\nUse \"-h\" for help." >&2
|
|
exit 1
|
|
fi
|
|
if [ -z "$mode" ]; then
|
|
echo -e "OMGLoggerDecoder: Missing option \"-m\"(Mode not specified).\nUse \"-h\" for help." >&2
|
|
exit 1
|
|
fi
|
|
if [ "$mode" != "informative" ] && [ "$mode" != "normal" ]; then
|
|
echo -e "DuckyLoggerDecoder: Invalid mode \"$mode\".\nUse \"-h\" for help." >&2
|
|
exit 1
|
|
fi
|
|
if [ "$mode" == "normal" ] ; then
|
|
awk 'BEGIN{while (("xmodmap -pke" | getline) > 0) k[$2]=$4} {print $0 "[" k [$NF] "]"}' $filename | grep press | awk '{print $4}' > $output
|
|
exit 1
|
|
fi
|
|
if [ "$mode" == "informative" ] ; then
|
|
awk 'BEGIN{while (("xmodmap -pke" | getline) > 0) k[$2]=$4} {print $0 "[" k [$NF] "]"}' $filename > $output
|
|
exit 1
|
|
fi
|