Created
December 26, 2017 09:32
-
-
Save makersm/2d83851e786cfcc3def4d4f77bc40635 to your computer and use it in GitHub Desktop.
login script
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 | |
ID="loginID" | |
PWD="Password" | |
URL="https://testurl.com" | |
COOKIE_FILE="cookies.txt" | |
LOG_FILE="login_log.html" | |
`(curl ${URL} \ | |
--data-urlencode "id=${ID}" \ | |
--data-urlencode "pwd=${PWD}" \ | |
--cookie "${COOKIE_FILE}" \ | |
--cookie-jar "${COOKIE_FILE}" \ | |
--location --verbose \ | |
--silent 2>&1) > ${LOG_FILE}` | |
RESULT=`iconv -f euc-kr -t utf-8 ${LOG_FILE} \ | |
| grep 환영합니다 \ | |
| wc -l` | |
if [ ${RESULT} -ge 1 ];then | |
echo 'login success' | |
rm ${COOKIE_FILE} ${LOG_FILE} | |
else | |
echo 'login fail... plz check log......................................' | |
iconv -f euc-kr -t utf-8 ${LOG_FILE} | |
rm -rf ${COOKIE_FILE} | |
echo '.................................................................' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment