This file is indexed.

/usr/lib/python2.7/dist-packages/vinreport.py is in vinetto 1:0.07-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# -*- coding: UTF-8 -*-
"""
module vinreport.py
-----------------------------------------------------------------------------

 Vinetto : a forensics tool to examine Thumbs.db files
 Copyright (C) 2005, 2006 by Michel Roukine
 
This file is part of Vinetto.
 
 Vinetto is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published
 by the Free Software Foundation; either version 2 of the License, or (at
 your option) any later version.
 
 Vinetto is distributed in the hope that it will be
 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 General Public License for more details.
 
 You should have received a copy of the GNU General Public License along
 with the vinetto package; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
-----------------------------------------------------------------------------
"""

__revision__ = "$Revision: 47 $"
__version__ = "0.02"
__author__ = 'Michel Roukine'

HtHeader = []
HtPicRow = []
HtOrphans = []
HtFooter = []
IMGTAG = "<IMG SRC=\"./__TNFNAME__.jpg\" ALT=\"__TNNAME__\">"

from time import time, ctime
from os.path import dirname, basename, abspath, getmtime
from vinutils import getCatEntry       


class Report:
    """ Vinetto report SuperClass.  """
    def __init__ (self, target, outputdir, verstr):
        """ Initialize a new Report instance.  """
        self.tDBfname = basename(target)
        self.tDBdirname = abspath(dirname(target))
        self.tDBmtime = getmtime(target)
        self.outputdir = outputdir
        self.verstr = verstr


