Sign in to follow this  
Followers 0
phatzilla

Pulling Data from a Webpage, MD5 Hashing it, And storing IN a Text file.

8 posts in this topic

#1 ·  Posted (edited)

So I need to access a PHP page that has ~600 lines of data (lines are dynamic -- Different every time you visit the page)

The lines are also each a different length.

Line1

Line2

Line3

..

.

~Line600

What i need to do is Have Autoit parse the lines on the Page

Hash Every single Line Via MD5

Save every Hashed Line into a Textfile (1 Hash Per Line)

I already Use the MD5 UDF (Found here : )

Preciate The help, thanks guys

Edited by phatzilla

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I tried

$textfile = "parsed.txt"

InetGet("http://www.website.com", $textfile, 1)

But it's all clumped up together with the <BR> tags which are useless to me.

Would it be a good idea to replace the BR tags with @CRLF? Or is this just a roundabout way of doing things from scratch?

Edited by phatzilla

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Okay, i figured out the first part.

$szFile = "parsed.txt"

$szText = FileRead($szFile,FileGetSize($szFile))
$szText = StringReplace($szText, "<br>", @CRLF)
FileDelete($szFile)
FileWrite($szFile,$szText)

That replaces the <BR> tags with @CRLF which gives me fresh lines yay

Now the next step is how to Hash each line with MD5 and replace the file with the output.

Edited by phatzilla

Share this post


Link to post
Share on other sites

I'm not sure how the MD5 function takes input, but try it something like this way: $szText = MD5Function(StringReplace($szText, "<br>", @CRLF))


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Tried that, it gave me gibberish.

All i really need now is to use the _MD5 Function to hash every line of the previously edited text file

$Hash = _MD5('The quick brown fox jumps over the lazy dog')
Edited by phatzilla

Share this post


Link to post
Share on other sites

$szFile needs to be read and 'processed' one line at a time. Try the FileReadLine function. The example in the Docs is probably all you need to get you going. Good luck.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I'm a total numbskull, but it doesnt seem to be saving each line with the hashed values

#include "md5.au3"
$file = FileOpen("PARSEDURLS\parsed1.txt", 0)

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
    $Hash = _MD5($line)
$MD5 = Hex($Hash) ; IMPORTANT, REMOVES 0X
Wend

FileClose($file)

Any ideas

Edited by phatzilla

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

The line needs to be written (to a new file. It can be renamed later..) after it is 'processed' (this'll be the last step in the While loop..). See the FileWriteLine function.<br><br>Edit: added last step thing..<br>

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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