Sign in to follow this  
Followers 0
Westi

Get your offical IP address

22 posts in this topic

Maybe useful for computers behind routers or with NAT or ip masquerading:

This is the updated version from: IP Help !

MyIP.au3

Opt("TrayIconHide", 1)
Opt("MustDeclareVars", 1) 
Dim $INI, $POS, $IP, $URLS, $URL, $I, $IPTMP, $FS, $FILE, $LINE, $LINE1
$INI = @ScriptDir & "\myip.ini"

If FileExists($INI) = 0 Then
IniWrite($INI, "URL", "1", "dynupdate.no-ip.com")
IniWrite($INI, "URL", "2", "www.bpftpserver.com")
IniWrite($INI, "URL", "3", "www.minasithil.org")
IniWrite($INI, "URL", "4", "ressourcen.snooweatinganima.de")
IniWrite($INI, "URL", "5", "dasdeck.de/staff/valentin/tools")
IniWrite($INI, "URL", "6", "julien.games-fed.com")
IniWrite($INI, "URL", "7", "www.dorm.org/~dorm")
IniWrite($INI, "URL", "8", "www.ois.uic.edu/pubtools")
IniWrite($INI, "URL", "9", "www.espresso.iki.fi/pub/php")
IniWrite($INI, "URL", "10", "www.vtcz.ch")
IniWrite($INI, "URL", "11", "pmh.compunet.hu/tenzor")
IniWrite($INI, "URL", "12", "www.spunge.org/~oblivion")
IniWrite($INI, "URL", "13", "Dev.trag.nl")
IniWrite($INI, "URL", "14", "naholyr.free.fr")
IniWrite($INI, "URL", "15", "mgt.heinrich.free.fr")
IniWrite($INI, "URL", "16", "www.liero-masters.host.sk")
IniWrite($INI, "URL", "17", "www.zoo-gate.fi")
IniWrite($INI, "URL", "18", "filezilla.sourceforge.net/misc/")
IniWrite($INI, "URL", "19", "cipres.cec.uchile.cl/~hvergara")
IniWrite($INI, "URL", "20", "www.nicoland.de/scripts")
IniWrite($INI, "URL", "URLS", "20")
IniWrite($INI, "URL", "Warning1", "Don't add addresses in another format!(No leading: http:// etc.)")
IniWrite($INI, "URL", "Warning2", "The program searches for a script called: ip.php")
IniWrite($INI, "URL", "Warning3", "The output from ip.php is the pure IP address!(No leading: Your IP is:)")
EndIF

$POS = 0
$IP = 0
$URLS = IniRead($INI, "URL", "URLS", "")

