| Paste number 122957: | getports |
| Pasted by: | foobar |
| When: | 10 months, 2 weeks ago |
| Share: | Tweet this! | http://paste.lisp.org/+2MVH |
| Channel: | None |
| Paste contents: |
# Lists open ports coming from nmap.
# It assumes the file is in PYX format and complies with the appropriate DTD.
function reset()
{
protocol = "";
portid = 0;
state = ""
service = "";
in_port = 0;
}
BEGIN {
reset();
}
/\(port$/ {
in_port = 1;
}
/\)port$/ {
printf("%s %u %s %s\n", protocol, portid, state, service);
reset();
}
/^Aprotocol / {
if (in_port)
protocol = $2;
}
/^Aportid / {
if (in_port)
portid = $2;
}
/^Astate / {
if (in_port)
state = $2;
}
/^Aname / {
if (in_port)
service = $2;
}
This paste has no annotations.