This blog has moved to http://www.andyjarrett.co.uk/blog/ | New RSS FEED

Netstat information via ColdFusion

I just found an old bit of ColdFusion code which ouputs Netstats results which I thought someone might find useful.


<!--
    Name            : netstat.cfm
    Author        : Andy Jarrett
    Purpose        : To display netstat information
-->


<cfset argsList = "a,b,e,n,o,p tcp,p udp,r,s,v"/>
<cfparam name="form.args" default="-1"/>

<cfoutput>
    <form action="netstat.cfm" method="post">
    <fieldset>
        <legend>Netstat test</legend>
        <div>
            <label>Choose you argument</label>
            <select name="args">
                <cfloop list="#argsList#" index="i">
                    <option value="#i#">#i#</option>
                </cfloop>
            </select>
        </div>
        <input type="submit" name="sbt" value="Run"/>
    </fieldset>
    </form>
    
    <cfif form.args NEQ -1>
        <cftry>
        <cfexecute name = "C:\windows\System32\netstat.exe"
             arguments = "-#args#"
             timeout = "3"
             variable="netstat">

        </cfexecute>
        <xmp>#netstat#</xmp>
    <cfcatch>
        I don't know what you tried to do but it caused an error
        <br/>
        <strong>Problem:</strong> #cfcatch.message#
    </cfcatch>
    </cftry>
    </cfif>
</cfoutput>

*** Comments *** (*** Comment Moderation is enabled. Your comment will not appear until approved. ***)
BlogCFC was created by Raymond Camden / Contact Blog Owner / mptooling.com / spicemerchants-portsmouth.co.uk / ipicture.it