Re: How to get mac address of bluetooth with python in win7?

2014-08-07 Thread Ben Finney
elearn writes: > How to get mac address of bluetooth with python in win7? This may not be a Python-specific question. How would you get the MAC adress of a Bluetooth device in Windows, in any programming language? My advice is for you to do a web search https://duckduckgo.com/?q=pyt

How to get mac address of bluetooth with python in win7?

2014-08-07 Thread elearn
How to get mac address of bluetooth with python in win7? -- https://mail.python.org/mailman/listinfo/python-list

Re: How to get Mac address of ethernet port?

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 2:42 AM, William Ray Wing wrote: > The one I've used is to spawn a subprocess and run the "ifconfig" command > with no arguments (which doesn't require any special privileges). Very small caveat: On some systems, running ifconfig doesn't require privileges, but it's not i

Re: How to get Mac address of ethernet port?

2014-01-13 Thread William Ray Wing
one ethernet adapter. Most > computers have two (wired and wireless) adapters. > > Getting a mac address is platform-specific, and the OP has not specified > what OS he is using. > > On Windows I imagine you'd have to access the WMI subsystem in Windows. > > On Linux

Re: How to get Mac address of ethernet port?

2014-01-11 Thread Sam
On Sunday, January 12, 2014 12:34:35 AM UTC+8, Michael Torrie wrote: > On 01/11/2014 07:35 AM, Andriy Kornatskyy wrote: > > > On Linux you could access the /sys/devices/virtual/net/ > > file in the sysfs filesystem. I'm sure there are other ways. > Thank you to everyone for the helpful answer

Re: How to get Mac address of ethernet port?

2014-01-11 Thread Chris Angelico
On Sun, Jan 12, 2014 at 8:55 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> We had a connection set up a few years >> ago where the ISP tech recorded the source MAC into the far end, and >> only that MAC would work - so when I stuck in a different router, I >> needed to switch

Re: How to get Mac address of ethernet port?

2014-01-11 Thread Roy Smith
In article , Chris Angelico wrote: > We had a connection set up a few years > ago where the ISP tech recorded the source MAC into the far end, and > only that MAC would work - so when I stuck in a different router, I > needed to switch it to the old MAC before it could establish a > connection.

Re: How to get Mac address of ethernet port?

2014-01-11 Thread Chris Angelico
On Sun, Jan 12, 2014 at 3:29 AM, Roy Smith wrote: > If you don't believe that two machines can have the same MAC address, > look up Hot Standby Router Protocol. And if you don't believe a machine > can ignore the BIA and assign a new MAC address in software, look up >

Re: How to get Mac address of ethernet port?

2014-01-11 Thread Michael Torrie
On 01/11/2014 07:35 AM, Andriy Kornatskyy wrote: > Sam, > > How about this? > > from uuid import getnode as get_mac > '%012x' % get_mac() This seems to work if you have only one ethernet adapter. Most computers have two (wired and wireless) adapters. Getting a mac

Re: How to get Mac address of ethernet port?

2014-01-11 Thread Roy Smith
In article , "James Harris" wrote: > "Andriy Kornatskyy" wrote in message > news:mailman.5329.1389450993.18130.python-l...@python.org... > > Sam, > > > > How about this? > > > > from uuid import getnode as get_mac > > '%012x&

Re: How to get Mac address of ethernet port?

2014-01-11 Thread James Harris
"Andriy Kornatskyy" wrote in message news:mailman.5329.1389450993.18130.python-l...@python.org... > Sam, > > How about this? > > from uuid import getnode as get_mac > '%012x' % get_mac() AIUI that will return a mac address even if there isn't one. T

Re: How to get Mac address of ethernet port?

2014-01-11 Thread Skip Montanaro
This is slightly longer than ChrisA's second solution: >>> import uuid >>> s = "%12x" % uuid.getnode() >>> ":".join(x+y for x, y in zip(s[::2], s[1::2])) '18:03:73:cb:2a:ee' Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: How to get Mac address of ethernet port?

