mirror of
https://github.com/elisspace/autopsy.git
synced 2026-10-05 08:46:20 +00:00
Initial commit of Code
Initial commit of code for getting country code for phone numbers in the contacts tab.
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
<dependency conf="core->default" org="org.apache.opennlp" name="opennlp-tools" rev="1.9.1"/>
|
||||
|
||||
<dependency org="org.sejda.webp-imageio" name="webp-imageio-sejda" rev="0.1.0"/>
|
||||
<dependency org="com.googlecode.libphonenumber" name="libphonenumber" rev="3.5" />
|
||||
|
||||
<dependency conf="core->default" org="commons-validator" name="commons-validator" rev="1.6"/>
|
||||
<dependency conf="core->default" org="net.htmlparser.jericho" name="jericho-html" rev="3.3"/>
|
||||
|
||||
@@ -51,6 +51,7 @@ file.reference.jul-to-slf4j-1.7.25.jar=release\\modules\\ext\\jul-to-slf4j-1.7.2
|
||||
file.reference.juniversalchardet-1.0.3.jar=release\\modules\\ext\\juniversalchardet-1.0.3.jar
|
||||
file.reference.junrar-2.0.0.jar=release\\modules\\ext\\junrar-2.0.0.jar
|
||||
file.reference.jython-standalone-2.7.0.jar=release/modules/ext/jython-standalone-2.7.0.jar
|
||||
file.reference.libphonenumber-3.5.jar=release/modules/ext/libphonenumber-3.5.jar
|
||||
file.reference.mchange-commons-java-0.2.9.jar=release/modules/ext/mchange-commons-java-0.2.9.jar
|
||||
file.reference.metadata-extractor-2.11.0.jar=release\\modules\\ext\\metadata-extractor-2.11.0.jar
|
||||
file.reference.netcdf4-4.5.5.jar=release\\modules\\ext\\netcdf4-4.5.5.jar
|
||||
|
||||
@@ -405,6 +405,10 @@
|
||||
<runtime-relative-path>ext/okhttp-2.7.5.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/okhttp-2.7.5.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/libphonenumber-3.5.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/libphonenumber-3.5.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/tika-core-1.20.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\tika-core-1.20.jar</binary-origin>
|
||||
@@ -517,6 +521,10 @@
|
||||
<runtime-relative-path>ext/google-http-client-1.29.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/google-http-client-1.29.0.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/sleuthkit-postgresql-4.7.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/sleuthkit-postgresql-4.7.0.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/bcpkix-jdk15on-1.60.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\bcpkix-jdk15on-1.60.jar</binary-origin>
|
||||
@@ -605,10 +613,6 @@
|
||||
<runtime-relative-path>ext/jbig2-imageio-3.0.2.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\jbig2-imageio-3.0.2.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/sleuthkit-postgresql-4.7.0.jar</runtime-relative-path>
|
||||
<binary-origin>release/modules/ext/sleuthkit-postgresql-4.7.0.jar</binary-origin>
|
||||
</class-path-extension>
|
||||
<class-path-extension>
|
||||
<runtime-relative-path>ext/apache-mime4j-dom-0.8.2.jar</runtime-relative-path>
|
||||
<binary-origin>release\modules\ext\apache-mime4j-dom-0.8.2.jar</binary-origin>
|
||||
|
||||
@@ -11,6 +11,7 @@ ContactNode_Name=Name
|
||||
ContactNode_Office_Number=Office Number
|
||||
ContactNode_Phone=Phone Number
|
||||
ContactNode_URL=URL
|
||||
ContactsViewer_columnHeader_Country=Country
|
||||
ContactsViewer_columnHeader_Email=Email
|
||||
ContactsViewer_columnHeader_Name=Name
|
||||
ContactsViewer_columnHeader_Phone=Phone
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.communications.relationships;
|
||||
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
@@ -70,7 +73,7 @@ final class ContactNode extends BlackboardArtifactNode {
|
||||
@Override
|
||||
protected Sheet createSheet() {
|
||||
Sheet sheet = new Sheet();
|
||||
|
||||
|
||||
final BlackboardArtifact artifact = getArtifact();
|
||||
BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID());
|
||||
if (fromID != TSK_CONTACT) {
|
||||
@@ -103,26 +106,26 @@ final class ContactNode extends BlackboardArtifactNode {
|
||||
otherList.add(bba);
|
||||
}
|
||||
}
|
||||
|
||||
addPropertiesToSheet(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME.getLabel(),
|
||||
sheetSet, nameList);
|
||||
addPropertiesToSheet(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER.getLabel(),
|
||||
sheetSet, phoneNumList);
|
||||
addPropertiesToSheet(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL.getLabel(),
|
||||
sheetSet, emailList);
|
||||
|
||||
addPropertiesToSheet(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME.getLabel(),
|
||||
sheetSet, nameList);
|
||||
addPropertiesToSheet(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER.getLabel(),
|
||||
sheetSet, phoneNumList);
|
||||
addPropertiesToSheet(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL.getLabel(),
|
||||
sheetSet, emailList);
|
||||
|
||||
for (BlackboardAttribute bba : otherList) {
|
||||
sheetSet.put(new NodeProperty<>(bba.getAttributeType().getTypeName(), bba.getAttributeType().getDisplayName(), "", bba.getDisplayString()));
|
||||
}
|
||||
|
||||
|
||||
List<Content> children = artifact.getChildren();
|
||||
if(children != null) {
|
||||
if (children != null) {
|
||||
int count = 0;
|
||||
String imageLabelPrefix = "Image";
|
||||
for(Content child: children) {
|
||||
if(child instanceof AbstractFile) {
|
||||
for (Content child : children) {
|
||||
if (child instanceof AbstractFile) {
|
||||
String imageLabel = imageLabelPrefix;
|
||||
if(count > 0) {
|
||||
if (count > 0) {
|
||||
imageLabel = imageLabelPrefix + "-" + count;
|
||||
}
|
||||
sheetSet.put(new NodeProperty<>(imageLabel, imageLabel, imageLabel, child.getName()));
|
||||
@@ -136,14 +139,20 @@ final class ContactNode extends BlackboardArtifactNode {
|
||||
|
||||
return sheet;
|
||||
}
|
||||
|
||||
|
||||
private void addPropertiesToSheet(String propertyID, Sheet.Set sheetSet, List<BlackboardAttribute> attributeList) {
|
||||
int count = 0;
|
||||
for (BlackboardAttribute bba : attributeList) {
|
||||
if (count++ > 0) {
|
||||
sheetSet.put(new NodeProperty<>(propertyID + "_" + count, bba.getAttributeType().getDisplayName(), "", bba.getDisplayString()));
|
||||
if (bba.getAttributeType().getTypeName().startsWith("TSK_PHONE")) {
|
||||
sheetSet.put(new NodeProperty<>("Country" + "_" + count, bba.getAttributeType().getDisplayName() + " Country", "", getCountryCode(bba.getValueString())));
|
||||
}
|
||||
} else {
|
||||
sheetSet.put(new NodeProperty<>(propertyID, bba.getAttributeType().getDisplayName(), "", bba.getDisplayString()));
|
||||
if (bba.getAttributeType().getTypeName().startsWith("TSK_PHONE")) {
|
||||
sheetSet.put(new NodeProperty<>("Country", bba.getAttributeType().getDisplayName() + " Country", "", getCountryCode(bba.getValueString())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,4 +184,23 @@ final class ContactNode extends BlackboardArtifactNode {
|
||||
public String getSourceName() {
|
||||
return getDisplayName();
|
||||
}
|
||||
|
||||
private String getCountryCode(String phoneNumber) {
|
||||
String regionCode = "";
|
||||
try {
|
||||
PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
|
||||
Phonenumber.PhoneNumber phoneNum = phoneNumberUtil.parse(phoneNumber, "US");
|
||||
regionCode = phoneNumberUtil.getRegionCodeForNumber(phoneNum);
|
||||
|
||||
if (regionCode == null) {
|
||||
return "";
|
||||
} else {
|
||||
return regionCode;
|
||||
}
|
||||
} catch (NumberParseException ex) {
|
||||
logger.log(Level.WARNING, "Error getting country code, for phone number: {0}", phoneNumber);
|
||||
return regionCode;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ public final class ContactsViewer extends JPanel implements RelationshipsViewer{
|
||||
"ContactsViewer_columnHeader_Name=Name",
|
||||
"ContactsViewer_columnHeader_Phone=Phone",
|
||||
"ContactsViewer_columnHeader_Email=Email",
|
||||
"ContactsViewer_columnHeader_Country=Country",
|
||||
"ContactsViewer_noContacts_message=<No contacts found for selected account>"
|
||||
})
|
||||
|
||||
@@ -96,7 +97,8 @@ public final class ContactsViewer extends JPanel implements RelationshipsViewer{
|
||||
outline = outlineViewPanel.getOutlineView().getOutline();
|
||||
outlineViewPanel.getOutlineView().setPropertyColumns(
|
||||
"TSK_EMAIL", BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL.getDisplayName(),
|
||||
"TSK_PHONE_NUMBER", BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER.getDisplayName()
|
||||
"TSK_PHONE_NUMBER", BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER.getDisplayName(),
|
||||
"Country", "Country"
|
||||
);
|
||||
outline.setRootVisible(false);
|
||||
((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.ContactsViewer_columnHeader_Name());
|
||||
|
||||
Reference in New Issue
Block a user