19 package org.sleuthkit.autopsy.coreutils;
21 import java.io.IOException;
22 import java.net.MalformedURLException;
24 import java.net.UnknownHostException;
25 import java.util.logging.Level;
26 import org.apache.commons.lang.StringUtils;
45 hostName = java.net.InetAddress.getLocalHost().getHostName();
46 }
catch (UnknownHostException ex) {
49 hostName = System.getenv(
"COMPUTERNAME");
51 if (hostName == null || hostName.isEmpty()) {
52 hostName = System.getenv(
"COMPUTERNAME");
67 String cleanUrl = url.replaceFirst(
".*:\\/\\/",
"");
70 String dirToks[] = cleanUrl.split(
"\\/");
71 if (dirToks.length > 0) {
79 base = DomainTokenizer.getInstance().getDomain(host);
80 }
catch (IOException ex) {
81 logger.log(Level.WARNING,
"Unable to load resources for domain categorization.", ex);
85 if (base.matches(
".*[~`!@#$%^&\\*\\(\\)\\+={}\\[\\];:\\?<>,/ ].*")) {
90 if (!base.contains(
".")) {
105 if (urlString == null) {
108 String urlHost = null;
111 URL url =
new URL(urlString);
112 urlHost = url.getHost();
113 }
catch (MalformedURLException ex) {
119 String result = (StringUtils.isNotBlank(urlHost))
static String extractDomain(String urlString)
static final Logger logger
static String getBaseDomain(String url)
static String getLocalHostName()
synchronized static Logger getLogger(String name)