Qbasicnews.com
March 02, 2021, 01:14:20 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Back to Qbasicnews.com
|
QB Online Help
|
FAQ
|
Chat
|
All Basic Code
|
QB Knowledge Base
Home
Help
Search
Login
Register
Qbasicnews.com
>
QBasic
>
QB Discussion & Programming Help
>
Network Tools - Using Shell Programming Commands
Pages: [
1
]
« previous
next »
Print
Author
Topic: Network Tools - Using Shell Programming Commands (Read 2688 times)
kimalasi
New Member
Posts: 3
Network Tools - Using Shell Programming Commands
«
on:
June 07, 2006, 02:38:56 PM »
REM NETWORK TOOL REPORT. THIS FILE YOU MAY INCLUIDIT IN YOUR
REM WINDOWS SYSTEM FOLDER. IF YOU HAVE WINDOWS 2000 YOU
REM HAVE TO INCLUDE IT IN THE WINNT\SYSTEM32 FOLDER.
REM THIS IS A USEFUL TOOL TO MAKE NETWORK ANALISIS.
REM
REM DONE BY JULIO VIERA 06/02/06
OPEN "c:\localnet" FOR APPEND AS #1
OPEN "c:\myinfo.txt" FOR APPEND AS #2
CLS
REM CLEAR THE report.rpt
comdel$ = "del "
drive$ = "c:\"
reporte$ = "report.rpt"
holecomdel$ = comdel$ + drive$ + reporte$
SHELL holecomdel$
netcommand$ = "net "
option$ = "view"
redirect$ = " > "
nameoffile$ = "c:\network.txt"
holecommand$ = netcommand$ + option$ + redirect$ + nameoffile$
SHELL holecommand$
showfile$ = "type "
files$ = "c:\network.txt"
holeshow$ = showfile$ + files$
SHELL holeshow$
PRINT "-----------------------------------------------------------------"
PRINT "ENTER A NAME OF THE COMPUTER IN THE LIST :"
INPUT answer$
PRINT ""
PRINT ""
PRINT "PROBING TRANSMITION NETWORK COMMUNICATIONS THRU NETWORK "
pinginfo$ = "ping "
holeping$ = pinginfo$ + answer$
SHELL holeping$
PRINT "-----------------------------------------------------------------"
PRINT ""
PRINT ""
PRINT "PHASE I-GETTING THE IP ADDRESS OF THE COMPUTER AND HEALTH OF TRANSMITION."
SLEEP 4
computer$ = "ping"
bspace$ = " "
extention$ = ".ipg"
drive$ = "c:\"
barspace$ = " > "
holecomputer$ = computer$ + bspace$ + answer$ + barspace$ + drive$ + answer$ + extention$
PRINT holecomputer$
SHELL holecomputer$
PRINT "-----------------------------------------------------------------"
PRINT ""
PRINT ""
PRINT "PHASE II- VIEW SHARE FOLDERS OF THE COMPUTER IN THE NETWORK"
SLEEP 4
viewshare$ = "net view "
holeview$ = viewshare$ + answer$
viewext$ = ".viw"
PRINT
PRINT
PRINT
PRINT holeview$
SHELL holeview$
netview$ = "net view "
holenetshare$ = netview$ + answer$ + barspace$ + drive$ + answer$ + viewext$
SHELL holenetshare$
PRINT holenetshare$
PRINT "-------------------------------------------------------------------"
PRINT ""
PRINT ""
PRINT "PHASE III -NSLOOKUCP FOR AUTHORITATIVE OR NON AUTORITATIVE RESPONSE"
SLEEP 4
nscommand$ = "nslookup "
holens$ = nscommand$ + answer$
extention$ = ".nsl"
PRINT holens$
SHELL holens$
createfile$ = nscommand$ + bspace$ + answer$ + barspace$ + drive$ + answer$ + extention$
PRINT createfile$
SHELL createfile$
SLEEP 2
PRINT "END OF NETWORK AND COMPUTERS ANALISIS"
holecommand$ = "dir /s /b " + drive$ + answer$ + ".*"
SHELL holecommand$
INPUT "ENTER NAME OF FILE SHOWN IN SCREEN : ", files$
pcfiles$ = "dir /b "
braket$ = " > "
ext1$ = ".*"
espacio$ = " "
drive$ = "c:\"
mynetfiles$ = "netpcs.txt"
thecommand$ = pcfiles$ + files$ + ext1$ + espacio$ + braket$ + drive$ + mynetfiles$
PRINT thecommand$
SHELL thecommand$
PRINT "======================================================================"
PRINT
PRINT
PRINT "CREATING THE REPORT OF THE NETWORK"
catcommand$ = "type "
drive$ = "c:\"
ext1$ = ".ipg"
ext2$ = ".viw"
ext3$ = ".nsl"
dbraket$ = " >> "
filenet$ = "network.txt"
printrpt$ = "report.rpt"
commandcat$ = catcommand$ + drive$ + filenet$ + dbraket$ + drive$ + printrpt$
SHELL commandcat$
commandcat$ = catcommand$ + drive$ + files$ + ext1$ + dbraket$ + drive$ + printrpt$
SHELL commandcat$
commandcat$ = catcommand$ + drive$ + files$ + ext2$ + dbraket$ + drive$ + printrpt$
SHELL commandcat$
commandcat$ = catcommand$ + drive$ + files$ + ext3$ + dbraket$ + drive$ + printrpt$
SHELL commandcat$
PRINT commandcat$
SLEEP 5
PRINT ""
PRINT "---------------------------------------------------------------------"
CLS
PRINT "COMPUTER NETWORK INFORMATION"
PRINT ""
PRINT "REPORT FINISHED"
PRINT ""
PRINT ""
fecha$ = DATE$
INPUT "DO YOU WANT TO PRINT THE REPORT (Y\N) : ", printrep$
IF printrep$ = "Y" OR printrep$ = "y" THEN
printreport$ = "notepad /p "
holeprint$ = printreport$ + drive$ + printrpt$
SHELL holeprint$
PRINT holeprint$
ELSE
printscreen$ = "type "
forpause$ = " |more"
holeprintscreen$ = printscreen$ + drive$ + printrpt$ + forpause$
SHELL holeprintscreen$
END IF
CLOSE #1
CLOSE #2
END
---------------------------------------------------------------------------------
THIS IS THE OUTPUT OF THE REPORTS CREATED IN c:\report.rpt
Server Name Remark
-------------------------------------------------------------------------------
\\HUMANRESOURCES Human Resources
\\MAIL Mail and Web Server
The command completed successfully.
Pinging Accounting [192.168.0.222] with 32 bytes of data:
Reply from 192.168.0.222: bytes=32 time<1ms TTL=128
Reply from 192.168.0.222: bytes=32 time<1ms TTL=128
Reply from 192.168.0.222: bytes=32 time<1ms TTL=128
Reply from 192.168.0.222: bytes=32 time<1ms TTL=128
Ping statistics for 192.168.0.222:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Shared resources at accounting
Leilanys Computer
Share name Type Used as Comment
-------------------------------------------------------------------------------
backup Disk
C Disk
knoppix Disk
laser Print Lexmark E210
leila Disk
My Documents Disk
Peachw Disk
SharedDocs Disk
VELEZ Disk
The command completed successfully.
Server: mail.mshome.net
Address: 192.168.0.1
Name: Accounting.mshome.net
Address: 192.168.0.222
Hope you enjoy it. Use it and modify at your own flavor. Any suggestion to improve it please let me know. I am a beginner programmer.[/img]
Logged
LPRINT in Windows XP was replaced with the SHELL "notepad /p yourfile".
Ralph
Ancient Guru
Posts: 544
Network Tools - Using Shell Programming Commands
«
Reply #1 on:
June 07, 2006, 07:15:44 PM »
Suggestion. Instead of:
Code:
comdel$ = "del "
drive$ = "c:\"
reporte$ = "report.rpt"
holecomdel$ = comdel$ + drive$ + reporte$
SHELL holecomdel$
why not just:
Code:
SHELL "del c:\report.rpt"
The same applies throughout your code. It would be greatly reduced, and much easier to write and to follow.
Logged
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
kimalasi
New Member
Posts: 3
I tryit already.
«
Reply #2 on:
June 08, 2006, 09:01:28 AM »
It seem for some reason I the program do not enable me to use the SHELL command as you presented me.
I tried using SHELL "del c:\report.rpt" and I get an outcome of "bad command".
So when I did like you saw it runs perfect.
Thanks for your advice.
Logged
LPRINT in Windows XP was replaced with the SHELL "notepad /p yourfile".
Ralph
Ancient Guru
Posts: 544
Network Tools - Using Shell Programming Commands
«
Reply #3 on:
June 08, 2006, 01:13:29 PM »
Very strange! It worked fine for me. Try this very short program: w
Code:
CLS
SHELL "dir c:\"
WHILE INKEY$="":WEND
'assuming you have the file, "report.rpt" in the directory you see:
SHELL "del c:\report.rpt"
SHELL "dir c:\"
'the file should not show up in the listing now
Did this work for you?
Logged
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
kimalasi
New Member
Posts: 3
yeah! it worked.
«
Reply #4 on:
June 09, 2006, 09:20:31 AM »
Well I have to modify the program. Thanks guy for your colaboration. Hop to post the new source code tomorrow.
Logged
LPRINT in Windows XP was replaced with the SHELL "notepad /p yourfile".
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Forum has moved
-----------------------------
=> Forum has moved
-----------------------------
QbasicNews.Com
-----------------------------
=> QB/FB News
=> Site/Forum Issues
=> Challenges
-----------------------------
QBasic
-----------------------------
=> QB Discussion & Programming Help
=> QB Projects
-----------------------------
Qbasic "like" compilers/interpreters
-----------------------------
=> General QB "like"
=> QB64
=> FB Discussion & Programming Help
===> FB Projects
===> FB Documentation
-----------------------------
General
-----------------------------
=> General/Misc
===> Art & Music
===> General Programming
Loading...