import sys
import getopt
import os
import multiprocessing def list_all_file(path):
"""
list all files of a directory
:param path:
:return:
"""
file_list = []
for (path, _, files) in os.walk(path):
for filename in files:
file_list.append(os.path.join(path, filename))
return file_list def process_file(filename, is_black):
suffix = os.path.splitext(filename)[-1][1:]
if suffix != "pcap":
return if is_black:
cmd = "python extract_tls_flow4.py -vr {} -o black/{}.txt >logs/black/{}.log".format(filename, os.path.basename(filename), os.path.basename(filename))
else:
cmd = "python extract_tls_flow4.py -vr {} -o white/{}.txt >logs/white/{}.log".format(filename, os.path.basename(filename), os.path.basename(filename))
os.system(cmd) def process_black_file(filename):
process_file(filename, 1) def process_white_file(filename):
process_file(filename, 0) def process_dir(sample_dir, is_black):
file_list = list_all_file(sample_dir) process_num = 30
pool = multiprocessing.Pool(processes=process_num)
if is_black:
pool.map(process_black_file, file_list)
else:
pool.map(process_white_file, file_list) pool.close()
pool.join()
print("End...........") black_sample_dir = "/opt/data/samples/black_pcap"
white_sample_dir = "/opt/data/samples/white_pcap" process_dir(black_sample_dir, 1)
process_dir(white_sample_dir, 0)

  

最新文章

  1. Git 如何只更新项目中某个目录里的文件
  2. Oracle启动报错ORA-03113解决
  3. MSSQL 死锁查询
  4. Babelfish 分类: 哈希 2015-08-04 09:25 2人阅读 评论(0) 收藏
  5. 有了 Docker,用 JavaScript 框架开发的 Web 站点也能很好地支持网络爬虫的内容抓取
  6. linux中的livecd、liveDVD和其他安装方式简介
  7. UITableViewCell高度自适应探索--AutoLayout结合Frame
  8. 关于Integer类中parseInt()和valueOf()方法的区别以及int和String类性的转换.以及String类valueOf()方法
  9. 【转】兼容性测试套件(CTS)框架用户手册
  10. registerWithTouchDispatcher()函数的使用
  11. Type mismatch: cannot convert from Enumeration<String> to Enumeration<Object>
  12. mysql show processlist详解
  13. 关于在TabBar 中添加按钮,并通过block 或代理在控制器中实现响应
  14. ue4打包问题的巧妙解决——二分回退大法!
  15. 简单的调用OpenCV库的Android NDK开发 工具Android Studio
  16. Oracle profile 使用技巧
  17. 继续死磕SDRAM控制器
  18. nnet3配置中的上下文和chunk(块)大小
  19. IDEA常用快捷键整理(Mac OS X版本)
  20. 用json获取拉钩网的信息

热门文章

  1. 【三十四】thinkphp之curd操作
  2. ipconfig/all参数解析
  3. List、Map、Set的区别与联系
  4. 基于Arcface Android平台的人脸识别实现
  5. node+ts的心得与坑
  6. icehouse版本中常用操作命令
  7. NGUI实现UITexture的UV滚动
  8. MySql安装成功后无法远程登录
  9. 通过cookies跳过验证码登陆页面,直接访问网站的其它URL
  10. mongodb分享(二)