hashcat/hashcat-utils

feature: multibyte cutb

Opened this issue · 0 comments

When input is UTF-8, cutting on character count - even when it is not aligned with byte count - would be useful. This could be added to cutb as a flag, or could be a separate utility.

This script produces some of the desired behavior:

$ cat multicutb
#!/bin/bash

if [ -z "$1" -o -z "$2" ]; then
    echo "Usage: $0 [offset] [length]"
    echo "(similar to cutb from hashcat utils)"
    exit 1
fi
offset=$1
length=$2

grep -Po "^.{$offset}\K.{$length}"
$ echo Τηεοδ29 | multicutb 1 3
ηεο

(but doesn't cover the negative-offset functionality)