新编码方式的实现及测试

github链接:

新编码方式的实现

EBSNN的编码方式

image-20211201232830690

nprint的编码方式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
### nPrint Regex Filter Help:
### All field names follow syntax: proto_field_bit
### Each protocol in help follow syntax: proto field numbits

# Ethernet
eth eth_dhost 48
eth eth_shost 48
eth eth_ethertype 16

# IPv4
ipv4 ipv4_ver 4
ipv4 ipv4_hl 4
ipv4 ipv4_tos 8
ipv4 ipv4_tl 16
ipv4 ipv4_id 16
ipv4 ipv4_rbit 1
ipv4 ipv4_dfbit 1
ipv4 ipv4_mfbit 1
ipv4 ipv4_foff 13
ipv4 ipv4_ttl 8
ipv4 ipv4_proto 8
ipv4 ipv4_cksum 16
ipv4 ipv4_src 32
ipv4 ipv4_dst 32
ipv4 ipv4_opt 320

# IPv6
ipv6 ipv6_ver 4
ipv6 ipv6_tc 8
ipv6 ipv6_fl 20
ipv6 ipv6_len 16
ipv6 ipv6_nh 8
ipv6 ipv6_hl 8
ipv6 ipv6_src 128
ipv6 ipv6_dst 128

# TCP
tcp tcp_sprt 16
tcp tcp_dprt 16
tcp tcp_seq 32
tcp tcp_ackn 32
tcp tcp_doff 4
tcp tcp_res 3
tcp tcp_ns 1
tcp tcp_cwr 1
tcp tcp_ece 1
tcp tcp_urg 1
tcp tcp_ackf 1
tcp tcp_psh 1
tcp tcp_rst 1
tcp tcp_syn 1
tcp tcp_wsize 16
tcp tcp_cksum 16
tcp tcp_urp 16
tcp tcp_opt 320

# UDP
udp udp_sport 16
udp udp_dport 16
udp udp_len 16
udp udp_cksum 16

# ICMP
icmp icmp_type 8
icmp icmp_code 8
icmp icmp_cksum 16
icmp icmp_roh 32

# Payload
payload payload_bit n


### End of nPrint regex filter help, exiting

我们的编码方式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
不要-1,0,1的方式,我们写成one-hot的方式
# Ethernet
eth eth_dhost //放弃
eth eth_shost //放弃
eth eth_ethertype //放弃

# IPv4
ipv4 ipv4_ver 4
ipv4 ipv4_hl 4
ipv4 ipv4_tos 8
ipv4 ipv4_tl 16
ipv4 ipv4_id 16 //放弃
ipv4 ipv4_rbit 1
ipv4 ipv4_dfbit 1
ipv4 ipv4_mfbit 1
ipv4 ipv4_foff 13
ipv4 ipv4_ttl 8
ipv4 ipv4_proto 8
ipv4 ipv4_cksum 16 //放弃
ipv4 ipv4_src 32 //放弃
ipv4 ipv4_dst 32 //放弃
ipv4 ipv4_opt 320

# IPv6
ipv6 ipv6_ver 4
ipv6 ipv6_tc 8
ipv6 ipv6_fl 20
ipv6 ipv6_len 16
ipv6 ipv6_nh 8
ipv6 ipv6_hl 8
ipv6 ipv6_src 128
ipv6 ipv6_dst 128

# TCP
tcp tcp_sprt 16 //放弃
tcp tcp_dprt 16 //放弃
tcp tcp_seq 32
tcp tcp_ackn 32
tcp tcp_doff 4
tcp tcp_res 3
tcp tcp_ns 1
tcp tcp_cwr 1
tcp tcp_ece 1
tcp tcp_urg 1
tcp tcp_ackf 1
tcp tcp_psh 1
tcp tcp_rst 1
tcp tcp_syn 1
tcp tcp_wsize 16
tcp tcp_cksum 16
tcp tcp_urp 16
tcp tcp_opt 320

# UDP
udp udp_sport 16 //放弃
udp udp_dport 16 //放弃
udp udp_len 16
udp udp_cksum 16

# ICMP
icmp icmp_type 8
icmp icmp_code 8
icmp icmp_cksum 16
icmp icmp_roh 32

# Payload
payload payload_bit n