Package org.sleuthkit.datamodel

Examples of org.sleuthkit.datamodel.Image


            if (dir != null) {
                actions.add(ExtractAction.getInstance());
            }

            // file search action
            final Image img = this.getLookup().lookup(Image.class);
            if (img != null) {
                actions.add(new FileSearchAction(
                        NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.openFileSrcByAttr.text")));
            }
View Full Code Here


            summary.append("<div class=\"info\">\n"); //NON-NLS
            try {
                for (Content c : currentCase.getDataSources()) {
                    summary.append("<p>").append(c.getName()).append("</p>\n"); //NON-NLS
                    if (c instanceof Image) {
                        Image img = (Image) c;
                   
                        summary.append("<table>\n"); //NON-NLS
                        summary.append("<tr><td>").append( //NON-NLS
                                NbBundle.getMessage(this.getClass(), "ReportHTML.writeSum.timezone"))
                               .append("</td><td>").append(img.getTimeZone()).append("</td></tr>\n"); //NON-NLS
                        for(String imgPath : img.getPaths()) {
                            summary.append("<tr><td>").append( //NON-NLS
                                    NbBundle.getMessage(this.getClass(), "ReportHTML.writeSum.path"))
                                   .append("</td><td>").append(imgPath).append("</td></tr>\n"); //NON-NLS
                        }
                        summary.append("</table>\n"); //NON-NLS
View Full Code Here

                    NbBundle.getMessage(this.getClass(),
                    "EwfVerifyIngestModule.process.skipNonEwf",
                    imgName)));
            return ProcessResult.OK;
        }
        Image img = (Image)dataSource;

        // Skip images that are not E01
        if (img.getType() != TskData.TSK_IMG_TYPE_ENUM.TSK_IMG_TYPE_EWF_EWF) {
            logger.log(Level.INFO, "Skipping non-ewf image {0}", imgName); //NON-NLS
            services.postMessage(IngestMessage.createMessage( MessageType.INFO, E01VerifierModuleFactory.getModuleName(),
                    NbBundle.getMessage(this.getClass(),
                    "EwfVerifyIngestModule.process.skipNonEwf",
                    imgName)));
            return ProcessResult.OK;
        }

        if ((img.getMd5() != null) && !img.getMd5().isEmpty()) {
            storedHash = img.getMd5().toLowerCase();
            logger.log(Level.INFO, "Hash value stored in {0}: {1}", new Object[]{imgName, storedHash}); //NON-NLS
        } else {
            services.postMessage(IngestMessage.createMessage( MessageType.ERROR, E01VerifierModuleFactory.getModuleName(),
                    NbBundle.getMessage(this.getClass(),
                    "EwfVerifyIngestModule.process.noStoredHash",
                    imgName)));
            return ProcessResult.ERROR;
        }

        logger.log(Level.INFO, "Starting hash verification of {0}", img.getName()); //NON-NLS
        services.postMessage(IngestMessage.createMessage( MessageType.INFO, E01VerifierModuleFactory.getModuleName(),
                NbBundle.getMessage(this.getClass(),
                "EwfVerifyIngestModule.process.startingImg",
                imgName)));

        long size = img.getSize();
        if (size == 0) {
            logger.log(Level.WARNING, "Size of image {0} was 0 when queried.", imgName); //NON-NLS
            services.postMessage(IngestMessage.createMessage( MessageType.ERROR, E01VerifierModuleFactory.getModuleName(),
                    NbBundle.getMessage(this.getClass(),
                    "EwfVerifyIngestModule.process.errGetSizeOfImg",
                    imgName)));
        }

        // Libewf uses a sector size of 64 times the sector size, which is the
        // motivation for using it here.
        long chunkSize = 64 * img.getSsize();
        chunkSize = (chunkSize == 0) ? DEFAULT_CHUNK_SIZE : chunkSize;

        int totalChunks = (int) Math.ceil(size / chunkSize);
        logger.log(Level.INFO, "Total chunks = {0}", totalChunks); //NON-NLS
        int read;

        byte[] data;
        statusHelper.switchToDeterminate(totalChunks);

        // Read in byte size chunks and update the hash value with the data.
        for (int i = 0; i < totalChunks; i++) {
            if (context.dataSourceIngestIsCancelled()) {
                return ProcessResult.OK;
            }
            data = new byte[(int) chunkSize];
            try {
                read = img.read(data, i * chunkSize, chunkSize);
            } catch (TskCoreException ex) {
                String msg = NbBundle.getMessage(this.getClass(),
                        "EwfVerifyIngestModule.process.errReadImgAtChunk", imgName, i);
                services.postMessage(IngestMessage.createMessage( MessageType.ERROR, E01VerifierModuleFactory.getModuleName(), msg));
                logger.log(Level.SEVERE, msg, ex);
View Full Code Here

                logger.log(Level.WARNING, "Errors occured while committing the image", e); //NON-NLS
                errorList.add(e.getMessage());
            } finally {
                if (imageId != 0) {
                    // get the newly added Image so we can return to caller
                    Image newImage = currentCase.getSleuthkitCase().getImageById(imageId);
                    
                    //while we have the image, verify the size of its contents
                    String verificationErrors = newImage.verifyImageSize();
                    if (verificationErrors.equals("") == false) {
                        //data error (non-critical)
                        errorList.add(verificationErrors);
                    }
View Full Code Here

                return TimeZone.getTimeZone("GMT");
            }
            else {
                final Content dataSource = c.getDataSource();
                if ((dataSource != null) && (dataSource instanceof Image)) {
                    Image image = (Image)dataSource;
                    return TimeZone.getTimeZone(image.getTimeZone());
                } else {
                    //case such as top level VirtualDirectory
                    return TimeZone.getDefault();
                }
            }
View Full Code Here

                // simulated.
                String resultsFilePath = outputDirPath + File.separator + String.format("job_%d_results.xml", context.getJobId());
                boolean haveRealExecutable = false;
                if (haveRealExecutable) {
                    if (dataSource instanceof Image) {
                        Image image = (Image)dataSource;
                        String dataSourcePath = image.getPaths()[0];
                        List<String> commandLine = new ArrayList<>();
                        commandLine.add("some.exe");
                        commandLine.add(dataSourcePath);
                        commandLine.add(resultsFilePath);
                        ProcessBuilder processBuilder = new ProcessBuilder(commandLine);
View Full Code Here

            } catch (TskCoreException ex) {
                setImgLabel("No Images In Case");
                setStatusMsg("");
                return;
            }
            Image image = null;
            for (Content c : dataSources) {
                if (c instanceof Image) {
                    image = (Image)c;
                }
            }
            if (image == null) {
                setImgLabel("No Images In Case");
                setStatusMsg("");
                return;
            }
           
            long start = new Date().getTime();

            byte[] buf = new byte[4096];
            long bytesRead = 0;
           
            // random starting point to prevent caching from effecting it
            Random rand = new Random();
            long curOffset = rand.nextLong();
            if (curOffset < 0) {
                curOffset *= -1;
            }
            curOffset = curOffset % (image.getSize() / 2);
            curOffset = 512 * ((curOffset + 511) / 512);
           
            //long curOffset = 0;
            while (bytesRead < 1000 * 1024 * 1024 ) {
                long read;
                try {
                    read = image.read(buf, curOffset, buf.length);
                } catch (TskCoreException ex) {
                    break;
                }
                if (read <= 0)
                    break;
View Full Code Here

            } catch (TskCoreException ex) {
                setFileReadLabel("No Images In Case");
                setStatusMsg("");
                return;
            }
            Image image = null;
            for (Content c : dataSources) {
                if (c instanceof Image) {
                    image = (Image)c;
                }
            }
            if (image == null) {
                setFileReadLabel("No Images In Case");
                setStatusMsg("");
                return;
            }
           
            File file = new File(image.getPaths()[0]);
            if (file.exists() == false) {
                setFileReadLabel("Image Path Doesn't Exist");
                setStatusMsg("");
                return;
            }
View Full Code Here

TOP

Related Classes of org.sleuthkit.datamodel.Image

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.