JerichoST Posted August 1, 2013 Share Posted August 1, 2013 i have made a script that reads linkes form a file (emails) they are all with the same password. logs in to the site (that i have mede iti right) and i tray to make the script read the url returned after submiting the form. All i have trayed returned the initial url not the url returned. is is the an error / wrong password, accound inexistent, accound suspended is all in the url returned. i need the script to save the email and the returned url to extarct the errors latter. Here is my scipt #include <ie.au3> Func Tmail ($line) Local $fileG = FileOpen("good.txt", 1) Local $fileB = FileOpen("bad.txt", 1) $oIE = _IECreate ("http://www.talktalk.co.uk/mail/?check_cookie=1") $oForm = _IEFormGetObjByName ($oIE, "fm") $oQuery1 = _IEFormElementGetObjByName ($oForm, "email") $oQuery2 = _IEFormElementGetObjByName ($oForm, "password") $uname=$line $pwd="yourpassword" _IEFormElementSetValue ($oQuery1,$uname) _IEFormElementSetValue ($oQuery2,$pwd) $oButton=_IEGetObjById($oIE,"loginButton") _IEAction ($oButton, "click") _IELoadWait($oIE) $txt = _IEBodyReadText($oIE) $word2="recently" If StringInStr($txt,$word2) then FileWrite($fileG, $txt & @CRLF) FileClose($fileG) Else FileWrite($fileB, $line & @CRLF) FileClose($fileB) EndIf _IEQuit($oIE) EndFunc Local $file = FileOpen("test.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 Local $line = FileReadLine($file) If @error = -1 Then ExitLoop Tmail ($line) WEnd FileClose($file) Link to comment Share on other sites More sharing options...
Edano Posted August 1, 2013 Share Posted August 1, 2013 (edited) imo it's working. ie closes so fast because the script ends. . expandcollapse popup#include <ie.au3> Func Tmail ($line) Local $fileG = FileOpen("good.txt", 1) Local $fileB = FileOpen("bad.txt", 1) $oIE = _IECreate ("http://www.talktalk.co.uk/mail/?check_cookie=1") $oForm = _IEFormGetObjByName ($oIE, "fm") $oQuery1 = _IEFormElementGetObjByName ($oForm, "email") $oQuery2 = _IEFormElementGetObjByName ($oForm, "password") $uname=$line $pwd="yourpassword" _IEFormElementSetValue ($oQuery1,$uname) _IEFormElementSetValue ($oQuery2,$pwd) $oButton=_IEGetObjById($oIE,"loginButton") _IEAction ($oButton, "click") _IELoadWait($oIE) $txt = _IEBodyReadText($oIE) $word2="recently" If StringInStr($txt,$word2) then FileWrite($fileG, $txt & @CRLF) FileClose($fileG) Else FileWrite($fileB, $line & @CRLF) FileClose($fileB) EndIf Sleep(5000) _IEQuit($oIE) EndFunc Local $file = FileOpen("test.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 Local $line = FileReadLine($file) If @error = -1 Then ExitLoop Tmail ($line) WEnd FileClose($file) . of course i cannot judge if your name and pw is correct Edited August 1, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
JerichoST Posted August 1, 2013 Author Share Posted August 1, 2013 The script reads the contect of the page for changes. but there are no changes mede after login if you login with a good user and a bad password the url will change something like this : http://abcd.com/ original url will change to http://abcd.com/bad.password.php. i need to record the email and that response url ... Link to comment Share on other sites More sharing options...
Edano Posted August 1, 2013 Share Posted August 1, 2013 (edited) i get a new url after wrong password. http://www.talktalk.co.uk/mail/index.html?redirected=1&error=error.user.invalid&s=1375359776861&check_cookie=1 anyway, i see no problem with your code, maybe others find the problem Edited August 1, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
JerichoST Posted August 1, 2013 Author Share Posted August 1, 2013 yes is corect thats the url but how do i save it in file in format mail url $line $url but i dont know how to read that url my script does not read it Link to comment Share on other sites More sharing options...
Edano Posted August 1, 2013 Share Posted August 1, 2013 the url or the html body ? [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
JerichoST Posted August 1, 2013 Author Share Posted August 1, 2013 the url the body with with IEreadText or IEreadHtml does not change. the only thing that changes is the url. it is the only way to check if the url changes and write the url down alingside the mail in a text file. the code as it is right now trays to read the content of body for changes and sort the mails in bad or good but if there are no changes and the string that te script searches does not exist ... all mails are writed down as bad or good it does not matter to the script ... so it is useles. Link to comment Share on other sites More sharing options...
Edano Posted August 1, 2013 Share Posted August 1, 2013 (edited) ah, now i see the problem. check this out. it works after the sleep ! expandcollapse popup#include <ie.au3> Func Tmail ($line) Local $fileG = FileOpen("good.txt", 1) Local $fileB = FileOpen("bad.txt", 1) $oIE = _IECreate ("http://www.talktalk.co.uk/mail/?check_cookie=1") $oForm = _IEFormGetObjByName ($oIE, "fm") $oQuery1 = _IEFormElementGetObjByName ($oForm, "email") $oQuery2 = _IEFormElementGetObjByName ($oForm, "password") $uname=$line $pwd="yourpassword" _IEFormElementSetValue ($oQuery1,$uname) _IEFormElementSetValue ($oQuery2,$pwd) $oButton=_IEGetObjById($oIE,"loginButton") _IEAction ($oButton, "click") _IELoadWait($oIE) $txt = _IEBodyReadText($oIE) $word2="recently" If StringInStr($txt,$word2) then FileWrite($fileG, $txt & @CRLF) FileClose($fileG) Else FileWrite($fileB, $line & @CRLF) FileClose($fileB) EndIf MsgBox(0,"",_IEPropertyGet($oIE,"locationurl")); Retrieves the URL of the resource that Internet Explorer is currently displaying. Sleep(5000) MsgBox(0,"",_IEPropertyGet($oIE,"locationurl")); Retrieves the URL of the resource that Internet Explorer is currently displaying. _IEQuit($oIE) EndFunc Local $file = FileOpen("test.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 Local $line = FileReadLine($file) If @error = -1 Then ExitLoop Tmail ($line) WEnd FileClose($file) . maybe you add a waiting loop until the url changes. but it is a bit strange indeed. surely a javascript thingy Edited August 1, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
JerichoST Posted August 1, 2013 Author Share Posted August 1, 2013 Thanks a million. in deed the problem was with the timing (sleep) i make the modifications to write it to the file and i add a timer to make the check from time to time and all is done. thanks alot Link to comment Share on other sites More sharing options...
Edano Posted August 1, 2013 Share Posted August 1, 2013 (edited) was hard to find out ... _IELoadWait($oIE) is not sufficient Edited August 1, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
JerichoST Posted August 1, 2013 Author Share Posted August 1, 2013 my explications are a bit lame because my bad english and i'm sorry for that Link to comment Share on other sites More sharing options...
Edano Posted August 1, 2013 Share Posted August 1, 2013 (edited) i found this helpfile: (why do i find that always so late ?) . Browser scripting security restrictions may sometimes prevent _IELoadWait from guaranteeing that a page is fully loaded and can occasionally result in untrapped errors. In these cases you may need to avoid calling _IELoadWait and attempt to employ other methods of insuring that the page load has completed. These methods might include using a Sleep command, examining browser status bar text and other methods. When using functions that call _IELoadWait for objects other than the InternetExplorer (browser) object, you may also be successful by calling _IELoadWait for the browser yourself (e.g. _IELoadWait($oIE)). The most common causes of trouble are page redirects and cross-site scripting security restrictions associated with frames. Page re-writing techniques employed by some applications (e.g. Gmail) can also cause trouble here. Edited August 1, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now