;delete forgotten tempfiles
For $I = 1 To $URLS
   FileDelete(@ScriptDir & "\" & $POS + 1 & ".htm")
Next

While $POS < $URLS

   FileDelete(@ScriptDir & "\" & $POS - 1 & ".htm")
   $POS = $POS + 1
   $IPTMP = @ScriptDir & "\" & $POS & ".htm"
   $URL = IniRead($INI, "URL", $POS, "")
   $IP = URLDownloadToFile("http://" & $URL & "/ip.php", $IPTMP)
   $FS = FileGetSize($IPTMP)

;Who can made it easier ?! 
   If FileExists ($IPTMP) = 0 Then ContinueLoop
     If $FS > 16 Then
     ContinueLoop
   Else
     If $FS < 8 then ContinueLoop
   EndIf
 If $FS <= 16 then ExitLoop

Wend

If $POS >= $URLS then Error("NO URL AVAILABLE." & @CR & "ARE YOU OFFLINE!?" & @CR & "EXIT!")
$FILE = FileOpen($IPTMP, 0)
    If $FILE = -1 Then Error("Unable to open " & $URL)
$LINE = FileReadLine($FILE)

;check the result
$LINE1 = StringReplace($LINE, ".", "")
If StringIsDigit($LINE1) Then

;do something with the output, $line is your IP
  ;ClipPut($LINE)
  ;WinSetTitle ( "FRITZ!web DSL", "", $line )
   MsgBox(0, "Current IP Address:", $LINE)
Else

;show the error in default browser instead of IE
   RunWait(@ComSpec & " /c start " & $IPTMP, "", @SW_HIDE)

;pause script to load the file
   Sleep(1000)
EndIf

FileClose($FILE)
FileDelete($IPTMP)

Exit

Func Error($TXT)
   MsgBox(48, "Error", $TXT)
   Exit
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Westi,

What are you doing to generate the image in your signature? I would love to see the script/source you are using.

Posted Image

I see my information in the image, but it says that I am running Mozilla/Netscape 5. I am actually running Netscape 7.1, not 5. Others may not see what I am talking about, but hopefully Westi understands.

Edited by Nutster

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

That picture is created from a PHP script run everytime that picture is accessed. PHP has default variables for your ip address and browser type. Upon the aforementioned access the script takes the ip address and browser type variables and parses them into one of several pictures (along with one of several messages) chosen at random. You can find out how to create your own here:

http://www.iceteks.com/articles.php?act=vi...le=textsig&p=1&

Share this post


Link to post
Share on other sites

The one I see says I look at to much P0rn ..

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I made also a script for taking the real external ip, here it is:

URLDownloadToFile("http://www.whatismyipaddress.com/index.asp","temp")
$ip = FileReadLine("temp",1)
FileDelete("temp")
$ip = StringReplace($ip,"Our server doesn't like your browser (non-existant " & _
   "user agent), try something more standard. Here's your IP address: ","")
MsgBox(64,"IP address","Your IP address is:" & @lf & $Ip)

It uses the free service of whatismyipaddress.com .

Edited by ezzetabi

Share this post


Link to post
Share on other sites

Westi,

What are you doing to generate the image in your signature?  I would love to see the script/source you are using. 

I see my information in the image, but it says that I am running Mozilla/Netscape 5.  I am actually running Netscape 7.1, not 5.

You've copied the url, so you can see: www.danasoft.com/sig/Scan1.jpg

Goto danasoft and make your own.

I 've never see the php source and don't know why you use such an old browser. :ph34r:

http://www.autoitscript.com/fileman/users/public/Westi/scan1.png

@ezzetabi

What's the output of the script, if you're offline or the site is unavailable ?

I use this for online games, messenger and Ultr@VNC.

We know to take the external IP, but others don't...

This is what i get:

http://www.autoitscript.com/fileman/users/public/Westi/wrong.png

My script returns : 80.133.112.215

Westi

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I do not know what to say... It worked until today... I do not know why now it gives that parsing error... We are stuck in your implementation I guess :ph34r:

Edited by ezzetabi

Share this post


Link to post
Share on other sites

It is probably better to use Westi's version because that generates less bandwidth. On WhatIsMyIP.com, there is now a notice asking that his page not be loaded from automated scripts because this is eating a lot of his bandwidth.


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

A modification of ezzetabi's script:

FileChangeDir(@TempDir);make the Temp folder the current directory
URLDownloadToFile("http://www.whatismyipaddress.com/", "ip_temp")
$ip = FileReadLine("ip_temp",1)
FileDelete("ip_temp")
$ip = StringReplace($ip, "Nonexistant User-Agent. IP address: ","")
MsgBox(4096,"IP address", "Your IP address is " & $ip);simple message box

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

http://whatismyip.com

:(

urldownloadtofile, parse, end of story :ph34r:

*edit* oops, you beat me to it - oh well

Edited by mcfr1es

Roger! You son of a big pile o' Monkey Nuts.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

@dnsi

You might consider changing your sig if you read the forum rules.

So try to limit sigs to:

- A couple of inches in size

- If it contains an image, have consideration for everyone that has to download it (filesize)

- No "Your IP is nn.nn.nn.nn" images.

Edited by big_daddy

Share this post


Link to post
Share on other sites

A modification of ezzetabi's script:

FileChangeDir(@TempDir);make the Temp folder the current directory
URLDownloadToFile("http://www.whatismyipaddress.com/", "ip_temp")
$ip = FileReadLine("ip_temp",1)
FileDelete("ip_temp")
$ip = StringReplace($ip, "Nonexistant User-Agent. IP address: ","")
MsgBox(4096,"IP address", "Your IP address is " & $ip);simple message box
Gives the wrong IP address and

No User-Agent; Http requests to this site require a valid user-agent string to be passed.


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Why even download the file? Cant you just get the source of it using _INetGetSource('www.url.com/ip.php') ? And then parse the results if needed?

Share this post


Link to post
Share on other sites

Why even download the file? Cant you just get the source of it using _INetGetSource('www.url.com/ip.php') ? And then parse the results if needed?

-or-

#include<inet.au3>
$ip = _GetIP()

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Yes, or that hehe :)

Share this post


Link to post
Share on other sites

-or-

#include<inet.au3>
$ip = _GetIP()
The beta help file needs a better search function... :)

Thanks for the help, anyway!


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

The beta help file needs a better search function... :mellow:

Open Search page and type "IP" and hit List_Topics... second hit ... not bad i would say :)

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Open Search page and type "IP" and hit List_Topics... second hit ... not bad i would say :)

I`m sure that the last time it only listed the Macros.

if you type getIP in the search tab it does`nt return a listing, but if you type the same thing in the Index, it does!

Not exactly consistent....


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

I`m sure that the last time it only listed the Macros.

if you type getIP in the search tab it does`nt return a listing, but if you type the same thing in the Index, it does!

Not exactly consistent....

Some people are never happy ... :)

The index is a sorted list of keywords and ignores leading underscores, but the search doesn't..

If your not happy with that you need to write to our friends at Microsoft since we are using standard Helpfile functionality ...

oh and when you type "get ip address" is does show up , which to me looks like a more logical search.....

:mellow:

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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