Re: [Gambas-user] Obtain my IP with Gambas
you don't need a root account or root priviledges to get the IP address: just do a Shell "ip -4 addr show eth0 | grep inet" TO ipaddr and just parse the IP from that line. Note that eth0 is the name of your network interface. Hope this helps to simplify things in your code. Dimitris On Mon, Oct 28, 2013 at 11:41 AM, PICCORO McKAY Lenz wrote: > From: Jussi Lahtinen > > Hard to say without knowing what FAuth does. > > Can you make little runnable project to demonstrate your problem? > not necesary, the code explint itseft.. > but thanks was my fault, i declared the result of shell as integer, > event string... > that's why skip dialog, ;-) > > > -- > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk > ___ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > -- Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
From: Jussi Lahtinen > Hard to say without knowing what FAuth does. > Can you make little runnable project to demonstrate your problem? not necesary, the code explint itseft.. but thanks was my fault, i declared the result of shell as integer, event string... that's why skip dialog, ;-) -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
> I try to recover my local ip from network, and tryng this code, why > skip the dialog?: > Hard to say without knowing what FAuth does. Can you make little runnable project to demonstrate your problem? > when executed, and imput code are same as "1234", dont print and skip > lines follow > Probably due "Catch". The root account its the only that have access to ifconfig command by > security issues.. so must try using full path... > ??? Jussi -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
I try to recover my local ip from network, and tryng this code, why skip the dialog?: Public Sub btnenviocentral_Click() Dim ipaddr As Integer = 2 fauth = New FAuth If fauth.ShowModal() Or Not fauth.inputcodigo Then ' if nothinhg was input cancel an try again Return Else Shell "/sbin/ifconfig| grep -w 'inet addr' | grep -v '127.0.0.1' | cut -d: -f2| awk '{print $1}' " To ipaddr Print ipaddr If Comp(fauth.inputcodigo, "1234", gb.IgnoreCase) == 0 Then Message.Info("ip: '" & ipaddr & "'") Else Message.Error("worng passd.") Return Endif Endif Catch End when executed, and imput code are same as "1234", dont print and skip lines follow The root account its the only that have access to ifconfig command by security issues.. so must try using full path... -- Lenz McKAY Gerardo (PICCORO) http://qgqlochekone.blogspot.com -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
Sorry here is a revised one with a wan IP lookup DIM mycmd AS String DIM myIP AS String DIM myWanIP AS String 'returns the ip of a particular device replace eth0 with the name of the device mycmd = "ifconfig eth0| grep -w 'inet addr'| cut -d: -f2| awk '{print $1}'" 'mycmd = "ifconfig| grep -w 'inet addr' | grep -v '127.0.0.1' | cut -d: -f2| awk '{print $1}'" SHELL mycmd TO myIP PRINT myip 'You need wget to get this from the internet. 'mycmd = "wget www.whatismyip.com/automation/n09230945.asp -O - -q" 'using whatismyip mycmd = "wget www.sjdsoft.hk/getip.php -O - -q" 'using my webserver (seems faster based in Hong Kong) SHELL mycmd TO myWanIP PRINT myWanIP On Thu, 2009-09-10 at 11:20 +0800, Steven James Drinnan wrote: > You could try this > > DIM mycmd AS String > DIM myIP AS String > > > mycmd = "ifconfig| grep -w 'inet addr' | grep -v '127.0.0.1' | cut -d: > -f2| awk '{print $1}'" > > SHELL mycmd TO myip > > PRINT myip > > Have not confirmed what it returns but by the looks it returns the local > assigned ip. Not the wan side. > > > On Wed, 2009-09-09 at 19:12 +0200, Jean-Yves F. Barbier wrote: > > Benoît Minisini a écrit : > > >> On Wednesday 09 September 2009, Benoît Minisini wrote: > > it's OK, I think there must be something like User.IP :) > > > > Regards > > > > > > -- > > David > > >>> The IP address is not related to the user at all. > > >> How about System.IP? > > >> > > >> > > >> However David Villalobos did not tell which IP he wants. > > >> I do have a IP at the incomming connection of my building. > > >> For me known as WAN and a IP at the box, known to me as LAN. > > >> > > >> http://www.myipaddress.com for your WAN IP address :) > > >> > > >> Best regards, > > >> > > >> Ron_1st > > >> > > > > > > IP address are attached to network interfaces, and I'm not sure that a > > > network > > > interface could not have several IP, and different types of IPs. > > > > yep, that's right. > > ie: you can easily attach multiple IP adresses to an Ethernet interface as > > aliases, > > thus having one ethernet HW I/F that have 10 different IP addresses. > > > > > Instead of adding thousands lines of code to the interpreter, I think the > > > better is parsing the output of the ifconfig command. > > > > that's right too, many programs/scripts return different strings, obliging > > the dev to consider each possible return > > > > JY > > > -- > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > ___ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
You could try this DIM mycmd AS String DIM myIP AS String mycmd = "ifconfig| grep -w 'inet addr' | grep -v '127.0.0.1' | cut -d: -f2| awk '{print $1}'" SHELL mycmd TO myip PRINT myip Have not confirmed what it returns but by the looks it returns the local assigned ip. Not the wan side. On Wed, 2009-09-09 at 19:12 +0200, Jean-Yves F. Barbier wrote: > Benoît Minisini a écrit : > >> On Wednesday 09 September 2009, Benoît Minisini wrote: > it's OK, I think there must be something like User.IP :) > > Regards > > > -- > David > >>> The IP address is not related to the user at all. > >> How about System.IP? > >> > >> > >> However David Villalobos did not tell which IP he wants. > >> I do have a IP at the incomming connection of my building. > >> For me known as WAN and a IP at the box, known to me as LAN. > >> > >> http://www.myipaddress.com for your WAN IP address :) > >> > >> Best regards, > >> > >> Ron_1st > >> > > > > IP address are attached to network interfaces, and I'm not sure that a > > network > > interface could not have several IP, and different types of IPs. > > yep, that's right. > ie: you can easily attach multiple IP adresses to an Ethernet interface as > aliases, > thus having one ethernet HW I/F that have 10 different IP addresses. > > > Instead of adding thousands lines of code to the interpreter, I think the > > better is parsing the output of the ifconfig command. > > that's right too, many programs/scripts return different strings, obliging > the dev to consider each possible return > > JY -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
On Wednesday 09 September 2009, Benoît Minisini wrote: > IP address are attached to network interfaces, and I'm not sure that a > network > interface could not have several IP, and different types of IPs. > Yes it can be done. More IP at one interface. I have a remote sites IP addres as second IP on my card. This way I can develop local a page with embeded IP's in code and test on my ownbox before upload to the real site. Very handy to test flash objects that are only allowed to get data from fixed IP. In ifconfig: eth0 Link encap:Ethernet HWaddr 00:e0:18:f8:37:7e inet addr:192.168.1.33 Bcast:192.168.1.255 Mask:255.255.255.0 ... eth0:0Link encap:Ethernet HWaddr 00:e0:18:f8:37:7e inet addr:10.0.0.128 Bcast:10.0.0.255 Mask:255.255.255.0 ... eth0:1Link encap:Ethernet HWaddr 00:e0:18:f8:37:7e inet addr:212.16.xxx.xxx Bcast:212.16.xxx.255 Mask:255.255.255.0 ... This an be done by: ifconfig eth0:0 xx.xx.xx.xx netmask yy.yy.yy.yy up where eth0 is your primary interface and eth0:0 is a virtual one > Instead of adding thousands lines of code to the interpreter, I think the > better is parsing the output of the ifconfig command. > > -- >Benoît Minisini ps Also on windows :) http://www.metacafe.com/watch/331275/multiple_ip_address_on_same_network_card_windows/ http://www.pc1news.com/how-to-bind-multiple-ip-address-to-a-single-network-card-796.html Best regards, Ron_1st -- -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
Benoît Minisini a écrit : >> On Wednesday 09 September 2009, Benoît Minisini wrote: it's OK, I think there must be something like User.IP :) Regards -- David >>> The IP address is not related to the user at all. >> How about System.IP? >> >> >> However David Villalobos did not tell which IP he wants. >> I do have a IP at the incomming connection of my building. >> For me known as WAN and a IP at the box, known to me as LAN. >> >> http://www.myipaddress.com for your WAN IP address :) >> >> Best regards, >> >> Ron_1st >> > > IP address are attached to network interfaces, and I'm not sure that a > network > interface could not have several IP, and different types of IPs. yep, that's right. ie: you can easily attach multiple IP adresses to an Ethernet interface as aliases, thus having one ethernet HW I/F that have 10 different IP addresses. > Instead of adding thousands lines of code to the interpreter, I think the > better is parsing the output of the ifconfig command. that's right too, many programs/scripts return different strings, obliging the dev to consider each possible return JY -- I'm rated PG-34!! -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
> On Wednesday 09 September 2009, Benoît Minisini wrote: > > > it's OK, I think there must be something like User.IP :) > > > > > > Regards > > > > > > > > > -- > > > David > > > > The IP address is not related to the user at all. > > How about System.IP? > > > However David Villalobos did not tell which IP he wants. > I do have a IP at the incomming connection of my building. > For me known as WAN and a IP at the box, known to me as LAN. > > http://www.myipaddress.com for your WAN IP address :) > > Best regards, > > Ron_1st > IP address are attached to network interfaces, and I'm not sure that a network interface could not have several IP, and different types of IPs. Instead of adding thousands lines of code to the interpreter, I think the better is parsing the output of the ifconfig command. -- Benoît Minisini -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
On Wednesday 09 September 2009, Benoît Minisini wrote: > > it's OK, I think there must be something like User.IP :) > > > > Regards > > > > > > -- > > David > > > > The IP address is not related to the user at all. > How about System.IP? However David Villalobos did not tell which IP he wants. I do have a IP at the incomming connection of my building. For me known as WAN and a IP at the box, known to me as LAN. http://www.myipaddress.com for your WAN IP address :) Best regards, Ron_1st -- -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
Hi, It works just fine. Thanks Jean-Yves Regards -- David - Original Message From: Jean-Yves F. Barbier <12u...@gmail.com> To: mailing list for gambas users Sent: Wednesday, September 9, 2009 9:44:14 AM Subject: Re: [Gambas-user] Obtain my IP with Gambas David Villalobos Cambronero a écrit : > Hi, is there an easy way to obtain my IP address? by shell, I use: ifconfig | grep inet | cut -d: -f2 | cut -d' ' -f1 | grep -v 127 if you have multiple interfaces, you must add (for each unwanted): | grep -v nnn.nnn.nnn.nnn at the end HTH JY -- I don't mind what Congress does, as long as they don't do it in the streets and frighten the horses. -- Victor Hugo -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
> it's OK, I think there must be something like User.IP :) > > Regards > > > -- > David > The IP address is not related to the user at all. -- Benoît Minisini -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
David Villalobos Cambronero a écrit : > Hi, is there an easy way to obtain my IP address? by shell, I use: ifconfig | grep inet | cut -d: -f2 | cut -d' ' -f1 | grep -v 127 if you have multiple interfaces, you must add (for each unwanted): | grep -v nnn.nnn.nnn.nnn at the end HTH JY -- I don't mind what Congress does, as long as they don't do it in the streets and frighten the horses. -- Victor Hugo -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
it's OK, I think there must be something like User.IP :) Regards -- David - Original Message From: nando To: mailing list for gambas users Sent: Wednesday, September 9, 2009 9:23:55 AM Subject: Re: [Gambas-user] Obtain my IP with Gambas The way I do it is by shelling the ip command At the prompt: ip addr | grep -w "inet" I have redirected it to a file and parse items the lines I have used SHELL ".." FOR READ and used PROCESS_READ to parse the lines Somebody may have something much more elegant. -Fernando -- Original Message --- From: David Villalobos Cambronero To: Gambas Inglés Sent: Wed, 9 Sep 2009 07:52:43 -0700 (PDT) Subject: [Gambas-user] Obtain my IP with Gambas > Hi, is there an easy way to obtain my IP address? > > Regards > > -- > David > > -- > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > ___ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user --- End of Original Message --- -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Obtain my IP with Gambas
The way I do it is by shelling the ip command At the prompt: ip addr | grep -w "inet" I have redirected it to a file and parse items the lines I have used SHELL ".." FOR READ and used PROCESS_READ to parse the lines Somebody may have something much more elegant. -Fernando -- Original Message --- From: David Villalobos Cambronero To: Gambas Inglés Sent: Wed, 9 Sep 2009 07:52:43 -0700 (PDT) Subject: [Gambas-user] Obtain my IP with Gambas > Hi, is there an easy way to obtain my IP address? > > Regards > > -- > David > > -- > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > ___ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user --- End of Original Message --- -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] Obtain my IP with Gambas
Hi, is there an easy way to obtain my IP address? Regards -- David -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user