19 package org.sleuthkit.datamodel.blackboardutils;
21 import java.net.MalformedURLException;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.Collections;
26 import java.util.StringTokenizer;
27 import org.apache.commons.lang3.StringUtils;
54 super(caseDb, moduleName, srcContent);
73 Collections.emptyList());
92 Collection<BlackboardAttribute> otherAttributesList)
throws TskCoreException,
BlackboardException {
95 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
109 attributes.addAll(otherAttributesList);
110 bookMarkArtifact.addAttributes(attributes);
113 getSleuthkitCase().getBlackboard().postArtifact(bookMarkArtifact, getModuleName());
116 return bookMarkArtifact;
135 String name, String value, String programName)
throws TskCoreException,
BlackboardException {
137 return addWebCookie(url, creationTime, name, value, programName,
138 Collections.emptyList());
161 long creationTime, String name, String value, String programName,
162 Collection<BlackboardAttribute> otherAttributesList)
throws TskCoreException,
BlackboardException {
165 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
180 attributes.addAll(otherAttributesList);
181 cookieArtifact.addAttributes(attributes);
184 getSleuthkitCase().getBlackboard().postArtifact(cookieArtifact, getModuleName());
187 return cookieArtifact;
205 return addWebDownload(path, startTime, url, programName, Collections.emptyList());
224 Collection<BlackboardAttribute> otherAttributesList)
throws TskCoreException,
BlackboardException {
227 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
241 attributes.addAll(otherAttributesList);
242 webDownloadArtifact.addAttributes(attributes);
245 getSleuthkitCase().getBlackboard().postArtifact(webDownloadArtifact, getModuleName());
248 return webDownloadArtifact;
268 String phoneNumber, String mailingAddress,
269 long creationTime,
long accessTime,
int count)
throws TskCoreException,
BlackboardException {
271 mailingAddress, creationTime, accessTime, count,
272 Collections.emptyList());
293 String phoneNumber, String mailingAddress,
294 long creationTime,
long accessTime,
int count,
295 Collection<BlackboardAttribute> otherAttributesList)
throws TskCoreException,
BlackboardException {
298 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
315 attributes.addAll(otherAttributesList);
316 webFormAddressArtifact.addAttributes(attributes);
319 getSleuthkitCase().getBlackboard().postArtifact(webFormAddressArtifact, getModuleName());
322 return webFormAddressArtifact;
340 long creationTime,
long accessTime,
int count)
throws TskCoreException,
BlackboardException {
342 Collections.emptyList());
363 long creationTime,
long accessTime,
int count,
364 Collection<BlackboardAttribute> otherAttributesList)
throws TskCoreException,
BlackboardException {
366 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
380 attributes.addAll(otherAttributesList);
381 webFormAutofillArtifact.addAttributes(attributes);
384 getSleuthkitCase().getBlackboard().postArtifact(webFormAutofillArtifact, getModuleName());
387 return webFormAutofillArtifact;
406 String referrer, String title, String programName)
throws TskCoreException,
BlackboardException {
407 return addWebHistory(url, accessTime, referrer, title, programName,
408 Collections.emptyList());
428 String referrer, String title, String programName,
429 Collection<BlackboardAttribute> otherAttributesList)
throws TskCoreException,
BlackboardException {
432 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
448 attributes.addAll(otherAttributesList);
449 webHistoryArtifact.addAttributes(attributes);
452 getSleuthkitCase().getBlackboard().postArtifact(webHistoryArtifact, getModuleName());
455 return webHistoryArtifact;
468 private static String extractDomain(String urlString) {
469 if (urlString == null) {
475 URL url =
new URL(urlString);
476 result = url.getHost();
477 }
catch (MalformedURLException ex) {
483 if (result == null || StringUtils.isBlank(result)) {
484 return getBaseDomain(urlString);
496 private static String getBaseDomain(String url) {
500 String cleanUrl = url.replaceFirst(
".*:\\/\\/",
"");
503 String dirToks[] = cleanUrl.split(
"\\/");
504 if (dirToks.length > 0) {
511 StringTokenizer tok =
new StringTokenizer(host,
".");
512 StringBuilder hostB =
new StringBuilder();
513 int toks = tok.countTokens();
515 for (
int count = 0; count < toks; ++count) {
516 String part = tok.nextToken();
517 int diff = toks - count;
526 String base = hostB.toString();
528 if (base.matches(
".*[~`!@#$%^&\\*\\(\\)\\+={}\\[\\];:\\?<>,/ ].*")) {
533 if (!base.contains(
".")) {
BlackboardArtifact addWebDownload(String url, long startTime, String path, String programName)
BlackboardArtifact addWebBookmark(String url, String title, long creationTime, String progName)
BlackboardArtifact addWebDownload(String url, long startTime, String path, String programName, Collection< BlackboardAttribute > otherAttributesList)
BlackboardArtifact addWebFormAddress(String personName, String email, String phoneNumber, String mailingAddress, long creationTime, long accessTime, int count)
BlackboardArtifact addWebHistory(String url, long accessTime, String referrer, String title, String programName, Collection< BlackboardAttribute > otherAttributesList)
BlackboardArtifact addWebCookie(String url, long creationTime, String name, String value, String programName, Collection< BlackboardAttribute > otherAttributesList)
BlackboardArtifact addWebHistory(String url, long accessTime, String referrer, String title, String programName)
BlackboardArtifact newArtifact(int artifactTypeID)
BlackboardArtifact addWebFormAutofill(String name, String value, long creationTime, long accessTime, int count)
BlackboardArtifact addWebFormAutofill(String name, String value, long creationTime, long accessTime, int count, Collection< BlackboardAttribute > otherAttributesList)
BlackboardArtifact addWebBookmark(String url, String title, long creationTime, String progName, Collection< BlackboardAttribute > otherAttributesList)
BlackboardArtifact addWebCookie(String url, long creationTime, String name, String value, String programName)
WebBrowserArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent)
BlackboardArtifact addWebFormAddress(String personName, String email, String phoneNumber, String mailingAddress, long creationTime, long accessTime, int count, Collection< BlackboardAttribute > otherAttributesList)