Home | Blog | Twitter @AndyJ | Contact Me | Snippets/Downloads | RSS

Netstat information via ColdFusion

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

   view plainprintabout
 <!--
     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"/>
 
10  <cfoutput>
11      <form action="netstat.cfm" method="post">
12      <fieldset>
13          <legend>Netstat test</legend>
14          <div>
15              <label>Choose you argument</label>
16              <select name="args">
17                  <cfloop list="#argsList#" index="i">
18                      <option value="#i#">#i#</option>
19                  </cfloop>
20              </select>
21          </div>
22          <input type="submit" name="sbt" value="Run"/>
23      </fieldset>
24      </form>
25      
26      <cfif form.args NEQ -1>
27          <cftry>
28          <cfexecute name = "C:\windows\System32\netstat.exe"
29               arguments = "-#args#"
30               timeout = "3"
31               variable="netstat">

32          </cfexecute>
33          <xmp>#netstat#</xmp>
34      <cfcatch>
35          I don't know what you tried to do but it caused an error
36          <br/>
37          <strong>Problem:</strong> #cfcatch.message#
38      </cfcatch>
39      </cftry>
40      </cfif>
41  </cfoutput>
TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC / created by Raymond Camden / running version 5.9.5.003 / Contact AndyJarrett.com / Pet Rescue SOS www.redgiraffes.co.uk