Skip to content

Commit d84dd5d

Browse files
committed
hpHosts is dead. Removing related content accordingly.
1 parent f374b57 commit d84dd5d

File tree

4 files changed

+5
-108
lines changed

4 files changed

+5
-108
lines changed

assets/channels.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: Alternative channels data for failed curl requests (last modified: 2020.06.12).
10+
# This file: Alternative channels data for failed curl requests (last modified: 2020.07.16).
1111
##/
1212

1313
Triggers:
1414
GitHub: "https://raw.githubusercontent.com/"
1515
VirusTotal_HTTPS: "https://www.virustotal.com/vtapi"
16-
hpHosts_HTTPS: "https://verify.hosts-file.net/"
1716
GitHub:
1817
Charts:
1918
GitHub: "https://raw.githubusercontent.com/Maikuolan/Compatibility-Charts/"
@@ -22,7 +21,3 @@ VirusTotal_HTTPS:
2221
VirusTotal:
2322
VirusTotal_HTTPS: https://www.virustotal.com/vtapi
2423
VirusTotal_HTTP: http://www.virustotal.com/vtapi
25-
hpHosts_HTTPS:
26-
hpHosts:
27-
hpHosts_HTTPS: https://verify.hosts-file.net/
28-
hpHosts_HTTP: http://verify.hosts-file.net/

assets/config.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: Configuration defaults file (last modified: 2020.07.08).
10+
# This file: Configuration defaults file (last modified: 2020.07.16).
1111
##/
1212

1313
core:
@@ -180,14 +180,12 @@ core:
180180
default: false
181181
disabled_channels:
182182
type: "checkbox"
183-
default: "VirusTotal_HTTP,hpHosts_HTTP"
183+
default: "VirusTotal_HTTP"
184184
choices:
185185
GitHub: "GitHub"
186186
BitBucket: "BitBucket"
187187
VirusTotal_HTTPS: "VirusTotal (HTTPS)"
188188
VirusTotal_HTTP: "VirusTotal (HTTP)"
189-
hpHosts_HTTPS: "hpHosts (HTTPS)"
190-
hpHosts_HTTP: "hpHosts (HTTP)"
191189
value_preg_filter:
192190
"~\s~": ""
193191
signatures:
@@ -360,11 +358,6 @@ virustotal:
360358
default: 1
361359
preview: "minutes"
362360
urlscanner:
363-
lookup_hphosts:
364-
type: "bool"
365-
default: true
366-
See also:
367-
hosts-file.net: "https://hosts-file.net/"
368361
google_api_key:
369362
type: "string"
370363
default: ""

assets/shorthand.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: phpMussel shorthand data (last modified: 2020.06.12).
10+
# This file: phpMussel shorthand data (last modified: 2020.07.16).
1111
#
1212
# Warning: When modifying the information in this file, be careful to ensure
1313
# that any changes made won't conflict with the what phpMussel recognises as
@@ -21,17 +21,13 @@
2121
Vendor Shorthand:
2222
2: ClamAV
2323
3: phpMussel
24-
4: SecuriteInfo
2524
5: ZBB
2625
6: NLNetLabs
2726
7: FoxIT
2827
8:
2928
0: PhishTank
30-
1: Malc0de
31-
2: hpHosts
3229
3: Spam404
3330
4: Cybercrime.Tracker
34-
5: abuse.ch
3531
9: phpMussel
3632
10: Malware.Expert
3733
Vendor Weight Options:
@@ -40,16 +36,12 @@ Vendor Weight Options:
4036
Vendor Search Patterns:
4137
ClamAV: "\x1a[\x20-\x2f]|ClamAV"
4238
phpMussel: "\x1a[\x30-\x3f\x90-\x9f]|phpMussel"
43-
SecuriteInfo: "\x1a[\x40-\x4f]"
4439
ZBB: "\x1a[\x50-\x5f]"
4540
NLNetLabs: "\x1a[\x60-\x6f]"
4641
FoxIT: "\x1a[\x70-\x7f]"
4742
PhishTank: "\x1a\x80"
48-
Malc0de: "\x1a\x81"
49-
hpHosts: "\x1a\x82"
5043
Spam404: "\x1a\x83"
5144
Cybercrime.Tracker: "\x1a\x84"
52-
abuse.ch: "\x1a\x85"
5345
Malware.Expert: "\x1a[\xa0-\xaf]"
5446
Metadata Shorthand:
5547
1: Testfile

src/Scanner.php

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: The scanner (last modified: 2020.07.12).
11+
* This file: The scanner (last modified: 2020.07.16).
1212
*/
1313

1414
namespace phpMussel\Core;
@@ -1308,7 +1308,6 @@ private function dataHandler(string $str = '', int $Depth = 0, string $OriginalF
13081308
/** Begin URL scanner. */
13091309
if (
13101310
isset($this->Loader->InstanceCache['URL_Scanner']) ||
1311-
!empty($this->Loader->Configuration['urlscanner']['lookup_hphosts']) ||
13121311
!empty($this->Loader->Configuration['urlscanner']['google_api_key'])
13131312
) {
13141313
$this->Loader->InstanceCache['LookupCount'] = 0;
@@ -2007,88 +2006,6 @@ private function dataHandler(string $str = '', int $Depth = 0, string $OriginalF
20072006

20082007
$URLScanner['DomainsCount'] = count($URLScanner['DomainParts']);
20092008

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-
20922009
$URLScanner['URLsCount'] = count($URLScanner['URLParts']);
20932010

20942011
/** Codeblock for performing Google Safe Browsing API lookups. */

0 commit comments

Comments
 (0)