nevertheless...
Unfortuately, there is no "simple" way of determinging ports, you can check if a port is open/closed using $portfree(N), where N is the port number.
If you want to gather the port a dcc is being held on, you most likely would need to "intercept" the port in a ctcp *:*:*:{ event and save it for later.
Alternatively, you can perhaps get your script to perform a 'netstats' and compair the results.
Eamonn.