class HtRep(Report):
    """ Html vinetto elementary mode report Class.  """
    def __init__ (self, tDBfname, outputdir, charset, verstr):
        """ Initialize a new HtRep instance.  """
        Report.__init__(self, tDBfname, outputdir, verstr)
        self.rownumber = 0
        separatorID = 0
        
        for ligne in open("/usr/share/vinetto/HtRepTemplate.html",
                          "r").readlines():
            if ligne.find("__CHARSET__") > 0:
                ligne = ligne.replace("__CHARSET__", charset)
            if ligne.find("__ITS__") >= 0:
                separatorID += 1
                continue
                
            if separatorID == 0:
                HtHeader.append(ligne)
            elif separatorID == 1:
                HtPicRow.append(ligne)
            elif separatorID == 2:
                HtOrphans.append(ligne)
            elif separatorID == 3:
                HtFooter.append(ligne)
              
        self.TNidList = []
        self.TNtsList = []
        self.TNnameList = []
    
    
    def SetFileSection (self, FileSize, md5):
        """ Initialize data of the report file section.  """
        self.FileSize = FileSize
        self.md5 = md5
        
        
    def SetREtst (self, REtst):
        """ Initialize data of the report file section.  """
        self.REtst = REtst
       
        
    def headwrite (self):
        """ Writes report header.  """
        self.repfile = open(self.outputdir + "index.html", "w")    
        for ligne in HtHeader:
            ligne = ligne.replace("__DATEREPORT__", "Report date : " + ctime(time()))
            ligne = ligne.replace("__TDBDIRNAME__", self.tDBdirname)
            ligne = ligne.replace("__TDBFNAME__", self.tDBfname)
            ligne = ligne.replace("__TDBMTIME__", ctime(self.tDBmtime))
            ligne = ligne.replace("__FILESIZE__", str(self.FileSize))
            ligne = ligne.replace("__MD5__", self.md5)
            ligne = ligne.replace("__ROOTENTRYTST__", \
                                  "Root Entry modify timestamp : " + self.REtst)
            self.repfile.write(ligne)


    def close(self, statstring):
        """ Terminate processing HtRep instance.  """
            
        for ligne in HtFooter:
            ligne = ligne.replace("__TYPEXTRACT__", statstring)
            ligne = ligne.replace("__VVERSION__", "Vinetto " + self.verstr)
            self.repfile.write(ligne)
        self.repfile.close()

        
    def rowflush(self):
        """ Process a report line.  """
        self.rownumber += 1
        for ligne in HtPicRow:
            ligne = ligne.replace("__ROWNUMBER__", str(self.rownumber))
            for j in range(len(self.tnId)):
                ligne = ligne.replace("__TNfilled__" + str(j), "1")
                buff = IMGTAG.replace("__TNFNAME__", self.tnFname[j])
                buff = buff.replace("__TNNAME__", self.tnName[j])
                ligne = ligne.replace("__IMGTAG__" + str(j), buff)                
                ligne = ligne.replace("__TNID__" + str(j), self.tnId[j])
            for j in range(len(self.tnId),5):
                ligne = ligne.replace("__TNfilled__" + str(j), "0")
                ligne = ligne.replace("__IMGTAG__" + str(j), " &nbsp; ")
                ligne = ligne.replace("__TNID__" + str(j), " ")

            self.repfile.write(ligne)
            
        self.repfile.write("<TABLE WIDTH=\"720\"><TR><TD>&nbsp;</TD></TR>" + \
                           "<TR><TD><P ALIGN=\"LEFT\">")
        for i in range(len(self.tnId)):
            if self.tnName[i] != "":
                self.repfile.write("<TT>" + self.tnId[i] + " -- " + \
                               self.tnTs[i].replace("  ", " &nbsp;") + " -- " + \
                               self.tnName[i] + "</TT><BR>\n")
            else:
                self.repfile.write("<TT STYLE=\"color: blue\">" + self.tnId[i] + " ** " + \
                                   " no matching Catalog entry found " + \
                                   " ** " + "</TT><BR>\n")
                               
        self.repfile.write("</P></TD></TR><TR><TD>&nbsp;</TD></TR></TABLE>")
        
        self.tnId    = []
        self.tnFname = []
        self.tnTs    = []
        self.tnName  = []


    def printOrphanCatEnt(self, OrphanICat):
        """ Print orphan catalog entry.  """    
        if OrphanICat != []:
            endOrphanSection = False
            for ligne in HtOrphans:
                if ligne.find("__ORPHANENTRY__") >= 0:
                    oprhanLine = ligne
                    break
                else:
                    self.repfile.write(ligne)

            for iCat in OrphanICat:
                catEntry = getCatEntry (iCat)
                Ts = catEntry[0][0]
                Name = catEntry[0][1]
                str = "<TT>" + ("%04i" % iCat) + " -- " + \
                      Ts.replace("  ", " &nbsp;") + " -- " + Name + "</TT><BR>\n"
                ligne = oprhanLine.replace("__ORPHANENTRY__", str)
                self.repfile.write(ligne)
                           
            for ligne in HtOrphans:
                if ligne.find("__ORPHANENTRY__") < 0:
                    if endOrphanSection:
                        self.repfile.write(ligne)
                else:
                    endOrphanSection = True
        
            
    def flush(self, statstring):
        """ Process the report body and the report end.  """
        from vinutils import TNStreams
        from vinutils import Catalog

        self.headwrite()

        self.rownumber = 0
        self.tnId    = []
        self.tnFname = []
        self.tnTs    = []
        self.tnName  = []
        
#        for (iTN, vType, filename) in TNStreams:
        for iTN in TNStreams:
            for (vType, filename) in TNStreams[iTN]:
                self.tnId.append("%04i" % iTN)
                self.tnFname.append(filename)
                catEntry = getCatEntry (iTN)
                if len(catEntry) == 0:
                    Ts = ""
                    Name = ""
                elif len(catEntry) >= 1:
                # duplicate index numbers not properly handled !!!
                    Ts = catEntry[0][0]
                    Name = catEntry[0][1]
                self.tnTs.append(Ts)
                self.tnName.append(Name)
                if len(self.tnId) >= 5:
                    self.rowflush()
            
        if len(self.tnId) > 0:
            self.rowflush()
            
        # Scanning for orphan catalog entries
        OrphanICat = []
        for iCat in Catalog:
            if not TNStreams.has_key(iCat):
                OrphanICat.append(iCat)
        self.printOrphanCatEnt(OrphanICat)
        
        self.close(statstring)