473,804 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5387
In article <bv**********@n ews.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**********@n ews.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
18578
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 local mirror if there is one. This is what I use to get the local IP address: ip = socket.gethostbyaddr(socket.gethostname()) # returns: ('hostname.domain', , )
8
4804
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 windows displays). any ideas?? THanks
24
7328
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
2395
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 url is invoked (it's part of a chain) - you can see it using liveheaders in firefox. What is the best way to debug this? I tried setting debug on HTTPConnection but this doesn't work (from some web posts, setting debug is broken in 2.4). What's...
1
2367
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 object that simply outputted something like this: Developer Detroit Michigan
9
2587
by: volcano | last post by:
Can it be done, and if yes - how?
12
3312
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 connections and cannot restore them. I have Windows XP, a Belkin G wireless networking card and Belkin G hub. I have removed Python, removed and reinstalled the Windows networking components, the Belkin wireless card driver and wireless utility. ...
0
824
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
2986
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 PyCObject_FromVoidPtr the code that creates the PyCObject is as follows: tmp = PyCObject_FromVoidPtr (info.info.x11.display, NULL); PyDict_SetItemString (dict, "display", tmp); Py_DECREF (tmp);
0
1407
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 know better than everyone who might want to use my module. Using values other than NULL might be unwise (the man page I'm looking at states that clearly) but isn't one of the core design philosophies of Python "we're all consenting adults"?
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9171
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5530
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.