Last active
April 9, 2017 18:07
-
-
Save nathankrishnan/d4d8fb3e2659bc7f69b258847ef95588 to your computer and use it in GitHub Desktop.
Using a set to store malicious domains
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var badDomains: Set<String> = ["badguys.com", "drevil.me", "virus.io"] | |
let websiteToLoad = NSURL(string: "http://virus.io") | |
if let validDomain = websiteToLoad?.host { | |
if badDomains.contains(validDomain) { | |
print("This website is known to be malicious!") | |
} else { | |
print("This website doesn't exist in our dossier. Let's proceed.") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment