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

Python utils.write_to_csv函数代码示例

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

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



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

示例1: _csv_list_drives

 def _csv_list_drives(self, drives):
     with open(self.output_dir + '_list_drives.csv', 'wb') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "FAB", "PARTITIONS", "DISK", "FILESYSTEM"], csv_writer)
         for phCapt, partCapt, logicalCapt, fs in drives:
             write_to_csv([self.computer_name, 'list_drives', phCapt, partCapt, logicalCapt, fs], csv_writer)
     record_sha256_logs(self.output_dir + '_list_drives.csv', self.output_dir + '_sha256.log')
开发者ID:Nervous,项目名称:certitude,代码行数:7,代码来源:statemachine.py


示例2: _csv_list_scheduled_jobs

    def _csv_list_scheduled_jobs(self):
        self.logger.info('Health : Listing scheduled jobs')
        file_tasks = self.output_dir + '_tasks.csv'
        with open(file_tasks, 'wb') as tasks_logs:
            proc = subprocess.Popen(["schtasks.exe", '/query', '/fo', 'CSV'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            res = proc.communicate()
            res = get_terminal_decoded_string(res[0])
            # clean and write the command output
            write_to_output('"TASK_NAME","NEXT_SCHEDULE","STATUS"\r\n', tasks_logs, self.logger)
            column_names = None
            for line in res.split('\r\n'):
                if line == "":
                    continue
                if line[0] != '"':
                    continue
                if not column_names:
                    column_names = line
                    continue
                elif column_names == line:
                    continue
                write_to_output(line+"\r\n", tasks_logs, self.logger)

        self.logger.info('Health : Listing scheduled jobs')
        with open(file_tasks, "r") as fr, open(self.output_dir + "_scheduled_jobs.csv", 'wb') as fw:
            csv_writer = get_csv_writer(fw)
            write_to_csv(["COMPUTER_NAME", "TYPE", "JOB_NAME", "TIME", "STATE"], csv_writer)
            for l in fr.readlines():
                l = l.decode('utf8')
                if l.find('\\') > 0:
                    l = l[:-1].replace('"', '')  # remove the end of line
                    arr_write = [self.computer_name, 'scheduled_jobs'] + l.split(',')
                    write_to_csv(arr_write, csv_writer)
        self.logger.info('Health : Listing scheduled jobs')
        record_sha256_logs(self.output_dir + '_scheduled_jobs.csv', self.output_dir + '_sha256.log')
开发者ID:friedbutter,项目名称:Fastir_Collector,代码行数:34,代码来源:statemachine.py


示例3: _csv_list_network_drives

 def _csv_list_network_drives(self, drives):
     with open(self.output_dir + '_list_networks_drives.csv', 'wb') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "DISK", "FILESYSTEM", "PARTITION_NAME"], csv_writer)
         for diskCapt, diskFs, diskPName in drives:
             write_to_csv([self.computer_name, 'list_networks_drives', diskCapt, diskFs, diskPName], csv_writer)
     record_sha256_logs(self.output_dir + '_list_networks_drives.csv', self.output_dir + '_sha256.log')
开发者ID:Nervous,项目名称:certitude,代码行数:7,代码来源:statemachine.py


示例4: _csv_list_share

 def _csv_list_share(self, share):
     with open(self.output_dir + '_shares.csv', 'wb') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "SHARE_NAME", "SHARE_PATH"], csv_writer)
         for name, path in share:
             write_to_csv([self.computer_name, 'shares', name, path], csv_writer)
     record_sha256_logs(self.output_dir + '_shares.csv', self.output_dir + '_sha256.log')
开发者ID:Nervous,项目名称:certitude,代码行数:7,代码来源:statemachine.py


示例5: _csv_list_route_table

 def _csv_list_route_table(self, routes):
     with open(self.output_dir + "_routes_tables.csv", 'ab') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "NAME", "MASK"], csv_writer)
         for ip, mask in routes:
             write_to_csv([self.computer_name, 'routes_tables', unicode(ip), unicode(mask)], csv_writer)
     record_sha256_logs(self.output_dir + '_routes_tables.csv', self.output_dir + '_sha256.log')
开发者ID:Nervous,项目名称:certitude,代码行数:7,代码来源:statemachine.py


示例6: _csv_firefox_history

 def _csv_firefox_history(self, fhistory):
     with open(self.output_dir + '\\' + self.computer_name + '_firefox_history' + self.rand_ext, 'wb') as output:
         csv_writer = get_csv_writer(output)
         for time, url, user, profile in fhistory:
             write_to_csv([self.computer_name, 'firefox_history', time, url, user, profile], csv_writer)
     record_sha256_logs(self.output_dir + '\\' + self.computer_name + '_firefox_history' + self.rand_ext,
                        self.output_dir + '\\' + self.computer_name + '_sha256.log')
开发者ID:supercsq,项目名称:Fastir_Collector,代码行数:7,代码来源:fs.py


示例7: _csv_list_sessions

 def _csv_list_sessions(self, sessions):
     with open(self.output_dir + '_sessions.csv', 'ab') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "LOGON_ID", "AUTH_PACKAGE", "START_TIME", "LOGON_TYPE"], csv_writer)
         for logonID, authenticationPackage, startime, logontype in sessions:
             write_to_csv([self.computer_name, 'sessions', unicode(logonID),
                           authenticationPackage, unicode(startime.split('.')[0]), unicode(logontype)], csv_writer)
     record_sha256_logs(self.output_dir + '_sessions.csv', self.output_dir + '_sha256.log')
开发者ID:Nervous,项目名称:certitude,代码行数:8,代码来源:statemachine.py


示例8: _csv_chrome_history

 def _csv_chrome_history(self, chistory):
     with open(self.output_dir + '\\' + self.computer_name + '_chrome_history' + self.rand_ext, 'wb') as output:
         csv_writer = get_csv_writer(output)
         write_to_csv(("COMPUTER_NAME", "TYPE", "TIME", "URL", "TITLE", "USER", "PROFILE"), csv_writer)
         for time, url, title, user, profile in chistory:
             write_to_csv([self.computer_name, 'chrome_history', time, url, title, user, profile], csv_writer)
     record_sha256_logs(self.output_dir + '\\' + self.computer_name + '_chrome_history' + self.rand_ext,
                        self.output_dir + '\\' + self.computer_name + '_sha256.log')
开发者ID:supercsq,项目名称:Fastir_Collector,代码行数:8,代码来源:fs.py


示例9: _csv_list_network_drives

 def _csv_list_network_drives(self, drives):
     self.logger.info("Health : Listing network drives")
     with open(self.output_dir + '%s_list_networks_drives' % self.computer_name + self.rand_ext, 'wb') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "DISK", "FILESYSTEM", "PARTITION_NAME"], csv_writer)
         for diskCapt, diskFs, diskPName in drives:
             write_to_csv([self.computer_name, 'list_networks_drives', diskCapt, diskFs, diskPName], csv_writer)
     record_sha256_logs(self.output_dir + '_list_networks_drives' + self.rand_ext, self.output_dir + '_sha256.log')
开发者ID:SekoiaLab,项目名称:Fastir_Collector,代码行数:8,代码来源:statemachine.py


示例10: _csv_list_named_pipes

 def _csv_list_named_pipes(self, pipes):
     with open(self.output_dir + '\\' + self.computer_name + '_named_pipes' + self.rand_ext, 'wb') as output:
         csv_writer = get_csv_writer(output)
         write_to_csv(("COMPUTER_NAME", "TYPE", "NAME"), csv_writer)
         for pipe in pipes:
             write_to_csv([self.computer_name, 'named_pipes', pipe], csv_writer)
     record_sha256_logs(self.output_dir + '\\' + self.computer_name + '_named_pipes' + self.rand_ext,
                        self.output_dir + '\\' + self.computer_name + '_sha256.log')
