2017-08-30 109 views
0

我嘗試登錄到與捲曲網站。 這是我的代碼...但我每次回來到登錄頁面=/捲曲擊不登錄

USER="Dantes9999" 
PASS="******" 
TEST=$(curl -s --cookie-jar cookie --dump-header header_cookie https://de.metin2.gameforge.com | grep -o '<form action=['"'"'"][^"'"'"']*['"'"'"] method' | sed -e 's/^\s*<form action=["'"'"']//' -e 's/["'"'"'] method$//') 
LOGINDATA="'username=$USER&password=$PASS'" 
LOGINRESPONSE=$(curl -s -L -b header_cookie -d $LOGINDATA $TEST) 
LOGINRESPONSE1=$(curl -s -L -b cookie -d $LOGINDATA $TEST) 
echo "" > header_cookie 
if [[ $LOGINRESPONSE1 == *"Sicherheitswort"* ]]; then 
     echo "$USER + $PASS = positive Sicherheit" 
fi 
if [[ $LOGINRESPONSE1 == *"Drachenm"* ]]; then 
     echo "$USER + $PASS = positive Drachenm"  
fi 
if [[ $LOGINRESPONSE1 == *"login"* ]]; then 
     echo "$USER + $PASS = negative Login BtN"  
fi 
echo "" > cookie 
if [[ $LOGINRESPONSE == *"Sicherheitswort"* ]]; then 
     echo "$USER + $PASS = positive Sicherheit" 
fi 
if [[ $LOGINRESPONSE == *"Drachenm"* ]]; then 
     echo "$USER + $PASS = positive Drachenm"  
fi 
if [[ $LOGINRESPONSE == *"login"* ]]; then 
     echo "$USER + $PASS = negative Login BtN"  
fi 

,所以希望別人知道,如何得到這個。 隨着每一個請求我得到一個新的令牌和匹配的cookie爲此....

回答

0

不要grep這個網站,而是發送表單數據與帖子。

#!/bin/bash 

USER="Dantes9999" 
PASS="******" 
LOGINRESPONSE=$(curl -X POST -F 'username=$USER' -F 'password=$PASS' -c yourcookie https://de.metin2.gameforge.com/user/login) 
LOGINRESPONSE1=$(curl -X GET -b yourcookie https://de.metin2.gameforge.com/main/index) 
if [[ $LOGINRESPONSE1 == *"account"* ]]; then 
     echo "$USER + $PASS = positive Sicherheit" 
fi 
if [[ $LOGINRESPONSE1 == *"Drachenm"* ]]; then 
     echo "$USER + $PASS = positive Drachenm"  
fi 
if [[ $LOGINRESPONSE1 == *"login"* ]]; then 
     echo "$USER + $PASS = negative Login BtN"  
fi 
echo "" > cookie 
if [[ $LOGINRESPONSE == *"Sicherheitswort"* ]]; then 
     echo "$USER + $PASS = positive Sicherheit" 
fi 
if [[ $LOGINRESPONSE == *"Drachenm"* ]]; then 
     echo "$USER + $PASS = positive Drachenm"  
fi 
if [[ $LOGINRESPONSE == *"login"* ]]; then 
     echo "$USER + $PASS = negative Login BtN"  
fi 
+0

謝謝你,但這並不work..this帳戶存在和代碼,也就是說:它不存在... – V0lvox337

+0

謝謝你,但這並不work..this帳戶存在,並且代碼說,它不存在... 在每個網站上寫的「帳戶」somewere ...所以這是不是一個有效的測試,如果登錄完成 所以有「-L」缺少.. 想法很好,但不起作用 – V0lvox337