Sign in to follow this  
Followers 0
JerichoST

Problem with an url script

12 posts in this topic

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)
$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)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

imo it's working. ie closes so fast because the script ends.

.

#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 by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

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 ...

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

the url or the html body ?


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

ah, now i see the problem. check this out. it works after the sleep !

#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 by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

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 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

was hard to find out ... _IELoadWait($oIE) is not sufficient

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

my explications are a bit lame because my bad english and i'm sorry for that

Share this post


Link to post
Share on other sites

#12 ·  Posted (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 by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0