Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function ConvertTo-PunyCode{
- [cmdletbinding()][parameter()]param($Data)
- (New-object System.Globalization.IdnMapping).GetAscii($Data)
- }
- Function ConvertFrom-PunyCode{
- [cmdletbinding()][parameter()]param($Data)
- try {
- (New-object System.Globalization.IdnMapping).GetUnicode($Data)
- } catch {continue;}
- }
- $AlexaTop100 = (irm https://raw.githubusercontent.com/urbanadventurer/WhatWeb/master/plugin-development/alexa-top-100.txt).split("`n")
- function Get-IDN {
- [cmdletbinding()][parameter()]param($Domain,$ErrorActionPreference = "SilentlyContinue")
- $Homoglyphs = @()
- [array]$a = @(1072,1235,119886)
- [array]$e = @(1013,1077,119890,1213,1108)
- [array]$i = @(119894)
- [array]$u = @(0352056)
- [array]$o = @(1086)
- foreach ($entry in $domain){
- $a | %{$homoglyphs += New-object -typename 'psobject' -property @{domain=$entry;unicode=$domain.replace("a", [char]::ConvertFromUtf32($_));IDN=""}}
- $e | %{$homoglyphs += New-object -typename 'psobject' -property @{domain=$entry;unicode=$domain.replace("e", [char]::ConvertFromUtf32($_));IDN=""}}
- $i | %{$homoglyphs += New-object -typename 'psobject' -property @{domain=$entry;unicode=$domain.replace("o", [char]::ConvertFromUtf32($_));IDN=""}}
- $u | %{$homoglyphs += New-object -typename 'psobject' -property @{domain=$entry;unicode=$domain.replace("u", [char]::ConvertFromUtf32($_));IDN=""}}
- $o | %{$homoglyphs += New-object -typename 'psobject' -property @{domain=$entry;unicode=$domain.replace("o", [char]::ConvertFromUtf32($_));IDN=""}}
- }
- #$$Homoglyphs.count
- $Homoglyphs | %{$_.idn = ConvertTo-PunyCode $_.unicode}
- $Homoglyphs = $Homoglyphs | ?{($_.idn -match "xn" ) -and ($_.idn -notmatch "xn--cm-fmc$")}
- ($Homoglyphs | group unicode) |%{$_.group}
- }
- #clear
- #$AlexaTop100 | %{get-idn $_} |select domain,unicode,IDN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement