mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-29 05:05:29 +00:00
Previous checking for Bug 343059 was a patch by Serge Gautherie <gautheri@noos.fr>
This commit is contained in:
parent
c1fc015be8
commit
5fd14fc2d5
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user