Jump to content

Extract md5 hashes inside txt file to new txt file (one p


Recommended Posts

Hi, thx for reading this.

So yeah, I cannot program. :D

Never learned how, all dough i do understand some syntax from some languages.

I thought I could find a tool/program for his but I could not. I also searched the forums for a autoit script that I could easily adjust (no luck)

So here is my problem:

I have a 9 MB txt file.

I contains "Username" "Email" "MD5 hash"

between username and email there is a random number of spaces and tabs.

between email and md5 hash also. Sometime 1 space and sometimes up to 12 spaces.

I need to extract all the md5 hashes so that I have a new txt file with a hash on each line.

The way I should think a script/program should be able to do this is like this:

- Openfile

-Read the first character, if it's not hexadecimal skip to the next character (so only valid characters are 0123456789ABCDEF, the hexadecimal values are all in uppercase)

-if it's hexadecimal (0123456789ABCDEF) put a counter on 1 and read the next character. If the next character is hexadecimal put the counter on 2, if not reset the counter back to 0.

when the counter has reached 32, read the last 32 characters and put those on the first line of a new txt file.

Repeat till end of file and put the next 32 hexadecimal string on a new line in the new txt file.

This should work and I should get a new txt file whit a 32 characters hexadecimal string on each line. ;)

Problem is that I don't know how the program the above.

I know I could eventually figure it out after 3 hours of wiki reading and another 3 hours of trial and error.

But I think a good programmer could write this in a autoit script within 5 minutes. ;)

Any good programmers that want to help me out ? :)

Edited by Kain134
Link to comment
Share on other sites

Fact is, there are any number of ways tocomplete the task, each would need a true example of the file in question (not all of it)

First, most people will not just write the code for you as this is a help section, you will most likely be directed to rentacoder if you hae no desire to put in any effort.

I recommend tAKING A LOOK AT THE STRING FUNCtions , or maybe try a _fileReadToArray() on the file to see what that produces, since you dont mention if the file is one line of many etc...

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

One hash per line.

I am now trying to write a c++ program for it.

I got the code for reading and writing to files from an example and I am now figuring out the rest.

Edited by Kain134
Link to comment
Share on other sites

From your description there is no doubt the task is very easy.

The problem I have with your request is that I'd like to read a good reason to extract MD5 and store them separately. Your wording make it look like somehow suspicious.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...