Link to home
Start Free TrialLog in
Avatar of Felix Bakhman
Felix Bakhman

asked on

data cleanup using sed

Hello, i am new to *NIX and for my security pen-testing class i have to cleanup a db dump. the instruction are to retrieve only the user name and Hash. please see http://screencast.com/t/X3FUrEYVfQpm
I removed partial information from the original dump and now i am left with only a DB with user information.

Let me know if any additional info is needed
Thank you for your assistance
Avatar of jmcg
jmcg
Flag of United States of America image

The data shown on that screendump does not at first appear to be a good candidate for using with sed. What do you look for as a human to spot the username and hash? What can you tell about the structure of the data that would let you construct instructions for sed to pull out that data. Think in terms of record separators, field separators, and relative field positions -- or possibly regular expressions.
Avatar of Felix Bakhman
Felix Bakhman

ASKER

Hello jmcg, i have attempted to use RegExr .com to some what attempt to clean up the data. I was able to highlight the user name and hash and an extra field that i have no use for, the challenge for me is applying this to the terminal
Please see screen shot
https://www.dropbox.com/s/owsc0yl59u6mnze/RegExr.png?dl=0

Thanks very much
Hash is just a string of (lowercase) hex? It looks like you have the right subexpression to match that.

Are usernames not allowed to have numbers?

It looks like there are grouping parens in the input data and the username appears as the second field and the hash appears as the third field. If these are the only paren groups in the data, you could use awk to consider the record separator to be the open paren and the field separator to be the three-character sequence ',' and pull out fields 2 and 3.
Yes each users information are separated by (    ) in the data, Usernames can be any character.
My goal is to be able to retrieve the username and the hash in the following order and format

Username : Hash

Thank you
ASKER CERTIFIED SOLUTION
Avatar of jmcg
jmcg
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you so very much for your expertise.