Package org.sleuthkit.datamodel

Examples of org.sleuthkit.datamodel.Content


                        reset();
                    }
                    break;
                case DATA_SOURCE_ADDED:
                    //copy all file data to drawable databse
                    Content newDataSource = (Content) evt.getNewValue();
                    if (isListeningEnabled()) {
                        queueDBWorkerTask(new PrePopulateDataSourceFiles(newDataSource.getId()));
                    } else {//TODO: keep track of what we missed for later
                        setStale(true);
                    }
                    break;
            }
View Full Code Here


            }
        }

        // find the ID of the parent FileSystem, Volume or Image
        long id = -1;
        Content parent = null;
        try {
            parent = abstractFile.getParent();
        } catch (TskCoreException ex) {
            logger.log(Level.SEVERE, "Exception while trying to get parent of AbstractFile.", ex); //NON-NLS
        }
        while (parent != null) {
            if (parent instanceof FileSystem
                    || parent instanceof Volume
                    || parent instanceof Image) {
                id = parent.getId();
                break;
            }
            try {
                parent = parent.getParent();
            } catch (TskCoreException ex) {
                logger.log(Level.SEVERE, "Exception while trying to get parent of Content object.", ex); //NON-NLS
            }
        }

        // make sure we have a valid systemID
        if (id == -1) {
            logger.log(Level.SEVERE, "Could not get an ID for a FileSystem, Volume or Image for the given AbstractFile."); //NON-NLS
            return ProcessResult.OK;
        }

        // carve the AbstractFile
        List<CarvedFileMeta> output = null;
        try {
            output = carver.carve(abstractFile, configFilePath, scalpelOutputDirPath);
        } catch (ScalpelException ex) {
            logger.log(Level.SEVERE, "Error when attempting to carved data from AbstractFile with ID {0}", abstractFile.getId()); //NON-NLS
            return ProcessResult.OK;
        }

        // add a carved file to the DB for each file that scalpel carved
        SleuthkitCase db = Case.getCurrentCase().getSleuthkitCase();
        List<LayoutFile> carvedFiles = new ArrayList<LayoutFile>(output.size());
        for (CarvedFileMeta carvedFileMeta : output) {

            // calculate the byte offset of this carved file
            long byteOffset;
            try {
                byteOffset = abstractFile.convertToImgOffset(carvedFileMeta.getByteStart());
            } catch (TskCoreException ex) {
                logger.log(Level.SEVERE, "Could not calculate the image byte offset of AbstractFile ({0})", abstractFile.getName()); //NON-NLS
                break;
            }

            // get the size of the carved file
            long size = carvedFileMeta.getByteLength();

            // create the list of TskFileRange objects
            List<TskFileRange> data = new ArrayList<TskFileRange>();
            data.add(new TskFileRange(byteOffset, size, 0));

            // add the carved file
            try {
                carvedFiles.add(db.addCarvedFile(carvedFileMeta.getFileName(), size, id, data));
            } catch (TskCoreException ex) {
                logger.log(Level.SEVERE, "There was a problem while trying to add a carved file to the database.", ex); //NON-NLS
            }
        }

        // get the IngestServices object
        IngestServices is = IngestServices.getInstance();

        // get the parent directory of the carved files
        Content carvedFileDir = null;
        if (!carvedFiles.isEmpty()) {
            try {
                carvedFileDir = carvedFiles.get(0).getParent();
            } catch (TskCoreException ex) {
                logger.log(Level.SEVERE, "There was a problem while trying to obtain the carved files directory.", ex); //NON-NLS
View Full Code Here

                    }
                    buffer.append("</td>"); //NON-NLS
                    buffer.append("</tr>\n"); //NON-NLS
                }

                final Content content = getAssociatedContent(artifact);

                String path = "";
                try {
                    path = content.getUniquePath();
                } catch (TskCoreException ex) {
                    logger.log(Level.SEVERE, "Exception while calling Content.getUniquePath() on {0} : {1}", new Object[]{content, ex.getLocalizedMessage()}); //NON-NLS
                }

                //add file path
View Full Code Here

        if (solrHasContent(selectedNode) == false) {
            setPanel(sources);
            return;
        }
       
        Content content = selectedNode.getLookup().lookup(Content.class);
        if (content == null) {
            return;
        }

        // make a new source for the raw content
View Full Code Here

     *
     * @param node
     * @return true if Solr has content, else false
     */
    private boolean solrHasContent(Node node) {
        Content content = node.getLookup().lookup(Content.class);
        if (content == null) {
            return false;
        }

        if (content.getSize() == 0) {
            return false;
        }

        final Server solrServer = KeywordSearch.getServer();

        boolean isDir = content.accept(isDirVisitor);
        if (isDir) {
            return false;
        }

        final long contentID = content.getId();

        try {
            return solrServer.queryIsIndexed(contentID);
        } catch (NoOpenCoreException ex) {
            logger.log(Level.WARNING, "Couldn't determine whether content is supported.", ex); //NON-NLS
View Full Code Here

        return highlightQueryEscaped;
    }
   
    @Override
    protected Node createNodeForKey(KeyValueQueryContent key) {
        final Content content = key.getContent();
        final String queryStr = key.getQueryStr();;
        QueryResults hits = key.getHits();

        Node kvNode = new KeyValueNode(key, Children.LEAF, Lookups.singleton(content));
View Full Code Here

    @Override
    public Action[] getActions(boolean popup) {

        List<Action> actions = new ArrayList<>();

        Content content = this.getOriginal().getLookup().lookup(Content.class);
        actions.addAll(content.accept(new GetPopupActionsContentVisitor()));

        return actions.toArray(new Action[actions.size()]);
    }
View Full Code Here

     */
    @Override
    public Action[] getActions(boolean popup) {
        List<Action> actions = new ArrayList<>();

        final Content content = this.getLookup().lookup(Content.class);
        if (content != null) {
            actions.addAll(DirectoryTreeFilterNode.getDetailActions(content));

            //extract dir action
            Directory dir = this.getLookup().lookup(Directory.class);
View Full Code Here

     * @param file The file to link to in the report.
     * @param tagName the name of the tag that the content was flagged by
     * @param linkHTMLContent the html that will be the body of the link
     */
    public void addRowWithTaggedContentHyperlink(List<String> row, ContentTag contentTag) {
        Content content = contentTag.getContent();
        if (content instanceof AbstractFile == false) {
            addRow(row);
            return;
        }
        AbstractFile file = (AbstractFile) content;
View Full Code Here

                // Add the artifact to the case database.
                int artifactTypeId = caseDb.getArtifactTypeID(artifactData.getType());
                if (artifactTypeId == -1) {
                    artifactTypeId = caseDb.addArtifactType(artifactData.getType(), artifactData.getType());
                }
                Content sourceFile = findFileInCaseDatabase(artifactData.getSourceFilePath());
                if (sourceFile != null) {
                    BlackboardArtifact artifact = sourceFile.newArtifact(artifactTypeId);

                    // Add the artifact's attributes to the case database.
                    Collection<BlackboardAttribute> attributes = new ArrayList<>();
                    for (ExternalResults.ArtifactAttribute attributeData : artifactData.getAttributes()) {
                        int attributeTypeId = caseDb.getAttrTypeID(attributeData.getType());
View Full Code Here

TOP

Related Classes of org.sleuthkit.datamodel.Content

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.