2014-01-11 Thread Chris Angelico
On Sun, Jan 12, 2014 at 1:35 AM, Andriy Kornatskyy wrote: > from uuid import getnode as get_mac > '%012x' % get_mac() > Code golf! Put colons in that, with as little code as possible. # Way too verbose. import uuid l=list("%012x"%uuid.getnode()) l[10:10]=l[8:8]=l[6:6]=l[4:4]=l[2:2]=':' mac = ''.

Re: How to get Mac address of ethernet port?

2014-01-11 Thread Chris Angelico
On Sun, Jan 12, 2014 at 1:26 AM, Sam wrote: > I would like to use python to retrieve the mac address of the ethernet port. > Can this be done? Thank you. > Did you try searching the web for 'python retrieve mac address' or similar? There are several options offered

Re: How to get Mac address of ethernet port?

2014-01-11 Thread Andriy Kornatskyy
Sam, How about this? from uuid import getnode as get_mac '%012x' % get_mac() Thanks. Andriy Kornatskyy On Jan 11, 2014, at 4:26 PM, Sam wrote: > I would like to use python to retrieve the mac address of the ethernet port. > Can this be done? Thank you. > -- > h

How to get Mac address of ethernet port?

2014-01-11 Thread Sam
I would like to use python to retrieve the mac address of the ethernet port. Can this be done? Thank you. -- https://mail.python.org/mailman/listinfo/python-list

Re: Getting Local MAC Address

2010-04-07 Thread Rebelo
Lawrence D'Oliveiro wrote: In message , Booter wrote: I am new to python ans was wondering if there was a way to get the mac address from the local NIC? What if you have more than one? you can try with netifaces : http://pypi.python.org/pypi/netifaces/0.3 I use them on both Window

Re: Getting Local MAC Address

2010-04-06 Thread Lawrence D'Oliveiro
In message , Booter wrote: > I am new to python ans was wondering if there was a way to get the mac > address from the local NIC? What if you have more than one? -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting Local MAC Address

2010-04-05 Thread Booter
All, Thanks for all of the great solutions! Sorry I wasn't more specific in my post and will keep that in mind for future posts. Just FYI I was using a Windows machine and running Python 2.6. Once again thanks for all of your help! Gerad -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting Local MAC Address

2010-04-04 Thread Michael Torrie
On 04/02/2010 04:01 PM, Dan McLeran wrote: > which is why my OP stated the solution was for windows: > > "for windows parse > p.stdout.read():" Gotcha. Definitely missed that! -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting Local MAC Address

2010-04-02 Thread Frank Millman
"Booter" wrote in message news:ec6d247c-a6b0-4f33-a36b-1d33eace6...@k19g2000yqn.googlegroups.com... Hello all, I am new to python ans was wondering if there was a way to get the mac address from the local NIC? Thanks for your help. Gerad This is what I use - --

Re: Getting Local MAC Address

2010-04-02 Thread Steve Holden
Booter wrote: > Hello all, > > I am new to python ans was wondering if there was a way to get the mac > address from the local NIC? > > Thanks for your help. > >>> import uuid >>> uuid.getnode() 246090452741227L >>> This is supposed to return

Re: Getting Local MAC Address

2010-04-02 Thread Michael Torrie
On 04/02/2010 02:14 PM, Booter wrote: > I am new to python ans was wondering if there was a way to get the mac > address from the local NIC? As Dan has indicated, you have to Popen an external command to get this information. Every OS has different commands and syntaxes for this. You'

Re: Getting Local MAC Address

2010-04-02 Thread Michael Torrie
On 04/02/2010 03:30 PM, Dan McLeran wrote: > i'm running python 2.6 on win xp sp3 and i get: Your code isn't portable to non-Windows OS's. On my Mac and on my Linux workstations it simply doesn't work. Using '/usr/sbin/ifconfig' as the executable name in Popen does work, however. The OP didn't

Re: Getting Local MAC Address

2010-04-02 Thread danmcle...@yahoo.com
On Apr 2, 2:52 pm, "danmcle...@yahoo.com" wrote: > On Apr 2, 2:14 pm, Booter wrote: > > > Hello all, > > > I am new to python ans was wondering if there was a way to get the mac > > address from the local NIC? > > > Thanks for your help. &

Re: Getting Local MAC Address

