• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pyflagsh.environment函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyflag.pyflagsh.environment函数的典型用法代码示例。如果您正苦于以下问题:Python environment函数的具体用法?Python environment怎么用?Python environment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了environment函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test03cpTests

    def test03cpTests(self):
        """ Test the cp (copy) command """
        self.env = pyflagsh.environment(case=self.test_case)
        pyflagsh.shell_execv(env=self.env, command="load",
                             argv=[self.test_case,])

        ## Make a directory for the files:
        tmpname = os.tmpnam()
        os.mkdir(tmpname)

        pyflagsh.shell_execv(env=self.env, command="cp",
                             argv=["/dscf108*", tmpname])

        ## Now verify the copy worked:
        fd = open(tmpname+"/dscf1080.jpg",'r')
        data = fd.read()
        md5sum = md5.new()
        md5sum.update(data)
        self.assertEqual(md5sum.hexdigest(),'9e03e022404a945575b813ffb56fd841')

        ## Clean up:
        for file in os.listdir(tmpname):
            os.unlink(tmpname+'/'+file)
            
        os.rmdir(tmpname)
开发者ID:anarchivist,项目名称:pyflag,代码行数:25,代码来源:BasicCommands.py


示例2: test01ls

    def test01ls(self):
        """ Test the ls command """
        self.env = pyflagsh.environment(case=self.test_case)
        pyflagsh.shell_execv(env=self.env, command="load",
                             argv=[self.test_case,])

        ## Check we can list default directory
        lines = [ l for l in pyflagsh.shell_execv_iter(env=self.env, command="ls",
                                                       argv=[])]
        self.assertEqual(len(lines),18)

        ## Check we can list directories
        lines = [ l for l in pyflagsh.shell_execv_iter(env=self.env, command="ls",
                                                       argv=["docs"])]
        self.assert_(len(lines)>=3)

        ## Check that we can glob files:
        lines = [ l for l in pyflagsh.shell_execv_iter(env=self.env, command="ls",
                                                       argv=["*.jpg"])]
        self.assertEqual(len(lines),5)
        
        ## Check that we can glob directories:
        lines = [ l for l in pyflagsh.shell_execv_iter(env=self.env, command="ls",
                                                       argv=["do*"])]
        self.assert_(len(lines)>3)
开发者ID:anarchivist,项目名称:pyflag,代码行数:25,代码来源:BasicCommands.py


示例3: test01RunScanners

    def test01RunScanners(self):
        """ Running Logical Index Scanner """
        ## Make sure the word secret is in there.
        pdbh = DB.DBO()
        pdbh.execute("select * from dictionary where word='secret' limit 1")
        row = pdbh.fetch()
        if not row:
            pdbh.insert('dictionary', **{'word':'secret', 'class':'English', 'type':'word'})
        
        env = pyflagsh.environment(case=self.test_case)
        pyflagsh.shell_execv(env=env, command="scan",
                             argv=["*",'IndexScan'])

        dbh = DB.DBO(self.test_case)
        dbh2 = DB.DBO(self.test_case)
        fsfd = DBFS(self.test_case)
        dbh.execute("select inode_id, word,offset,length from LogicalIndexOffsets join %s.dictionary on LogicalIndexOffsets.word_id=%s.dictionary.id where word='secret'", (config.FLAGDB,config.FLAGDB))
        count = 0
        for row in dbh:
            count += 1
            path, inode, inode_id = fsfd.lookup(inode_id = row['inode_id'])
            fd = fsfd.open(inode=inode)
            fd.overread = True
            fd.slack = True
            fd.seek(row['offset'])
            data = fd.read(row['length'])
            print "Looking for %s: Found in %s at offset %s length %s %r" % (
                row['word'], inode, row['offset'], row['length'],data)
            self.assertEqual(data.lower(), row['word'].lower())

        ## Did we find all the secrets?
        self.assertEqual(count,2)
开发者ID:anarchivist,项目名称:pyflag,代码行数:32,代码来源:LogicalIndex.py


示例4: test01RunScanner

 def test01RunScanner(self):
     """ Test cache scanner """
     env = pyflagsh.environment(case=self.test_case)
     pyflagsh.shell_execv(env=env, command="scan",
                          argv=["*",'ZipScan'])
     pyflagsh.shell_execv(env=env, command="scan",
                          argv=["*",'MozCacheScan','GoogleImageScanner'])
开发者ID:anarchivist,项目名称:pyflag,代码行数:7,代码来源:Mozilla.py


