I would like to output to tabular CSV format for the code below?

February 12, 2018 79 views
Ansible Applications

I would like to output to tabular CSV format for the code below?

1 comment
  • import socket,datetime
    iplist = open("c:\scriptrun\ips.txt").readlines()
    portlist = open("c:\scriptrun\ports.txt").readlines()
    openports = []
    failed
    ports = []
    def pscan(ips,ports):
    s = socket.socket(socket.AFINET, socket.SOCKSTREAM)
    s.settimeout(2)
    try:
    con = s.connect((ips,ports))
    return True
    except:
    return False
    print ('This Scan started on' , (datetime.datetime.utcnow() - datetime.timedelta(hours=5)))
    for ips in iplist:
    for ports in port
    list:
    con = pscan((ips.strip()),(ports.strip()))
    if con == True:
    openports.append(ports.strip())
    else:
    failed
    ports.append(ports.strip())
    print ()
    print ( "Device IP - " + ips.strip(),":Yes :".join(map(str, enumerate(openports))), \
    ":Nope :".join(map(str,enumerate(failed
    ports))))
    openports = []
    failed
    ports = []
    print ('This Scan Ended on' ,(datetime.datetime.utcnow() - datetime.timedelta(hours=5)))

    input ("Execution Complete-Press Enter to exist")

Be the first one to answer this question.