Hi I wrote a perl script to output a text file with port scans to excel now I need to format the text file so that when it prints to excel it's in csv format. Like this for example Server, port, protocol, state 69.25.194.14, 25, tcp, http
Here is my code that I hope you guys could modify, The code so far outputs the txt file to excel which is good now I just need it modified so that it can display it in csv format within the text file and output the txt file to excel :
$input = `Cat /cygdrive/c/Windows/System32/test11.txt | grep -v 'SYN Stealth' |grep -v'Discovered'`;
chomp input;
$output =" /cygdrive/c/Users/bpaul/Desktop/194.csv ";
if (! -e "$output")
{
`touch $output`;
}
open (OUTPUTFILE, ">$output") || die "Can't Open file $output";
print OUTPUTFILE "$input\n";
close (OUTPUTFILE);
Here is a piece of my txt file
Nmap scan report for 69.25.194.2 Host is up (0.072s 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 closed
http-proxy 9443/tcp closed tungsten-https
Could anybody please modify my code. Thanks!