Esempio n. 1
0
File: merge.py Progetto: halbbob/dff
 def _attributes(self):
    i = 1
    attr = VMap()
    attr.thisown = False
    vlist = VList()
    vlist.thisown = False
    for f in self.files:
       node = f.value()
       cattr = Variant(node.absolute())
       cattr.thisown = False
       vlist.append(cattr)
    vvlist = Variant(vlist)
    vvlist.thisown = False
    attr["concatanated files (ordered)"] = vvlist
    return attr
Esempio n. 2
0
 def createContext(self, selected):
     lpatterns = VList()
     lpatterns.thisown = False
     for filetype in selected.iterkeys():
         patterns = selected[filetype][0]
         aligned = selected[filetype][1]
         for pattern in patterns:
             vpattern = VMap()
             vpattern.thisown = False
             vfiletype = Variant(filetype, typeId.String)
             vfiletype.thisown = False
             vpattern["filetype"] = vfiletype
             header = VMap()
             header.thisown = False
             val = Variant(pattern[0], typeId.String)
             val.thisown = False
             header["needle"] = val
             val = Variant(len(pattern[0]), typeId.UInt32)
             val.thisown = False
             header["size"] = val
             footer = VMap()
             footer.thisown = False
             val = Variant(pattern[1], typeId.String)
             val.thisown = False
             footer["needle"] = val
             val = Variant(len(pattern[1]), typeId.UInt32)
             val.thisown = False
             footer["size"] = val
             vheader = Variant(header)
             vheader.thisown = False
             vpattern["header"] = vheader
             vfooter = Variant(footer)
             vfooter.thisown = False
             vpattern["footer"] = vfooter
             vwindow = Variant(int(pattern[2]), typeId.UInt32)
             vwindow.thisown = False
             vpattern["window"] = vwindow
             val = Variant(aligned, typeId.Bool)
             val.thisown = False
             vpattern["aligned"] = val
             lpatterns.append(vpattern)
     vpatterns = Variant(lpatterns)
     vpatterns.thisown = False
     return vpatterns
Esempio n. 3
0
 def start(self, args):
     patterns = VList()
     patterns.thisown = False
     if args.has_key("start-offset"):
         startoff = args["start-offset"].value()
     else:
         startoff = 0
     if args.has_key("block-aligned"):
         aligned = True
     else:
         aligned = False
     for mimetype in filetypes.keys():
         if mimetype in args:
             vsubtypes = args[mimetype].value()
             for subtype in filetypes[mimetype].keys():
                 if subtype in vsubtypes:
                     pattern = VMap()
                     pattern.thisown = False
                     descr = filetypes[mimetype][subtype]
                     filetype = Variant(subtype, typeId.String)
                     filetype.thisown = False
                     for p in descr:
                         pattern["filetype"] = filetype
                         header = VMap()
                         header.thisown = False
                         val = Variant(p[0], typeId.String)
                         val.thisown = False
                         header["needle"] = val
                         val = Variant(len(p[0]), typeId.UInt32)
                         val.thisown = False
                         header["size"] = val
                         footer = VMap()
                         footer.thisown = False
                         val = Variant(p[1], typeId.String)
                         val.thisown = False
                         footer["needle"] = val
                         val = Variant(len(p[1]), typeId.UInt32)
                         val.thisown = False
                         footer["size"] = val
                         vheader = Variant(header)
                         vheader.thisown = False
                         pattern["header"] = vheader
                         vfooter = Variant(footer)
                         vfooter.thisown = False
                         pattern["footer"] = vfooter
                         pattern["window"] = Variant(int(p[2]), typeId.UInt32)
                         if aligned:
                             val = Variant(True, typeId.Bool)
                             val.thisown = False
                             pattern["aligned"] = val
                         else:
                             val = Variant(False, typeId.Bool)
                             val.thisown = False
                             pattern["aligned"] = val
                         patterns.append(pattern)
     vpatterns = Variant(patterns)
     vpatterns.thisown = False
     margs = VMap()
     margs.thisown = False
     margs["patterns"] = vpatterns
     margs["file"] = args["file"]
     vstartoff = Variant(startoff, typeId.UInt64)
     vstartoff.thisown = False
     margs["start-offset"] = vstartoff
     proc = self.tm.add("carver", margs, ["console"])
     if proc:
         proc.event.wait()