|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
So I have... |
|
Posted: Fri Nov 16, 2007 3:25 am |
|
|
lordorion |
Regular user |
|
|
Joined: Nov 16, 2007 |
Posts: 6 |
|
|
|
|
|
|
|
A sql file with lots of usernames, md5s, etc. I am looking for a way to remove the md5s and organize them into a list. Any ideas? |
|
|
|
|
Posted: Fri Nov 16, 2007 3:29 am |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
Write script for that - in perl, php or other language. Or write shell script.
It's simple string manipulation
By the way i'm using special php CLI script, which takes raw copy-pasted text, extracts md5 hashes and then exports them to Cain cracker. Very useful, lot easier as copy-paste one-by-one |
|
|
|
|
Posted: Fri Nov 16, 2007 3:32 am |
|
|
lordorion |
Regular user |
|
|
Joined: Nov 16, 2007 |
Posts: 6 |
|
|
|
|
|
|
|
Yes, I could, but I'm not very good at scripting. I was wondering if anyone had one, otherwise I guess I'll have to hit the books |
|
|
|
|
Posted: Fri Nov 16, 2007 3:33 am |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
How big is your sql dump file? Megabytes? |
|
|
|
|
Posted: Fri Nov 16, 2007 3:35 am |
|
|
lordorion |
Regular user |
|
|
Joined: Nov 16, 2007 |
Posts: 6 |
|
|
|
|
|
|
|
Yeah, about 5.5 megs after I deleted some stuff. Original file size was 50 megs. |
|
|
|
|
Posted: Fri Nov 16, 2007 3:42 am |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
Yes, first thing to do is to remove unneeded info and let only user data.
I can write needed php script within minutes, but i need source.
Can you use php scripts on you PC? And if you dont have privacy concerns, then upload packed file somewhere and gimme da link. And i will write script for md5 extracting.
... Tomorrow, becaue right now there is 5:43 AM where I live |
|
|
|
|
Posted: Fri Nov 16, 2007 3:46 am |
|
|
lordorion |
Regular user |
|
|
Joined: Nov 16, 2007 |
Posts: 6 |
|
|
|
|
|
|
|
See, the thing is i kinda do have privacy concerns. The file basically looks like this all the way through:
','cc8cc5a0b0cd91564ea8b3514fa82d05',1165473474,-4,1165472573,1165472483,0,0,'0.00',4,'english','D M d, Y g:i a',2,0,1175641746,0,0,NULL,0,1,1,1,1,1,1,1,1,1,1,0,' |
|
|
|
|
|
|
|
|
Posted: Fri Nov 16, 2007 3:32 pm |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
OK, here is php CLI script I wrote today:
Code: |
<?php
error_reporting(E_ALL);
//=======================================================
$infile = 'test.txt';
$outfile = 'out.txt';
//=======================================================
if(!is_file($infile))
{
die('Cannot open input file, exiting!');
}
$buff = file_get_contents($infile);
$buff = strtolower($buff);
$arr = array();
$cnt = preg_match_all('/\'[a-f0-9]{32}\'/',$buff, $arr);
echo "found $cnt hashes\n";
$arr2 = array();
for($i = 0; $i < $cnt; $i ++)
{
$arr2[] = str_replace('\'', '', $arr[0][$i]);
}
$arr = array_unique($arr2);
$arr2 = array();
foreach($arr as $hash)
{
if(preg_match('/^[a-f0-9]{32}$/',$hash))
{
$arr2[] = $hash;
}
}
sort($arr2);
$cnt2 = count($arr2);
echo "got $cnt2 unique hashes\n";
$out = implode("\n", $arr2);
$fh = fopen($outfile, 'wb');
fwrite($fh, $out);
fclose($fh);
die("--okok--");
?>
|
It is simple script and can't handle too big input files (> 20MB). And there can be some "noise", because hash extracting regex is as simple as possible. If someone writes better version - share it here |
|
|
|
|
|
|
|
|
Posted: Fri Nov 16, 2007 6:53 pm |
|
|
lordorion |
Regular user |
|
|
Joined: Nov 16, 2007 |
Posts: 6 |
|
|
|
|
|
|
|
Worked really well, thank you! |
|
|
|
|
Posted: Sat Nov 17, 2007 8:31 am |
|
|
pexli |
Valuable expert |
|
|
Joined: May 24, 2007 |
Posts: 665 |
Location: Bulgaria |
|
|
|
|
|
|
waraxe i don't try your script but look nice.Install phpmyadmin on your PC.Import this dump in some db.After that simple sql query
example
Select concat(username,":",password) from users
Select concat(username,":",password,":",salt) from users |
|
|
|
|
Posted: Mon Nov 19, 2007 6:22 am |
|
|
sk8er |
Advanced user |
|
|
Joined: May 09, 2005 |
Posts: 64 |
|
|
|
|
|
|
|
How is it going? , Because is this php useful for working hash truth?,
I am interested in getting the list from e-mails would you help me there???
saludos |
|
|
|
|
www.waraxe.us Forum Index -> Newbies corner
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT
Page 1 of 1
|
|
|
Powered by phpBB © 2001-2008 phpBB Group
|
|
|
|
|