|
8 | 8 | * License: GNU/GPLv2
|
9 | 9 | * @see LICENSE.txt
|
10 | 10 | *
|
11 |
| - * This file: The scanner (last modified: 2020.07.12). |
| 11 | + * This file: The scanner (last modified: 2020.07.16). |
12 | 12 | */
|
13 | 13 |
|
14 | 14 | namespace phpMussel\Core;
|
@@ -1308,7 +1308,6 @@ private function dataHandler(string $str = '', int $Depth = 0, string $OriginalF
|
1308 | 1308 | /** Begin URL scanner. */
|
1309 | 1309 | if (
|
1310 | 1310 | isset($this->Loader->InstanceCache['URL_Scanner']) ||
|
1311 |
| - !empty($this->Loader->Configuration['urlscanner']['lookup_hphosts']) || |
1312 | 1311 | !empty($this->Loader->Configuration['urlscanner']['google_api_key'])
|
1313 | 1312 | ) {
|
1314 | 1313 | $this->Loader->InstanceCache['LookupCount'] = 0;
|
@@ -2007,88 +2006,6 @@ private function dataHandler(string $str = '', int $Depth = 0, string $OriginalF
|
2007 | 2006 |
|
2008 | 2007 | $URLScanner['DomainsCount'] = count($URLScanner['DomainParts']);
|
2009 | 2008 |
|
2010 |
| - /** Codeblock for performing hpHosts API lookups. */ |
2011 |
| - if ($this->Loader->Configuration['urlscanner']['lookup_hphosts'] && $URLScanner['DomainsCount']) { |
2012 |
| - |
2013 |
| - /** Fetch the cache entry for hpHosts, if it doesn't already exist. */ |
2014 |
| - if (!isset($this->Loader->InstanceCache['urlscanner_domains'])) { |
2015 |
| - $this->Loader->InstanceCache['urlscanner_domains'] = $this->Loader->Cache->getEntry('urlscanner_domains'); |
2016 |
| - } |
2017 |
| - |
2018 |
| - $URLExpiry = $this->Loader->Time + $this->Loader->Configuration['urlscanner']['cache_time']; |
2019 |
| - $URLScanner['ScriptIdentEncoded'] = urlencode($this->Loader->ScriptIdent); |
2020 |
| - $URLScanner['classes'] = [ |
2021 |
| - 'EMD' => "\x1a\x82\x10\x1bXXX", |
2022 |
| - 'EXP' => "\x1a\x82\x10\x16XXX", |
2023 |
| - 'GRM' => "\x1a\x82\x10\x32XXX", |
2024 |
| - 'HFS' => "\x1a\x82\x10\x32XXX", |
2025 |
| - 'PHA' => "\x1a\x82\x10\x32XXX", |
2026 |
| - 'PSH' => "\x1a\x82\x10\x31XXX" |
2027 |
| - ]; |
2028 |
| - for ($i = 0; $i < $URLScanner['DomainsCount']; $i++) { |
2029 |
| - if (!empty($URLScanner['DomainPartsNoLookup'][$URLScanner['DomainParts'][$i]])) { |
2030 |
| - continue; |
2031 |
| - } |
2032 |
| - if ( |
2033 |
| - $this->Loader->Configuration['urlscanner']['maximum_api_lookups'] > 0 && |
2034 |
| - $this->Loader->InstanceCache['LookupCount'] > $this->Loader->Configuration['urlscanner']['maximum_api_lookups'] |
2035 |
| - ) { |
2036 |
| - if ($this->Loader->Configuration['urlscanner']['maximum_api_lookups_response']) { |
2037 |
| - $this->Loader->atHit($sha256, $StringLength, $OriginalFilename, sprintf( |
2038 |
| - $this->Loader->L10N->getString('grammar_exclamation_mark'), |
2039 |
| - $this->Loader->L10N->getString('too_many_urls') |
2040 |
| - ), 2, $Depth); |
2041 |
| - } |
2042 |
| - break; |
2043 |
| - } |
2044 |
| - $URLHash = hash('md5', $URLScanner['DomainParts'][$i]) . ':' . strlen($URLScanner['DomainParts'][$i]) . ':'; |
2045 |
| - while (substr_count($this->Loader->InstanceCache['urlscanner_domains'], $URLHash)) { |
2046 |
| - $URLScanner['Class'] = |
2047 |
| - $this->Loader->substrBeforeFirst($this->Loader->substrAfterLast($this->Loader->InstanceCache['urlscanner_domains'], $URLHash), ';'); |
2048 |
| - if (!substr_count($this->Loader->InstanceCache['urlscanner_domains'], $URLHash . ':' . $URLScanner['Class'] . ';')) { |
2049 |
| - break; |
2050 |
| - } |
2051 |
| - $URLScanner['Expiry'] = (int)$this->Loader->substrBeforeFirst($URLScanner['Class'], ':'); |
2052 |
| - if ($URLScanner['Expiry'] > $this->Loader->Time) { |
2053 |
| - $URLScanner['Class'] = $this->Loader->substrAfterFirst($URLScanner['Class'], ':'); |
2054 |
| - if (!$URLScanner['Class']) { |
2055 |
| - continue 2; |
2056 |
| - } |
2057 |
| - $URLScanner['Class'] = $this->getShorthand($URLScanner['Class']); |
2058 |
| - $this->detected($URLScanner['Class'], $OriginalFilename, $sha256, $StringLength, $Depth); |
2059 |
| - } |
2060 |
| - $this->Loader->InstanceCache['urlscanner_domains'] = |
2061 |
| - str_ireplace($URLHash . $URLScanner['Class'] . ';', '', $this->Loader->InstanceCache['urlscanner_domains']); |
2062 |
| - } |
2063 |
| - $URLScanner['req'] = |
2064 |
| - 'v=' . $URLScanner['ScriptIdentEncoded'] . |
2065 |
| - '&s=' . $URLScanner['DomainParts'][$i] . |
2066 |
| - '&class=true'; |
2067 |
| - $URLScanner['req_result'] = $this->Loader->request( |
2068 |
| - 'https://verify.hosts-file.net/?' . $URLScanner['req'], |
2069 |
| - ['v' => $URLScanner['ScriptIdentEncoded'], 's' => $URLScanner['DomainParts'][$i], 'Class' => true], |
2070 |
| - 12 |
2071 |
| - ); |
2072 |
| - $this->Loader->InstanceCache['LookupCount']++; |
2073 |
| - if (substr($URLScanner['req_result'], 0, 6) === 'Listed') { |
2074 |
| - $URLScanner['Class'] = substr($URLScanner['req_result'], 7, 3); |
2075 |
| - $URLScanner['Class'] = $URLScanner['classes'][$URLScanner['Class']] ?? "\x1a\x82\x10\x3fXXX"; |
2076 |
| - $this->Loader->InstanceCache['urlscanner_domains'] .= |
2077 |
| - $URLHash . |
2078 |
| - $URLExpiry . ':' . |
2079 |
| - $URLScanner['Class'] . ';'; |
2080 |
| - $URLScanner['Class'] = $this->getShorthand($URLScanner['Class']); |
2081 |
| - $this->detected($URLScanner['Class'], $OriginalFilename, $sha256, $StringLength, $Depth); |
2082 |
| - } |
2083 |
| - $this->Loader->InstanceCache['urlscanner_domains'] .= $URLScanner['Domains'][$i] . $URLExpiry . ':;'; |
2084 |
| - } |
2085 |
| - $this->Loader->Cache->setEntry( |
2086 |
| - 'urlscanner_domains', |
2087 |
| - $this->Loader->InstanceCache['urlscanner_domains'], |
2088 |
| - $this->Loader->Configuration['urlscanner']['cache_time'] |
2089 |
| - ); |
2090 |
| - } |
2091 |
| - |
2092 | 2009 | $URLScanner['URLsCount'] = count($URLScanner['URLParts']);
|
2093 | 2010 |
|
2094 | 2011 | /** Codeblock for performing Google Safe Browsing API lookups. */
|
|
0 commit comments