Jump to content

Internet Network Utility Client


billmez
 Share

Recommended Posts

[edit]

4/6/06

Replaced attached clnetutil.au3 file with new version that contains function to abort trace route by pressing the escape key.

[/edit]

[edit]

2/23/06 replaced attached clnetutil.au3 file. Added repair network connection suggested by 1of10, made gui size wider to better accommodate output display. Added help menu item for repair connection.

[/edit]

[edit]

2/23/06 Replaced attached au3 file. Fixed mising closing paren. (thanks mikeytown2) and modified $GUI_CHECKED control checking routine and display font used, and changed traceroute timeout to use the selected value from the settings menu, 3 seconds by default (thanks 1of10).

[/edit]

For anyone who is a web site host, service provider, or just plain has to support broadband or network users (friends, family, etc.) who don't know how to diagonose connectivity issues :o , I hope you find the attached script useful.

I wrote it to distribute to web clients who call us instead of their ISP when their connection is down, or their router needs to be recycled.

The functionality is all detailed under the help menu. It includes a modification of the system information sample script supplied with AutoIt, and requires at least Windows 2000 to run for the ipconfig abilities.

Select and read the Network Utility Instructions on the help menu to begin. Be sure to scroll to the top as it scrolls the window down.

As always, coments are welcome.

[edit]

Handy for your system too as a shell to ping, traceroute, ipconfig /xxx

[/edit]

billmez

clnetutil.au3

Edited by billmez
Link to comment
Share on other sites

Nice code, i got an error with the msgbox, you forgot to put in the ) at the end. Other then that, awesome!

If @OSTYPE <> "WIN32_NT" Then

MsgBox(0, "Invalid Operating System", "This program requires WIndows 2000 or later to run.")

Exit

EndIf

One thing i noticed was the new run command that is available in the latest beta, that is good to know! this solves some problems that I've been dealing with. Which is awesome!

Link to comment
Share on other sites

... <SNIPPED> ...

Just wanted to point out the broken "Test Connection" feature... As written, it only tests "Client Web Site," due to the way the other hosts are tested to see if they are checked.

The mistake is in the 5th Case in the GUIGetMsg loop, with the GUICtrlRead.

Original:

Case $msg = $Button1    
        For $p = 1 To UBound($pingitem) -1
        If GUICtrlRead($pingitem[$p][1]) = 69 Then ; <== This doesn't work.
           ;MsgBox(0, "", $pingitem[$p][2])
            _PingIt($pingitem[$p][2])

Correct:

Case $msg = $Button1    
        For $p = 1 To UBound($pingitem) -1
        If BitAND(GUICtrlRead($pingitem[$p][1]),$GUI_CHECKED) = $GUI_CHECKED Then ; <== Correct method of testing if checked.
           ;MsgBox(0, "", $pingitem[$p][2])
            _PingIt($pingitem[$p][2])

There's a couple of things I would recommend that would make this program even better:

  • Instead of duplicating the IPCONFIG /RELEASE & IPCONFIG /RENEW on the "Network Utility" menu, leave the first occurance, "Release/Renew," and replace the seperate menu items with a LAN Repair feature. Below, I've included the commands that are executed when you click the "Repair" button on a LAN Connection in Windows XP.
  • I find it much easier to read the information placed in the $Edit1 GUICtrl if it's a fixed width font. Especially if you're just capturing command prompt text, which is aligned as fixed width to begin with.
  • Probably the best suggestion would be a way to abort the current test. This would be most beneficial for the "Trace Route" function, which traces a route to a host over 30 with a timeout of five seconds. It took forever to complete when I traced to a host that refuses PING! The trace completed at about hop 15, but the command kept going for the remaining 15, waiting five seconds for each of the three pings made for each hop! (And yes, I know, I can force kill the process from a command prompt, or even from SciTe, but I wanted to experience the whole thing.)

Here's the commands that are run behind the scenes when you click "Repair" on a LAN Connection in Windows XP:

IPCONFIG /release
    IPCONFIG /renew
    ARP -d *
    NBTSTAT -R
    NBTSTAT -RR
    IPCONFIG /flushdns
    IPCONFIG /registerdns

Oh, and it should be noted, just incase, that the subsequent commands are all dependant upon the first command completing successfully. I'm sure we've all seen that one error message about the DHCP server when clicking "Repair." :geek:

That'll about do it for my two Rubles worth... :o

[right][img]style_emoticons/autoit/robot.gif[/img]One of TenSecondary Adjunct of Unimatrix Z03[/right]

Link to comment
Share on other sites

Just wanted to point out the broken "Test Connection" feature... As written, it only tests "Client Web Site," due to the way the other hosts are tested to see if they are checked.

The mistake is in the 5th Case in the GUIGetMsg loop, with the GUICtrlRead.

Original:

Case $msg = $Button1    
        For $p = 1 To UBound($pingitem) -1
        If GUICtrlRead($pingitem[$p][1]) = 69 Then; <== This doesn't work.
         ;MsgBox(0, "", $pingitem[$p][2])
            _PingIt($pingitem[$p][2])

