[Forensics-changes] [vinetto] 03/05: Imported Upstream version 0.07

Joao Eriberto Mota Filho eriberto at moszumanska.debian.org
Thu Dec 11 17:18:18 UTC 2014


This is an automated email from the git hooks/post-receive script.

eriberto pushed a commit to branch debian
in repository vinetto.

commit 0ab65891bbd6f7a13ada882a42be249dbd2774b5
Author: Joao Eriberto Mota Filho <eriberto at debian.org>
Date:   Thu Dec 11 15:15:09 2014 -0200

    Imported Upstream version 0.07
---
 CHANGELOG              |  0
 README                 | 10 +++++++---
 TODO                   |  0
 res/HtRepTemplate.html |  3 ++-
 vinetto                | 43 +++++++++++++++++++++++++++++++++----------
 vinreport.py           |  4 +++-
 6 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
index 0000000..e69de29
diff --git a/README b/README
index b206003..3ec8e3a 100644
--- a/README
+++ b/README
@@ -6,7 +6,7 @@
 
 
 
-Version alpha 0.06 (7 may 2006)
+Version beta 0.07 (June 14 2007)
 ------------------
 
 Introduction
@@ -93,16 +93,20 @@ thumbnails. ***
 Usage
 -----
 
-Usage: vinetto [OPTIONS] [-o DIR] file
+usage: vinetto [OPTIONS] [-s] [-U] [-o DIR] file
 
 options:
   --version   show program's version number and exit
   -h, --help  show this help message and exit
   -o DIR      write thumbnails to DIR
   -H          write html report to DIR
+  -U          use utf8 encodings
+  -s          create symlink of the image realname to the numbered name in
+              DIR/.thumbs
+
 
 	Metadata list will be written on standard output.
 
 --------------
-7 may 2006
+June 14 2007
 Michel Roukine
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..e69de29
diff --git a/res/HtRepTemplate.html b/res/HtRepTemplate.html
index 046984d..f25f51a 100644
--- a/res/HtRepTemplate.html
+++ b/res/HtRepTemplate.html
@@ -1,6 +1,7 @@
 <HTML>
 <HEAD>
 <TITLE>Vinetto -H report</TITLE>
+<META http-equiv="Content-Type" content="text/html;charset=__CHARSET__">
 </HEAD>
 <BODY>
 <CENTER><H2>Vinetto -- thumbnails extraction report</H2></CENTER>
@@ -85,4 +86,4 @@
 </DIV>
 <EM>__VVERSION__</EM>
 </BODY>
