зеркало из https://github.com/mozilla/pjs.git
Previous checking for Bug 343059 was a patch by Serge Gautherie <gautheri@noos.fr>
This commit is contained in:
Родитель
4b05c9de36
Коммит
9b41e6edd5
|
@ -114,7 +114,7 @@ function isPhishingURL(aLinkNode, aSilentMode, aHref)
|
|||
{
|
||||
unobscuredHostName.value = hrefURL.host;
|
||||
|
||||
if (hostNameIsIPAddress(hrefURL.host, unobscuredHostName))
|
||||
if (hostNameIsIPAddress(hrefURL.host, unobscuredHostName) && !isLocalIPAddress(unobscuredHostName))
|
||||
phishingType = kPhishingWithIPAddress;
|
||||
else if (misMatchedHostWithLinkText(aLinkNode, hrefURL, linkTextURL))
|
||||
phishingType = kPhishingWithMismatchedHosts;
|
||||
|
@ -243,3 +243,14 @@ function confirmSuspiciousURL(aPhishingType, aSuspiciousHostName)
|
|||
var buttons = nsIPS.STD_YES_NO_BUTTONS + nsIPS.BUTTON_POS_1_DEFAULT;
|
||||
return promptService.confirmEx(window, titleMsg, dialogMsg, buttons, "", "", "", "", {}); /* the yes button is in position 0 */
|
||||
}
|
||||
|
||||
// returns true if the IP address is a local address.
|
||||
function isLocalIPAddress(unobscuredHostName)
|
||||
{
|
||||
var ipComponents = unobscuredHostName.value.split(".");
|
||||
|
||||
return ipComponents[0] == 10 ||
|
||||
(ipComponents[0] == 192 && ipComponents[1] == 168) ||
|
||||
(ipComponents[0] == 169 && ipComponents[1] == 254) ||
|
||||
(ipComponents[0] == 172 && ipComponents[1] >= 16 && ipComponents[1] < 32);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче