473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

How to get my MAC address with python ?

Hi,

I want to know the MAC address of my local network card with a python
script.
I tested the socket module which gives only the IP address.
Is someone have an idea ?

Thanks.

O.R.

Jul 18 '05 #1
4 5365
In article <bv**********@news.univ-rennes1.fr>,
olivier Ravard <ra****@univ-rennes1.fr> wrote:
Hi,

I want to know the MAC address of my local network card with a python
script.
I tested the socket module which gives only the IP address.
Is someone have an idea ?

Jul 18 '05 #2
olivier Ravard wrote:
Hi,

I want to know the MAC address of my local network card with a python
script.
I tested the socket module which gives only the IP address.
Is someone have an idea ?


Here's a url where Mark Hammond explains how to do it on Windows:

http://groups.google.com/groups?oi=d...m=an_603363272

On Linux you can parse the output of the ifconfig command as described in
following url:

http://mail.python.org/pipermail/pyt...st/008816.html

Jul 18 '05 #3
Cameron Laird wrote:
In article <bv**********@news.univ-rennes1.fr>,
olivier Ravard <ra****@univ-rennes1.fr> wrote:
Hi,

I want to know the MAC address of my local network card with a python
script.
I tested the socket module which gives only the IP address.
Is someone have an idea ?


.
.
.
What operating system interests you?


Linux and windows. If there is a portable procedure it would be fine!

Jul 18 '05 #4
Rick Holbert wrote:
olivier Ravard wrote:

Hi,

I want to know the MAC address of my local network card with a python
script.
I tested the socket module which gives only the IP address.
Is someone have an idea ?

Here's a url where Mark Hammond explains how to do it on Windows:

http://groups.google.com/groups?oi=d...m=an_603363272

On Linux you can parse the output of the ifconfig command as described in
following url:

http://mail.python.org/pipermail/pyt...st/008816.html


It is also arbitrarily trivial to parse the output of ipconfig /all in
Windows 2k/xp/2k3. Windows 98/ME would be different.

- Josiah

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Darren Kirby | last post by:
Hello list: I am writing a small app in python which tracks the kernel banner at kernel.org and downloads newer kernel version(s) (if there are any). I am using GeoIP to set the download to a...
8
by: codecraig | last post by:
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.1....but i want the external IP address (such as ipconfig on...
24
by: Daniel Crespo | last post by:
Hi, I tried: import ctypes import socket import struct def get_macaddress(host): """ Returns the MAC address of a network host, requires >= WIN2K. """
1
by: joemynz | last post by:
Help please with a URLError. Invoking a url that works in Firefox and IE results in a "urlerror 7, no address ..." in python. I need to debug why. Traceback is below. There's a redirect when the...
1
by: Jamie J. Begin | last post by:
I'm very new to the world of Python and am trying to wrap my head around it's OOP model. Much of my OOP experience comes from VB.Net, which is very different. Let's say I wanted to create an...
9
by: volcano | last post by:
Can it be done, and if yes - how?
12
by: lmcleroy | last post by:
I'm new around here so I'm just hoping I'm in the correct place. Today I installed the latest Python for windows (2.5.1) from python.org. That went well but I lost my internet and home network...
0
by: Patrick Stinson | last post by:
you can unsubscribe yourself at the list info page (the same page you subscribed from) On Thu, Jun 5, 2008 at 10:22 AM, Hank @ITGroup <hank.infotec@gmail.comwrote:
14
by: Gordon Allott | last post by:
Hello :) The result of various incompatibilities has left me needing to somehow extract the address that a null pointer is pointing to with the null pointer being exposed to python via...
0
by: Philip Semanchuk | last post by:
On Oct 22, 2008, at 8:33 PM, Robert Kern wrote: I agree. To deny users of this module access to this param of shmat() would be design arrogance on my part. To do so would be to claim that I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.