Beispiel #1
0
    def display(self, value, row, result):
        dbh = DB.DBO(self.case)
        fsfd = FileSystem.DBFS(self.case)
        dbh.execute(
            "select file.inode_id as inode_id, name from file, webmail_attachments where webmail_attachments.inode_id = %r and file.inode_id = webmail_attachments.attachment",
            value)
        for row in dbh:
            tmp = result.__class__(result)

            try:
                fd = fsfd.open(inode_id=row['inode_id'])
                image = Graph.Thumbnailer(fd, 100)
            except IOError:
                pass

            if image.height > 0:
                tmp.image(image, width=image.width, height=image.height)
            else:
                tmp.image(image, width=image.width)

            link = result.__class__(result)
            name = row['name']
            if len(name) > 20: name = name[:20] + " ..."
            tmp.para(name)
            link.link(tmp,
                      tooltip=row['name'],
                      pane='new',
                      target=FlagFramework.query_type(
                          family="Disk Forensics",
                          report="ViewFile",
                          case=self.case,
                          mode='Summary',
                          inode_id=row['inode_id']))
            result.row(link)
Beispiel #2
0
    def display(self, query, result):
        new_q = result.make_link(query, '')
        if not query.has_key('limit'): query['limit'] = 0
        dbh = self.DBO(query['case'])

        fsfd = FileSystem.DBFS(query["case"])
        ## If this is a directory, only show the stats
        if query.has_key('inode_id'):
            fd = fsfd.open(inode_id=query['inode_id'])
            fd.inode_id = query['inode_id']
            query['inode'] = fd.inode
        else:
            fd = fsfd.open(inode=query['inode'])

        if not fd: return
        image = Graph.Thumbnailer(fd, 300)

        ## Make a series of links to each level of this inode - this
        ## way we can view parents of this inode.
        tmp = result.__class__(result)
        tmp.text("Viewing file in inode ", make_inode_link(fd, query, result))
        result.heading(tmp)

        try:
            result.text("Classified as %s by magic" % image.GetMagic())
        except IOError, e:
            result.text("Unable to classify file, no blocks: %s" % e)
            image = None
Beispiel #3
0
    def render_html(self, inode_id, table_renderer):
        ct=''
        try:
            fd = self.fsfd.open(inode_id = inode_id)
            image = Graph.Thumbnailer(fd, 200)
            inode_filename, ct, fd = table_renderer.make_archive_filename(inode_id)

            filename, ct, fd = table_renderer.make_archive_filename(inode_id, directory = "thumbnails/")
        
            table_renderer.add_file_from_string(filename,
                                                image.display())
        except IOError,e:
            print e
            return "<a href=%r ><img src='images/broken.png' /></a>" % inode_filename
Beispiel #4
0
    def render_cell(self, inode_id):
        """ Renders a single inode_id """
        filename, ct, fd = self.make_archive_filename(inode_id, directory = "thumbnails/")
        image = Graph.Thumbnailer(fd, 200)

        inode_filename,ct, fd = self.make_archive_filename(inode_id)
        
        self.add_file_from_string(filename, image.display())
        path, inode, inode_id = FileSystem.DBFS(self.case).lookup(inode_id = inode_id)
        ## Make sure we export the inode
        dbh = DB.DBO()
        dbh.insert("jobs",
                   command = "Export",
                   arg1 = self.case,
                   arg2 = inode_id,
                   )

        return "<abbr title='%s'><a href='%s'><img src='%s' /></a><br/>"\
               "<a href='inodes/%s_explain.html' ><img src=images/question.png /></a>"\
               "%s</abbr>" % (\
                              path, inode_filename, filename, inode_id, fd.inode)
Beispiel #5
0
            for k, v in istat.iteritems():
                left.row('%s:' % k, '', v, align='left')
        except AttributeError:
            pass

        #What did libextractor have to say about this file?
        dbh = DB.DBO(self.case)
        dbh.execute("select property,value from xattr where inode_id=%r",
                    istat['inode_id'])

        for row in dbh:
            left.row(row['property'], ': ', row['value'])

        left.end_table()

        image = Graph.Thumbnailer(self, 300)
        if image:
            right = result.__class__(result)
            right.image(image, width=200)
            result.start_table(width="100%")
            result.row(left, right, valign='top', align="left")
            image.headers = [
                ("Content-Disposition", "attachment; filename=%s" % name),
            ]
        else:
            result.start_table(width="100%")
            result.row(left, valign='top', align="left")


class StringIOFile(File):
    """ This is a File object which is implemented as a StringIO.