示例5: test02catTests

    def test02catTests(self):
        """ Test the cat command """
        self.env = pyflagsh.environment(case=self.test_case)
        pyflagsh.shell_execv(env=self.env, command="load",
                             argv=[self.test_case,])

        self.fsfd = FileSystem.DBFS(self.test_case)
        fd = self.fsfd.open("/dscf1080.jpg")
        data1=fd.read()        
        fd = self.fsfd.open("/dscf1081.jpg")
        data2=fd.read()
        fd = self.fsfd.open("/dscf1082.jpg")
        data3=fd.read()

        result = ''
        for l in pyflagsh.shell_execv_iter(env=self.env, command="cat",
                                           argv=["/dscf1081.jpg"]):
            result+=l
        self.assertEqual(result,data2)

        result = ''
        for l in pyflagsh.shell_execv_iter(env=self.env, command="cat",
                                           argv=["/dscf108*"]):
            result+=l

        self.assertEqual(len(result),len(data1)+len(data2)+len(data3))
        self.assert_(result==data1+data2+data3)
开发者ID:anarchivist,项目名称:pyflag,代码行数:27,代码来源:BasicCommands.py


示例6: test01SMTPScanner

 def test01SMTPScanner(self):
     """ Test SMTP Scanner """
     env = pyflagsh.environment(case=self.test_case)
     pyflagsh.shell_execv(env=env,
                          command="scan",
                          argv=["*",                   ## Inodes (All)
                                "SMTPScanner", "RFC2822", "TypeScan"
                                ])                   ## List of Scanners
开发者ID:anarchivist,项目名称:pyflag,代码行数:8,代码来源:SMTP.py


示例7: test01GmailScanner

 def test01GmailScanner(self):
     """ Test Google Image Scanner """
     env = pyflagsh.environment(case=self.test_case)
     pyflagsh.shell_execv(env=env,
                          command="scan",
                          argv=["*",                   ## Inodes (All)
                                "GoogleImageScanner",
                                ])                   ## List of Scanners
开发者ID:anarchivist,项目名称:pyflag,代码行数:8,代码来源:Google.py


示例8: test01YahooMailScanner

 def test01YahooMailScanner(self):
     """ Test Scanner """
     env = pyflagsh.environment(case=self.test_case)
     pyflagsh.shell_execv(env=env,
                          command="scan",
                          argv=["*",                   ## Inodes (All)
                                "YahooMail20Scan",
                                ])                   ## List of Scanners
开发者ID:anarchivist,项目名称:pyflag,代码行数:8,代码来源:YahooMail.py


示例9: test01

 def test01(self):
     """ Test Reassebler """
     env = pyflagsh.environment(case=self.test_case)
     pyflagsh.shell_execv(env=env,
                          command="scan",
                          argv=["*",                   ## Inodes (All)
                                "NetworkScanners",
                                ])                   ## List of Scanners
开发者ID:anarchivist,项目名称:pyflag,代码行数:8,代码来源:Reassembler.py


示例10: test01RunScanner

    def test01RunScanner(self):
        """ Running scanners """
        env = pyflagsh.environment(case=self.test_case)
        pyflagsh.shell_execv(env=env, command="scan",
                             argv=["*",'ZipScan', 'TarScan', 'GZScan'])

        pyflagsh.shell_execv(env=env, command="scan",
                             argv=["*",'JPEGCarver', 'ZipScan', 'TarScan', 'GZScan', 'TypeScan', 'IndexScan'])
开发者ID:anarchivist,项目名称:pyflag,代码行数:8,代码来源:dftt.py


示例11: test01GmailScanner

 def test01GmailScanner(self):
     """ Test Gmail Scanner """
     env = pyflagsh.environment(case=self.test_case)
     pyflagsh.shell_execv(env=env,
                          command="scan",
                          argv=["*",                   ## Inodes (All)
                                "GmailScanner", "YahooMailScan",
                                "SquirrelMailScan", "HotmailScanner"
                                ])                   ## List of Scanners
开发者ID:anarchivist,项目名称:pyflag,代码行数:9,代码来源:Gmail.py


示例12: test02Hash

 def test02Hash(self):
     """ Test the hashes of loaded files """
     env = pyflagsh.environment(case=self.test_case)
     pyflagsh.shell_execv(env=env, command="scan",
                          argv=["*",'MD5Scan'])
         
     dbh = DB.DBO(self.test_case)
     dbh.execute("select binary_md5 from hash where binary_md5=%b",
                 "04D68B7C8993A3A485A5780EC1A8D62D".decode("hex"))
     self.assert_(dbh.fetch(), "Expected hash not found")
开发者ID:anarchivist,项目名称:pyflag,代码行数:10,代码来源:Raid.py


示例13: test01CarveImage

    def test01CarveImage(self):
        """ Carving from Image """
        env = pyflagsh.environment(case=self.test_case)
        pyflagsh.shell_execv(env=env, command="scan",
                             argv=["*",'ScriptCarver'])

        dbh = DB.DBO(self.test_case)
        dbh.execute("select count(*) as c from type where type like %r", "%script")
        row = dbh.fetch()
        self.assert_(row != None)
        self.assert_(row['c']>=3)