-</HTML>
\ No newline at end of file
+</HTML>
diff --git a/vinetto b/vinetto
index ca2c859..2b4a49e 100755
--- a/vinetto
+++ b/vinetto
@@ -25,7 +25,7 @@ This file is part of Vinetto.
 -----------------------------------------------------------------------------
 """
 
-__revision__ = "$Revision: 56 $"
+__revision__ = "$Revision: 59 $"
 __version__ = "0.06"
 __author__ = 'Michel Roukine'
 
@@ -46,6 +46,7 @@ PPS_TYPES = ["undefined", "storage", "stream", "undefined", "undefined", "root"]
 EOI = unhexlify('ffd9')
 HEADER1 = unhexlify('0c00')
 PIL = ""
+NUMBERED_THUMBS_DIR = ".thumbs"
 
 
 def getargs():
@@ -54,12 +55,18 @@ def getargs():
              "Copyright (C) 2005-2006 Michel Roukine.\n" + \
              "Vinetto is open source software," + \
              " see http://vinetto.sourceforge.net/"
-    parser = OptionParser(usage="%prog [OPTIONS] [-o DIR] file", version=verstr)
+    parser = OptionParser(usage="%prog [OPTIONS] [-s] [-U] [-o DIR] file", version=verstr)
     parser.add_option("-o", dest="outputdir",
                       help="write thumbnails to DIR", metavar="DIR")
     parser.set_defaults(htmlrep=False)
     parser.add_option("-H", action="store_true", dest="htmlrep",
                       help="write html report to DIR")
+    parser.set_defaults(encoding=False)
+    parser.add_option("-U", action="store_true", dest="encoding",
+                      help="use utf8 encodings")
+    parser.set_defaults(symlinks=False)
+    parser.add_option("-s", action="store_true", dest="symlinks",
+                      help="create symlink of the image realname to the numbered name in DIR/.thumbs")
     opts, pargs = parser.parse_args()
     
     if len(pargs) != 1:
@@ -67,9 +74,23 @@ def getargs():
         
     if (opts.outputdir == None) and (opts.htmlrep == True):
         parser.error("-H option requires -o with a directory name")
-    
-    return (pargs[0], opts.outputdir, opts.htmlrep) 
+    os.system("mkdir " + opts.outputdir + "/" + NUMBERED_THUMBS_DIR)
+    return (pargs[0], opts.outputdir, opts.htmlrep, opts.encoding, opts.symlinks) 
+
 
+def getencodings():
+    """What encoding we use?"""
+    if utf8encoding: 
+        fileencoding = 'utf8'
+    else:
+        fileencoding = 'iso-8859-1'
+    return fileencoding
+
+def encodefilename(originame):
+    """Convert filename to the global encoding. """
+    TNname = unicode(originame,
+                   'utf-16-le').encode(getencodings(), 'replace')
+    return TNname
 
 def conv2pytime (win32filetime):
     """Convert win32 timestamp to python time.  """
@@ -90,7 +111,7 @@ def nextBlock (TDB, Table, indx):
     return unpack("<l", TDB[offst:offst+4])[0]
 
 # Beginning ...   
-tDBfname, outputdir, htmlrep = getargs()
+tDBfname, outputdir, htmlrep, utf8encoding, symlinks = getargs()
 
 # Testing file and DIR parameters
 if not os.access(tDBfname, os.F_OK):
@@ -141,7 +162,7 @@ if outputdir != None :
     huffman      = open("/usr/share/vinetto/huffman","rb").read()
  
     if htmlrep == True:
-        report = vinreport.HtRep(tDBfname, outputdir, __version__ + " (r" + \
+        report = vinreport.HtRep(tDBfname, outputdir, getencodings(), __version__ + " (r" + \
                                  __revision__[11:-2] +")")
         md5tDB = md5.new(thumbsDB).hexdigest()
         report.SetFileSection(longueur, md5tDB)
@@ -267,8 +288,10 @@ while currentBlock != -2:
                     originame   = sr[indcat+16 :indcat+16+nameLen]
                     TNid = "%04i" % num
                     TNtimestamp = ctime(conv2pytime(timestamp))
-                    TNname = unicode(originame,
-                                   'utf-16-le').encode('iso-8859-1', 'replace')
+                    TNname = encodefilename(originame)
+                    if symlinks:
+                        os.system( "ln -fs " + NUMBERED_THUMBS_DIR + "/" + TNid + ".jpg " + "\"" + \
+                                    outputdir + "/" + TNname + "\"" )
                     print  " " + TNid, " ", TNtimestamp, " ", TNname
                     addCatEntry(num, TNtimestamp, TNname)
                     indcat = indcat + recordLen
@@ -294,7 +317,7 @@ while currentBlock != -2:
                 # is it a type 2 thumbnail ? (full jpeg)
                 if  sr[0x0c:0x10] == "\xff\xd8\xff\xe0" :
                     if outputdir != None :
-                        open(outputdir + TNfname(SIDstr, "2") + ".jpg", \
+                        open(outputdir + "/" + NUMBERED_THUMBS_DIR + "/" + TNfname(SIDstr, "2") + ".jpg", \
                              "wb").write(sr[0x0c:])                                   
                 elif  unpack("<L",sr[0x0c:0x10])[0] == 1 :
                     # is second header OK ?
@@ -362,4 +385,4 @@ print statstring
 
 if htmlrep == True:
     report.flush(statstring)
-    
\ No newline at end of file
+    
diff --git a/vinreport.py b/vinreport.py
index 70fd7e0..98ba732 100644
--- a/vinreport.py
+++ b/vinreport.py
@@ -53,7 +53,7 @@ class Report:
 
 class HtRep(Report):
     """ Html vinetto elementary mode report Class.  """
-    def __init__ (self, tDBfname, outputdir, verstr):
+    def __init__ (self, tDBfname, outputdir, charset, verstr):
         """ Initialize a new HtRep instance.  """
         Report.__init__(self, tDBfname, outputdir, verstr)
         self.rownumber = 0
@@ -61,6 +61,8 @@ class HtRep(Report):
         
         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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/vinetto.git



More information about the forensics-changes mailing list