Updated from latest live version

This commit is contained in:
Daniel Winzen
2019-02-03 12:52:18 +01:00
parent 189262d6cb
commit eb412415ea
11 changed files with 177 additions and 76 deletions

View File

@ -18,28 +18,37 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Executed every 24 hours via cron - checks for new sites.
// Executed daily via cronjob - checks for new sites.
include('common_config.php');
try{
$db=new PDO('mysql:host=' . DBHOST . ';dbname=' . DBNAME . ';charset=utf8mb4', DBUSER, DBPASS, [PDO::ATTR_ERRMODE=>PDO::ERRMODE_WARNING, PDO::ATTR_PERSISTENT=>PERSISTENT]);
$db=new PDO('mysql:host=' . DBHOST . ';dbname=' . DBNAME, DBUSER, DBPASS, [PDO::ATTR_ERRMODE=>PDO::ERRMODE_WARNING, PDO::ATTR_PERSISTENT=>PERSISTENT]);
}catch(PDOException $e){
die($I['nodb']);
}
$ch=curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, USERAGENT);
curl_setopt($ch, CURLOPT_PROXY, PROXY);
curl_setopt($ch, CURLOPT_PROXYTYPE, 7);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 25);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_ENCODING, '');
$onions=[];
//sources to get links from
check_links($onions, $ch, 'https://tt3j2x4k5ycaa5zt.onion.to/antanistaticmap/stats/yesterday');
check_links($onions, $ch, 'https://tt3j2x4k5ycaa5zt.tor2web.org/antanistaticmap/stats/yesterday');
check_links($onions, $ch, 'http://tt3j2x4k5ycaa5zt.onion/onions.php?format=text');
check_links($onions, $ch, 'http://skunksworkedp2cg.onion/sites.txt');
check_links($onions, $ch, 'http://7cbqhjnlkivmigxf.onion/');
check_links($onions, $ch, 'https://tt3j2x4k5ycaa5zt.onion.link/antanistaticmap/stats/yesterday');
check_links($onions, $ch, 'https://tt3j2x4k5ycaa5zt.onion.rip/antanistaticmap/stats/yesterday');
check_links($onions, $ch, 'https://tt3j2x4k5ycaa5zt.onion.sh/antanistaticmap/stats/yesterday');
check_links($onions, $ch, 'https://tt3j2x4k5ycaa5zt.tor2web.io/antanistaticmap/stats/yesterday');
check_links($onions, $ch, 'http://visitorfi5kl7q7i.onion/address/');
check_links($onions, $ch, 'https://onion.cab/list.php?a=list');
check_links($onions, $ch, 'http://zlal32teyptf4tvi.onion/json/all');
check_links($onions, $ch, 'http://7cbqhjnlkivmigxf.onion/');
check_links($onions, $ch, 'http://dhosting4okcs22v.onion/list.php');
check_links($onions, $ch, 'http://hostdanyyyf65r4b.onion/list.php');
check_links($onions, $ch, 'http://cb3robuo3hobodw6.onion/darknet/');
//add them to the database
add_onions($onions, $db);
@ -49,7 +58,7 @@ $db->exec('DELETE FROM ' . PREFIX . "onions WHERE address!='' AND timediff>24192
function check_links(&$onions, &$ch, $link){
curl_setopt($ch, CURLOPT_URL, $link);
$links=curl_exec($ch);
if(preg_match_all('~(https?://)?([a-z0-9]*\.)?([a-z2-7]{16}).onion(/[^\s><"]*)?~i', $links, $addr)){
if(preg_match_all('~(https?://)?([a-z0-9]*\.)?([a-z2-7]{16}|[a-z2-7]{56}).onion(/[^\s><"]*)?~i', $links, $addr)){
foreach($addr[3] as $link){
$link=strtolower($link);
$onions[md5($link, true)]=$link;
@ -57,7 +66,7 @@ function check_links(&$onions, &$ch, $link){
}
}
function add_onions(&$onions, PDO $db){
function add_onions(&$onions, $db){
$stmt=$db->query('SELECT md5sum FROM ' . PREFIX . 'onions;');
while($tmp=$stmt->fetch(PDO::FETCH_NUM)){
if(isSet($onions[$tmp[0]])){
@ -72,4 +81,3 @@ function add_onions(&$onions, PDO $db){
}
$db->commit();
}
?>