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;
55 super(caseDb, moduleName, srcContent);
74 Collections.emptyList());
93 Collection<BlackboardAttribute> otherAttributesList)
throws TskCoreException,
BlackboardException {
96 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
110 attributes.addAll(otherAttributesList);
111 bookMarkArtifact.addAttributes(attributes);
114 getSleuthkitCase().getBlackboard().postArtifact(bookMarkArtifact, getModuleName());
117 return bookMarkArtifact;
136 String name, String value, String programName)
throws TskCoreException,
BlackboardException {
138 return addWebCookie(url, creationTime, name, value, programName,
139 Collections.emptyList());
162 long creationTime, String name, String value, String programName,
163 Collection<BlackboardAttribute> otherAttributesList)
throws TskCoreException,
BlackboardException {
166 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
181 attributes.addAll(otherAttributesList);
182 cookieArtifact.addAttributes(attributes);
185 getSleuthkitCase().getBlackboard().postArtifact(cookieArtifact, getModuleName());
188 return cookieArtifact;
206 return addWebDownload(path, startTime, url, programName, Collections.emptyList());
225 Collection<BlackboardAttribute> otherAttributesList)
throws TskCoreException,
BlackboardException {
228 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
242 attributes.addAll(otherAttributesList);
243 webDownloadArtifact.addAttributes(attributes);
246 getSleuthkitCase().getBlackboard().postArtifact(webDownloadArtifact, getModuleName());
249 return webDownloadArtifact;
269 String phoneNumber, String mailingAddress,
270 long creationTime,
long accessTime,
int count)
throws TskCoreException,
BlackboardException {
272 mailingAddress, creationTime, accessTime, count,
273 Collections.emptyList());
294 String phoneNumber, String mailingAddress,
295 long creationTime,
long accessTime,
int count,
296 Collection<BlackboardAttribute> otherAttributesList)
throws TskCoreException,
BlackboardException {
299 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
302 if(StringUtils.isNotBlank(email)) {
306 if(StringUtils.isNotBlank(phoneNumber)) {
307 commManager.createAccountFileInstance(
Account.
Type.
PHONE, phoneNumber,
this.getModuleName(), this.getContent());
325 attributes.addAll(otherAttributesList);
329 getSleuthkitCase().getBlackboard().postArtifact(webFormAddressArtifact, getModuleName());
332 return webFormAddressArtifact;
350 long creationTime,
long accessTime,
int count)
throws TskCoreException,
BlackboardException {
352 Collections.emptyList());
373 long creationTime,
long accessTime,
int count,
374 Collection<BlackboardAttribute> otherAttributesList)
throws TskCoreException,
BlackboardException {
376 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
390 attributes.addAll(otherAttributesList);
391 webFormAutofillArtifact.addAttributes(attributes);
394 getSleuthkitCase().getBlackboard().postArtifact(webFormAutofillArtifact, getModuleName());
397 return webFormAutofillArtifact;
416 String referrer, String title, String programName)
throws TskCoreException,
BlackboardException {
417 return addWebHistory(url, accessTime, referrer, title, programName,
418 Collections.emptyList());
438 String referrer, String title, String programName,
439 Collection<BlackboardAttribute> otherAttributesList)
throws TskCoreException,
BlackboardException {
442 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
458 attributes.addAll(otherAttributesList);
459 webHistoryArtifact.addAttributes(attributes);
462 getSleuthkitCase().getBlackboard().postArtifact(webHistoryArtifact, getModuleName());
465 return webHistoryArtifact;
478 private static String extractDomain(String urlString) {
479 if (urlString == null) {
485 URL url =
new URL(urlString);
486 result = url.getHost();
487 }
catch (MalformedURLException ex) {
493 if (result == null || StringUtils.isBlank(result)) {
494 return getBaseDomain(urlString);
506 private static String getBaseDomain(String url) {
510 String cleanUrl = url.replaceFirst(
".*:\\/\\/",
"");
513 String dirToks[] = cleanUrl.split(
"\\/");
514 if (dirToks.length > 0) {
521 StringTokenizer tok =
new StringTokenizer(host,
".");
522 StringBuilder hostB =
new StringBuilder();
523 int toks = tok.countTokens();
525 for (
int count = 0; count < toks; ++count) {
526 String part = tok.nextToken();
527 int diff = toks - count;
536 String base = hostB.toString();
538 if (base.matches(
".*[~`!@#$%^&\\*\\(\\)\\+={}\\[\\];:\\?<>,/ ].*")) {
543 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)
void addAttributes(Collection< BlackboardAttribute > attributes)
AccountFileInstance createAccountFileInstance(org.sleuthkit.datamodel.Account.Type accountType, String accountUniqueID, String moduleName, Content sourceFile)
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)
static final Account.Type PHONE
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)
static final Account.Type EMAIL