Package org.sleuthkit.datamodel

Examples of org.sleuthkit.datamodel.AbstractFile


        }
    }

    public static DrawableFile<?> create(Long id, boolean analyzed) throws TskCoreException, IllegalStateException {

        AbstractFile abstractFileById = Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(id);
        if (ImageAnalyzerModule.isVideoFile(abstractFileById)) {
            return new VideoFile<>(abstractFileById, analyzed);
        } else {
            return new ImageFile<>(abstractFileById, analyzed);
        }
View Full Code Here


            if (artifact != null && messageGroup.getCount() == 1) {
                viewArtifactButton.setEnabled(true);
               
                //check file type
                long objId = artifact.getObjectID();
                AbstractFile file = null;
                try {
                    file = Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(objId);
                } catch (TskException ex) {
                  
                }
                if (file == null) {
                    viewContentButton.setEnabled(false);
                }
                else if (! file.getType().equals(TSK_DB_FILES_TYPE_ENUM.FS)) {
                    viewContentButton.setEnabled(false);
                }
                else {
                    viewContentButton.setEnabled(true);
                }
View Full Code Here

        Collection<? extends AbstractFile> selectedFiles = Utilities.actionsGlobalContext().lookupAll(AbstractFile.class);
        if (selectedFiles.size() > 1) {
            extractFiles(e, selectedFiles);
        }
        else if (selectedFiles.size() == 1) {
            AbstractFile source = selectedFiles.iterator().next();
            if (source.isDir()) {
                extractFiles(e, selectedFiles);               
            }
            else {
                extractFile(e, selectedFiles.iterator().next());
            }
View Full Code Here

        sb.append("</td></tr>"); //NON-NLS
    }
   
    @Override
    public void setNode(Node node) {
        AbstractFile file = node.getLookup().lookup(AbstractFile.class);
        if (file == null) {
            setText(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.nonFilePassedIn"));
            return;
        }
       
        StringBuilder sb = new StringBuilder();
        startTable(sb);
       
        try {
            addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), file.getUniquePath());
        } catch (TskCoreException ex) {
            addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), file.getParentPath() + "/" + file.getName());
        }
               
        addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.type"), file.getType().getName());
        addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.size"), new Long(file.getSize()).toString() );
        addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.fileNameAlloc"), file.getDirFlagAsString());
        addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.metadataAlloc"), file.getMetaFlagsAsString());
        addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.modified"), ContentUtils.getStringTime(file.getMtime(), file));
        addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.accessed"), ContentUtils.getStringTime(file.getAtime(), file));
        addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.created"),  ContentUtils.getStringTime(file.getCrtime(), file));
        addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.changed"),  ContentUtils.getStringTime(file.getCtime(), file));
      
        String md5 = file.getMd5Hash();
        if (md5 == null) {
            md5 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc");
        }
        addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.md5"), md5);
        addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.hashLookupResults"), file.getKnown().toString());
       
        addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.internalid"), new Long(file.getId()).toString());
        if (file.getType().compareTo(TSK_DB_FILES_TYPE_ENUM.LOCAL) == 0) {
            addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), file.getLocalAbsPath());
        }
       
        endTable(sb);
        setText(sb.toString());
    }
View Full Code Here

        return;
    }

    @Override
    public boolean isSupported(Node node) {
        AbstractFile file = node.getLookup().lookup(AbstractFile.class);
        if (file == null) {
            return false;
        }
        return true;
    }
View Full Code Here

    public static boolean thumbnailSupported(Content content) {
        if (content instanceof AbstractFile == false) {
            return false;
        }
       
        AbstractFile f = (AbstractFile) content;
        if (f.getSize() == 0) {
            return false;
        }

        // check the blackboard for a file type attribute
        try {
            ArrayList <BlackboardAttribute> attributes = f.getGenInfoAttributes(ATTRIBUTE_TYPE.TSK_FILE_TYPE_SIG);
            for (BlackboardAttribute attribute : attributes) {
                if (SUPP_MIME_TYPES.contains(attribute.getValueString())) {
                    return true;
                }
            }
        }
        catch (TskCoreException ex) {
            logger.log(Level.WARNING, "Error while getting file signature from blackboard.", ex); //NON-NLS
        }
       
        final String extension = f.getNameExtension();
       
        // if we have an extension, check it
        if (extension.equals("") == false) {
            // Note: thumbnail generator only supports JPG, GIF, and PNG for now
            if (SUPP_EXTENSIONS.contains(extension)) {
View Full Code Here

                FileIngestPipeline pipeline = this.fileIngestPipelines.take();
                if (!pipeline.isEmpty()) {
                    /**
                     * Get the file to process.
                     */
                    AbstractFile file = task.getFile();

                    /**
                     * Update the file ingest progress bar.
                     */
                    synchronized (this.fileIngestProgressLock) {
                        ++this.processedFiles;
                        if (this.processedFiles <= this.estimatedFilesToProcess) {
                            this.fileIngestProgress.progress(file.getName(), (int) this.processedFiles);
                        } else {
                            this.fileIngestProgress.progress(file.getName(), (int) this.estimatedFilesToProcess);
                        }
                        this.filesInProgress.add(file.getName());
                    }

                    /**
                     * Run the file through the pipeline.
                     */
                    List<IngestModuleError> errors = new ArrayList<>();
                    errors.addAll(pipeline.process(task));
                    if (!errors.isEmpty()) {
                        logIngestModuleErrors(errors);
                    }

                    /**
                     * Update the file ingest progress bar again, in case the
                     * file was being displayed.
                     */
                    if (!this.cancelled) {
                        synchronized (this.fileIngestProgressLock) {
                            this.filesInProgress.remove(file.getName());
                            if (this.filesInProgress.size() > 0) {
                                this.fileIngestProgress.progress(this.filesInProgress.get(0));
                            } else {
                                this.fileIngestProgress.progress("");
                            }
View Full Code Here

        @Override
        protected Node[] createNodes(Node arg) {
            if (filter) {
                // Filter out child nodes that represent known files
                AbstractFile file = arg.getLookup().lookup(AbstractFile.class);
                if (file != null && (file.getKnown() == TskData.FileKnown.KNOWN)) {
                    return new Node[]{};
                }
            }
            return new Node[] { new KnownFileFilterNode(arg, filter) };
        }
View Full Code Here

            if (selectedNode == null) {
                resetComponent();
                return;
            }

            AbstractFile file = selectedNode.getLookup().lookup(AbstractFile.class);
            if (file == null) {
                resetComponent();
                return;
            }

            if (file.equals(lastFile)) {
                return; //prevent from loading twice if setNode() called mult. times
            }

            lastFile = file;
View Full Code Here

            if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) {
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                try {
                    Node[] selectedNodes = em.getSelectedNodes();
                    if (selectedNodes.length == 1) {
                        AbstractFile af = selectedNodes[0].getLookup().lookup(AbstractFile.class);
                        if (af == null) {
                            filePathLabel.setText("");
                        }
                        else {
                            try {
                                String uPath = af.getUniquePath();
                                filePathLabel.setText(uPath);
                                filePathLabel.setToolTipText(uPath);
                            }
                            catch (TskCoreException e){
                                logger.log(Level.WARNING, "Could not get unique path for content: {0}", af.getName()); //NON-NLS
                            }
                        }                       
                    }
                    else {
                        filePathLabel.setText("");           
View Full Code Here

TOP

Related Classes of org.sleuthkit.datamodel.AbstractFile

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.