开发者ID:supercsq,项目名称:Fastir_Collector,代码行数:8,代码来源:fs.py


示例11: _csv_list_route_table

 def _csv_list_route_table(self, routes):
     self.logger.info('Health : Listing routes tables')
     with open(self.output_dir + '_routes_tables' + self.rand_ext, 'ab') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "NAME", "MASK"], csv_writer)
         for ip, mask in routes:
             write_to_csv([self.computer_name, 'routes_tables', unicode(ip), unicode(mask)], csv_writer)
     record_sha256_logs(self.output_dir + '_routes_tables' + self.rand_ext, self.output_dir + '_sha256.log')
开发者ID:SeungGiJeong,项目名称:SK_FastIR,代码行数:8,代码来源:statemachine.py


示例12: _csv_list_share

 def _csv_list_share(self, share):
     self.logger.info("Health : Listing shares")
     with open(self.output_dir + '_shares' + self.rand_ext, 'wb') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "SHARE_NAME", "SHARE_PATH"], csv_writer)
         for name, path in share:
             write_to_csv([self.computer_name, 'shares', name, path], csv_writer)
     record_sha256_logs(self.output_dir + '_shares' + self.rand_ext, self.output_dir + '_sha256.log')
开发者ID:SeungGiJeong,项目名称:SK_FastIR,代码行数:8,代码来源:statemachine.py


示例13: _csv_list_drives

 def _csv_list_drives(self, drives):
     self.logger.info("Health : Listing drives")
     with open(self.output_dir + '%s_list_drives' % self.computer_name + self.rand_ext, 'wb') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "FAB", "PARTITIONS", "DISK", "FILESYSTEM"], csv_writer)
         for phCapt, partCapt, logicalCapt, fs in drives:
             write_to_csv([self.computer_name, 'list_drives', phCapt, partCapt, logicalCapt, fs], csv_writer)
     record_sha256_logs(self.output_dir + '_list_drives' + self.rand_ext, self.output_dir + '_sha256.log')
开发者ID:SekoiaLab,项目名称:Fastir_Collector,代码行数:8,代码来源:statemachine.py


示例14: _list_running_process

 def _list_running_process(self, list_running):
     write_to_csv(["PID", "NAME", "COMMAND", "PATH"], "")
     for p in list_running:
         pid = p[0]
         name = p[1]
         cmd = p[2]
         exe_path = p[3]
         write_to_csv([unicode(pid), name, (unicode(cmd)).replace("\"", ""), (unicode(exe_path)).replace("\"", "")], "")
开发者ID:Nervous,项目名称:certitude,代码行数:8,代码来源:statemachine.py


示例15: _csv_list_kb

 def _csv_list_kb(self, kbs):
     with open(self.output_dir + '_kb.csv', 'ab') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "CAPTION", "CS_NAME", "FIX_COMMENTS", "HOTFIX_ID", "INSTALL_DATE",
                       "INSTALLED_ON", "NAME", "SERVICE_PACK", "STATUS"], csv_writer)
         for Caption, CSName, FixComments, HotFixID, InstallDate, InstalledOn, Name, ServicePackInEffect, Status in kbs:
             write_to_csv(
                 [self.computer_name, 'kb', Caption, CSName, FixComments, HotFixID, InstallDate, InstalledOn, Name,
                  ServicePackInEffect, Status], csv_writer)
开发者ID:Nervous,项目名称:certitude,代码行数:9,代码来源:statemachine.py


示例16: _csv_list_services

 def _csv_list_services(self, services):
     with open(self.output_dir + '_services.csv', 'ab') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "CAPTION", "PID", "SERVICE_TYPE", "PATH_NAME", "STATUS", "STATE",
                       "START_MODE"], csv_writer)
         for name, caption, processId, pathName, serviceType, status, state, startMode in services:
             write_to_csv([self.computer_name, 'services', caption,
                           unicode(processId), serviceType, pathName,
                           unicode(status), state, startMode], csv_writer)
     record_sha256_logs(self.output_dir + '_services.csv', self.output_dir + '_sha256.log')