Correct:

Case $msg = $Button1    
        For $p = 1 To UBound($pingitem) -1
        If BitAND(GUICtrlRead($pingitem[$p][1]),$GUI_CHECKED) = $GUI_CHECKED Then; <== Correct method of testing if checked.
         ;MsgBox(0, "", $pingitem[$p][2])
            _PingIt($pingitem[$p][2])

There's a couple of things I would recommend that would make this program even better:

  • Instead of duplicating the IPCONFIG /RELEASE & IPCONFIG /RENEW on the "Network Utility" menu, leave the first occurance, "Release/Renew," and replace the seperate menu items with a LAN Repair feature. Below, I've included the commands that are executed when you click the "Repair" button on a LAN Connection in Windows XP.
  • I find it much easier to read the information placed in the $Edit1 GUICtrl if it's a fixed width font. Especially if you're just capturing command prompt text, which is aligned as fixed width to begin with.
  • Probably the best suggestion would be a way to abort the current test. This would be most beneficial for the "Trace Route" function, which traces a route to a host over 30 with a timeout of five seconds. It took forever to complete when I traced to a host that refuses PING! The trace completed at about hop 15, but the command kept going for the remaining 15, waiting five seconds for each of the three pings made for each hop! (And yes, I know, I can force kill the process from a command prompt, or even from SciTe, but I wanted to experience the whole thing.)

Here's the commands that are run behind the scenes when you click "Repair" on a LAN Connection in Windows XP:

IPCONFIG /release
    IPCONFIG /renew
    ARP -d *
    NBTSTAT -R
    NBTSTAT -RR
    IPCONFIG /flushdns
    IPCONFIG /registerdns

Oh, and it should be noted, just incase, that the subsequent commands are all dependant upon the first command completing successfully. I'm sure we've all seen that one error message about the DHCP server when clicking "Repair." :geek:

That'll about do it for my two Rubles worth... :o

Thanks for the heads up on the checked item. It works perfectly on winXp pro, and the only way I found to get it to work was with a return value of 69 (where it came from I don't know since it isn't listed as a constant value).

Ss to the repair scenario, is that only on XP or will it work on 2000 also. I don't want to provide functionality that won't run on 2K.

What would your suggestions be to kill the traceroute process.

Thanks

Edited by billmez
Link to comment
Share on other sites

Nice code, i got an error with the msgbox, you forgot to put in the ) at the end. Other then that, awesome!

If @OSTYPE <> "WIN32_NT" Then

MsgBox(0, "Invalid Operating System", "This program requires WIndows 2000 or later to run.")

Exit

EndIf

One thing i noticed was the new run command that is available in the latest beta, that is good to know! this solves some problems that I've been dealing with. Which is awesome!

Thanks,

I'll do an edit and repost.

Link to comment
Share on other sites

New clnetutil.au3 posted in the original message.

2/23/06 Replaced attached au3 file. Fixed mising closing paren. (thanks mikeytown2) and modified $GUI_CHECKED control checking routine and display font used, and changed traceroute timeout to use the selected value from the settings menu, 3 seconds by default (thanks 1of10).

I haven't figured out the best way to interrupt or kill the traceroute process (suggestions please), and am investigating the suggestion of adding the repair connection XP routine.

Thanks guys

[edit]

I've verified that the repair connection routine from XP will work on at least Win2K Pro, so I will add it in the next version.

I am reluctant to remove the individual /release and /renew entries because the release is a good way to disconnect from the network in case of worm attacks (I still have vivid memories of nimda) and users should be instructed that if anything funny appears to be going on, the first thing they should do is disconnect from the network.

[/edit]

Edited by billmez
Link to comment
Share on other sites

kinda useful of CCNAs like me.

I'll add it onto the floppy that i carry around with those "useful networking" applications that i use often.

Link to comment
Share on other sites

As to that repair - if it would wor with 2k or not:

Yes, it should. The only command i am not sure whether it is on a 2k box is the NBTSTAT command.

If you are wondering, this is what those commands do:

IPCONFIG /release ;delete current ip address, subnet mask, etc.

IPCONFIG /renew ;get an ip address, subnet mask, etc.

ARP -d * ;clear the ARP catche (used for transalting IP addresses to MAC addresses)

NBTSTAT -R ;clear & reload the NBI cache table

NBTSTAT -RR ;release your cache name then re-requests it

IPCONFIG /flushdns ;Clears the DNS resolver catche

IPCONFIG /registerdns ;refreshes DHCP leases and re-registers DNS names

Link to comment
Share on other sites

As to that repair - if it would wor with 2k or not:

Yes, it should. The only command i am not sure whether it is on a 2k box is the NBTSTAT command.

I'm glad you'll find it useful. It will save me some problems when clients call because they are unable to reach their web site or have email issues. It seems to be much easier than talking them through opening a command window and runing a ping, traceroute, etc.

As to the W2K stuff, I tried the commands on 2Kpro and they worked, so I included the rebuild option in this version.

