How to find MAC address and uids?
Marcin Jurczuk
mj-usunto at tkb.pl
Wed Nov 10 07:19:36 EST 2004
More information about the Python-list mailing list
Wed Nov 10 07:19:36 EST 2004
- Previous message (by thread): How to find MAC address and uids?
- Next message (by thread): How to find MAC address and uids?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2004-11-10, Marcin Jurczuk <mj-usunto at tkb.pl> wrote: > On 2004-11-10, Daniel T. <postmaster at earthlink.net> wrote: > >> 1) How can I programatically find the MAC address of the machine? Is it >> stored in a file I can look into? (MacOS X) > What is syntax of this file ?? My Mistake :) If you have access to /sbin/ifconfig (if MacOS X is FreeBSD based it should be in /sbin) you can use something like this: >>> import os >>> a=os.popen('/sbin/ifconfig bge0|grep ether').read().replace('\n','').split()[1] >>> print a 00:30:84:b3:b3:3a >>> Important - replace bge0 your card name ... > >> 2) If I have a user name in a string how do I get his UID? > >>>> import pwd >>>> pwd.getpwnam('spock') > ('spock', 'x', 100, 101, '', '/export/home/spock', '/bin/bash') >>>> pwd.getpwnam('spock')[2] > 100 >>>> > > -- Marcin Jurczuk, NIC-HDL: MJ1679-RIPE
- Previous message (by thread): How to find MAC address and uids?
- Next message (by thread): How to find MAC address and uids?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list