Archive: Get IP


Get IP
well, i know this might be difficult. i was wondering if it is possible to get the machine's ip connected to the internet (not local ip). you might say that this is unnecessary since many people are on dialup, but the installer i'm working on is targeted for servers with 24/7 connection. so if there's a possibility to get the ip, please let me know!

thanks in advance,

jan


I'm pretty sure NSIS doesn't do anything like that, but you should be able to use NET.EXE or something.


if it was a windows based sever with dos or dos support then you could use "ipconfig" or "winipcfg" then once you've got that then output to file or something.
hope i helped.


Please be more specific. _What_ IP?
Not local but the IP "coonected to the internet"
What the hell do you mean?

Probably that:


Machine-->LAN--->Router/Firewall+->INET
^
|
This one ?


If yes, that's nearly impossible. Some router can be queried via snmp but the MIBS are different models. Probably traceroute with some postprocessing of it's output ..

Or do you mean the default gateway?
Thats simple, run ipconfig and parse it's
output.

Ciao
-Fritz

Originally posted by bballer182
if it was a windows based sever with dos or dos support then you could use "ipconfig" or "winipcfg" then once you've got that then output to file or something.
hope i helped.
i know how to find out my ip dude, but i want NSIS to do that.

let's take my rig as example. i got to NICs in my machine, one for the lan (localhost), the other one is connected to the internet. although i know the ip, i'd like NSIS to query the ip connected to the internet and add it to the .ini of my installer's application.

You can write a simple plugin for NSIS in c++ to add the users ip address to a register in NSIS. Then you can do whatever you want with the ip. If you want some source code for this, let me know.

Rob


if it was a hop throught the machine then you could use trace route or "tracert".


Originally posted by bballer182
if it was a hop throught the machine then you could use trace route or "tracert".
maybe re-read my post... my question was not for a command in windows but for a function within NSIS (guess why i posted it HERE).

sorry just trying to help


Originally posted by killahbite


maybe re-read my post... my question was not for a command in windows but for a function within NSIS (guess why i posted it HERE).
Maybe you misunderstood my (and other people's) answers, so here some more elaborated:

Run ipconfig from within NSIS by using the ExecWait function of NSIS. Redirect its output to a temporary file. Then read that file by using the FileOpen/FileRead/FileClose functions and filter the lines for the desired value by using String functions. Of course, the filtering is not trivial with NSIS' limited string functions, (hint: use StrStr from the function examles as a start.)

Or you can also use rainwater's approach with an external DLL (i would do that if i had you problem) but i expect, you don't want that, because otherwise you wouldn't have asked and started hacking away a DLL ;-)

Ciao
-Fritz

Quote:


thats exactly what i was talking about Fritz thanx for the backup

Originally posted by felfert


Maybe you misunderstood my (and other people's) answers, so here some more elaborated:

Run ipconfig
from within NSIS by using the ExecWait function of NSIS. Redirect its output to a temporary file. Then read that file by using the FileOpen/FileRead/FileClose functions and filter the lines for the desired value by using String functions. Of course, the filtering is not trivial with NSIS' limited string functions, (hint: use StrStr from the function examles as a start.)

Or you can also use rainwater's approach with an external DLL (i would do that if i had you problem) but i expect, you don't want that, because otherwise you wouldn't have asked and started hacking away a DLL ;-)

Ciao
-Fritz