Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   PHP, PERL, MySQL, JavaScript (https://forum.antichat.xyz/forumdisplay.php?f=37)
-   -   помогите с парсилкой (https://forum.antichat.xyz/showthread.php?t=107558)

maxi163 23.02.2009 03:18

помогите с парсилкой
 
есть логи из которых я хочу выдрать "email=" и "pass="
структура такова что под емейлом находится пасс
Я юзаю такой скрипт
Код:

<?php

/*
ZeuS Passwords Parser
by Helkern
(c) ItHack.ws
*/

error_reporting(0);
set_time_limit(0);

$usage=" [ ZeuS Passwords Parser v1.0 ]\r\n\r\n";
$usage.="\t\t-l  Logs file.\r\n";
$usage.="\t\t-o  Outfile.\r\n\r\n";
$usage.=" (c) ItHack.ws, by Helkern\r\n\r\n";

if($argc==1) {
echo $usage;
exit();
}

$i=0;
while($i<=$argc) {
if($argv[$i]=="-l")
$logs_file=$argv[$i+1];
elseif($argv[$i]=="-o")
$out_file=$argv[$i+1];

$i++;
}

$url_pattern="^http://[a-zA-Z0-9\._-]+\.[a-zA-Z]{2,4}";
$user_pattern="^email=";
$pass_pattern="^pass=";

echo $usage;

$fp=fopen($logs_file, "r") or die(" [~] Can't open logs file ($logs_file)\r\n");
$fo=fopen($out_file, "a+") or die(" [~] Can't open outfile ($out_file)\r\n");

while(!feof($fp)) {
$data=trim(fgets($fp, 1024));
if(eregi($url_pattern, $data))
fwrite($fo, $data."\r\n");
if(eregi($user_pattern, $data))
fwrite($fo, $data."\r\n");
if(eregi($pass_pattern, $data))
fwrite($fo, $data."\r\n");
}

echo " [~] See the $out_file and have the fun =)\r\n";

fclose($fp);
fclose($fo);

?>

дак проблема в том что в логах имеются значени такие как email=[пустота] и pass=[пустота], появляется куча дублей. Если кто может помогите, нужно доработать скрипт чтобы он тянул емайл и пасс и записывал в таком виде email;pass и соответственно без дубликатов

вид лога:
Код:

-------------ttp://vkontakte.ru/--------------
Session cookies: remixchk=5
Key pressed: ak2812@mail.ru726788<enter><enter>
Field hooked: email=ak2812@mail.ru
pass=726788

email=ak2812@mail.ru
pass=726788
----------------------------------------------------

-------------ttp://vkontakte.ru/id957285--------------
Session cookies: remixchk=5; remixmid=957285; remixemail=ak2812%40mail.ru; remixpass=34a1586358b4d492b9713e6af945a62d
Key pressed:
Field hooked: email=ak2812@mail.ru
pass=726788

q=Поиск
act=quick
to_m_id=957285
edit_activity_text=
to_op_id=957285
to_id=9572850715
act=sent


************2008.07.26 23:03:18 :: 78.85.65.13************
----------------------------------------------------

-------------ttp://vkontakte.ru/id957285--------------
Session cookies: remixchk=5; remixmid=957285; remixemail=ak2812%40mail.ru; remixpass=34a1586358b4d492b9713e6af945a62d
Key pressed:
Field hooked: q=Поиск
act=quick
=957285
=1
to_m_id=957285
=7bea19086b6ccdf6d5c1a23e2541b6d4
edit_activity_text=
to_op_id=957285
to_id=9572850715
act=sent

q=Поиск
act=quick
to_m_id=957285
edit_activity_text=
to_op_id=957285
to_id=9572850715
act=sent
q=Поиск
act=quick
to_m_id=957285
edit_activity_text=
to_op_id=957285
to_id=9572850715
act=sent


[dei] 23.02.2009 03:43

ну как то так =\

PHP код:

<?php

/*
ZeuS Passwords Parser
by Helkern
(c) ItHack.ws
*/

error_reporting(0);
set_time_limit(0);

$usage=" [ ZeuS Passwords Parser v1.0 ]\r\n\r\n";
$usage.="\t\t-l   Logs file.\r\n";
$usage.="\t\t-o   Outfile.\r\n\r\n";
$usage.=" (c) ItHack.ws, by Helkern\r\n\r\n";

if(
$argc==1) {
echo 
$usage;
exit();
}

$i=0;
while(
$i<=$argc) {
if(
$argv[$i]=="-l")
$logs_file=$argv[$i+1];
elseif(
$argv[$i]=="-o")
$out_file=$argv[$i+1];

$i++;
}

echo 
$usage;

$fo=fopen($out_file"a+") or die(" [~] Can't open outfile ($out_file)\r\n");

$data=file_get_contents($logs_file) or die(" [~] Can't open logs file ($logs_file)\r\n");

preg_match_all('/email=(.+?)\s+pass=(.+)/'$data$matches);
$c count($matches[0]);
for(
$i=0;$i<$c;$i++) {
fwrite($fo$matches[1][$i].':'.$matches[2][$i]."\n");
}

echo 
" [~] See the $out_file and have the fun =)\r\n";

fclose($fo);

?>


maxi163 23.02.2009 04:40

[dei] респект и уважуха
после 3-х парсеров и ручек получил то что хотел!

Blackcat95 23.02.2009 09:43

А в зевсе разве пассы не в мд5?

maxi163 23.02.2009 09:57

у меня не зевс

maxi163 25.02.2009 20:56

ещё просьба:
нужен скрипт который удаляет из txt файла такие строчки:
xxxx@yyyy:[пустота], где yyyy это может быть mail.ru, yahoo.com и т.д.

[dei] 26.02.2009 01:17

PHP код:

<?php
$file1
='in.txt';
$file2='out.txt';

$f fopen($file2,'w');
foreach(
file($file1) as $line) {
    if(
preg_match('/.*@.*:.+/U',trim($line))) fputs($f,$line);
}
?>


maxi163 26.02.2009 11:54

ещё раз благодарю


Время: 23:21