Package org.sleuthkit.autopsy.casemodule.services

Examples of org.sleuthkit.autopsy.casemodule.services.FileManager$FileAddProgressUpdater


        int index = parent_path.lastIndexOf('/');
        String name = parent_path.substring(++index);
        parent_path = parent_path.substring(0, index);
        //String query = "select * from tsk_files where parent_path like \"" + parent_path + "\" AND name like \"" + name + "\"";
       
        FileManager fileManager = Case.getCurrentCase().getServices().getFileManager();
        List<AbstractFile> files = null;
        try {
            files = fileManager.findFiles(dataSource, name, parent_path);
        } catch (TskCoreException ex) {
            logger.log(Level.WARNING, "Error fetching 'index.data' files for Internet Explorer history."); //NON-NLS
        }
       
        if (files == null || files.isEmpty()) {
View Full Code Here


        this.errors.clear();
        return importErrors;
    }

    private void importDerivedFiles(ExternalResults results) {
        FileManager fileManager = Case.getCurrentCase().getServices().getFileManager();
        for (ExternalResults.DerivedFile fileData : results.getDerivedFiles()) {
            String localPath = fileData.getLocalPath();
            try {
                File localFile = new File(localPath);
                if (localFile.exists()) {
                    String relativePath = this.getPathRelativeToCaseFolder(localPath);
                    if (!relativePath.isEmpty()) {
                        String parentFilePath = fileData.getParentPath();
                        AbstractFile parentFile = findFileInCaseDatabase(parentFilePath);
                        if (parentFile != null) {
                            DerivedFile derivedFile = fileManager.addDerivedFile(localFile.getName(), relativePath, localFile.length(),
                                    0, 0, 0, 0, // Do not currently have file times for derived files from external processes.
                                    true, parentFile,
                                    "", "", "", ""); // Not currently providing derivation info for derived files from external processes.
                            IngestServices.getInstance().fireModuleContentEvent(new ModuleContentEvent(derivedFile));
                        } else {
View Full Code Here

        try {

            progressMonitor.setIndeterminate(true);
            progressMonitor.setProgress(0);

            final FileManager fileManager = currentCase.getServices().getFileManager();
            String[] paths = dataSourcePath.split(LocalFilesPanel.FILES_SEP);
            List<String> absLocalPaths = new ArrayList<>();
            for (String path : paths) {
                absLocalPaths.add(path);
            }
            newContents.add(fileManager.addLocalFilesDirs(absLocalPaths, progUpdater));
        } catch (TskCoreException ex) {
            logger.log(Level.WARNING, "Errors occurred while running add logical files. ", ex); //NON-NLS
            hasCritError = true;
            errorList.add(ex.getMessage());
        }
View Full Code Here

        progressBar.switchToDeterminate(2);

        Case autopsyCase = Case.getCurrentCase();
        SleuthkitCase sleuthkitCase = autopsyCase.getSleuthkitCase();
        Services services = new Services(sleuthkitCase);
        FileManager fileManager = services.getFileManager();
        try {
            // Get count of files with .doc extension.
            long fileCount = 0;
            List<AbstractFile> docFiles = fileManager.findFiles(dataSource, "%.doc");
            for (AbstractFile docFile : docFiles) {
                if (!skipKnownFiles || docFile.getKnown() != TskData.FileKnown.KNOWN) {
                    ++fileCount;
                }
            }
            progressBar.progress(1);

            if (context.dataSourceIngestIsCancelled()) {
                return IngestModule.ProcessResult.OK;
            }

            // Get files by creation time.
            long currentTime = System.currentTimeMillis() / 1000;
            long minTime = currentTime - (14 * 24 * 60 * 60); // Go back two weeks.
            List<AbstractFile> otherFiles = fileManager.findFiles(dataSource, "crtime > " + minTime);
            for (AbstractFile otherFile : otherFiles) {
                if (!skipKnownFiles || otherFile.getKnown() != TskData.FileKnown.KNOWN) {
                    ++fileCount;
                }
            }
View Full Code Here

            String fileName;
            long fileSize;
            String result;
            String[] fields;

            FileManager fileManager = Case.getCurrentCase().getServices().getFileManager();

            // create and initialize the list to put into the database
            List<CarvedFileContainer> carvedFileContainer = new ArrayList<>();

            // create and initialize a line
            String line = in.readLine();

            // loop until an empty line is read
            reachedEndOfFile:
            while (!line.isEmpty()) {
                while (!line.contains("<fileobject>")) //NON-NLS
                {
                    if (line.equals("</dfxml>")) //NON-NLS
                    { // We have found the end. Break out of both loops and move on to processing.
                        line = "";
                        break reachedEndOfFile;
                    }
                    line = in.readLine();
                }

                List<TskFileRange> ranges = new ArrayList<>();

                // read filename line
                line = in.readLine();
                fileName = getValue("filename", line); //NON-NLS
                Path p = Paths.get(fileName);
                if (p.startsWith(basePath)) {
                    fileName = p.getFileName().toString();
                }

                line = in.readLine(); /// read filesize line
                fileSize = Long.parseLong(getValue("filesize", line)); //NON-NLS

                in.readLine(); /// eat a line and move on to the next

                line = in.readLine(); /// now get next valid line
                while (line.contains("<byte_run")) //NON-NLS
                {
                    result = line.replaceAll("[\t ]*<byte_run offset='", ""); //NON-NLS
                    result = result.replaceAll("'[\t ]*img_offset='", " "); //NON-NLS
                    result = result.replaceAll("'[\t ]*len='", " "); //NON-NLS
                    result = result.replaceAll("'/>[\t ]*", ""); //NON-NLS
                    fields = result.split(" ")/// offset, image offset, length //NON-NLS
                    ranges.add((new TskFileRange(af.convertToImgOffset(Long.parseLong(fields[1])), Long.parseLong(fields[2]), ranges.size())));

                    // read the next line
                    line = in.readLine();
                }
                carvedFileContainer.add(new CarvedFileContainer(fileName, fileSize, id, ranges));
            }
            return fileManager.addCarvedFiles(carvedFileContainer);
        }
        catch (IOException | NumberFormatException | TskCoreException ex) {
            logger.log(Level.SEVERE, "Error parsing PhotoRec output and inserting it into the database: {0}", ex); //NON_NLS
        }

View Full Code Here

        /**
         * Traverse the tree top-down after unzipping is done and create derived
         * files for the entire hierarchy
         */
        void addDerivedFilesToCase() throws TskCoreException {
            final FileManager fileManager =  Case.getCurrentCase().getServices().getFileManager();
            for (UnpackedNode child : rootNode.children) {
                addDerivedFilesToCaseRec(child, fileManager);
            }
        }
View Full Code Here

TOP

Related Classes of org.sleuthkit.autopsy.casemodule.services.FileManager$FileAddProgressUpdater

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.