开发者ID:Nervous,项目名称:certitude,代码行数:10,代码来源:statemachine.py


示例17: _csv_list_sockets_network

 def _csv_list_sockets_network(self, connections):
     with open(self.output_dir + '_sockets.csv', 'ab') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "PID", "PROCESS_NAME", "LOCAL_ADDR", "SOURCE_PORT", "REMOTE_ADDR",
                       "REMOTE_PORT", "STATUS"], csv_writer)
         for pid, name, local_address, source_port, remote_addr, remote_port, status in connections:
             write_to_csv([self.computer_name, 'sockets', unicode(pid),
                           unicode(name), unicode(local_address), unicode(source_port),
                           unicode(remote_addr), unicode(remote_port), unicode(status)], csv_writer)
     record_sha256_logs(self.output_dir + '_sockets.csv', self.output_dir + '_sha256.log')
开发者ID:Nervous,项目名称:certitude,代码行数:10,代码来源:statemachine.py


示例18: _csv_infos_fs

 def _csv_infos_fs(self, files):
     with open(self.output_dir + '\\' + self.computer_name + '_Filecatcher' + self.rand_ext, 'wb') as fw:
         csv_writer = get_csv_writer(fw)
         for f, mime, md5,sha1,sha256, zip_value, datem, empty in files:
             write_to_csv([self.computer_name, 'Filecatcher', unicode(datem),
                           unicode(f), unicode(md5), unicode(sha1), unicode(sha256), unicode(mime),
                           unicode(zip_value), unicode(empty), self._get_url_VT(sha256)], csv_writer)
     record_sha256_logs(self.output_dir + '\\' + self.computer_name + '_Filecatcher' + self.rand_ext,
                        self.output_dir + '\\' + self.computer_name + '_sha256.log')
     self.zip_file.close()
开发者ID:supercsq,项目名称:Fastir_Collector,代码行数:10,代码来源:fileCatcher.py


示例19: _csv_list_arp_table

 def _csv_list_arp_table(self, arp):
     with open(self.output_dir + "_arp_table.csv", 'wb') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "IP", "MAC_ADDR", "STATUS"], csv_writer)
         for entry in arp:
             entry.replace('\xff', '')
             tokens = entry.split()
             entry_to_write = ''
             if len(tokens) == 3:
                 entry_to_write = '"' + self.computer_name + '"|"arp_table"|"' + '"|"'.join(tokens) + '"\n'
             if entry_to_write.find('\.') != 1 and len(entry_to_write) > 0:
                 arr_to_write = [self.computer_name, 'arp_table'] + tokens
                 write_to_csv(arr_to_write, csv_writer)
     record_sha256_logs(self.output_dir + '_arp_table.csv', self.output_dir + '_sha256.log')
开发者ID:Nervous,项目名称:certitude,代码行数:14,代码来源:statemachine.py


示例20: _csv_list_running_process

 def _csv_list_running_process(self, list_running):
     self.logger.info("Health : Listing running processes")
     with open(self.output_dir + '_processes.csv', 'ab') as fw:
         csv_writer = get_csv_writer(fw)
         write_to_csv(["COMPUTER_NAME", "TYPE", "PID", "PROCESS_NAME", "COMMAND", "EXEC_PATH"], csv_writer)
         for p in list_running:
             pid = p[0]
             name = p[1]
             cmd = p[2]
             exe_path = p[3]
             write_to_csv(
                 [self.computer_name, 'processes', unicode(pid), name, unicode(cmd), unicode(exe_path)],
                 csv_writer)
     record_sha256_logs(self.output_dir + '_processes.csv', self.output_dir + '_sha256.log')
开发者ID:friedbutter,项目名称:Fastir_Collector,代码行数:14,代码来源:statemachine.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python utils.Utils类代码示例发布时间:2022-05-26
下一篇:
Python utils.write_list_to_csv函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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