Sign in to follow this  
Followers 0
fraudh8er

List of computer on the network

8 posts in this topic

i was wondering if i can do the following in autolt:

1. list the computers on the network

2. display the external ip address, like via www.whatismyip.com or something.

thanks you

you guys rock

Share this post


Link to post
Share on other sites



send a net view to a file, take all the names out of the file and ping them. Now you have name and IP.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Not pretty, but here is an example.

RunWait(@ComSpec & " /c net view >c:\templist.txt","",@SW_MINIMIZE)
$file="c:\templist.txt"
$lines=StringReplace(Fileread($file,FileGetSize($file)),@LF,@CR)
$lines=StringSplit($lines,@CR)

For $i=1 To $lines[0]
If StringLeft($lines[$i],2)="\\" Then
$compname=StringLeft(StringTrimLeft($lines[$i],2),StringInStr($lines[$i],"   ")-3)
RunWait(@ComSpec & " /c ping -n 1 "& $compname & " >c:\tempip.txt","",@SW_HIDE)
$parse=FileRead("c:\tempip.txt",5000)
$ip=StringTrimLeft($parse,StringInStr($parse,"["))
$ip=StringLeft($ip,StringInStr($ip,"]")-1)
    MsgBox(1,$compname,$IP)
EndIf    

Next

oops, you wanted External IP. well for that you will need to run something on thier computer. I use tools from sysinternals for that type of thing.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

well after i posted i realized that i could take the www.whatismyip.com and make it a text file and just look for the ip address. but i am not sure how to parse a text file.

i have this part of the text file i need to get a ip addres out of:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<HTML>

<HEAD>

<TITLE>Your ip is 24.179.13.137 WhatIsMyIP.com</TITLE>

<meta name="Keywords" content="IP, address, address translation, proxy, firewall, dhcp, network, games, voice chat, tutorials">

this is not m real ip address for obvious reasons.

Not pretty, but here is an example.

RunWait(@ComSpec & " /c net view >c:\templist.txt","",@SW_MINIMIZE)
$file="c:\templist.txt"
$lines=StringReplace(Fileread($file,FileGetSize($file)),@LF,@CR)
$lines=StringSplit($lines,@CR)

For $i=1 To $lines[0]
If StringLeft($lines[$i],2)="\\" Then
$compname=StringLeft(StringTrimLeft($lines[$i],2),StringInStr($lines[$i],"   ")-3)
RunWait(@ComSpec & " /c ping -n 1 "& $compname & " >c:\tempip.txt","",@SW_HIDE)
$parse=FileRead("c:\tempip.txt",5000)
$ip=StringTrimLeft($parse,StringInStr($parse,"["))
$ip=StringLeft($ip,StringInStr($ip,"]")-1)
    MsgBox(1,$compname,$IP)
EndIf    

Next

oops, you wanted External IP.  well for that you will need to run something on thier computer. I use tools from sysinternals for that type of thing.

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

i am an idiot, you just showed he how to do it in you program, i shoudl be ok, but will let you know if not.

well after i posted i realized that i could take the www.whatismyip.com and make it a text file and just look for the ip address.  but i am not sure how to parse a text file.

i have this part of the text file i need to get a ip addres out of:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<HTML>

<HEAD>

<TITLE>Your ip is 24.179.13.137 WhatIsMyIP.com</TITLE>

<meta name="Keywords" content="IP, address, address translation, proxy, firewall, dhcp, network, games, voice chat, tutorials">

this is not m real ip address for obvious reasons.

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

any problems, post the code. Good to do it on your own a bit though. Parsing is nice once you get the hang of it.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Here is the code that was shown to me just for www.whatismyip.com :)

If URLDownloadToFile("http://www.whatismyip.com",@tempdir & "\~ip.tmp") Then
      $IP = FileRead(@tempdir & "\~ip.tmp",FileGetSize(@tempdir & "\~ip.tmp"))
      FileDelete(@tempdir & "\~ip.tmp")
      $IP = StringTrimLeft($IP,StringInStr($IP,"<TITLE>Your ip is ")+17)
      $IP = StringLeft($IP,StringInStr($IP," WhatIsMyIP.com</TITLE>")-1)      
      Return $ip
   Else
      SetError(1)
      Return -1
   EndIf

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Just a thought,

If you get a list of computers on your network, would it be safe to assume that every computer is sharing a common internet connection? If yes then all of the PC's will return the same value from www.whatismyip.com


CheersNobby

Share this post


Link to post
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
Sign in to follow this  
Followers 0