Johny [EMAIL PROTECTED] writes:
So I know that www.google.com has 209.85.129.147 IP address.
But how can I find it directly from Python script?
import socket
print socket.gethostbyname('www.google.com')
66.102.7.147
--
http://mail.python.org/mailman/listinfo/python-list
Johny [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
How can I find server's IP address?
From console I can use ping, for example:
C:\RobotP\cgi-binping www.google.com
Pinging www.google.com [209.85.129.147] with 32 bytes of data:
[...]
But how can I find it directly from
the networked IP address of the machine the code is running on? For example, my laptop's IP address is
192.168.0.101, and I want to bind a server to that address. Is there a clean way of doing so that will work, for example, when I move the code to my server (which obviously doesn't have the same IP address
wondering is this: Is there a clean way to
get the networked IP address of the machine the code is running on? For
example, my laptop's IP address is 192.168.0.101, and I want to bind a
server to that address. Is there a clean way of doing so that will work,
for example, when I move the code to my
Michael B. Trausch wrote:
Hello,
Every programming example that I have seen thus far shows simple
server code and how to bind to a socket--however, every example binds
to the localhost address. What I am wondering is this: Is there a
clean way to get the networked IP address
Normaly I can log user's IP address using os.environ[REMOTE_ADDR] .
If a user is behind a proxy, I will log proxy's IP address only.
Is there a way how to find a real IP user's address?
os.environ[HTTP_X_FORWARDED_FOR]
(but that can easily be spoofed, and is mostly meaningless
Normaly I can log user's IP address using os.environ[REMOTE_ADDR] .
If a user is behind a proxy, I will log proxy's IP address only.
Is there a way how to find a real IP user's address?
os.environ[HTTP_X_FORWARDED_FOR]
(but that can easily be spoofed, and is mostly meaningless
Lad [EMAIL PROTECTED] wrote:
Fredrik Lundh wrote:
Lad wrote:
Normaly I can log user's IP address using os.environ[REMOTE_ADDR] .
If a user is behind a proxy, I will log proxy's IP address only.
Is there a way how to find a real IP user's address?
os.environ[HTTP_X_FORWARDED_FOR
On 09/15/2006 Lad wrote:
How can be HTTP_X_FORWARDED_FOR easily spoofed? I thought that IP
address is not possible change.
Because it is a header that is added by the proxy. This header has (or
should have) no role in the proces of relaying the request by the proxy.
It is just politely added
Normaly I can log user's IP address using os.environ[REMOTE_ADDR] .
If a user is behind a proxy, I will log proxy's IP address only.
Is there a way how to find a real IP user's address?
Thank you for help.
LL.
--
http://mail.python.org/mailman/listinfo/python-list
Lad wrote:
Normaly I can log user's IP address using os.environ[REMOTE_ADDR] .
If a user is behind a proxy, I will log proxy's IP address only.
Is there a way how to find a real IP user's address?
os.environ[HTTP_X_FORWARDED_FOR]
(but that can easily be spoofed, and is mostly meaningless
I would like to record visitor's IP address.How can I do that in
Python?
Thanks for help
L
--
http://mail.python.org/mailman/listinfo/python-list
Sybren Stuvel wrote:
Lad enlightened us with:
I would like to record visitor's IP address.How can I do that in
Python?
Too little information. Visitors of what?
Sybren
I have a website written in Python and I would like to login every
visitor's IP address.
In other words, if a visitor
In article [EMAIL PROTECTED], Lad wrote:
I have a website written in Python and I would like to login every
visitor's IP address.
In other words, if a visitor come to my Python application, this
application will record his IP.
Depending on what CGI framework you're using, something like
Sybren Stuvel wrote:
Lad enlightened us with:
I have a website written in Python and I would like to login every
visitor's IP address.
Ehm... that's probably log not login.
In other words, if a visitor come to my Python application, this
application will record his IP. Is it possible
Hello,
I've started python a few weeks ago, and to now everything went fine
with my cookbook and a learning book.
Now, I've tried the SimpleXMLRPCServer, and it worked OK untill I
tried to get the client IP address. I have searched a long time the
Internet but couldn't find a _simple_ solution
Jeremy Monnet wrote:
Tips I've found were :
- use the requestHandler and its method address_string(), but I didn't
an easy to understand example
- http://mail.python.org/pipermail/python-list/2006-May/340266.html
but this thread seems not to have been finished :-(
maybe the explanation in
Thanks for your answer !
On 6/28/06, Fredrik Lundh [EMAIL PROTECTED] wrote:
maybe the explanation in that message was good enough for the poster ?
I think so ... unfortunately not for me ... yet ! :-)
Your handler object should be getting set up with the client_address
property.
of mixin classes mixing things up. I'm not confused, it's not
passed.
I can't figure out how to get the client IP address at all from inside
my program. I can reach the socket object via my server object, but the
connection has been dropped before my handler is called.
Any help or pointers
can't figure out how to get the client IP address at all from inside
my program. I can reach the socket object via my server object, but the
connection has been dropped before my handler is called.
Any help or pointers would be appreciated. At this point I think I
would need to make changes
DarkBlue wrote:
Chris wrote:
How do I find and print to screen the IP address of the computer my
python program is working on?
def readip():
import re, urllib
f = urllib.urlopen('http://checkip.dyndns.org')
s = f.read()
m = re.search('([\d]*\.[\d]*\.[\d]*\.[\d]*)', s)
return
Chris wrote:
How do I find and print to screen the IP address of the computer my
python program is working on?
def readip():
import re, urllib
f = urllib.urlopen('http://checkip.dyndns.org')
s = f.read()
m = re.search('([\d]*\.[\d]*\.[\d]*\.[\d]*)', s)
return m.group(0)
myip = readip
How do I find and print to screen the IP address of the computer my
python program is working on?
--
http://mail.python.org/mailman/listinfo/python-list
Chris schrieb:
How do I find and print to screen the IP address of the computer my
python program is working on?
IP adresses are bound to network interfaces not to computers.
One Computer can have multiple network interfaces.
--
Servus, Gregor
http://www.gregor-horvath.com
--
http
One way:
import socket
socket.getaddrinfo(socket.gethostname(), None)[0][4][0]
It was the first google hit
--
http://mail.python.org/mailman/listinfo/python-list
hehe, works a charm, cheers mate.
--
http://mail.python.org/mailman/listinfo/python-list
Chris wrote:
hehe, works a charm, cheers mate.
Beware that if you have a different entry in your hosts file you can match a
different name.
Test it:
- add 127.0.0.2yourhost.yourdomain yourhost to /etc/hosts
- rerun the code.
You'll see 127.0.0.2 as the result. So take that into account.
print '127.0.0.1'
:-P
--
http://mail.python.org/mailman/listinfo/python-list
On 2006-04-27, Gregor Horvath [EMAIL PROTECTED] wrote:
Chris schrieb:
How do I find and print to screen the IP address of the computer my
python program is working on?
IP adresses are bound to network interfaces not to computers.
One Computer can have multiple network interfaces.
And each
Grant Edwards [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On 2006-04-27, Gregor Horvath [EMAIL PROTECTED] wrote:
Chris schrieb:
How do I find and print to screen the IP address of the computer my
python program is working on?
IP adresses are bound to network interfaces
While on the subject of network identity, does anyone have a scheme to
get the MAC address of the end device? I've never come up with a way to
do it, but I haven't had it proven to me that it is impossible (yet).
Justin Ezequiel wrote:
os.environ['REMOTE_ADDR']
os.environ['REMOTE_HOST']
EP wrote:
While on the subject of network identity, does anyone have a scheme to
get the MAC address of the end device? I've never come up with a way to
do it, but I haven't had it proven to me that it is impossible (yet).
Which end? I'll assume you mean _not_ the server end. :-)
The MAC
One quick question:
I have a python cgi script running behind a CGI server which is also
built using python using CGIHTTPServer module. How can my cgi script
obtain the remote ip address?
--
http://mail.python.org/mailman/listinfo/python-list
os.environ['REMOTE_ADDR']
os.environ['REMOTE_HOST']
--
http://mail.python.org/mailman/listinfo/python-list
Alvin A. Delagon [EMAIL PROTECTED] writes:
I have a python cgi script running behind a CGI server which is also
built using python using CGIHTTPServer module. How can my cgi script
obtain the remote ip address?
The CGI specification lists a number of environment variables that are
set
Thanks a lot Justin! ^_^
--
http://mail.python.org/mailman/listinfo/python-list
The traditional right way (tm) to do this is to call getsockname() on
the (a?) socket that's connected to the guy you want to tell your
address to. This picks the right address in case you have several. If
you don't have a socket handy, you can make a connectionless UDP
socket and connect() it to
That man is a genius:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((gmail.com,80))
print s.getsockname()
('192.168.0.174', 2768)
s.close()
Should work on Windows as well.
--
http://mail.python.org/mailman/listinfo/python-list
On Linux, it is a simple matter to get the local ip address with
system.os(ifconfig /tmp/ip); ip=open(/tmp/ip).readlines(), etc.
How can I do this with Windows?
--
http://mail.python.org/mailman/listinfo/python-list
SolaFide wrote:
On Linux, it is a simple matter to get the local ip address with
system.os(ifconfig /tmp/ip); ip=open(/tmp/ip).readlines(), etc.
ip = os.popen(ifconfig).readlines()
is a bit more convenient.
How can I do this with Windows?
the command is called ipconfig in windows
You can do essentially the same thing substituting ipconfig for
ifconfig.
Though I am sure there are better ways
--
http://mail.python.org/mailman/listinfo/python-list
The second solution can give really weird results though, e.g. on my
Linux system I get:
gethostbyaddr(gethostname())
('linux.site', ['linux'], ['127.0.0.2'])
A more flexible but potentially unportable way would be:
import socket
import fcntl
import struct
def get_ip_address(ifname):
...
Thanks again Peter. I found 2 potential solutions for obtaining the ip
address of the incoming
connection. The first was to subclass SimpleXMLRPCRequestHandler class
and pass it
to the SimpleXMLRPCServer constructor. In doing so, I could directly
access the client_address via
[EMAIL PROTECTED] wrote:
Thanks for the reply Peter. Can you provide a code snippet for
extracting this data. When I print the dir() of the SimpleXMLRPCServer
instance I do not see a request_handler attribute or method.
this is ok.
In the serverclass-object, there is no such method because
Thanks for the reply Peter. Can you provide a code snippet for
extracting this data. When I print the dir() of the SimpleXMLRPCServer
instance I do not see a request_handler attribute or method.
Phil
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
Is it possible to obtain the client's ip address from a
SimpleXMLRPCServer instance or subclass instance? When running
SimpleXMLRPCServer with logRequests = 1, the xmlrpc server prints out
the fqdn on the console, however, I'm not sure if this information
(either
Is it possible to obtain the client's ip address from a
SimpleXMLRPCServer instance or subclass instance? When running
SimpleXMLRPCServer with logRequests = 1, the xmlrpc server prints out
the fqdn on the console, however, I'm not sure if this information
(either fqdn or ip address) is available
[billie]
| Hi all. I'm searching for a module that permits me to
| low-level interact
| with ethernet interfaces of my system.
| I would like to determine at least the first of the followings
values:
|
| 1 - IP address assigned to the interface
| 2 - subnet mask
| 3 - default gateway
| 4
billie wrote:
Hi all. I'm searching for a module that permits me to low-level interact
with ethernet interfaces of my system.
I would like to determine at least the first of the followings values:
1 - IP address assigned to the interface
2 - subnet mask
3 - default gateway
4 - primary
Hi all. I'm searching for a module that permits me to low-level interact
with ethernet interfaces of my system.
I would like to determine at least the first of the followings values:
1 - IP address assigned to the interface
2 - subnet mask
3 - default gateway
4 - primary and secondary dns
5
This may depend on your OS. How about:
http://www.inl.fr/nuface-doc/nupyf-doc-en.html#id2457044
--
http://mail.python.org/mailman/listinfo/python-list
How can I learn the DNS Server's IP address for my network, programmatically?
The idea is to learn DNS Server IP and initialize medusa.resolver accordingly.
Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list
html
head
titleYour IP address/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
style type=text/css
!--
body {
background-color: ##BBE1DF;
}
.style1 {
font-size: 36px;
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif
address?
Date: Fri, 15 Jul 2005 17:49:26 +0200
Sandeep Arya wrote:
Hello to all
Well this is my first mail on this list. I am facing a problem associated
with collecting IP address on my network.
What i thought is to send broadcast packet over the network and then
recieving back the reply
Hello to all
Well this is my first mail on this list. I am facing a problem associated
with collecting IP address on my network.
What i thought is to send broadcast packet over the network and then
recieving back the reply from the computers and bridges connected to my
network and then adding
Sandeep Arya wrote:
Hello to all
Well this is my first mail on this list. I am facing a problem associated
with collecting IP address on my network.
What i thought is to send broadcast packet over the network and then
recieving back the reply from the computers and bridges connected to my
the source
IP address of the client.) Of course, I had to weave in some code that
allowed me to pass the client IP address through the URLopener class in
the urllib library. Everything seems to work so far.
John, thanks again for your help. You pointed me in the right
direction.
-Dan
--
http
, because
I would think that overriding the http_open function in the handler
would have signaled that this function is capable of handling http. If
I call the HTTPHandler base class http_open function from within the
derived class, all works okay, but of course, I don't get to use the
source IP
John,
Thanks for your input. I can kind of see the light in this, but I'm
having difficulty knowing where the do_open method comes from. Also,
I'll need to follow redirects, so I assume then I would add a
HTTPRedirectHandler instance to the urllib2.build_opener. (?) Thanks
again for your help.
Dan [EMAIL PROTECTED] writes:
Does anybody know how to control the source IP address (IPv4) when
using the urllib2 library? I have a Linux box with several IP
addresses in the same subnet, and I want to simulate several
individuals within that subnet accessing web pages independently. I
Does anybody know how to control the source IP address (IPv4) when
using the urllib2 library? I have a Linux box with several IP
addresses in the same subnet, and I want to simulate several
individuals within that subnet accessing web pages independently. I
need the functionality of urllib2
http://checkip.tk/
codecraig ha scritto:
hi,
how can i use python to figure the ip address of the machine which
the python script is running on? I dont mean like 127.0.0.1but i
want the external IP address (such as ipconfig on windows displays).
any ideas??
THanks
--
http
[Format recovered from top-posting.]
[EMAIL PROTECTED] writes:
codecraig ha scritto:
how can i use python to figure the ip address of the machine which
the python script is running on? I dont mean like 127.0.0.1but i
want the external IP address (such as ipconfig on windows displays
codecraig wrote:
hi,
how can i use python to figure the ip address of the machine which
the python script is running on? I dont mean like 127.0.0.1but i
want the external IP address (such as ipconfig on windows displays).
any ideas??
THanks
To get the public IP (like when you're behind
codecraig wrote:
hi,
how can i use python to figure the ip address of the machine which
the python script is running on? I dont mean like 127.0.0.1but i
want the external IP address (such as ipconfig on windows displays).
I use the following (all on one line):
external_ip = os.popen
On 2005-04-15, codecraig [EMAIL PROTECTED] wrote:
hi,
how can i use python to figure the ip address of the machine which
the python script is running on? I dont mean like 127.0.0.1but i
want the external IP address (such as ipconfig on windows displays).
any ideas??
I use
import socket
print socket.gethostbyname( socket.gethostname() )
--
http://mail.python.org/mailman/listinfo/python-list
Kartic, Quarta 05 Janeiro 2005 14:08, wrote:
socket.gethostbyaddr(socket.gethostname())
will return a tuple containing fully qualified hostname, alternative
hostnames, ip addresses (1 if multihomed).
or
socket.gethostbyname(socket.gethostname())
None of these work with computers with
and hostname == socket.gethostname():
# when we want to determine local IP and did not have succes
# with gethostbyname_ex then we would like to connect to say...
# google.com and determine the local ip address bound to the
# local socket.
try:
s
J Berends wrote:
Lee Harr wrote:
Basically, it scrapes the output from ifconfig for the
actual address assigned to the interface. Works perfectly
on FreeBSD and Linux (given the correct configuration).
Nice way, have to device something for windows than.
Use the same approach, but scrape the
J Berends wrote:
def getipaddr(hostname='default'):
[snip]
It returns the IP address with which it connects to the world (not lo),
might be a pvt LAN address or an internet routed IP. Depend on where the
host is.
I hate the google trick actually, so any suggestions to something better
and hostname == socket.gethostname():
# when we want to determine local IP and did not have succes
# with gethostbyname_ex then we would like to connect to say...
# google.com and determine the local ip address bound to the
# local socket.
try
and hostname == socket.gethostname():
# when we want to determine local IP and did not have succes
# with gethostbyname_ex then we would like to connect to say...
# google.com and determine the local ip address bound to the
# local socket.
try:
s
I want to determine the outside (non local, a.k.a. 127.0.0.x) ip
addresses of my host. It seems that the socket module provides me with
some nifty tools for that but I cannot get it to work correctly it seems.
Can someone enlightened show a light on this:
import socket
def
socket.gethostbyaddr(socket.gethostname())
will return a tuple containing fully qualified hostname, alternative
hostnames, ip addresses (1 if multihomed).
Thanks,
--Kartic
--
http://mail.python.org/mailman/listinfo/python-list
or
socket.gethostbyname(socket.gethostname())
--
http://mail.python.org/mailman/listinfo/python-list
301 - 376 of 376 matches
Mail list logo