Deepcorr项目的数据特征提取
最近在做有关Deepcorr的相关项目,由于需要提取数据喂给Deepcorr就写了个小工具用于提取Deepcorr所需要的相关特征。
import dpkt
import datetime
import socket
import os
import math
import threading
import time
import traceback
import pickle
here_ip = '11.0.0.6' #自定义的here_ip
there_ip = ['100.0.0.1','11.0.0.7','11.0.0.8','11.0.0.9'] #自定义的there_ip
send_path = r'./p.pickle' #输出路径
path = './pcap/' #输入文件夹
flowsize = 300 #每组数据集的大小
m = 6 #线程数
src_addr = None
dst_addr = None
dataset = []
datasetx = 0
datasetxi = 1
datasety = 0
datasetyi = 1
dataseta = 0
datasetai = 1
datasetb = 0
datasetbi = 1
flowsize+=1
# In[]:
def get_ip(ip):
try:
global src_addr,dst_addr
src_addr = socket.inet_ntoa(ip.src)
dst_addr = socket.inet_ntoa(ip.dst)
except:
return -1
# In[]:
def open_dataset(i,where,direction,long):
global dataset
#print(dataset)
try:
dataset[i][where][0][directi