View previous topic :: View next topic |
Author |
Message |
dmonckton Contributor


Joined: 09 Aug 2002 Posts: 117 Location: Lewes, U.K.
|
Posted: Thu Jan 14, 2010 3:19 pm Post subject: Network Box |
|
|
Hi All
Here is a very simple program I made to collect together all the various
networking commands so that I can run them from one place. There is
no clever programming in this script.
Code: |
OPTION TIPTIME,10
title Network Box
DIALOG CREATE,Network Box v1.3,-1,0,550,347
DIALOG ADD,CHECK,echo,304,324,160,18,Echo results to log file,,Saves Log file to Desktop
DIALOG ADD,GROUP,GROUP1,25,270,244,137,Networking Dialogs
DIALOG ADD,BUTTON,MSND,118,322,150,24,MS Network Diagnostics,netsh diag gui
DIALOG ADD,BUTTON,LAC,51,322,148,24,Local Area Connections,ncpa.cpl
DIALOG ADD,BUTTON,firewall,84,322,148,24,Firewall,firewall.cpl
DIALOG ADD,GROUP,GROUP2,169,272,248,121,NetBIOS
DIALOG ADD,BUTTON,testNetbios1,205,292,210,24,Test NetBIOS Name Resolution,nbtstat -a host
DIALOG ADD,BUTTON,testNetbios2,246,292,210,24,Test NetBIOS Address Resolution,nbtstat -A IP-address
DIALOG ADD,GROUP,GROUP3,15,34,212,316,Networking Command-line
DIALOG ADD,BUTTON,ipSettings,37,61,148,24,IP Settings,ipconfig /all
DIALOG ADD,BUTTON,ping1,71,61,148,24,Ping Address,ping -a IP-address
DIALOG ADD,BUTTON,ping2,104,61,148,24,Ping Name,ping host
DIALOG ADD,BUTTON,nonFrag,134,61,148,24,Non Fragmented Ping,ping -n 1 -f -l length IP-address
DIALOG ADD,BUTTON,dnsLookup,165,61,148,24,DNS Lookup,nslookup IP-address
DIALOG ADD,BUTTON,traceRoute,198,61,148,24,Trace Route,tracert -d -h 10 -w 300 IP-address
DIALOG ADD,BUTTON,routeTable,231,61,148,24,Routing Table,netstat /R
DIALOG ADD,BUTTON,arp,266,61,148,24,ARP Table,arp -a
DIALOG ADD,BUTTON,activeConnections,297,61,148,24,TCP Connections,netstat -anb -p TCP
DIALOG SHOW
%%address =
%%machine =
%%echo = @chr(34)@env(USERPROFILE)\Desktop\@env(COMPUTERNAME) Network Box.txt@chr(34)
%%desk = @env(USERPROFILE)\Desktop\@env(COMPUTERNAME) Network Box.txt
%%log = ""
%%length = 32
rem Perpetual Event Manager Loop
:Evloop
rem flush the event buffer
while @event()
wait
wend
wait event
gosub @event()
goto evloop
:MSNDbutton
runz cmd.exe" /c netsh diag gui"
exit
:LACbutton
info Right-click and use the repair option on the active network connection to quickly renew the connection settings
shell ,rundll32.exe,"shell32.dll,Control_RunDLL ncpa.cpl"
exit
:firewallbutton
shell ,rundll32.exe,"shell32.dll,Control_RunDLL firewall.cpl"
exit
:testNetbios1button
%%machine = @input(Enter Computer Name,%%machine)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "nbtstat -a "%%machine
gosub log
runh cmd.exe" /c nbtstat -a "%%machine" >> "%%echo
end
run cmd.exe" /t:0A /k nbtstat -a "%%machine
exit
:testNetbios2button
%%address = @input(Enter IP Address,%%address)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "nbtstat -A "%%address
gosub log
runh cmd.exe" /c nbtstat -A "%%address" >> "%%echo
end
run cmd.exe" /t:0A /k nbtstat -A "%%address
exit
:ipSettingsbutton
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "ipconfig /all"
gosub log
runh cmd.exe" /c ipconfig /all >> "%%echo
end
run cmd.exe" /t:0A /k ipconfig /all"
exit
:ping1button
%%address = @input(Enter IP Address,%%address)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "ping -a "%%address
gosub log
runh cmd.exe" /c ping -a "%%address" >> "%%echo
end
run cmd.exe" /t:0A /k ping -a "%%address
exit
:ping2button
%%machine = @input(Enter Computer Name,%%machine)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "ping "%%machine
gosub log
runh cmd.exe" /c ping "%%machine" >> "%%echo
end
run cmd.exe" /t:0A /k ping "%%machine
exit
:dnsLookupbutton
%%machine = @input(Enter Computer Name,%%machine)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "nslookup "%%machine
gosub log
runh cmd.exe" /c nslookup "%%machine" >> "%%echo
end
run cmd.exe" /t:0A /k nslookup "%%machine
exit
:routeTablebutton
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "netstat /R"
gosub log
runh cmd.exe" /c netstat /R >> "%%echo
end
run cmd.exe" /t:0A /k netstat /R"
exit
:traceRoutebutton
%%address = @input(Enter target IP address,%%address)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "tracert -d -h 10 -w 300 "%%address
gosub log
runh cmd.exe" /c tracert -d -h 10 -w 300 "%%address" >> "%%echo
end
run cmd.exe" /t:0A /k tracert -d -h 10 -w 300 "%%address
exit
:activeConnectionsbutton
if @ask(Do you want the addresses in Numerical Form)
%%numeric = -anb
else
%%numeric = -ab
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "netstat "%%numeric" -p TCP"
gosub log
runh cmd.exe" /c netstat "%%numeric" -p TCP >> "%%echo
end
run cmd.exe" /t:0A /k netstat "%%numeric" -p TCP"
exit
:nonFragbutton
%%address = @input(Enter IP Address,%%address)
if @not(@ok())
exit
end
%%length = @input(Enter packet length in bytes,%%length)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "ping -n 1 -f -l "%%length" "%%address
gosub log
runh cmd.exe" /c ping -n 1 -f -l "%%length" "%%address" >> "%%echo
end
run cmd.exe" /t:0A /k ping -n 1 -f -l "%%length" "%%address
exit
:arpbutton
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "arp -a"
gosub log
runh cmd.exe" /c arp -a >> "%%echo
end
run cmd.exe" /t:0A /k arp -a"
exit
:log
list create,1
list loadfile,1,%%desk
list add,1,%%log
list savefile,1,%%desk
list close,1
exit
rem Have to stop the script as exit will return to Evloop
:close
stop
|
Cheers
David... |
|
Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Jan 14, 2010 5:12 pm Post subject: |
|
|
Ok, so no awards for programming genius, but it's a sweet little tool to have!
Thanks David  _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
Back to top |
|
 |
