I wrote a Perl script for the production of a text file filled with an IP address and ports, which I used to do in Microsoft Excel Had scanned. Now when that excellence is in the data, my owner wants me to organize the file in CSV format such as
server, port, protocol, random, random, random Ns1, 25, TCP, luggage, stuff, input = `cat / cigrendiv / c / windows / system 32 / test 11 grep -v 'SYN stealth'; Chomp input; $ Output = "/cygdrive/c/Users/bpaul/Desktop/194.csv"; If (! -e "$ Output") {`'Output Touch $'; } Open (AutoTouple, "& gt; $ Output") || Die "file $ output can not be opened"; Print output "$ input \ n"; Close (output); Here is a fragment of my file 69.25.194.2 (0.072 th latency). Not shown: 9992 filtered ports port state service 25 / TCP open smtp 80 / TCP open http 82 / TCP open xfer 443 / TCP open https 4443 / TCP closed pharos 5666 / TCP closed nrpe 8080 / TCP http-proxy Closed 9443 / TCP turned off Tungsten-https
So far my code took my txt file and now I get this outputted in the data format to achieve excellence: / P>
desired output:
server, port, protocol, random, random, random Ns1, 25, TCP, luggage, luggage, accessories
I'm thinking of you meaning 69.25.194.2 when you said Ns1 too .
Strict use; Use warnings; Use text: CSV_XS qw (); My $ csv = Text :: CSV_XS- & gt; New ({binary = gt; 1, eol = & gt; "\ n"}); $ Csv-> Print (\ * STDOUT, [qw (server port protocol random random random)]); My $ host = '[unknown]'; While ($ Print (\ * STDOUT, [$ host, $ port, $ protocol, 'luggage', 'luggage', 'luggage',]); } Usage:
grep -v 'SYN stealth' /cygdrive/c/Windows/System32/test11.txt | Pearl to_csv.pl & gt; /cygdrive/c/Users/bpaul/Desktop/194.csv Update : Change hardcoded Ns1 also < / Code> with the address of the scanned machine Update : The place of generic use with the use of OP.
Comments
Post a Comment