BrettF Posted March 20, 2007 Share Posted March 20, 2007 Hi, I'm toying with an idea to see what files are shared on all computers connected to the network. So now wth some questions.... 1) How can I get all of the computers connected in the network? 2) How can I find the shared folders and files on the computer? Thanks, Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
ptrex Posted March 20, 2007 Share Posted March 20, 2007 @bert This will list all the share information in a PC. expandcollapse popup$wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Share", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "AccessMask: " & $objItem.AccessMask & @CRLF $Output = $Output & "AllowMaximum: " & $objItem.AllowMaximum & @CRLF $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "MaximumAllowed: " & $objItem.MaximumAllowed & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "Path: " & $objItem.Path & @CRLF $Output = $Output & "Status: " & $objItem.Status & @CRLF $Output = $Output & "Type: " & $objItem.Type & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_Share" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc So you need to wite a text file with all PC names in it and that to an Array, This way you can pick up all share info from those PC's. Enjoy !! ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
jefhal Posted March 20, 2007 Share Posted March 20, 2007 1) How can I get all of the computers connected in the network?You can use the command "Net view" in a dos window to get the names of all the computers currently online. I take it you do not have Active Directory or a dhcp server? ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
jvanegmond Posted March 20, 2007 Share Posted March 20, 2007 You can use the command "Net view" in a dos window to get the names of all the computers currently online. I take it you do not have Active Directory or a dhcp server?I was just going to mention Net View. I'm working on the same issue, but I think I'll just go with scanning ip's and giving users an option to input them manually. nbtstat can be a usefull tool if you want to get the computername from an IP-adress. Want an example? github.com/jvanegmond Link to comment Share on other sites More sharing options...
BrettF Posted March 20, 2007 Author Share Posted March 20, 2007 I was just going to mention Net View. I'm working on the same issue, but I think I'll just go with scanning ip's and giving users an option to input them manually. nbtstat can be a usefull tool if you want to get the computername from an IP-adress. Want an example?Yes please.... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BrettF Posted March 20, 2007 Author Share Posted March 20, 2007 @bert This will list all the share information in a PC. $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Share", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "AccessMask: " & $objItem.AccessMask & @CRLF $Output = $Output & "AllowMaximum: " & $objItem.AllowMaximum & @CRLF $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "MaximumAllowed: " & $objItem.MaximumAllowed & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "Path: " & $objItem.Path & @CRLF $Output = $Output & "Status: " & $objItem.Status & @CRLF $Output = $Output & "Type: " & $objItem.Type & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_Share" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc So you need to wite a text file with all PC names in it and that to an Array, This way you can pick up all share info from those PC's. Enjoy !! ptrex That worked really well.... How can I get shared info from other computers?? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
dinodod Posted March 21, 2007 Share Posted March 21, 2007 That worked really well.... How can I get shared info from other computers??That may be something I can help you with if you can wait. In my Macgyver Toolkit, I am actually working on just that same issue as well. What i am trying to do is then use SQLite to store the results. For now, I think a real time report would be easier.The answer may lie in the leverage of WMI, something that is really quite a marvel once you understand it. But what if the application isn't registered? Then what? Then I say, you have to manually search the HD for files which as you can imagine, might take some time. This is where I was thinking I could hack into Windows Desktop Search engine / Google Desktop and see if I could rip out their data (If the PC is already using those tools).As I work on this, I can let you know if you don't mind waiting. My schedule is pretty crazy so I don't know how long it might take me. The WMI portion shouldn't take long and I already have the function to list the PCs and then cycle thru them. All you would need is admin rights to the remote PCs. Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007 Link to comment Share on other sites More sharing options...
CrewXp Posted March 21, 2007 Share Posted March 21, 2007 That worked really well.... How can I get shared info from other computers?? ... you mean like shared computer files? I'm pretty sure you just type \\IPADDRESS or \\COMPUTERNAME ...but it seems kinda easy. I think I'm mis-understanding your question. Link to comment Share on other sites More sharing options...
BrettF Posted March 21, 2007 Author Share Posted March 21, 2007 ... you mean like shared computer files? I'm pretty sure you just type \\IPADDRESS or \\COMPUTERNAME ...but it seems kinda easy. I think I'm mis-understanding your question. Ok... That worked but how can i find the computers in a network? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
dinodod Posted March 21, 2007 Share Posted March 21, 2007 Ok... That worked but how can i find the computers in a network?Bert, if you are a network tech, I highly recommend you read the MSDT book in order to understand XP and the next OS, VISTA. I'm a little nervous that you are asking for help on this issue cause I don't want you to do something that will cause issues later.But if you need to know...* If you are in an AD domain, then the list is in AD that you can export. In NT, it's a bit of a pain. * If the network manager is willing, he can give you a list from the DHCP.* You can always sniff your network but that requires a solid understanding of your network layout and the tools that you would use. Being that you are asking for help on this issue, I hesitate to say how to do this as you could cause serious issues depending on how you proceed. Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007 Link to comment Share on other sites More sharing options...
CrewXp Posted March 21, 2007 Share Posted March 21, 2007 can you state why you'ld want to list available pc's in the network first? Just curious. Link to comment Share on other sites More sharing options...
dinodod Posted March 21, 2007 Share Posted March 21, 2007 can you state why you'ld want to list available pc's in the network first? Just curious.Accountability, auditing, organization, & security to start with. As with any network tool, you need to hav a list of your PCs that you can throw into your tool so that it can process each one. Without that list, it's like living in the dark. You don't know how many forks and knives you have nor do you know where they are. Imagine trying to find them. How do you manage your network? Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007 Link to comment Share on other sites More sharing options...
BrettF Posted March 21, 2007 Author Share Posted March 21, 2007 Accountability, auditing, organization, & security to start with. As with any network tool, you need to hav a list of your PCs that you can throw into your tool so that it can process each one. Without that list, it's like living in the dark. You don't know how many forks and knives you have nor do you know where they are. Imagine trying to find them. How do you manage your network?Sorry. Maybe I should have been more clear. I do get your reasoning though.... I'm maybe thinking that because it is part of a workgroup I could get all the computers from there??? Its not really my network.... Its schools. And (almost) everyone shares something.... Like a masive interconnected p2p network.... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
jvanegmond Posted March 21, 2007 Share Posted March 21, 2007 I'd love to get a list of computers in a windows domain too, and not just offline ones with 'net view'. github.com/jvanegmond Link to comment Share on other sites More sharing options...
BrettF Posted March 21, 2007 Author Share Posted March 21, 2007 I'd love to get a list of computers in a windows domain too, and not just offline ones with 'net view'.Hmm..... I'm doing some reasearch now, seeing possible methods to get all computers in a workgroup... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
jvanegmond Posted March 21, 2007 Share Posted March 21, 2007 (edited) Hmm..... I'm doing some reasearch now, seeing possible methods to get all computers in a workgroup... I'll join your research. I'm leaving domains and trying to get all computers in a workgroup too.Edit: I know for fact that a router keeps a DHCP list. Getting that list might solve your problems.. Edited March 21, 2007 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
jvanegmond Posted March 21, 2007 Share Posted March 21, 2007 (edited) Yes please.... $Info = _GetMacAndName("192.168.2.103") If Not @error Then MsgBox(0x40,"_GetMacAndName()",$Info[0] & @CRLF & $Info[1]) Else MsgBox(0x20,"_GetMacAndName()", "Connection timed out. We were unable to get the mac-adress and name of the remote computer.") EndIf Func _GetMacAndName($g_IP) Dim $Return[2] $PID = Run(@ComSpec & " /c nbtstat -A " & $g_IP,@ScriptDir,@SW_HIDE,2) While ProcessExists($PID) Sleep(50) WEnd $nRead = StdoutRead($PID,1024) $Mac = StringRegExp($nRead,"([A-F0-9]{2}-?){6}",2) If Not @error Then $Computername = StringRegExp($nRead,"[^\n]+<..>",3) If Not @error Then $Computername = StringStripWS(StringTrimRight($Computername[0],4),8) $Return[0] = $Computername $Return[1] = $Mac[0] SetError(0) Return $Return EndIf EndIf SetError(1) Return 0 EndFunc Edited March 21, 2007 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
BrettF Posted March 21, 2007 Author Share Posted March 21, 2007 (edited) I'll join your research. I'm leaving domains and trying to get all computers in a workgroup too.Edit: I know for fact that a router keeps a DHCP list. Getting that list might solve your problems..It would probably be easier to not try find that out............ I have no idea what the schools net even looks like.... With the whole place wireless, and everyone from grade 5 having laptops.... there's a few of them around..... (Last count around 2000+) and every person has 100mb of online storage (already around 200gb) But for what type the network is I have no idea.... I can tell you there's a proxy. and that the room with all the networking stuff has independant aircon! and they cant even get us some... I did find a delphi code snipit, but it didnt really help.... Edited March 21, 2007 by bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
jinxter Posted March 21, 2007 Share Posted March 21, 2007 so ... basically you're just trying to grab stuff from other students computers without them knowing ? you could do a ipscan of the network, just use the netmask to figure out the span. Prolly the easiest way if you're unable to browse the DHCP-server. > there are 10 types of people in the world, those who understand binary and those who don't. Link to comment Share on other sites More sharing options...
CrewXp Posted March 21, 2007 Share Posted March 21, 2007 (edited) so ... basically you're just trying to grab stuff from other students computers without them knowing ? you could do a ipscan of the network, just use the netmask to figure out the span. Prolly the easiest way if you're unable to browse the DHCP-server.Heh..Anywho, Quite an easy task, but it sounds like them two got it. If they want to research it, the better! It'll be easier for them to understand. Edited March 21, 2007 by CrewXp Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now