Нужен парсер!

Discussion in 'PHP' started by IIAHbI4, 15 Dec 2008.

  1. IIAHbI4

    IIAHbI4 Banned

    Joined:
    24 Aug 2006
    Messages:
    276
    Likes Received:
    331
    Reputations:
    11
    Нужен парсер sql дампа, сохраняющий в file.txt информацию вида
    [ username ; hash ; e-mail ; icq ]
     
    3 people like this.
  2. ntldr

    ntldr Elder - Старейшина

    Joined:
    4 Dec 2007
    Messages:
    367
    Likes Received:
    140
    Reputations:
    23
    проще дамп загнать в базу, а из нее скриптом из 10 строк сделать как надо тебе
     
  3. IIAHbI4

    IIAHbI4 Banned

    Joined:
    24 Aug 2006
    Messages:
    276
    Likes Received:
    331
    Reputations:
    11
    1. дамп на удалённо хеккерском конпьютере
    2. он весит ~180 метров
    3. при данных обстоятельствах, я не могу установить скуль сервер
     
  4. IIAHbI4

    IIAHbI4 Banned

    Joined:
    24 Aug 2006
    Messages:
    276
    Likes Received:
    331
    Reputations:
    11
    вот так выдираем мыльники
    PHP:
    <?php
    $to
    =array('>','<','/','"','\'','='. ',','.');
    $fnl=array();
    $result=array();
    /*считываем файл*/
    $fin=fopen('input.txt','r');
    while(!
    feof($fin)){
    $result[]=fgets($fin);
    }
    fclose($fin);
    разбиваем весь файл на один массив
    со значениями 
    - словами*/
    $result=implode(' ',$result);
    $result=str_replace($to,' ',$result);/*очищаем от ненужных символов*/
    $result=explode(' ',$result);
    for(
    $i=0;$i<sizeof($result);$i++)
    {
    $str=$result[$i];
    $tst=strpos($str,'@');/*находим слова с нужным символом*/
    if(!empty($tst)){
    if(
    $str[0]=='/')
    $str[0]=' ';
    $fnl[]=trim($str);
    }
    unset(
    $tst);
    }
    $fout=fopen('output.txt','w');
    for(
    $i=0;$i<sizeof($fnl);$i++)   /*вывод*/
    {
    fputs($fout,$fnl[$i]."\r\n");
    }
    fclose($fout);
    ?> 
     
    1 person likes this.
  5. IIAHbI4

    IIAHbI4 Banned

    Joined:
    24 Aug 2006
    Messages:
    276
    Likes Received:
    331
    Reputations:
    11
    вот так хэши
    PHP:
    <?php    $text = ' [B]тут около 40 метров текста содержащего текст /: [/B]';    $pattern = "|[a-z0-9]{32}|is";    preg_match_all($pattern, $text, $out);    echo "<pre>";    print_r($out);    echo "</pre>";  ?> 
     
  6. IIAHbI4

    IIAHbI4 Banned

    Joined:
    24 Aug 2006
    Messages:
    276
    Likes Received:
    331
    Reputations:
    11
    нее говнокод /:
     
    1 person likes this.
  7. groundhog

    groundhog Elder - Старейшина

    Joined:
    12 May 2007
    Messages:
    1,159
    Likes Received:
    425
    Reputations:
    180
    Напиши хоть структуру таблицы и пример одной записи дампа...
     
  8. IIAHbI4

    IIAHbI4 Banned

    Joined:
    24 Aug 2006
    Messages:
    276
    Likes Received:
    331
    Reputations:
    11
    PHP:
    INSERT INTO phpbb_users (user_id, user_active, username, user_password, user_session_time, user_session_page, user_lastvisit, user_regdate, user_level, user_posts, user_timezone, user_style, user_lang, user_dateformat, user_new_privmsg, user_unread_privmsg, user_last_privmsg, user_login_tries, user_last_login_try, user_emailtime, user_viewemail, user_attachsig, user_allowhtml, user_allowbbcode, user_allowsmile, user_allowavatar, user_allow_pm, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_rank, user_avatar, user_avatar_type, user_email, user_icq, user_website, user_from, user_sig, user_sig_bbcode_uid, user_aim, user_yim, user_msnm, user_occ, user_interests, user_actkey, user_newpasswd) VALUES('7463', '0', 'qerikiopik', 'bf587d217f71ffd2015c3c042efc223f', '0', '0', '0', '1222954348', '0', '0', '-12.00', '1', 'bulgarian', 'D M d, Y g:i a', '0', '0', '0', '0', '0', NULL, '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', NULL, '', '0', 'qerikiopikj@mail.ru', '1238812', 'http://avtovolt.ru', 'Россия', '', '', '', '', '', 'Автоэлектрика', 'автомобили, автоспорт, авторемонт', '8c28b6f2fa32081938df01f66a', NULL); 
     
  9. -Hormold-

    -Hormold- Кто, если не ты?

    Joined:
    29 Sep 2007
    Messages:
    418
    Likes Received:
    290
    Reputations:
    44
    PHP:
    <?php
    $str
    =file("1.txt");
    $o="";
    for(
    $i=0;$i<count($str);$i++){
        
    $ex=explode("'",$str[$i]);
        
    $user=$ex[5];
        
    $password=$ex[7];
        
    $mail=$ex[65];
        
    $icq=$ex[67];
        
    $o.="[ $user ; $password ; $mail ; $icq ]\n";
    }
    $fp=fopen("file.txt","ab");
    fwrite($fp,$o);
    fclose($fp);
    ?>

    вот!
     
    #9 -Hormold-, 15 Dec 2008
    Last edited: 15 Dec 2008
  10. Pashkela

    Pashkela Динозавр

    Joined:
    10 Jan 2008
    Messages:
    2,750
    Likes Received:
    1,044
    Reputations:
    339
    http://pashkela.narod.ru/progi/mail_hash_parser.rar