-
-
Save dmiyakawa/f30ad3324415dc79804b to your computer and use it in GitHub Desktop.
A script communicating with YK-KSM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/bin/bash | |
host='localhost' | |
verbose=1 | |
request_decrypt() { | |
otp=$1 | |
qw_str=$(echo $otp | tr "axje.uidchtnmbrl'poygk,qf;" 'abcdefghijklmnopqrstuvwxyz') | |
url="http://${host}/wsapi/decrypt?otp=${qw_str}" | |
test $verbose -eq 1 && echo "url: ${url}" | |
curl ${url} | |
} | |
while getopts h:v OPT | |
do | |
case $OPT in | |
h) | |
host=$OPTARG | |
;; | |
v) | |
verbose=1 | |
;; | |
\?) | |
exit | |
;; | |
esac | |
done | |
shift $((OPTIND - 1)) | |
if [[ $# == 0 ]]; then | |
while true; do | |
read otp | |
if [[ -z "${otp}" ]] | |
then | |
break | |
fi | |
request_decrypt $otp | |
done | |
else | |
for otp in $@; do | |
request_decrypt $otp | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment