Gidday, just before I go and re-invent the wheel, does anyone happen to have an up to date SQL dump of TCP Well known ports c/o iana. Cheers Dan Clark
On 18 Mar 2009, at 22:35, Dan Clark wrote:
Gidday, just before I go and re-invent the wheel, does anyone happen to have an up to date SQL dump of TCP Well known ports c/o iana.
[calamari:~]% curl -s 'http://www.iana.org/assignments/port-numbers' | awk '/^[^# ].*[0-9]\/(udp|tcp) / { split($2, p, /\//); print "insert into \"PORTS\" (\"name\", \"port\", \"protocol\") VALUES (\"" $1 "\", \"" p[1] "\", \"" p[2] "\");" }' | head insert into "PORTS" ("name", "port", "protocol") VALUES ("spr-itunes", "0", "tcp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("spl-itunes", "0", "tcp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("tcpmux", "1", "tcp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("tcpmux", "1", "udp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("compressnet", "2", "tcp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("compressnet", "2", "udp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("compressnet", "3", "tcp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("compressnet", "3", "udp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("rje", "5", "tcp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("rje", "5", "udp"); [calamari:~]% (remove the head at the end of the pipeline for a full list, obviously; modulate schema and no-doubt broken SQL to taste.) Joe
awesome, thanks for that! Cheers Dan Joe Abley wrote:
On 18 Mar 2009, at 22:35, Dan Clark wrote:
Gidday, just before I go and re-invent the wheel, does anyone happen to have an up to date SQL dump of TCP Well known ports c/o iana.
[calamari:~]% curl -s 'http://www.iana.org/assignments/port-numbers' | awk '/^[^# ].*[0-9]\/(udp|tcp) / { split($2, p, /\//); print "insert into \"PORTS\" (\"name\", \"port\", \"protocol\") VALUES (\"" $1 "\", \"" p[1] "\", \"" p[2] "\");" }' | head insert into "PORTS" ("name", "port", "protocol") VALUES ("spr-itunes", "0", "tcp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("spl-itunes", "0", "tcp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("tcpmux", "1", "tcp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("tcpmux", "1", "udp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("compressnet", "2", "tcp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("compressnet", "2", "udp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("compressnet", "3", "tcp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("compressnet", "3", "udp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("rje", "5", "tcp"); insert into "PORTS" ("name", "port", "protocol") VALUES ("rje", "5", "udp"); [calamari:~]%
(remove the head at the end of the pipeline for a full list, obviously; modulate schema and no-doubt broken SQL to taste.)
Joe
participants (2)
-
Dan Clark
-
Joe Abley