开发者ID:anarchivist,项目名称:pyflag,代码行数:11,代码来源:ScriptCarver.py


示例14: test01RunScanner

    def test01RunScanner(self):
        """ Test IE History scanner """
        env = pyflagsh.environment(case=self.test_case)
        pyflagsh.shell_execv(env=env, command="scan",
                             argv=["*",'IECarver'])

        dbh = DB.DBO(self.test_case)
        dbh.execute("select count(*) as c from ie_history")
        row = dbh.fetch()['c']
        print "Got %s rows" % row
        self.assert_(row >= 20)
开发者ID:anarchivist,项目名称:pyflag,代码行数:11,代码来源:IEHistoryCarver.py


示例15: test01TypeScan

    def test01TypeScan(self):
        """ Check the type scanner works """
        env = pyflagsh.environment(case=self.test_case)
        pyflagsh.shell_execv(env=env, command="scan",
                             argv=["*",'TypeScan'])

        ## Make sure the extra magic is being used properly.
        dbh = DB.DBO(self.test_case)
        dbh.execute('select count(*) as count from type where type like "%%Outlook%%"')
        count = dbh.fetch()['count']
        self.failIf(count==0, "Unable to locate an Outlook PST file - maybe we are not using our custom magic file?")
开发者ID:backupManager,项目名称:pyflag,代码行数:11,代码来源:TypeScan.py


示例16: test01FTPScanner

    def test01FTPScanner(self):
        """ Test basic FTP scanning """
        env = pyflagsh.environment(case=self.test_case)
        pyflagsh.shell_execv(env=env,
                             command="scan",
                             argv=["*",                   ## Inodes (All)
                                   "FTPScanner"
                                  ])                   ## List of Scanners

        ## What should we have found? FIXME
        dbh = DB.DBO(self.test_case)
开发者ID:backupManager,项目名称:pyflag,代码行数:11,代码来源:FTP.py


示例17: setUp

 def setUp(self):
     """ Load test Case"""
     env = pyflagsh.environment(case=self.test_case)
     pyflagsh.shell_execv(command="delete_case", env=env,
                          argv=[self.test_case])
     pyflagsh.shell_execv(command="create_case", env=env,
                          argv=[self.test_case])
     if self.test_case:
         pyflagsh.shell_execv(command='execute', env=env,
                              argv=['Load Data.Load AFF4 Volume',
                                    'case=%s' % self.test_case, 
                                    'filename=%s' % self.test_file])
开发者ID:backupManager,项目名称:pyflag,代码行数:12,代码来源:tests.py


示例18: test04LocatingNTFS_ADS

    def test04LocatingNTFS_ADS(self):
        """ Test for finding ADS files """
        ## Do type scanning:
        env = pyflagsh.environment(case=self.test_case)
        pyflagsh.shell_execv(env=env, command="scan",
                             argv=["*",'TypeScan'])

        dbh = DB.DBO(self.test_case)
        dbh.execute('select type.type from type,inode where type.inode_id=inode.inode_id and type like "%executable%" and inode.inode like "%33-128-7%"')
        row = dbh.fetch()

        self.assert_(row, "Executable within ADS was not found???")
开发者ID:anarchivist,项目名称:pyflag,代码行数:12,代码来源:Sleuthkit.py


示例19: test01TypeScan

    def test01TypeScan(self):
        """ Check the type scanner works """
        env = pyflagsh.environment(case=self.test_case)
        pyflagsh.shell_execv(env=env, command="scan",
                             argv=["*",'TypeScan'])

        pyflagsh.shell_execv(env=env, command="export",
                             argv=["Images","HTMLDirectoryRenderer",
                                   "TypeCaseTable.Thumbnail",
                                   "TypeCaseTable.Type","InodeTable.Size",
                                   #'filter=Type contains JPEG',
                                   ])
开发者ID:anarchivist,项目名称:pyflag,代码行数:12,代码来源:ExportCommands.py


示例20: test01SMTPScanner

    def test01SMTPScanner(self):
        """ Test POP Scanner """
        env = pyflagsh.environment(case=self.test_case)
        pyflagsh.shell_execv(env=env,
                             command="scan",
                             argv=["*",                   ## Inodes (All)
                                   "POPScanner", "RFC2822",
                                   ])                   ## List of Scanners

        dbh = DB.DBO(self.test_case)
        dbh.execute("select count(*) as total from passwords where type='POP3'")
        row = dbh.fetch()
        self.failIf(row['total']==0,"Could not parse any POP3 passwords")
开发者ID:anarchivist,项目名称:pyflag,代码行数:13,代码来源:POP.py



注:本文中的pyflag.pyflagsh.environment函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyflagsh.shell_execv函数代码示例发布时间:2022-05-25
下一篇:
Python pyflaglog.log函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap