featurize_packets.py 文件源码

python
阅读 41 收藏 0 点赞 0 评论 0

项目:NetDetect 作者: ericzhao28 项目源码 文件源码
def score_packets(input_url='data/raw_packets.csv', output_url='data/scored_packets.csv'):
  '''
  Adds score indicators to botnets
  '''
  print("Transforming initial data csv")
  with open(output_url, 'w') as raw_flows:
    writer = csv.writer(raw_flows, delimiter=',', quotechar='"', quoting=csv.QUOTE_ALL)
    with open(input_url) as csvfile:
      writer.writerow(headers + "Score")
      first = True
      for row in csv.reader(csvfile, delimiter=',', quotechar='"'):
        if first is True:
          first = False
          continue
        if row[headers.index('Label')] == "BENIGN":
          row.append(0)
        else:
          row.append(1)
        writer.writerow(row)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号