JRoza Contributor


Joined: 17 Aug 2003 Posts: 182 Location: Netherlands
|
Posted: Fri Jan 15, 2010 8:10 pm Post subject: |
|
|
I agree with Garrett, it's not the the programming art that make a good program but the fact if it is the good answer to somebody's needs.
This one certainly is a very handy tool, so compliments!
Jan |
|
Back to top |
|
 |
stewcam Newbie
Joined: 30 Sep 2006 Posts: 21
|
Posted: Sun Jan 17, 2010 6:10 am Post subject: |
|
|
This is a good example of what VDS excels at - simple and compact solutions. Nicely done! |
|
Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sun Jan 17, 2010 6:55 am Post subject: |
|
|
It's almost funny how simple it can be to use VDS for something useful, even if it's just making interface access for some command line stuff. _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
Back to top |
|
 |
dmonckton Contributor


Joined: 09 Aug 2002 Posts: 117 Location: Lewes, U.K.
|
Posted: Mon Jan 18, 2010 8:56 am Post subject: |
|
|
Thanks for the positive feedback.
I've adjusted some of the commandlines to capture the STDERR stream
aswell as I'd missed that.
Code: | :testNetbios1button
%%machine = @input(Enter Computer Name,%%machine)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "nbtstat -a "%%machine
gosub log
rem redirect STDERR to STDOUT then ammend
runh cmd.exe" /c nbtstat -a "%%machine" 1>> "%%echo" 2>&1"
end
run cmd.exe" /t:0A /k nbtstat -a "%%machine
exit |
Thanks
David. |
|
Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Jan 18, 2010 5:11 pm Post subject: |
|
|
You know David, you should next build your own console window into your interface and have all the console information piped into your own window  _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
Back to top |
|
 |
dmonckton Contributor


Joined: 09 Aug 2002 Posts: 117 Location: Lewes, U.K.
|
Posted: Wed Jan 20, 2010 11:26 am Post subject: |
|
|
Hi Garrett
I took your advice and recoded including a built-in console!
Code: |
OPTION SCALE,96
OPTION TIPTIME,10
title Network Box
DIALOG CREATE,Network Box v2.0,5,50,926,668,SAVEPOS
REM *** Modified by Dialog Designer on 20/01/2010 - 11:08 ***
DIALOG ADD,STYLE,STYLE1,MS Sans Serif,8,,,
DIALOG ADD,STYLE,STYLE2,Courier New,8,,BLACK,LIME
DIALOG ADD,CHECK,echo,14,742,160,18,Echo results to log file,,Saves Log file to Desktop
DIALOG ADD,GROUP,GROUP1,495,715,202,137,Networking Dialogs
DIALOG ADD,BUTTON,MSND,588,742,148,24,MS Network Diagnostics,netsh diag gui
DIALOG ADD,BUTTON,LAC,521,742,148,24,Local Area Connections,ncpa.cpl
DIALOG ADD,BUTTON,firewall,553,742,148,24,Firewall,firewall.cpl
DIALOG ADD,GROUP,GROUP2,371,715,202,106,NetBIOS
DIALOG ADD,BUTTON,testNetbios1,399,742,148,24,NetBIOS Name Resolution,nbtstat -a host,STYLE1
DIALOG ADD,BUTTON,testNetbios2,435,742,148,24,NetBIOS Address Resolution,nbtstat -A IP-address,STYLE1
DIALOG ADD,GROUP,GROUP3,44,715,202,316,Networking Command-line
DIALOG ADD,BUTTON,ipSettings,66,742,148,24,IP Settings,ipconfig /all
DIALOG ADD,BUTTON,ping1,100,742,148,24,Ping Address,ping -a IP-address
DIALOG ADD,BUTTON,ping2,133,742,148,24,Ping Name,ping host
DIALOG ADD,BUTTON,nonFrag,163,742,148,24,Non Fragmented Ping,ping -n 1 -f -l length IP-address
DIALOG ADD,BUTTON,dnsLookup,194,742,148,24,DNS Lookup,nslookup IP-address
DIALOG ADD,BUTTON,traceRoute,227,742,148,24,Trace Route,tracert -w 300 IP-address
DIALOG ADD,BUTTON,routeTable,260,742,148,24,Routing Table,netstat /R
DIALOG ADD,BUTTON,arp,295,742,148,24,ARP Table,arp -a
DIALOG ADD,BUTTON,activeConnections,326,742,148,24,TCP Connections,netstat -anb -p TCP
DIALOG ADD,GROUP,GROUP4,3,6,701,661,Command-Line
DIALOG ADD,LIST,LIST1,22,14,684,633,,STYLE2
DIALOG SHOW
%%address =
%%machine =
%%echo = @chr(34)@env(USERPROFILE)\Desktop\@env(COMPUTERNAME) Network Box.txt@chr(34)
%%desk = @env(USERPROFILE)\Desktop\@env(COMPUTERNAME) Network Box.txt
%%log = ""
%%length = 32
rem Perpetual Event Manager Loop
:Evloop
rem flush the event buffer
while @event()
wait
wend
wait event
gosub @event()
goto evloop
:MSNDbutton
runz cmd.exe" /c netsh diag gui"
exit
:LACbutton
info Right-click and use the repair option on the active network connection to quickly renew the connection settings
shell ,rundll32.exe,"shell32.dll,Control_RunDLL ncpa.cpl"
exit
:firewallbutton
shell ,rundll32.exe,"shell32.dll,Control_RunDLL firewall.cpl"
exit
:testNetbios1button
%%machine = @input(Enter Computer Name,%%machine)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "nbtstat -a "%%machine
gosub log
rem redirect STDERR to STDOUT them ammend
runh cmd.exe" /c nbtstat -a "%%machine" 1>> "%%echo" 2>&1"
end
list clear,list1
list add,list1,"nbtstat -a "%%machine
dialog cursor,wait
runh cmd.exe" /c nbtstat -a "%%machine,pipe,wait
list append,list1,@pipe()
dialog cursor
exit
:testNetbios2button
%%address = @input(Enter IP Address,%%address)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "nbtstat -A "%%address
gosub log
rem redirect STDERR to STDOUT them ammend
runh cmd.exe" /c nbtstat -A "%%address" 1>> "%%echo" 2>&1"
end
list clear,list1
list add,list1,"nbtstat -A "%%address
dialog cursor,wait
runh cmd.exe" /c nbtstat -A "%%address,pipe,wait
list append,list1,@pipe()
dialog cursor
exit
:ipSettingsbutton
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "ipconfig /all"
gosub log
runh cmd.exe" /c ipconfig /all >> "%%echo
end
list clear,list1
list add,list1,"ipconfig /all"
dialog cursor,wait
runh cmd.exe" /c ipconfig /all",pipe,wait
list append,list1,@pipe()
dialog cursor
exit
:ping1button
%%address = @input(Enter IP Address,%%address)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "ping -a "%%address
gosub log
runh cmd.exe" /c ping -a "%%address" >> "%%echo
end
list clear,list1
list add,list1,"ping -a "%%address
dialog cursor,wait
runh cmd.exe" /c ping -a "%%address,pipe,wait
list append,list1,@pipe()
dialog cursor
exit
:ping2button
%%machine = @input(Enter Computer Name,%%machine)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "ping "%%machine
gosub log
runh cmd.exe" /c ping "%%machine" >> "%%echo
end
list clear,list1
list add,list1,"ping "%%machine
dialog cursor,wait
runh cmd.exe" /c ping "%%machine,pipe,wait
list append,list1,@pipe()
dialog cursor
exit
:dnsLookupbutton
%%machine = @input(Enter Computer Name,%%machine)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "nslookup "%%machine
gosub log
rem redirect STDERR to STDOUT them ammend
runh cmd.exe" /c nslookup "%%machine" 1>> "%%echo" 2>&1"
end
list clear,list1
list add,list1,"nslookup "%%machine
list add,list1,""
dialog cursor,wait
runh cmd.exe" /c nslookup "%%machine,pipe,wait
list append,list1,@pipe()
dialog cursor
exit
:routeTablebutton
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "netstat /R"
gosub log
runh cmd.exe" /c netstat /R >> "%%echo
end
list clear,list1
list add,list1,"netstat /R"
dialog cursor,wait
runh cmd.exe" /c netstat /R",pipe,wait
list append,list1,@pipe()
dialog cursor
exit
:traceRoutebutton
%%address = @input(Enter target IP address,%%address)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "tracert -w 300 "%%address
gosub log
runh cmd.exe" /c tracert -w 300 "%%address" >> "%%echo
end
list clear,list1
list add,list1,"tracert -w 300 "%%address
dialog cursor,wait
runh cmd.exe" /c tracert -w 300 "%%address,pipe,wait
list append,list1,@pipe()
dialog cursor
exit
:activeConnectionsbutton
if @ask(Do you want the addresses in Numerical Form)
%%numeric = -anb
else
%%numeric = -ab
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "netstat "%%numeric" -p TCP"
gosub log
runh cmd.exe" /c netstat "%%numeric" -p TCP >> "%%echo
end
list clear,list1
list add,list1,"netstat "%%numeric" -p TCP"
dialog cursor,wait
runh cmd.exe" /c netstat "%%numeric" -p TCP",pipe,wait
list append,list1,@pipe()
dialog cursor
exit
:nonFragbutton
%%address = @input(Enter IP Address,%%address)
if @not(@ok())
exit
end
%%length = @input(Enter packet length in bytes,%%length)
if @not(@ok())
exit
end
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "ping -n 1 -f -l "%%length" "%%address
gosub log
runh cmd.exe" /c ping -n 1 -f -l "%%length" "%%address" >> "%%echo
end
list clear,list1
list add,list1,"ping -n 1 -f -l "%%length" "%%address
dialog cursor,wait
runh cmd.exe" /c ping -n 1 -f -l "%%length" "%%address,pipe,wait
list append,list1,@pipe()
dialog cursor
exit
:arpbutton
if @dlgtext(echo)
%%log = "----------------------------------------------------------------------"
gosub log
%%log = "arp -a"
gosub log
runh cmd.exe" /c arp -a >> "%%echo
end
list clear,list1
list add,list1,"arp -a"
dialog cursor,wait
runh cmd.exe" /c arp -a",pipe,wait
list append,list1,@pipe()
dialog cursor
exit
:log
list create,1
list loadfile,1,%%desk
list add,1,%%log
list savefile,1,%%desk
list close,1
exit
rem Have to stop the script as exit will return to Evloop
:close
stop
|
Regards
David. |
|
Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Jan 20, 2010 4:59 pm Post subject: |
|
|
Sweet.
This is nice. _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|