Skip to content

Instantly share code, notes, and snippets.

@oreoshake
Created August 21, 2014 07:42
Show Gist options
  • Save oreoshake/2c8476f7ecda5fe930b7 to your computer and use it in GitHub Desktop.
Save oreoshake/2c8476f7ecda5fe930b7 to your computer and use it in GitHub Desktop.
val reasonFiltered: Option[String] = {
val sourceFileString = sourceFile.getOrElse("").toLowerCase
if ("localhost" == reportHost || "localhost" == blockedHost
|| "127.0.0.1" == reportHost || "127.0.0.1" == blockedHost) {
Some("localhost")
} else if (sourceFileString.startsWith("resource://")
|| blockedUri.contains("addons.mozilla.org%22%3B%0Avar%20c%3D%22FastestFox")) {
Some("firefox_extension")
} else if (sourceFileString.startsWith("chromenull://") || blockedUri.startsWith("chromenull://")) {
Some("chromenull")
} else if (blockedUri.startsWith("chromeinvoke://")) {
Some("chromeinvoke")
} else if (blockedUri.startsWith("chromeinvokeimmediate://")) {
Some("chromeinvokeimmediate")
} else if (blockedUri.startsWith("webviewprogressproxy://")) {
Some("webviewprogressproxy")
} else if (blockedUri.startsWith("mbinit://")) {
Some("mbinit")
} else if (blockedHost == "superfish.com" || sourceFileString.contains("superfish.com")) {
Some("superfish_com")
} else if (sourceFileString.startsWith("chrome") || blockedUri.startsWith("symres:")) {
Some("chrome")
} else if (sourceFileString.startsWith("safari") || blockedUri.startsWith("safari")) {
Some("safari")
} else if (scriptSample.getOrElse("").toLowerCase.contains("lastpass")) {
Some("lastpass")
} else if (sourceFileString.startsWith("http://js.blinkadr.com")) {
Some("js_blinkadr_com")
} else if (sourceFileString.startsWith("https://nzj.divdriver.net")) {
Some("nzj_divdriver_net")
} else if (blockedHost == "v.zilionfast.in") {
Some("v_zilionfast_in")
} else if (blockedHost == "istatic.datafastguru.info") {
Some("istatic_datafastguru_info")
} else if (blockedUri.startsWith("tmtbff://")) {
Some("tmtbff")
} else if (blockedHost == "widgets.amung.us") {
Some("widgets_amung_us")
} else if (blockedHost == "xls.searchfun.in") {
Some("xls_searchfun_in")
} else if (blockedHost == "static.image2play.com") {
Some("static_image2play_com")
} else if (!isTwitterHostname(reportHost) && !errorWhenParsingHost(reportHost)) {
Some("non-twitter-owned/" + reportHost)
} else if (blockedUri.equalsIgnoreCase("mxaddon-pkg")) {
Some("maxthon_plugin")
} else if (blockedUri.startsWith("jar:file:///")) {
Some("jar_file")
} else if (blockedUri.matches("""\Ahttps?://.*_info\.tlscdn\.com.*\z""")) {
Some("info_tlscdn_com")
} else {
None
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment