Re: IP address to binary conversion

2020-05-09 Thread al . alexiev
Hi Alan, Yes, agreed that any '!I' or '!L' combination will work on different type of platforms in a consistent manner, when applied in both directions. I was referring to Alex Martelli's output, where the conversion back to IP seems to be reversed, even with '!L', which means that he's already

Re: IP address to binary conversion

2020-05-08 Thread Alan Bawden
al.alex...@gmail.com writes: > Just for the records and to have a fully working bidirectional solution: > > >>> ip > '10.44.32.0' > >>> struct.unpack('L', socket.inet_aton(ip))[0] > 2108426 > >>> socket.inet_ntoa(struct.pack(' '10.44.32.0' > >>> > > Good luck ;-) This will not work as expected

Re: IP address to binary conversion

2020-05-08 Thread al . alexiev
Just for the records and to have a fully working bidirectional solution: >>> ip '10.44.32.0' >>> struct.unpack('L', socket.inet_aton(ip))[0] 2108426 >>> socket.inet_ntoa(struct.pack('>> Good luck ;-) -- https://mail.python.org/mailman/listinfo/python-list

Re: getfqdn passes a hostname to gethostbyaddr instead of an ip address

2018-09-12 Thread Thomas Jollans
docs say, turning the hostname into an IP address and working with that would be incorrect. Say we have a server, 'fred.weasley.example.com', which is also known as 'www.example.com'. Its reverse DNS pointer is 'fred.weasley.example.com'. Now, if we have 'e

Re: getfqdn passes a hostname to gethostbyaddr instead of an ip address

2018-09-12 Thread Rhodri James
On 12/09/18 15:29, Florian Bergmann wrote: Hello, While I was debugging some salt issues I dug into the python code and found a piece of code in the `socket.py` module that surprised my a bit: In the `getfqdn` function the `gethostbyaddr` name function is being called with a `hostname` instead

getfqdn passes a hostname to gethostbyaddr instead of an ip address

2018-09-12 Thread Florian Bergmann
for name in aliases: if '.' in name: break else: name = hostname return name ``` 1. `gethostname()`: The documentation states: ``` Return a string containing the hostname of the machine where the Python interpreter is curren

Re: urllib/urllib2 support for specifying ip address

2014-06-19 Thread Chris Angelico
On Fri, Jun 20, 2014 at 12:19 AM, Robin Becker wrote: > in practice [monkeypatching socket] worked well with urllib in python27. Excellent! That's empirical evidence of success, then. Like with all monkey-patching, you need to keep it as visible as possible, but if your driver script is only a p

Re: urllib/urllib2 support for specifying ip address

2014-06-19 Thread Robin Becker
t sure why it hasn't been updated beyond that), pull up urllib2.py, and step through manually, seeing where the hostname gets turned into an IP address. Hence, this code: . in practice this approach worked well with urllib in python27. -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list

Re: urllib/urllib2 support for specifying ip address

2014-06-19 Thread Chris Angelico
Basically, what I did was go to my Python 2 installation (which happens to be 2.7.3, because that's what Debian Wheezy ships with - not sure why it hasn't been updated beyond that), pull up urllib2.py, and step through manually, seeing where the hostname gets turned into an IP

Re: urllib/urllib2 support for specifying ip address

2014-06-19 Thread Robin Becker
.. Since you mention urllib2, I'm assuming this is Python 2.x, not 3.x. The exact version may be significant. I can use python >= 3.3 if required. Can you simply query the server by IP address rather than host name? According to the docs, urllib2.urlopen() doesn

Re: urllib/urllib2 support for specifying ip address

2014-06-19 Thread Chris Angelico
e > instance on a different ip address. Since you mention urllib2, I'm assuming this is Python 2.x, not 3.x. The exact version may be significant. Can you simply query the server by IP address rather than host name? According to the docs, urllib2.urlopen() doesn't check the certificate

urllib/urllib2 support for specifying ip address

2014-06-19 Thread Robin Becker
I want to run torture tests against an https server on domain A; I have configured apache on the server to respond to a specific hostname ipaddress. I don't want to torture the live server so I have set up an alternate instance on a different ip address. Is there a way to get url

Re: How to send broadcast IP address to network?

2013-08-24 Thread Irmen de Jong
On 23-8-2013 14:32, lightai...@gmail.com wrote: > I want to send a broadcast packet to all the computers connected to my home > router. > > The following 2 lines of code do not work; > host="192.168.0.102" > s.connect((host, port)) > > Can someone advise? > > Thank you. > Use UDP (datagram)

Re: How to send broadcast IP address to network?

2013-08-23 Thread Chris Angelico
On Fri, Aug 23, 2013 at 10:32 PM, wrote: > I want to send a broadcast packet to all the computers connected to my home > router. > > The following 2 lines of code do not work; > host="192.168.0.102" > s.connect((host, port)) > > Can someone advise? You can't establish a TCP socket with a broadc

Re: How to send broadcast IP address to network?

2013-08-23 Thread Neil Cerutti
On 2013-08-23, lightai...@gmail.com wrote: >> The following 2 lines of code do not work; >> >> host="192.168.0.255" >> host="192.168.0.102" >> s.connect((host, port)) Traceback (most recent call last): File "", line 1, in NameError: name 's' is not defined I bet that's not the same traceback

Re: How to send broadcast IP address to network?

2013-08-23 Thread lightaiyee
Some typo mistake. Should be host="192.168.0.255", not "192.168.0.102" On Friday, August 23, 2013 8:32:10 PM UTC+8, light...@gmail.com wrote: > I want to send a broadcast packet to all the computers connected to my home > router. > > > > The following 2 lines of code do not work; > > host="

How to send broadcast IP address to network?

2013-08-23 Thread lightaiyee
I want to send a broadcast packet to all the computers connected to my home router. The following 2 lines of code do not work; host="192.168.0.102" s.connect((host, port)) Can someone advise? Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Geo Location extracted from visitors ip address

2013-07-08 Thread Grant Edwards
On 2013-07-06, ?? Gr33k wrote: > 6/7/2013 4:41 , ??/?? ?? Gr33k : >> Yes i know iam only storing the ISP's city instead of visitor's homeland >> but this is the closest i can get: >> >> try: >>gi = pygeoip.GeoIP('/home/nikos/GeoLiteCity.dat') >>city

Re: Geo Location extracted from visitors ip address

2013-07-08 Thread Grant Edwards
On 2013-07-06, ?? Gr33k wrote: > Yes i know iam only storing the ISP's city instead of visitor's homeland > but this is the closest i can get: > > try: >gi = pygeoip.GeoIP('/home/nikos/GeoLiteCity.dat') >city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] ) >host

Re: Geo Location extracted from visitors ip address

2013-07-08 Thread Chris Angelico
he user visits out website from? >>> >>> Perhaps by utilizing his originated ip address? >> >> >> It is possible to look up the geographic region associated with a block of >> IP addresses. That does not necessarily bear any resemblence to the >> actual

Re: Geo Location extracted from visitors ip address

2013-07-08 Thread Support by Νίκος
Στις 5/7/2013 10:28 μμ, ο/η Jerry Hill έγραψε: On Fri, Jul 5, 2013 at 3:08 PM, Νίκος Gr33k wrote: Is there a way to extract out of some environmental variable the Geo location of the user being the city the user visits out website from? Perhaps by utilizing his originated ip address? No

Re: Geo Location extracted from visitors ip address

2013-07-08 Thread Robert Kern
On 2013-07-06 09:41, Νίκος Gr33k wrote: Στις 6/7/2013 11:30 πμ, ο/η Chris Angelico έγραψε: On Sat, Jul 6, 2013 at 6:01 PM, � Gr33k wrote: Is there any way to pinpoint the visitor's exact location? Yes. You ask them to fill in a shipping address. They may still lie, or they may choose to

Re: Geo Location extracted from visitors ip address

2013-07-08 Thread Jerry Hill
On Fri, Jul 5, 2013 at 3:08 PM, Νίκος Gr33k wrote: > Is there a way to extract out of some environmental variable the Geo > location of the user being the city the user visits out website from? > > Perhaps by utilizing his originated ip address? No, you'd need to take the origi

Re: Geo Location extracted from visitors ip address

2013-07-08 Thread Joel Goldstick
On Fri, Jul 5, 2013 at 3:08 PM, Νίκος Gr33k wrote: > Is there a way to extract out of some environmental variable the Geo > location of the user being the city the user visits out website from? > > Perhaps by utilizing his originated ip address? > > -- > What is now pro

Re: Geo Location extracted from visitors ip address

2013-07-07 Thread Νίκος Gr33k
Στις 6/7/2013 11:51 μμ, ο/η Νίκος Gr33k έγραψε: Στις 6/7/2013 11:32 μμ, ο/η Tim Chase έγραψε: Can you be more specific please about using the aforementioned HTML5 location API ? https://www.google.com/search?q=html5+location+api It's client-side JavaScript. so, i must edit my cgi script an

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Νίκος Gr33k
Στις 6/7/2013 11:32 μμ, ο/η Tim Chase έγραψε: Can you be more specific please about using the aforementioned HTML5 location API ? https://www.google.com/search?q=html5+location+api It's client-side JavaScript. so, i must edit my cgi script and do this: print ''' var x=document.getElementB

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Νίκος Gr33k
Στις 6/7/2013 11:33 μμ, ο/η Tim Chase έγραψε: Who controlls the script's privileges then? The process that calls the script file, i.e. Apache? Yes. When we run the python interpreter to run a python script like python metrites.py then out script will inherit the kind of access the python inte

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Tim Chase
On 2013-07-06 23:12, Νίκος Gr33k wrote: > I though that the ownership of the script file controlled the > privileges it runs under. Only if the script is SUID. In some environments, scripts can't be run SUID, only binaries. > Who controlls the script's privileges then? > The process that cal

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Tim Chase
On 2013-07-06 23:14, Νίκος Gr33k wrote: Can you be more specific please about using the aforementioned > HTML5 location API ? https://www.google.com/search?q=html5+location+api It's client-side JavaScript. > Never heard of it. Can it be utilizized via a python cgi script? Because it's client-s

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Νίκος Gr33k
Στις 6/7/2013 2:20 μμ, ο/η Tim Chase έγραψε: 1) using the aforementioned HTML5 location API, your device may be tattling on where you are. Are you browsing from a smart-phone or other device with a GPS built in? I'm using my lenovo laptop, by maps.gogole.com, fb and twitter have no problem pi

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Νίκος Gr33k
Στις 6/7/2013 5:43 μμ, ο/η Dennis Lee Bieber έγραψε: It was some guy form hostgator.com that had told me that a python script has the same level of access to anything on the filesystem as its coressponding user running it, implying that if i run it under user 'root' the python script could access

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Dave Angel
On 07/06/2013 04:41 AM, Νίκος Gr33k wrote: Στις 6/7/2013 11:30 πμ, ο/η Chris Angelico έγραψε: On Sat, Jul 6, 2013 at 6:01 PM, � Gr33k wrote: Is there any way to pinpoint the visitor's exact location? Yes. You ask them to fill in a shipping address. They may still lie, or they may choose

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Tim Chase
that this is often wrong or grossly inaccurate, as mentioned in other threads (geolocation by IP address often puts me in the nearest major city which is a good 45min drive away, and if I just visit Google maps with a fresh browser, it just shows me the state, TX, which is a ~13hr drive across, if d

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Νίκος Gr33k
Στις 6/7/2013 11:30 πμ, ο/η Chris Angelico έγραψε: On Sat, Jul 6, 2013 at 6:01 PM, � Gr33k wrote: Is there any way to pinpoint the visitor's exact location? Yes. You ask them to fill in a shipping address. They may still lie, or they may choose to not answer, but that's the best you're go

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Chris Angelico
On Sat, Jul 6, 2013 at 6:01 PM, Νίκος Gr33k wrote: > Is there any way to pinpoint the visitor's exact location? Yes. You ask them to fill in a shipping address. They may still lie, or they may choose to not answer, but that's the best you're going to achieve without getting a wizard to cast Scryi

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Νίκος Gr33k
Στις 6/7/2013 4:41 πμ, ο/η Νίκος Gr33k έγραψε: Yes i know iam only storing the ISP's city instead of visitor's homeland but this is the closest i can get: try: gi = pygeoip.GeoIP('/home/nikos/GeoLiteCity.dat') city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] ) host = soc

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Νίκος Gr33k
Στις 6/7/2013 5:52 πμ, ο/η Dennis Lee Bieber έγραψε: On Sat, 06 Jul 2013 04:10:24 +0300, ? Gr33k declaimed the following: But he cgi scripts when running have full access to the server. No? or they only have the kind of access that their user has also? In any decent system, the

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Νίκος Gr33k
Yes i know iam only storing the ISP's city instead of visitor's homeland but this is the closest i can get: try: gi = pygeoip.GeoIP('/home/nikos/GeoLiteCity.dat') city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] ) host = socket.gethostbyaddr( os.environ['HTTP_CF_CONNECTING_

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Joel Goldstick
On Fri, Jul 5, 2013 at 9:10 PM, Νίκος Gr33k wrote: > Στις 6/7/2013 3:56 πμ, ο/η Joel Goldstick έγραψε: > >> >> Your code is not finding /root/GeoIPCity.dat because your directory has >> this file: GeoLiteCity.dat >> >> FileNotFoundError: [Errno 2] No such file or directory: >> '/root/GeoI

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Νίκος Gr33k
Στις 6/7/2013 3:56 πμ, ο/η Joel Goldstick έγραψε: Your code is not finding /root/GeoIPCity.dat because your directory has this file: GeoLiteCity.dat FileNotFoundError: [Errno 2] No such file or directory: '/root/GeoIPCity.dat' My mistake. Is there a differnce between GeoLiteCity.dat a

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Joel Goldstick
ote: >>>> >>>>> Is there a way to extract out of some environmental variable the >>>>> Geo location of the user being the city the user visits out website >>>>> from? >>>>> >>>>> Perhaps by utilizing his originate

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Νίκος Gr33k
visits out website from? Perhaps by utilizing his originated ip address? Yep. You can get an 11MB database (17MB uncompressed) http://dev.maxmind.com/geoip/legacy/downloadable/ http://pypi.python.org/pypi/pygeoip/ # pure Python Thank you very much Tim. i am know trying to use it

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Νίκος Gr33k
his originated ip address? Yep. You can get an 11MB database (17MB uncompressed) http://dev.maxmind.com/geoip/legacy/downloadable/ http://pypi.python.org/pypi/pygeoip/ # pure Python Thank you very much Tim. i am know trying to use it as: import pygeoip try: gic = pygeoip.GeoIP

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Νίκος Gr33k
Στις 5/7/2013 10:58 μμ, ο/η Tim Chase έγραψε: On 2013-07-05 22:08, Νίκος Gr33k wrote: Is there a way to extract out of some environmental variable the Geo location of the user being the city the user visits out website from? Perhaps by utilizing his originated ip address? Yep. You can get

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Grant Edwards
On 2013-07-05, ?? Gr33k wrote: > Is there a way to extract out of some environmental variable the Geo > location of the user being the city the user visits out website from? No. > Perhaps by utilizing his originated ip address? There is a very poor correlation between IP ad

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Tim Chase
isits out > >> website from? > >> > >> Perhaps by utilizing his originated ip address? > > Yep. You can get an 11MB database (17MB uncompressed) > > > > http://dev.maxmind.com/geoip/legacy/downloadable/ > > > Thank you ill take a look Alternativel

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Dave Angel
On 07/05/2013 04:44 PM, Tim Roberts wrote: ? Gr33k wrote: Is there a way to extract out of some environmental variable the Geo location of the user being the city the user visits out website from? Perhaps by utilizing his originated ip address? It is possible to look up the geographic

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Tim Roberts
? Gr33k wrote: > >Is there a way to extract out of some environmental variable the Geo >location of the user being the city the user visits out website from? > >Perhaps by utilizing his originated ip address? It is possible to look up the geographic region associated wit

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Support by Νίκος
Στις 5/7/2013 10:58 μμ, ο/η Tim Chase έγραψε: On 2013-07-05 22:08, Νίκος Gr33k wrote: Is there a way to extract out of some environmental variable the Geo location of the user being the city the user visits out website from? Perhaps by utilizing his originated ip address? Yep. You can get an

Re: Geo Location extracted from visitors ip address

2013-07-05 Thread Tim Chase
On 2013-07-05 22:08, Νίκος Gr33k wrote: > Is there a way to extract out of some environmental variable the > Geo location of the user being the city the user visits out website > from? > > Perhaps by utilizing his originated ip address? Yep. You can get an 11MB database (17

Geo Location extracted from visitors ip address

2013-07-05 Thread Νίκος Gr33k
Is there a way to extract out of some environmental variable the Geo location of the user being the city the user visits out website from? Perhaps by utilizing his originated ip address? -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list

Re: using text file to get ip address from hostname

2012-09-19 Thread Dan Katorza
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > i hope i'm clear :) > >

Re: using text file to get ip address from hostname

2012-09-19 Thread Dave Angel
help you understand programming. Two concepts you're going to have to get a lot more comfortable with, in Python, or in some other language. One is loops, and the other is functions. >> #!/usr/bin/env python >> #Get the IP Address >> >> import sys, socket, os >>

Re: using text file to get ip address from hostname

2012-09-19 Thread Dan Katorza
> > > > > > > > > > > > > > > > > > > > > > > Yep! Look up the docs and tutorial on "control flow" and "looping > > > > > > > > > > >

Re: using text file to get ip address from hostname

2012-09-19 Thread Dan Katorza
it every time. > > > > > > > > > > > > > > i hope i'm clear :) > > > > > > > > > > > > Yep! Look up the docs and tutorial on "control flow" and "looping > &

Re: using text file to get ip address from hostname

2012-09-19 Thread Chris Angelico
On Wed, Sep 19, 2012 at 6:50 PM, Dan Katorza wrote: > i know about the while loop , but forgive me i just don't have a clue how to > use it for this situation. You've already used one. What you need to do is surround your entire code with the loop, so that as soon as it gets to the bottom, it go

Re: using text file to get ip address from hostname

2012-09-19 Thread Dan Katorza
ain > > menu or full exit from the program, and i want it every time. > > > > > > i hope i'm clear :) > > > > Yep! Look up the docs and tutorial on "control flow" and "looping > > constructs". Sounds like what you want here is a

Re: using text file to get ip address from hostname

2012-09-19 Thread Chris Angelico
On Wed, Sep 19, 2012 at 5:41 PM, Dan Katorza wrote: > > Hello again, > I have another question and i hope you will understand me.. > Is there any option where you can set the program to go back to lets say the > top of the code? > I mean if the program finished the operation and i want to stay in

Re: using text file to get ip address from hostname

2012-09-19 Thread Dan Katorza
he web and could not find an answer for > > my issue. > > > > > > > > > > > > i need to get an ip address from list of hostnames which are in a textfile. > > > > > > > > > > > > this is what i have so far > > > > > &g

Re: using text file to get ip address from hostname

2012-09-17 Thread Thomas Rachel
... - First - #!/usr/bin/env python #Get the IP Address print("hello, please enter file name here>"), import socket for line in open(raw_input()): hostname = line.strip() print("IP address for {0} is {1}

Re: using text file to get ip address from hostname

2012-09-15 Thread Dan Katorza
בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת Dan Katorza: > hello , > > > > i'm new to Python and i searched the web and could not find an answer for my > issue. > > > > i need to get an ip address from list of hostnames which are in a textfile

Re: using text file to get ip address from hostname

2012-09-15 Thread Hans Mulder
On 15/09/12 18:20:42, Dan Katorza wrote: > בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת Dan Katorza: >> hello , >> >> >> >> i'm new to Python and i searched the web and could not find an answer for my >> issue. >> >> >> >&g

Re: using text file to get ip address from hostname

2012-09-15 Thread Dan Katorza
בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת Dan Katorza: > hello , > > > > i'm new to Python and i searched the web and could not find an answer for my > issue. > > > > i need to get an ip address from list of hostnames which are in a textfile

Re: using text file to get ip address from hostname

2012-09-12 Thread Jason Friedman
> i need to get an ip address from list of hostnames which are in a textfile. > > this is what i have so far > -- > #!/usr/bin/env python > #Get the IP Address > > import socket > hostname = '

Re: using text file to get ip address from hostname

2012-09-12 Thread Terry Reedy
On 9/12/2012 10:41 AM, dkato...@gmail.com wrote: it's not really homework, i found a lab exercise on the web > and i;m trying to study with it. maybe not the most efficient way. i have a file with hostnames ordered line by line. Key fact for this exercise: open files are iterable. So your

Re: using text file to get ip address from hostname

2012-09-12 Thread Alister
On Wed, 12 Sep 2012 07:41:10 -0700, dkatorza wrote: > בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת dkat...@gmail.com: >> hello , >> >> >> >> i'm new to Python and i searched the web and could not find an answer >> for my issue. >> &

Re: using text file to get ip address from hostname

2012-09-12 Thread dkatorza
בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת dkat...@gmail.com: > hello , > > > > i'm new to Python and i searched the web and could not find an answer for my > issue. > > > > i need to get an ip address from list of hostnames which are in a textf

Re: using text file to get ip address from hostname

2012-09-12 Thread Chris Angelico
On Thu, Sep 13, 2012 at 12:24 AM, wrote: > i'm new to Python and i searched the web and could not find an answer for my > issue. > > i need to get an ip address from list of hostnames which are in a textfile. This is sounding like homework, so I'll just give you a ba

using text file to get ip address from hostname

2012-09-12 Thread dkatorza
hello , i'm new to Python and i searched the web and could not find an answer for my issue. i need to get an ip address from list of hostnames which are in a textfile. this is what i have so far -- #!/usr/bin/env p

Re: Get the IP address of WIFI interface

2011-05-16 Thread Jun Hu
gt; use. It knows which interfaces are active and what kind they are (LAN, > WLAN, WWAN etc.) NetworkManager communicates via dbus and even > includes python example scripts. So here's my scriptlet based on > NetworkManager example nm-state.py. This one prints out all active > dev

Re: Get the IP address of WIFI interface

2011-05-16 Thread Anssi Saari
e[:15]) > )[20:24]) One possible solution in Linux is asking NetworkManager, if it's in use. It knows which interfaces are active and what kind they are (LAN, WLAN, WWAN etc.) NetworkManager communicates via dbus and even includes python example scripts. So here's my scriptlet based on

Re: Get the IP address of WIFI interface

2011-05-15 Thread MrJean1
Perhaps, this recipe works for your case: It does parse ifconfig and ipconfig, if found. /Jean On May 15, 2:14 pm, Andrew Berg wrote: > On 2011.05.15 06:12 AM, Tim Golden wrote:> ... and for Windows: > > > > > import wmi > > > for nic in wmi.WM

Re: Get the IP address of WIFI interface

2011-05-15 Thread Jun Hu
On Sun, May 15, 2011 at 2:14 PM, Andrew Berg wrote: > > One thing I found out about Win32_NetworkAdapterConfiguration is that it > only contains /current/ information and not the stored info that it uses > when making an initial connection (you can see and edit this info in the > Network and Shari

Re: Get the IP address of WIFI interface

2011-05-15 Thread Andrew Berg
On 2011.05.15 06:12 AM, Tim Golden wrote: > ... and for Windows: > > > import wmi > > for nic in wmi.WMI ().Win32_NetworkAdapterConfiguration (IPEnabled=1): >print nic.Caption, nic.IPAddress > > One thing I found out about Win32_NetworkAdapterConfiguration is that it only contains /current/ i

Re: Get the IP address of WIFI interface

2011-05-15 Thread Tim Golden
On 15/05/2011 20:23, Jun Hu wrote: Thanks for the tip, it is really helpful! however the class of Win32_NetworkAdapterConfiguration doesn't include the interface type (you can NOT tell if it is a wifi interface), so I change the code a bit like following: import wmi wlan_int_id=None for nic in

Re: Get the IP address of WIFI interface

2011-05-15 Thread Jun Hu
t >>> interface, the other is wifi interface, both are connected and has an ip >>> address. >>> The question is: How to get the ip address of the wifi interface in a >>> python >>> script without parsing the output of a shell command like "ipc

Re: Get the IP address of WIFI interface

2011-05-15 Thread Tim Golden
On 15/05/2011 12:04 PM, Neal Becker wrote: Far.Runner wrote: Hi python experts: There are two network interfaces on my laptop: one is 100M Ethernet interface, the other is wifi interface, both are connected and has an ip address. The question is: How to get the ip address of the wifi interface

Re: Get the IP address of WIFI interface

2011-05-15 Thread Neal Becker
Far.Runner wrote: > Hi python experts: > There are two network interfaces on my laptop: one is 100M Ethernet > interface, the other is wifi interface, both are connected and has an ip > address. > The question is: How to get the ip address of the wifi interface in a python &

Re: Get IP address of WIFI interface

2011-05-14 Thread Jun Hu
nterface, the other is wifi interface, both are connected > and > > has an IP address. then the question is: how to get the ip address of the > > wifi interface in a python script? > > OS: Windows or Linux > > Detect the OS with os.name and branch out to specific use cas

Re: Get IP address of WIFI interface

2011-05-13 Thread Ishwor Gurung
Hi. On 14 May 2011 14:46, Far.Runner wrote: > Hi Python Experts: > There are two network interfaces on my laptop, one is > 100M Ethernet interface, the other is wifi interface, both are connected and > has an IP address. then the question is: how to get the ip address of the > wi

How to get the IP address of the wifi interface?

2011-05-13 Thread Jun Hu
Hi python experts: There are two network interfaces on my laptop, one is 100M Ethernet, the other is wifi, both are connected and have IP addresses. The question is: how to get the ip address of WIFI interface without parsing the output of a shell command like "ipconfig" or "

Get the IP address of WIFI interface

2011-05-13 Thread Far.Runner
Hi python experts: There are two network interfaces on my laptop: one is 100M Ethernet interface, the other is wifi interface, both are connected and has an ip address. The question is: How to get the ip address of the wifi interface in a python script without parsing the output of a shell command

Get IP address of WIFI interface

2011-05-13 Thread Far.Runner
Hi Python Experts: There are two network interfaces on my laptop, one is 100M Ethernet interface, the other is wifi interface, both are connected and has an IP address. then the question is: how to get the ip address of the wifi interface in a python script? OS: Windows or Linux -- http

Re: Cross-platform way to retrieve the current (Operative system) DNS server IP address in python

2010-04-30 Thread Hans Mulder
joamag wrote: It's not my ip address that I want to discover... I want to discover my default dns server ip address. This ip is stored in an operative system basis. Dos anyone know how to get it ? You asked for a cross-platform solution; there probably isn't one. The code belo

Re: Cross-platform way to retrieve the current (Operative system) DNS server IP address in python

2010-04-27 Thread Tiago Katcipis
retrieve the default DNS > > > server IP address in python ? > > > > > Thanks ! > > > João > > > > import os,urllib2,re > > > > def getIpAddr(): > > """ > > Function for parsing external ip adress by ping

Re: Cross-platform way to retrieve the current (Operative system) DNS server IP address in python

2010-04-27 Thread joamag
On 24 Abr, 14:50, DarkBlue wrote: > On Apr 22, 4:55 pm, joamag wrote: > > > Does anybody know a cross platform way to retrieve the default DNS > > server IP address in python ? > > > Thanks ! > > João > > import os,urllib2,re > > def getIpAddr(): >

Re: Cross-platform way to retrieve the current (Operative system) DNS server IP address in python

2010-04-24 Thread DarkBlue
On Apr 22, 4:55 pm, joamag wrote: > Does anybody know a cross platform way to retrieve the default DNS > server IP address in python ? > > Thanks ! > João import os,urllib2,re def getIpAddr(): """ Function for parsing external ip adress by pinging dynd

Cross-platform way to retrieve the current (Operative system) DNS server IP address in python

2010-04-22 Thread joamag
Does anybody know a cross platform way to retrieve the default DNS server IP address in python ? Thanks ! João -- http://mail.python.org/mailman/listinfo/python-list

Get Cliet IP Address

2009-08-02 Thread Fred Atkinson
What is the function to obtain the client browser's IP address? Fred -- http://mail.python.org/mailman/listinfo/python-list

Re: Get Cliet IP Address

2009-08-02 Thread Piet van Oostrum
> Fred Atkinson (FA) wrote: >FA>What is the function to obtain the client browser's IP >FA> address? You mean in a web server? The following should work (and was posted by me not long ago): from os import getenv ip = (getenv("HTTP_CLIENT_IP") or getenv("HTTP_X_FORWARDED_FOR")

Re: Get Cliet IP Address

2009-08-02 Thread eliasf
"Fred Atkinson" wrote: What is the function to obtain the client browser's IP address? Do you mean the external public IP to the Internet? When I wanted to log the dynamic IP that my ADSL connection gets, I used whatismyip.com like this: import urllib2 QU

Re: IP Address Function

2009-07-09 Thread Tim Roberts
Fred Atkinson wrote: > >I wonder why they don't just have a function to return it instead of >putting you through all of that? In CGI, EVERYTHING gets communicated through environment variables. That (and the stdin stream) is really the only option, since you get a new process for every reques

Re: IP Address Function

2009-07-09 Thread Piet van Oostrum
> Fred Atkinson (FA) wrote: >FA> On Wed, 08 Jul 2009 12:29:54 +0200, Piet van Oostrum >FA> wrote: >>> Something like: >>> >>> #! /usr/bin/env python >>> >>> import cgi >>> from os import getenv >>> >>> print "Content-type: text/html" >>> print >>> >>> ipaddr = (getenv("HTTP_CLIENT_IP")

Re: IP Address Function

2009-07-08 Thread Nobody
quot;UNKNOWN") >> >>print ipaddr > > That did it. > > I wonder why they don't just have a function to return it instead of > putting you through all of that? There's no unambiguous definition of "client IP", so you have to choose which defi

Re: IP Address Function

2009-07-08 Thread Fred Atkinson
On Wed, 08 Jul 2009 12:29:54 +0200, Piet van Oostrum wrote: >Something like: > >#! /usr/bin/env python > >import cgi >from os import getenv > >print "Content-type: text/html" >print > >ipaddr = (getenv("HTTP_CLIENT_IP") or > getenv("HTTP_X_FORWARDED_FOR") or > getenv("HTTP_X_FORWARDED_F

Re: IP Address Function

2009-07-08 Thread Piet van Oostrum
>>>>> Fred Atkinson (FA) wrote: >FA> On Tue, 07 Jul 2009 22:54:03 -0300, "Gabriel Genellina" >FA> wrote: >>> En Tue, 07 Jul 2009 22:45:24 -0300, Fred Atkinson >>> escribió: >>> >>>> Is there a Python function I

Re: IP Address Function

2009-07-08 Thread Fred Atkinson
On Tue, 07 Jul 2009 22:54:03 -0300, "Gabriel Genellina" wrote: >En Tue, 07 Jul 2009 22:45:24 -0300, Fred Atkinson >escribió: > >> Is there a Python function I can use to get the user's IP >> address so I can display it on his browser? > >The

Re: IP Address Function

2009-07-07 Thread Gabriel Genellina
En Tue, 07 Jul 2009 22:45:24 -0300, Fred Atkinson escribió: Is there a Python function I can use to get the user's IP address so I can display it on his browser? There is a long distance between "Python" and "browser" - you'll have to tell us

Re: IP Address Function

2009-07-07 Thread Chris Rebert
On Tue, Jul 7, 2009 at 6:45 PM, Fred Atkinson wrote: >        Is there a Python function I can use to get the user's IP > address so I can display it on his browser? from socket import gethostname, gethostbyname ip = gethostbyname(gethostname()) Cheers, Chris -- http://blog.r

Re: IP Address Function

2009-07-07 Thread Tim Harig
On 2009-07-08, Fred Atkinson wrote: > Is there a Python function I can use to get the user's IP > address so I can display it on his browser? If you are using CGI you can get it from the REMOTE_ADDR environmental variable. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   >