matheusbsi
(usa Ubuntu)
Enviado em 10/11/2017 - 10:56h
Marcelo, bom dia.
Tenho o seguinte :
11/08-17:26:28.504038 [**] [1:1000002:2] SCAN [**] [Priority: 0] {TCP} 54.192.204.11:443 -> 192.168.2.5:52798
11/08-17:26:49.095708 [**] [1:1000002:2] SCAN [**] [Priority: 0] {TCP} 209.132.180.180:443 -> 192.168.2.4:44824
11/08-17:27:08.564379 [**] [1:1000002:2] SCAN [**] [Priority: 0] {TCP} 54.235.146.237:80 -> 192.168.2.5:52784
11/08-17:27:18.785223 [**] [1:1000002:2] SCAN [**] [Priority: 0] {TCP} 8.43.85.9:443 -> 192.168.2.4:42946
11/08-17:27:54.378222 [**] [1:1000002:2] SCAN [**] [Priority: 0] {TCP} 192.168.2.4:57921 -> 192.168.2.3:2701
11/08-17:27:54.378250 [**] [1:1000002:2] SCAN [**] [Priority: 0] {TCP} 192.168.2.3:2701 -> 192.168.2.4:57921
11/08-17:28:45.968941 [**] [1:1000002:2] SCAN [**] [Priority: 0] {TCP} 172.217.30.110:443 -> 192.168.2.3:57552
11/08-17:28:57.339303 [**] [1:1000003:1] DoS [**] [Priority: 0] {TCP} 53.94.208.57:1845 -> 192.168.2.5:80
(53.94.208.57:1845 -> 192.168.2.5:80 ) São junto por exemplo!
Para poder separar foi utilizado os seguintes comandos :
awk '{print $1,$4,$8,$9,$11}' alertas.txt | sed -r 's/\.[0-9]{6}//;s/[{}]//g;s/ /,/g;s/:/,/3g; s/-/,/; s/^/'$(date +%Y)'\//'
Resultado :
2017/11/08,17:26:28,SCAN,TCP,54.192.204.11,443,192.168.2.5,52798
2017/11/08,17:26:49,SCAN,TCP,209.132.180.180,443,192.168.2.4,44824
2017/11/08,17:27:08,SCAN,TCP,54.235.146.237,80,192.168.2.5,52784
2017/11/08,17:27:18,SCAN,TCP,8.43.85.9,443,192.168.2.4,42946
2017/11/08,17:27:54,SCAN,TCP,192.168.2.4,57921,192.168.2.3,2701
2017/11/08,17:27:54,SCAN,TCP,192.168.2.3,2701,192.168.2.4,57921
2017/11/08,17:28:45,SCAN,TCP,172.217.30.110,443,192.168.2.3,57552
2017/11/08,17:28:57,DoS,TCP,53.94.208.57,1845,192.168.2.5,80
2017/11/08,17:29:33,SDoSsssssssssssssssssssssssss,TCP,211.182.176.108,14445,192.168.2.5,80
Só que quero trocar :
Por exemplo:
2017/11/08,17:28:57.339303,DoS,TCP,53.94.208.57,1845,192.168.2.5,80
Por isso:
2017/11/08,17:28:57.339303,DoS,TCP,53.94.208.57,192.168.2.5,1845,80
Desde já, muito obrigado !