2010-04-02 Thread Irmen de Jong
On 2-4-2010 22:55, danmcle...@yahoo.com wrote: On Apr 2, 2:52 pm, "danmcle...@yahoo.com" wrote: On Apr 2, 2:14 pm, Booter wrote: Hello all, I am new to python ans was wondering if there was a way to get the mac address from the local NIC? Thanks for your help. Gerad f

Re: Getting Local MAC Address

2010-04-02 Thread danmcle...@yahoo.com
On Apr 2, 2:52 pm, "danmcle...@yahoo.com" wrote: > On Apr 2, 2:14 pm, Booter wrote: > > > Hello all, > > > I am new to python ans was wondering if there was a way to get the mac > > address from the local NIC? > > > Thanks for your help. &

Re: Getting Local MAC Address

2010-04-02 Thread danmcle...@yahoo.com
On Apr 2, 2:14 pm, Booter wrote: > Hello all, > > I am new to python ans was wondering if there was a way to get the mac > address from the local NIC? > > Thanks for your help. > > Gerad for windows parse p.stdout.read(): import subprocess p = subprocess.Popen('ip

Getting Local MAC Address

2010-04-02 Thread Booter
Hello all, I am new to python ans was wondering if there was a way to get the mac address from the local NIC? Thanks for your help. Gerad -- http://mail.python.org/mailman/listinfo/python-list

Re: Remote mac address

2008-04-14 Thread Frank Stutzman
Matias Surdi <[EMAIL PROTECTED]> wrote: > Anyone knows how having the IP address of a host on the lan could I get > the mac address of that hosr? > p/d: Parsing the output of arp -a is not an option. What kind of system? On linux and probably several other unix-like system

Re: Remote mac address

2008-04-14 Thread Huzaifa Sidhpurwala
Michael Stro"der wrote: > Matias Surdi wrote: > >> Anyone knows how having the IP address of a host on the lan could I get >> the mac address of that hosr? >> >> p/d: Parsing the output of arp -a is not an option. >> > > Any reason w

Re: Remote mac address

2008-04-14 Thread Michael Ströder
Matias Surdi wrote: > Anyone knows how having the IP address of a host on the lan could I get > the mac address of that hosr? > > p/d: Parsing the output of arp -a is not an option. But the ARP table is exactly what you need to access. This is probably system-specific. You could

Remote mac address

2008-04-14 Thread Matias Surdi
Anyone knows how having the IP address of a host on the lan could I get the mac address of that hosr? p/d: Parsing the output of arp -a is not an option. Thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list

RE: mac address

2006-09-07 Thread Tim Golden
| Is it possible to get the mac address of a device | with python 2.4 using code which works in wxp and linux | rather than requiring some code for windows and some | other code for linux ? I'm fairly sure the answer's no. It wouldn't be beyond the wit of man to produce

mac address

2006-09-07 Thread DarkBlue
Hello Is it possible to get the mac address of a device with python 2.4 using code which works in wxp and linux rather than requiring some code for windows and some other code for linux ? Db -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get the local mac address?

2005-12-19 Thread Daniel Crespo
> I was looking on how to get MAC address universally (Windows and Linux) and > found one package that is doing that and more... > http://libdnet.sourceforge.net/ Thank you for the info too :) Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get the local mac address?

2005-12-15 Thread bonono
Dejan Rodiger wrote: > I was looking on how to get MAC address universally (Windows and Linux) and > found one package that is doing that and more... > > http://libdnet.sourceforge.net/ > Thanks for the info. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get the local mac address?

2005-12-15 Thread Dejan Rodiger
I was looking on how to get MAC address universally (Windows and Linux) and found one package that is doing that and more... http://libdnet.sourceforge.net/ -- Dejan Rodiger - PGP ID 0xAC8722DC Delete wirus from e-mail address -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get the local mac address?

2005-12-15 Thread mwilliams
Well, that kinda depends on what you want the MAC Address of. Personally (on Unix systems) I simply read from a popen('ifconfig') and use a regular expression to parse out the mac address. Works perfectly. Just my 2¢, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get the local mac address?

2005-12-15 Thread bonono
Grant Edwards wrote: > > you can read my temper from what I write ? > > If not, then you should be more careful what you write. > such as ? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get the local mac address?

2005-12-15 Thread bonono
Grant Edwards wrote: > On 2005-12-15, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >>>>Why should you want to associate a MAC address with a socket? Each > >>>>interface has an IP address, and it's that you should be using. > >>

Re: How to get the local mac address?

2005-12-15 Thread Grant Edwards
On 2005-12-15, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>>>>>Why should you want to associate a MAC address with a socket? Each >>>>>>interface has an IP address, and it's that you should be using. >>>>> >>>>>Say fo

Re: How to get the local mac address?

2005-12-15 Thread Grant Edwards
On 2005-12-15, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>>>Why should you want to associate a MAC address with a socket? Each >>>>interface has an IP address, and it's that you should be using. >>> >>> Say for example I want to fin

Re: How to get the local mac address?

2005-12-15 Thread Jorge Godoy
Steve Holden <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: > > Steve Holden wrote: > > > >>Why should you want to associate a MAC address with a socket? Each > >>interface has an IP address, and it's that you should be using. > > Say for

Re: How to get the local mac address?

2005-12-15 Thread bonono
Steve Holden wrote: > I'm probably just not reading your responses carefully enough. That is fine, misunderstanding happens all the time. And why I am curious that there is no such thing in Python, it is because of this : http://search.cpan.org/~lds/IO-Interface-0.98/Interface.pm I am learning p

Re: How to get the local mac address?

2005-12-15 Thread Steve Holden
model, > when I saw a "OS dependent" implementation of getting MAC. Nothing > more. And your answer that there is not sufficient need for putting it > in the standard libary(for the maintainance work needed), answered my > puzzle. > > >>I asked "Why should

Re: How to get the local mac address?

2005-12-15 Thread bonono
getting MAC. Nothing more. And your answer that there is not sufficient need for putting it in the standard libary(for the maintainance work needed), answered my puzzle. > > I asked "Why should you want to associate a MAC address with a socket?" > and you replied "Say for e

Re: How to get the local mac address?

2005-12-15 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Steve Holden wrote: > >>[EMAIL PROTECTED] wrote: >> >>>Steve Holden wrote: >>> >>> >>>>[EMAIL PROTECTED] wrote: >>>> >>>> >>>>>Steve Holden wrote: >>>>>

Re: How to get the local mac address?

2005-12-15 Thread bonono
Steve Holden wrote: > [EMAIL PROTECTED] wrote: > > Steve Holden wrote: > > > >>[EMAIL PROTECTED] wrote: > >> > >>>Steve Holden wrote: > >>> > >>> > >>>>Why should you want to associate a MAC address with

Re: How to get the local mac address?

2005-12-15 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Steve Holden wrote: > >>[EMAIL PROTECTED] wrote: >> >>>Steve Holden wrote: >>> >>> >>>>Why should you want to associate a MAC address with a socket? Each >>>>interface has an IP address, and it'

Re: How to get the local mac address?

2005-12-15 Thread bonono
Steve Holden wrote: > [EMAIL PROTECTED] wrote: > > Steve Holden wrote: > > > >>Why should you want to associate a MAC address with a socket? Each > >>interface has an IP address, and it's that you should be using. > > > > Say for example I wan

Re: How to get the local mac address?

2005-12-15 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Steve Holden wrote: > >>Why should you want to associate a MAC address with a socket? Each >>interface has an IP address, and it's that you should be using. > > Say for example I want to find out the MAC if a particular interface in > py

Re: How to get the local mac address?

2005-12-15 Thread bonono
Steve Holden wrote: > Why should you want to associate a MAC address with a socket? Each > interface has an IP address, and it's that you should be using. Say for example I want to find out the MAC if a particular interface in python. > It may well be possible to write Python code

Re: How to get the local mac address?

2005-12-15 Thread Frank Millman
ioctl to read this info > out of the file handle of a socket but these modules don't exist on > Windows(may be some other platform as well). As you can see, this is a quick and dirty solution. I am sure you can hack at it some more, bring up the associated ip address, and compare it w

Re: How to get the local mac address?

2005-12-15 Thread Steve Holden
t;mac = line.split(':')[1].strip().replace('-',':') >>break >>else: >>for line in os.popen("/sbin/ifconfig"): >>if line.find('Ether') > -1: >> mac = l

Re: How to get the local mac address?

2005-12-14 Thread bonono
Frank Millman wrote: > [EMAIL PROTECTED] wrote: > > Sorry that I can't help you in any way but have a question myself. Is > > there an OS independent way to get this thing(regardless of how to > > format it) in Python ? I know this may not matter if all you want is > > Windows but there is just a

Re: How to get the local mac address?

2005-12-14 Thread Frank Millman
[EMAIL PROTECTED] wrote: > Sorry that I can't help you in any way but have a question myself. Is > there an OS independent way to get this thing(regardless of how to > format it) in Python ? I know this may not matter if all you want is > Windows but there is just another thread talking about one

Re: How to get the local mac address?

2005-12-14 Thread bonono
Daniel Crespo wrote: > Hi, I tried: > > import ctypes > import socket > import struct > > def get_macaddress(host): > """ Returns the MAC address of a network host, requires >= WIN2K. > """ > > # Check for api availabi

Re: How to get the local mac address?

2005-12-14 Thread Daniel Crespo
Hi, Scott, Thanks for your answer >> Hi, I tried: ... >> # Convert binary data into a string. >> macaddr = '' >> for intval in struct.unpack('BB', buffer): >> if intval > 15: >> replacestr = '0x' >> else: >> replacestr = 'x' >> macad

Re: How to get the local mac address?

2005-12-14 Thread Scott David Daniels
Daniel Crespo wrote: > Hi, I tried: ... > # Convert binary data into a string. > macaddr = '' > for intval in struct.unpack('BB', buffer): > if intval > 15: > replacestr = '0x' > else: > replacestr = 'x' > macaddr = ''.join([macaddr,

How to get the local mac address?

2005-12-14 Thread Daniel Crespo
Hi, I tried: import ctypes import socket import struct def get_macaddress(host): """ Returns the MAC address of a network host, requires >= WIN2K. """ # Check for api availability try: SendARP = ctypes.windll.Iphlpapi.SendARP except:

Re: putting a string in Mac Address form

2005-10-30 Thread Alex Martelli
kyle.tk <[EMAIL PROTECTED]> wrote: ... > new_mac = '' > c = 0 > while len(new_mac) < 16: > new_mac += mac[c:c+2] + ':' > c=c+2 > return new_mac[:-1].upper() ... > The part I think is bad is the while loop part. Could it be better? What abou

putting a string in Mac Address form

2005-10-30 Thread kyle.tk
I came up with this. Is there a better (more pythonic) way to do it? import string def mac_to_norm(mac): def bad_char(char): if char not in string.hexdigits: return False return True mac = filter(bad_char,mac) if len(m

Re: mac address

2005-06-02 Thread John Machin
[EMAIL PROTECTED] wrote: > Hello, > I am a newbie and i have problems filling an array with the mac address > read from the command line. > > The mac address is FF:FF:FF:FF:FF:FF > > options, args = parser.parse_args() > # options.d contains the address > destAd

mac address

2005-06-02 Thread shama . bell
Hello, I am a newbie and i have problems filling an array with the mac address read from the command line. The mac address is FF:FF:FF:FF:FF:FF options, args = parser.parse_args() # options.d contains the address destAddress = options.d data = array('L', '\0' * 24) The arra

Re: dealing with MAC address

2005-05-20 Thread Grant Edwards
On 2005-05-20, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > How do i fill in a command line passed mac address for source mac > address. The first six bytes of data[i] should contain destination mac > and the next six bytes of data[i] should contain the source mac > addres

dealing with MAC address

2005-05-20 Thread [EMAIL PROTECTED]
Hello, I am trying to fill a packet with source and destination mac address. The first 6 bytes hold the destination mac address and the next six bytes hold the source mac address. In the code i am filling in the first six bytes to broadcast address for the destination. # fill in the destination

store mac address

2005-05-19 Thread [EMAIL PROTECTED]
Hello, I am trying to fill an array with source and destination mac address. The first 6 bytes hold the destination mac address and the next six bytes hold the source mac address. Here's a snippet for filling in broadcast address for the destination mac. # Get destination address data = arr