Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Convert MAC to hex howto
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Johannes Graumann, post: 5053984"] Dear all, I'm trying to convert '00:08:9b:ce:f5:d4' to '\x00\x08\x9b\xce\xf5\xd4' for use in magic packet construction for WakeOnLan like so: wolsocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) wolsocket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) wolsocket.sendto('\xff'*6 + '\x00\x08\x9b\xce\xf5\xd4'*16, (expectedlanbroadcast, 80)) This is what I came up whith, but I remain puzzled on how to preserver the leading '\h' ... thanks for any hint expectedservermac = '00:08:9b:ce:f5:d4' hexcall = str.split(expectedservermac,":") hexcall.insert(0,'') hexcall = "\\x".join(hexcall).decode('string_escape') Thanks for any pointers. Sincerely, Joh [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Convert MAC to hex howto
Top