fraudh8er Posted November 12, 2004 Share Posted November 12, 2004 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 Link to comment Share on other sites More sharing options...
scriptkitty Posted November 12, 2004 Share Posted November 12, 2004 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. Link to comment Share on other sites More sharing options...
scriptkitty Posted November 12, 2004 Share Posted November 12, 2004 (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 November 12, 2004 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
fraudh8er Posted November 12, 2004 Author Share Posted November 12, 2004 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 Nextoops, 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}> Link to comment Share on other sites More sharing options...
fraudh8er Posted November 12, 2004 Author Share Posted November 12, 2004 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}> Link to comment Share on other sites More sharing options...
scriptkitty Posted November 12, 2004 Share Posted November 12, 2004 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. Link to comment Share on other sites More sharing options...
JSThePatriot Posted November 13, 2004 Share Posted November 13, 2004 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) Link to comment Share on other sites More sharing options...
nobby Posted November 13, 2004 Share Posted November 13, 2004 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 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