From 095685aa7702e60b99fdd9a761ea28e8fe44b650 Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Sun, 25 Oct 2020 19:00:01 +0100 Subject: [PATCH] Use encoding in all curl requests --- common_config.php | 1 + cron/tests.php | 4 ---- cron/update.php | 8 +------- helpers/tmp3.php | 1 - www/admin.php | 2 +- www/test.php | 1 - 6 files changed, 3 insertions(+), 14 deletions(-) diff --git a/common_config.php b/common_config.php index 4bc00b1..17de4b6 100644 --- a/common_config.php +++ b/common_config.php @@ -159,4 +159,5 @@ function set_curl_options(CurlHandle $ch){ curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($ch, CURLOPT_TIMEOUT, 60); + curl_setopt($ch, CURLOPT_ENCODING, ''); } diff --git a/cron/tests.php b/cron/tests.php index 12dd532..cf38f45 100644 --- a/cron/tests.php +++ b/cron/tests.php @@ -20,7 +20,6 @@ foreach($onions as $onion){ curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_MAXREDIRS, 2); - curl_setopt($ch, CURLOPT_ENCODING, ''); curl_setopt($ch, CURLOPT_HTTPHEADER, ["Host: $onion[address].onion", 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: en-US,en;q=0.5', 'Accept-Encoding: gzip, deflate', 'Connection: keep-alive', 'Upgrade-Insecure-Requests: 1']); curl_setopt($ch, CURLOPT_URL, "http://$onion[address].onion/"); curl_multi_add_handle($mh, $ch); @@ -79,7 +78,6 @@ foreach($curl_handles as $handle){ curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_MAXREDIRS, 2); - curl_setopt($ch, CURLOPT_ENCODING, ''); curl_setopt($ch, CURLOPT_HTTPHEADER, ["Host: $onion[address].onion", 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: en-US,en;q=0.5', 'Accept-Encoding: gzip, deflate', 'Connection: keep-alive', 'Upgrade-Insecure-Requests: 1']); curl_setopt($ch, CURLOPT_URL, "http://$onion[address].onion/".$matches[1]); $content=curl_exec($ch); @@ -90,7 +88,6 @@ foreach($curl_handles as $handle){ curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_MAXREDIRS, 2); - curl_setopt($ch, CURLOPT_ENCODING, ''); curl_setopt($ch, CURLOPT_HTTPHEADER, ["Host: $onion[address].onion", 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: en-US,en;q=0.5', 'Accept-Encoding: gzip, deflate', 'Connection: keep-alive', 'Upgrade-Insecure-Requests: 1']); curl_setopt($ch, CURLOPT_URL, $matches[1]); $content=curl_exec($ch); @@ -109,7 +106,6 @@ foreach($curl_handles as $handle){ curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_MAXREDIRS, 2); - curl_setopt($ch, CURLOPT_ENCODING, ''); curl_setopt($ch, CURLOPT_HTTPHEADER, ["Host: $onion[address].onion", 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: en-US,en;q=0.5', 'Accept-Encoding: gzip, deflate', 'Connection: keep-alive', 'Upgrade-Insecure-Requests: 1']); curl_setopt($ch, CURLOPT_URL, $link_to_check); $content=curl_exec($ch); diff --git a/cron/update.php b/cron/update.php index cbe0e35..97226d3 100644 --- a/cron/update.php +++ b/cron/update.php @@ -48,13 +48,7 @@ function check_links(array &$onions, CurlHandle &$ch, string $link_to_check, boo if($scan_children && empty($scanned_onions[$md5])){ $scanned_onions[$md5]=$link; $ch_child=curl_init(); - curl_setopt($ch_child, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch_child, CURLOPT_USERAGENT, USERAGENT); - curl_setopt($ch_child, CURLOPT_PROXY, PROXY); - curl_setopt($ch_child, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME); - curl_setopt($ch_child, CURLOPT_CONNECTTIMEOUT, 25); - curl_setopt($ch_child, CURLOPT_TIMEOUT, 30); - curl_setopt($ch_child, CURLOPT_ENCODING, ''); + set_curl_options($ch_child); curl_setopt($ch_child, CURLOPT_URL, "http://$link.onion"); curl_multi_add_handle($mh, $ch_child); $curl_handles []= $ch_child; diff --git a/helpers/tmp3.php b/helpers/tmp3.php index afcbef5..4cb2250 100644 --- a/helpers/tmp3.php +++ b/helpers/tmp3.php @@ -9,7 +9,6 @@ $stmt=$db->query("SELECT onions.address FROM onions LEFT JOIN phishing ON (phish $move=$db->prepare("UPDATE onions SET category=18, locked=1, description='Add injecting phishing clone of an existing site - SCAM' WHERE address=?;"); $ch=curl_init(); set_curl_options($ch); -//curl_setopt($ch, CURLOPT_HEADER, true); while($tmp=$stmt->fetch(PDO::FETCH_NUM)){ curl_setopt($ch, CURLOPT_URL, "http://".gethostbyname("$tmp[0].onion")); $response=curl_exec($ch); diff --git a/www/admin.php b/www/admin.php index ebc4905..71c4550 100644 --- a/www/admin.php +++ b/www/admin.php @@ -24,7 +24,7 @@ print_langs(); if(!isset($_POST['pass']) || $_POST['pass']!==ADMINPASS){ echo "
"; echo ""; - echo "

"; + echo "

"; echo ""; echo '
'; if(isset($_POST['pass'])){ diff --git a/www/test.php b/www/test.php index 4eb0079..e427ec4 100644 --- a/www/test.php +++ b/www/test.php @@ -39,7 +39,6 @@ if(!empty($_REQUEST['addr'])){ set_curl_options($ch); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); - curl_setopt($ch, CURLOPT_ENCODING, ''); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_URL, "http://$addr[4].onion/"); curl_setopt($ch, CURLOPT_HTTPHEADER, ["Host: $addr[4].onion", 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: en-US,en;q=0.5', 'Accept-Encoding: gzip, deflate', 'Connection: keep-alive', 'Upgrade-Insecure-Requests: 1']);