public function main() { // load CURL class require dirname(__FILE__) . '/lib/CURL.php'; // iterator over hashes foreach ($this->hashes as $index => $hash) { // check if csv line data $fields = str_getcsv($hash, ';'); if (count($fields) > 1) { $this->out('Trying hash: ' . implode(', ', $fields) . ' … ', false); $hash = $fields[count($fields) - 1]; } else { $this->out('Trying hash: ' . $hash . ' … ', false); } // use curl to send request to md5crack $CURL = new CURL('http://md5crack.com/crackmd5.php', array(CURLOPT_POSTFIELDS => array('term' => $hash, 'crackbtn' => true))); // search for result string if (preg_match('@Found:\\s+md5\\("(?P<source>.+)"\\)\\s=\\s+([a-z0-9]+)@mi', $CURL->read(), $found)) { $this->out($found['source']); } else { $this->out('not found'); } } $this->quit('done!'); }