Link to comment
Share on other sites

  • 1 month later...

Hi, this looks like it would be a very handy tool for me. But i cant get it to run - am i missing something. Below are the errors i get - im sure it's just me being thick :)

$ipinfo = Run(@ComSpec & " /c ipconfig /renew", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\AutoIT\clnetutil.au3(313,97) : ERROR: Run() [built-in] called with wrong number of args.

$ipinfo = Run(@ComSpec & " /c ARP -d *", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\AutoIT\clnetutil.au3(322,99) : ERROR: Run() [built-in] called with wrong number of args.

$ipinfo = Run(@ComSpec & " /c NBTSTAT -R", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\AutoIT\clnetutil.au3(331,100) : ERROR: Run() [built-in] called with wrong number of args.

$ipinfo = Run(@ComSpec & " /c NBTSTAT -RR", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\AutoIT\clnetutil.au3(340,107) : ERROR: Run() [built-in] called with wrong number of args.

$ipinfo = Run(@ComSpec & " /c IPCONFIG /flushdns", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~^

C:\AutoIT\clnetutil.au3(349,110) : ERROR: Run() [built-in] called with wrong number of args.

$ipinfo = Run(@ComSpec & " /c IPCONFIG /registerdns", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~^

C:\AutoIT\clnetutil.au3(362,106) : ERROR: Run() [built-in] called with wrong number of args.

$ipinfo = Run(@ComSpec & " /c ipconfig /release", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~^

C:\AutoIT\clnetutil.au3(374,104) : ERROR: Run() [built-in] called with wrong number of args.

$ipinfo = Run(@ComSpec & " /c ipconfig /renew", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\AutoIT\clnetutil.au3(479,55) : ERROR: undefined macro.

GUICtrlSetData($Edit1, "Processor: " & @ProcessorArch &

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\AutoIT\clnetutil.au3(166,85) : ERROR: $STDERR_CHILD: undeclared global variable.

$ipinfo = Run(@ComSpec & " /c ipconfig /all", @SystemDir, @SW_HIDE, $STDERR_CHILD +

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\AutoIT\clnetutil.au3 - 15 error(s), 2 warning(s)

Link to comment
Share on other sites

Nice script but (there is always 1) The repair function does not work on my wireless net adapter. It should disable the adapter first. Then I think the next part of the sequence is to re-enable but I will have to check that.

Other than that it works fine.

I also changed the following code.

Case $msg = $Button2    
            $pingValue = InputBox("Test Custom Host", "Enter the URL without HTTP://", "", "", 200, 100, -1, -1)
            If $pingValue Then
                If StringInStr($pingValue, "http://") Then
                   $PingValue = StringReplace($PingValue,'http://',CHR(0))
                #cs
                    MsgBox(0, "Improper Entry", "The URL can't contain http://")
                    ContinueLoop
                    #ce
                EndIf   
                _CLS()
                _PingIt($pingValue) 
            EndIf   
                GUICtrlSetData($Edit1, "Test Complete" & @crlf, 1)
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Nice script but (there is always 1) The repair function does not work on my wireless net adapter. It should disable the adapter first. Then I think the next part of the sequence is to re-enable but I will have to check that.

Other than that it works fine.

I also changed the following code.

Case $msg = $Button2    
            $pingValue = InputBox("Test Custom Host", "Enter the URL without HTTP://", "", "", 200, 100, -1, -1)
            If $pingValue Then
                If StringInStr($pingValue, "http://") Then
                   $PingValue = StringReplace($PingValue,'http://',CHR(0))
                #cs
                    MsgBox(0, "Improper Entry", "The URL can't contain http://")
                    ContinueLoop
                    #ce
                EndIf   
                _CLS()
                _PingIt($pingValue) 
            EndIf   
                GUICtrlSetData($Edit1, "Test Complete" & @crlf, 1)
I replaced the au3 file in the first post attachmetn with a version that allows terminating a traceroute by pressing the escape key.

@GEOSoft, I purposely didn't filter out the http:// on the ping function because I am trying to instruct the users to read and follow directions.

What happens if you just use the release network menu selection on your wireless adapter? Does it work or produce an error. If it produces an error, what happens when you use the repair option in the network connections folder of windows?

Link to comment
Share on other sites

  • 2 weeks later...

@GEOSoft, I purposely didn't filter out the http:// on the ping function because I am trying to instruct the users to read and follow directions.

:think: Shouldn't software should be intuitive enough to accept that users aren't always going to read and follow instructions.

As an Admin/Support person, I can tell you 90% of the time - they just want to know it's working.

Link to comment
Share on other sites

  • 1 year later...

great program, but when I try to use the Network Information feature it makes the program hang. I can't quit or do anything else, it displays the info, at least some of it, but it forces the focus on the text box to the bottom of the box, I can only view the information it displays if I hold the slider to the top of the box.

I'm not sure what causes it to hang exactly, but if you need to know any specific system info to try and figure it out, let me know.

[u]You can download my projects at:[/u] Pulsar Software
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...