Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- IFS=$'\n'
- case "$1" in
- *.pdf|*.png|*.jpg)
- FILE=($(zbarimg -q --raw -Sdisable -Sqrcode.enable $1))
- lines=$(zbarimg --raw -Sdisable -Sqrcode.enable $1 | wc -l)
- ;;
- "")
- echo "You need to put a filename as the first argument.
- If it's a pdf, png or jpg image it will be scanned for barcodes. If it's anything else then it will be scanned for secrets, one per line. If you have a webcam you can scan your barcodes using this command
- zbarcam -q --raw -Sdisable -Sqrcode.enable >> qrcodes
- and then validate them by running
- sudo ./validate3ofM qrcodes"
- ;;
- *)
- FILE=($(sed --quiet --regexp-extended '/^[0-9]+-[0-9a-f]*$/p' "$1" | sort -u))
- lines=$(sed --quiet --regexp-extended '/^[0-9]+-[0-9a-f]*$/p' "$1" | sort -u | wc -l)
- ;;
- esac
- list=$(seq 1 $lines)
- for c1 in $list; do
- for c2 in $list; do
- if [[ $c2 != $c1 && $c1 -lt $c2 ]]; then
- for c3 in $list; do
- if [[ $c3 != $c2 && $c3 != $c1 && $c2 -lt $c3 && $c1 -lt $c2 ]]; then
- printf "$c1-$c2-$c3: "
- printf "${FILE[$c1-1]}\n${FILE[$c2-1]}\n${FILE[$c3-1]}\n" | ssss-combine -q -t 3
- if [[ $? -ne 0 ]]; then
- printf "${FILE[$c1-1]}\n${FILE[$c2-1]}\n${FILE[$c3-1]}\n"
- fi
- fi
- done
- fi
- done
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement