Jump to content

Network Scan


Guest 1druid1
 Share

Recommended Posts

Guest 1druid1

Hi All

Hope you can help.

I am looking for a script that when loaded will scan my network based on a tcp/ip range and give me a list of all pcs and the users logged in. Then I would like to be able to select one of these PC's and click on a button called connect and it will automatically load up RealVnc with the computer name.

Hope you can help

Regards

Douglas Bell

Link to comment
Share on other sites

Hi 1druid1,

I have been using a combination of tools to do this so far.

The best I can come up with is to do a NET VIEW dos command, parse it into listboxes, automate a tool called STRCM from System Tools and get UltraVNC as it seems about the fastest.

If you need any help, let me know and I'll see how I can help.

Edited by sandyd
----[ SandyD ]---
Link to comment
Share on other sites

i think you need todo _rundos("netview > c:\output.txt")

something like that

you'll get the output in c:\output.txt and every line will be a computer.

then make a loop that reads 1 line till EOF.

the file will be something like

Servernaam Opmerking

-------------------------------------------------------------------------------

\\JOP Jop Computer

\\ZERO zeroZshadow

De opdracht is voltooid.

(yes its in dutch)

after that just automate ur ULTRAVcn to connect to that pc when clicked on in the LISTVIEW (where you OFCOURSE had to put the outcome of the loop)

don't get it??? PM ME

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

#include <GUIConstants.au3>

_RunDOS("net view" & " > " & @TempDir & "\temp.txt")

$file = FileOpen(@TempDir & "\temp.txt", 0)

GUICreate("Network", 300, 130)
$computer = GUICtrlCreateList("", 5, 40, 121, 97)

GUISetState()

While 1
   $line = FileReadLine($file)
   If @error = -1 Then ExitLoop
   If StringInStr($line, ".exe") Then
      GUICtrlSetData($computer, StringMid( (StringStripWS($line, 8)), 3))
   EndIf
WEnd

While 1
   $msg = GUIGetMsg()
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
   Sleep(100)
Wend

FileClose($file)

FileDelete(@TempDir & "\temp.txt")

I think that should work.

Edited by Burrup

qq

Link to comment
Share on other sites

Here is one I prepared earlier...

;delete last listing
Filedelete("b.tmp")

;gets the computer list and a few other things
RunWait(@ComSpec & ' /c net view > a.tmp', @ScriptDir, @SW_HIDE)
;open the file for working
$file = FileOpen("a.tmp", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

;Creates new file in which the result will be written
FileOpen("b.tmp", 1)

; Read in lines of text until the EOF is reached in file a.tmp
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
   ;find the string "\\"
    $result = StringInStr($line,"\\")
      if $result = 1 Then 
      ;find next blank
      $blankpos = StringInStr($line," ")
     ;Find length of line
      $len = StringLen($line)
     ;calculate from what position to Trim string to the right
      $len = $len - $blankpos
     ;Trim all characters after the computer name
      $line = StringTrimRight($line, $len)
     ;Trim the //
      $line = StringTrimLeft($line,2)
     ;Write line to file, adding "|"
      FileWrite("b.tmp", $line & "|")
      EndIf

 Wend

FileClose($file)
FileDelete("a.tmp")
$file2 = FileReadline("b.tmp", 1)

;GUI Start
#include "GUIConstants.au3"

;Set GUI
Opt("GUICoordMode", 1)
;Opt("GUINotifyMode", 1)
GuiCreate("PC Selection", 329,145)

;Create 2 buttons
$button_1 = GUICtrlCreateButton("DO IT", 20, 100, 80, 20)
               GUICtrlSetState(-1,$GUI_DEFBUTTON)
$button_2 = GUICtrlCreateButton("E&xit", 230, 100, 80, 20)

;Create 1 combo box, give focus and populate with contents of b.tmp
$combo_1 = GUICtrlCreateCombo( "", 180, 10, 120, 20)
               GUICtrlSetState(-1,$GUI_FOCUS) 
               GUICtrlSetData(-1,$file2)
;create labels
$label_1 = GUICtrlCreateLabel( "Choose the PC", 20, 10, 150, 20)

;Show the GUI
GuiSetState (@SW_SHOW)
$msg = 0
While $msg <> -3
$msg = GuiGetMsg()
Select
case $msg = $button_2
    Exit
case $msg = $button_1
    $CPUID = GuictrlRead($combo_1)
    RunWait("C:\Program Files\UltraVNC\vncviewer.exe " & $CPUID)
    GUICtrlSetData ( $combo_1, $file2)
    EndSelect
WEnd

Exit

I run UltraVNC, you may want to change the program path

CheersNobby

Link to comment
Share on other sites

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...