Example #1
0
    def make_table_stat(self, header):
        # Header
        w=[70,80]

        self.set_font('Times','B',12)
        self.underline = 1
        self.cell(0, 6, 'Technical Metadata', ln=1)
        self.set_font('Times','I',11)
        self.underline = 0
        if (FiwalkReport.numPartitions == 1):
            prtn = 'Partition'
        else:
            prtn = 'Partitions'
        self.cell(0, 6, 'Found '+ str(FiwalkReport.numPartitions) + ' ' + prtn + ' in this disk', ln=1)
              
        self.set_font('Times','',10)
        imgname = 'image_filename: ' + str(image_info['image_filename'])

        self.cell(0, 6, 'Disk Image: '+filename_from_path(imgname), ln=1)

        # Colors, line width and bold font
        self.set_table_hdr_attributes(w, header)

        # Color and font restoration
        self.set_table_body_attributes()

        # Per partition info now:
        for i in range(0, FiwalkReport.numPartitions):
          fill=0
          self.set_font('Times','',12)
          self.cell(w[0], 6, 'Partition','LR',0,'L',fill) 
          self.cell(w[1], 6, str(i+1), 'LR',0,'L',fill) 
          self.ln()
          fill=not fill

          ## First write all the information from glb_image_info
          self.set_font('Times','',10)
          current_prtn = glb_image_info[i]

          # Display just the file name for the "image_filename" key
          for j in range(0, len(prtn_info_items)):
            key = prtn_info_items[j]
            cell_text = current_prtn[key]
            if (cell_text == 0):
              continue

            self.cell(w[0],6,bc_utils.stringfix(key),'LR',0,'L',fill)
            self.cell(w[1],6,cell_text,'LR',0,'L',fill)
            self.ln()
            fill=not fill

          self.cell(w[0],6,"Number of Files",'LR',0,'L',fill)
          self.cell(w[1],6,str(FiwalkReport.numfiles[i]),'LR',0,'L',fill)
          self.ln()
          fill=not fill

          self.cell(w[0],6,"Total Directories",'LR',0,'L',fill)
          self.cell(w[1],6,str(FiwalkReport.dirs[i]),'LR',0,'L',fill)
          self.ln()
          fill=not fill
              
          self.cell(w[0],6,"Total Deleted Files",'LR',0,'L',fill)
          self.cell(w[1],6,str(FiwalkReport.deletedFiles[i]),'LR',0,'L',fill)
          self.ln()
          fill=not fill
              
          self.cell(w[0],6,"Total Unused Files",'LR',0,'L',fill)
          self.cell(w[1],6,str(FiwalkReport.unusedFiles[i]),'LR',0,'L',fill)
          self.ln()
          fill=not fill
              
          self.cell(w[0],6,"Files with Nlinks > 1",'LR',0,'L',fill)
          self.cell(w[1],6,str(FiwalkReport.moreNumlinks[i]),'LR',0,'L',fill)
          self.ln()
          fill=not fill
              
          self.cell(w[0],6,"Empty Files ",'LR',0,'L',fill)
          self.cell(w[1],6,str(FiwalkReport.emptyFiles[i]),'LR',0,'L',fill)
          self.ln()
          fill=not fill
              
          self.cell(w[0],6,"Big Files(> 1 MB) ",'LR',0,'L',fill)
          self.cell(w[1],6,str(FiwalkReport.bigFiles[i]),'LR',0,'L',fill)
          self.ln()
          fill=not fill
          self.cell(sum(w),0,'','T')

          ## Go to the next page and set up the header if this is not
          ## the last page
          if i < FiwalkReport.numPartitions-1:
            self.add_page()
            for j in range(0,len(header)):
              self.cell(w[j],7,header[j],1,0,'C',1)
            self.ln()
          fill=not fill
Example #2
0
    def make_table_stat(self, header):
        # Header
        w=[70,80]

        self.set_font('Times','B',12)
        self.underline = 1
        self.cell(0, 6, 'Technical Metadata', ln=1)
              
        self.set_font('Times','',10)
        imgname = 'image_filename: ' + str(image_info['image_filename'])

        self.cell(0, 6, 'Disk Image: '+filename_from_path(imgname), ln=1)

        #Colors, line width and bold font
        self.set_table_hdr_attributes(w, header)

        #Color and font restoration
        self.set_table_body_attributes()

        fill=0
        self.set_font('Times','',10)
        for key in image_info:
            # Display just the file name for the "image_filename" key
            if (key == 'image_filename'):
                cell_text = filename_from_path(image_info[key])
            else:
                cell_text = image_info[key]
                if (cell_text == 0):
                    continue
            
            self.cell(w[0],6,bc_utils.stringfix(key),'LR',0,'L',fill)
            self.cell(w[1],6,cell_text,'LR',0,'L',fill)
            self.ln()
            fill=not fill
  
        self.cell(w[0],6,"Number of Files",'LR',0,'L',fill)
        self.cell(w[1],6,str(FiwalkReport.numfiles),'LR',0,'L',fill)
        self.ln()
        fill=not fill

        self.cell(w[0],6,"Total Directories",'LR',0,'L',fill)
        self.cell(w[1],6,str(FiwalkReport.dirs),'LR',0,'L',fill)
        self.ln()
        fill=not fill
              
        self.cell(w[0],6,"Total Deleted Files",'LR',0,'L',fill)
        self.cell(w[1],6,str(FiwalkReport.deletedFiles),'LR',0,'L',fill)
        self.ln()
        fill=not fill
              
        self.cell(w[0],6,"Total Unused Files",'LR',0,'L',fill)
        self.cell(w[1],6,str(FiwalkReport.unusedFiles),'LR',0,'L',fill)
        self.ln()
        fill=not fill
              
        self.cell(w[0],6,"Files with Nlinks > 1",'LR',0,'L',fill)
        self.cell(w[1],6,str(FiwalkReport.moreNumlinks),'LR',0,'L',fill)
        self.ln()
        fill=not fill
              
        self.cell(w[0],6,"Empty Files ",'LR',0,'L',fill)
        self.cell(w[1],6,str(FiwalkReport.emptyFiles),'LR',0,'L',fill)
        self.ln()
        fill=not fill
              
        self.cell(w[0],6,"Big Files(> 1 MB) ",'LR',0,'L',fill)
        self.cell(w[1],6,str(FiwalkReport.bigFiles),'LR',0,'L',fill)
        self.ln()
        fill=not fill

        # Closure line
        self.cell(sum(w),0,'','T')