---
# System prepended metadata

title: '流量偵測 [github](https://github.com/KimLinTW/DDOS_simple_Defense)'
tags: [專題]

---

# 流量偵測 [github](https://github.com/KimLinTW/DDOS_simple_Defense)

# quickStart

1. sudo python3 pkt.py
輸入 e 結束程式
![](https://i.imgur.com/1uDPomo.png)


2. sudo python3 plot_out.py
查看 傳送流量
![](https://i.imgur.com/JxPHvp8.png)

3. cat logfile.txt
    :::spoiler click here
    0
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6680, 10100160], 'syn': [0, 0], 'icmp': [0, 0]}
    1
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [7849, 11867688], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8, 12096], 'syn': [0, 0], 'icmp': [0, 0]}
    2
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [7479, 11308248], 'syn': [0, 0], 'icmp': [0, 0]}
    3
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8871, 13412952], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6, 9072], 'syn': [0, 0], 'icmp': [0, 0]}
    4
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8833, 13355496], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [3, 4536], 'syn': [0, 0], 'icmp': [0, 0]}
    5
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8871, 13412952], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6, 9072], 'syn': [0, 0], 'icmp': [0, 0]}
    6
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [5058, 7647696], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.119-74:4c:a1:60:7b:03	 :{'total': [1034, 43428], 'syn': [0, 0], 'icmp': [1034, 43428]}
    SEND   : 192.168.0.127-28:c6:3f:e2:f6:94	 :{'total': [42, 2436], 'syn': [42, 2436], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 1082, 'syn': 0, 'icmp': 1082}
    6
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6, 9072], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 1082, 'syn': 0, 'icmp': 1082}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 58, 'syn': 58, 'icmp': 0}
    7
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2988, 4517856], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.127-28:c6:3f:e2:f6:94	 :{'total': [381, 22098], 'syn': [381, 22098], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [43, 65016], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2330, 'syn': 0, 'icmp': 2330}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 425, 'syn': 397, 'icmp': 0}
    8
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [3213, 4858056], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.127-28:c6:3f:e2:f6:94	 :{'total': [1284, 74472], 'syn': [1284, 74472], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 4779, 'syn': 0, 'icmp': 4779}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1327, 'syn': 1327, 'icmp': 0}
    9
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4321, 6533352], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8, 12096], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [45, 68040], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1748, 'syn': 1545, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 5853, 'syn': 0, 'icmp': 5853}
    10
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2499, 3778488], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.127-28:c6:3f:e2:f6:94	 :{'total': [1, 58], 'syn': [1, 58], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [28, 42336], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2250, 'syn': 0, 'icmp': 2250}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1087, 'syn': 871, 'icmp': 0}
    11
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2354, 3559248], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1275, 'syn': 936, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 3610, 'syn': 0, 'icmp': 3610}
    12
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2037, 3079944], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 794, 'syn': 636, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 1742, 'syn': 0, 'icmp': 1742}
    13
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [1656, 2503872], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 1829, 'syn': 0, 'icmp': 1829}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 606, 'syn': 418, 'icmp': 0}
    14
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [1892, 2860704], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.127-28:c6:3f:e2:f6:94	 :{'total': [7, 406], 'syn': [7, 406], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2168, 'syn': 0, 'icmp': 2168}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 525, 'syn': 399, 'icmp': 0}
    15
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2855, 4316760], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 707, 'syn': 464, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2188, 'syn': 0, 'icmp': 2188}
    16
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2224, 3362688], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 549, 'syn': 409, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2032, 'syn': 0, 'icmp': 2032}
    17
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [5451, 8241912], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [20, 30240], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 3783, 'syn': 3783, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 4317, 'syn': 0, 'icmp': 4317}
    18
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2426, 3668112], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2111, 'syn': 0, 'icmp': 2111}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 425, 'syn': 425, 'icmp': 0}
    19
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2177, 3291624], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2294, 'syn': 0, 'icmp': 2294}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 615, 'syn': 581, 'icmp': 0}
    20
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2970, 4490640], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2309, 'syn': 0, 'icmp': 2309}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 774, 'syn': 771, 'icmp': 0}
    21
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [3455, 5223960], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2, 3024], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2, 3024], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2, 3024], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1713, 'syn': 1712, 'icmp': 0}
    21
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4, 6048], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1713, 'syn': 1712, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 4561, 'syn': 0, 'icmp': 4561}
    22
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [5977, 9037224], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.127-28:c6:3f:e2:f6:94	 :{'total': [37, 2146], 'syn': [37, 2146], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [77, 116424], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 10203, 'syn': 0, 'icmp': 10203}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 743, 'syn': 743, 'icmp': 0}
    22
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [39, 58968], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 10206, 'syn': 0, 'icmp': 10206}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 745, 'syn': 745, 'icmp': 0}
    RECEIVE: 192.168.0.1-cc:2d:21:14:c9:90	:{'total': 1, 'syn': 0, 'icmp': 0}
    RECEIVE: 127.0.0.53-00:00:00:00:00:00	:{'total': 2, 'syn': 0, 'icmp': 0}
    23
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2990, 4520880], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 3852, 'syn': 0, 'icmp': 3852}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 287, 'syn': 287, 'icmp': 0}
    24
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [5282, 7986384], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [30, 45360], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2582, 'syn': 0, 'icmp': 2582}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 2782, 'syn': 2782, 'icmp': 0}
    25
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4091, 6185592], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 3474, 'syn': 3474, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 7197, 'syn': 0, 'icmp': 7197}
    26
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2795, 4226040], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2242, 'syn': 0, 'icmp': 2242}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 591, 'syn': 591, 'icmp': 0}
    27
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2582, 3903984], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 3075, 'syn': 0, 'icmp': 3075}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 607, 'syn': 607, 'icmp': 0}
    28
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2587, 3911544], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [10, 15120], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2025, 'syn': 0, 'icmp': 2025}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 385, 'syn': 385, 'icmp': 0}
    28
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2, 3024], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2025, 'syn': 0, 'icmp': 2025}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 385, 'syn': 385, 'icmp': 0}
    29
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2344, 3544128], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 927, 'syn': 927, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 1809, 'syn': 0, 'icmp': 1809}
    30
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2443, 3693816], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [123, 185976], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [12, 18144], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 421, 'syn': 421, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2577, 'syn': 0, 'icmp': 2577}
    31
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2435, 3681720], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [20, 30240], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 213, 'syn': 213, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2988, 'syn': 0, 'icmp': 2988}
    32
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2594, 3922128], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2388, 'syn': 0, 'icmp': 2388}
    32
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [63, 95256], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2390, 'syn': 0, 'icmp': 2390}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 293, 'syn': 293, 'icmp': 0}
    33
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [3762, 5688144], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 5396, 'syn': 0, 'icmp': 5396}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 967, 'syn': 967, 'icmp': 0}
    34
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2570, 3885840], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2865, 'syn': 0, 'icmp': 2865}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 455, 'syn': 455, 'icmp': 0}
    35
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [3153, 4767336], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 681, 'syn': 681, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2084, 'syn': 0, 'icmp': 2084}
    36
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2693, 4071816], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2474, 'syn': 0, 'icmp': 2474}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 699, 'syn': 699, 'icmp': 0}
    37
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2825, 4271400], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 1778, 'syn': 0, 'icmp': 1778}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 542, 'syn': 542, 'icmp': 0}
    38
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [3312, 5007744], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.127-28:c6:3f:e2:f6:94	 :{'total': [17, 986], 'syn': [17, 986], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2235, 'syn': 0, 'icmp': 2235}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 431, 'syn': 431, 'icmp': 0}
    39
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8179, 12366648], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 6390, 'syn': 0, 'icmp': 6390}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 988, 'syn': 988, 'icmp': 0}
    40
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2642, 3994704], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 176, 'syn': 176, 'icmp': 0}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 2236, 'syn': 0, 'icmp': 2236}
    41
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [3259, 4927608], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.119-74:4c:a1:60:7b:03	:{'total': 737, 'syn': 0, 'icmp': 737}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1281, 'syn': 1281, 'icmp': 0}
    42
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4123, 6233976], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1731, 'syn': 1731, 'icmp': 0}
    43
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [5877, 8886024], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 2327, 'syn': 2327, 'icmp': 0}
    44
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [5676, 8582112], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 399, 'syn': 399, 'icmp': 0}
    45
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6006, 9081072], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1046, 'syn': 1046, 'icmp': 0}
    46
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6296, 9519552], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 865, 'syn': 865, 'icmp': 0}
    47
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [5315, 8036280], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 982, 'syn': 982, 'icmp': 0}
    48
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [5429, 8208648], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 792, 'syn': 792, 'icmp': 0}
    49
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [7404, 11194848], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [85, 128520], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1223, 'syn': 1223, 'icmp': 0}
    50
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4637, 7011144], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1091, 'syn': 1091, 'icmp': 0}
    51
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [7379, 11157048], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1675, 'syn': 1675, 'icmp': 0}
    52
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4589, 6938568], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [33, 49896], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2, 3024], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 770, 'syn': 770, 'icmp': 0}
    53
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4927, 7449624], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1457, 'syn': 1457, 'icmp': 0}
    54
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6135, 9276120], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 7125, 'syn': 7125, 'icmp': 0}
    55
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4664, 7051968], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 3282, 'syn': 3282, 'icmp': 0}
    56
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4737, 7162344], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1628, 'syn': 1628, 'icmp': 0}
    56
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4, 6048], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1628, 'syn': 1628, 'icmp': 0}
    57
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4616, 6979392], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1200, 'syn': 1200, 'icmp': 0}
    58
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8104, 12253248], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [3, 4536], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 2870, 'syn': 2870, 'icmp': 0}
    58
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2, 3024], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2, 3024], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [9, 13608], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 2870, 'syn': 2870, 'icmp': 0}
    59
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4977, 7525224], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 3131, 'syn': 3131, 'icmp': 0}
    60
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4301, 6503112], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 3325, 'syn': 3325, 'icmp': 0}
    61
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4377, 6618024], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1628, 'syn': 1628, 'icmp': 0}
    62
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6617, 10004904], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1141, 'syn': 1141, 'icmp': 0}
    63
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [5964, 9017568], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1778, 'syn': 1778, 'icmp': 0}
    64
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6275, 9487800], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2, 3024], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 7008, 'syn': 7008, 'icmp': 0}
    65
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [3705, 5601960], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 2619, 'syn': 2619, 'icmp': 0}
    66
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [7353, 11117736], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 1146, 'syn': 1146, 'icmp': 0}
    67
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [7625, 11529000], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 169, 'syn': 169, 'icmp': 0}
    68
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [7659, 11580408], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6, 9072], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 274, 'syn': 274, 'icmp': 0}
    69
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [7569, 11444328], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [29, 43848], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 170, 'syn': 170, 'icmp': 0}
    70
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [7678, 11609136], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4, 6048], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 350, 'syn': 350, 'icmp': 0}
    71
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8479, 12820248], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [65, 98280], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.127-28:c6:3f:e2:f6:94	:{'total': 64, 'syn': 64, 'icmp': 0}
    72
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8310, 12564720], 'syn': [0, 0], 'icmp': [0, 0]}
    73
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8033, 12145896], 'syn': [0, 0], 'icmp': [0, 0]}
    74
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8796, 13299552], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [1, 1512], 'syn': [0, 0], 'icmp': [0, 0]}
    75
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8831, 13352472], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.111-74:4c:a1:60:7b:03	:{'total': 1, 'syn': 0, 'icmp': 0}
    76
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [7950, 12020400], 'syn': [0, 0], 'icmp': [0, 0]}
    77
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [5899, 8919288], 'syn': [0, 0], 'icmp': [0, 0]}
    78
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [5783, 8743896], 'syn': [0, 0], 'icmp': [0, 0]}
    79
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8956, 13541472], 'syn': [0, 0], 'icmp': [0, 0]}
    80
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8905, 13464360], 'syn': [0, 0], 'icmp': [0, 0]}
    81
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8828, 13347936], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2, 3024], 'syn': [0, 0], 'icmp': [0, 0]}
    82
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6150, 9298800], 'syn': [0, 0], 'icmp': [0, 0]}
    83
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6352, 9604224], 'syn': [0, 0], 'icmp': [0, 0]}
    84
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [5618, 8494416], 'syn': [0, 0], 'icmp': [0, 0]}
    85
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [6540, 9888480], 'syn': [0, 0], 'icmp': [0, 0]}
    86
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [7196, 10880352], 'syn': [0, 0], 'icmp': [0, 0]}
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [2, 3024], 'syn': [0, 0], 'icmp': [0, 0]}
    87
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8610, 13018320], 'syn': [0, 0], 'icmp': [0, 0]}
    88
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [8908, 13468896], 'syn': [0, 0], 'icmp': [0, 0]}
    89
    SEND   : 192.168.0.112-a4:02:b9:19:5a:64	 :{'total': [4050, 6123600], 'syn': [0, 0], 'icmp': [0, 0]}
    RECEIVE: 192.168.0.112-a4:02:b9:19:5a:64	:{'total': 1, 'syn': 0, 'icmp': 0}
    90
    91
    :::


# requirement
1. 同目錄下 rule.txt 紀錄iptables命令
2. 同目錄下 logfile.txt 紀錄流量訊息
3. 同目錄下 plot.py 繪製接收資料流
4. 同目錄下 plot_out.py 繪製傳送資料流
5. 同目錄下 iptables.conf 紀錄iptables設定
6. 同目錄下 getIP.sh 自動取得IP、mac
7. 同目錄下 pkt.py 流量監測+防禦
