19 package org.sleuthkit.autopsy.coreutils;
21 import java.net.MalformedURLException;
23 import java.net.UnknownHostException;
24 import java.util.StringTokenizer;
41 hostName = java.net.InetAddress.getLocalHost().getHostName();
42 }
catch (UnknownHostException ex) {
45 hostName = System.getenv(
"COMPUTERNAME");
47 if (hostName == null || hostName.isEmpty()) {
48 hostName = System.getenv(
"COMPUTERNAME");
63 String cleanUrl = url.replaceFirst(
".*:\\/\\/",
"");
66 String dirToks[] = cleanUrl.split(
"\\/");
67 if (dirToks.length > 0) {
74 StringTokenizer tok =
new StringTokenizer(host,
".");
75 StringBuilder hostB =
new StringBuilder();
76 int toks = tok.countTokens();
78 for (
int count = 0; count < toks; ++count) {
79 String part = tok.nextToken();
80 int diff = toks - count;
90 String base = hostB.toString();
92 if (base.matches(
".*[~`!@#$%^&\\*\\(\\)\\+={}\\[\\];:\\?<>,/ ].*")) {
97 if(!base.contains(
".")) {
113 if (urlString == null) {
119 URL url =
new URL(urlString);
120 result = url.getHost();
121 }
catch (MalformedURLException ex) {
126 if (result == null || result.trim().isEmpty()) {
static String extractDomain(String urlString)
static String getBaseDomain(String url)
static String getLocalHostName()