I created a custom SB module to try this.
include ip.bas
print "Public IP: " & IP::Public() & "\n"
print "Local IP: " & IP::Local("eth0") & "\n"
print "MAC Address for eth0: " & IP::MacAddress("eth0") & "\n"
OUTPUT:
riveraa@dpi:~/sb $ sb iptest.sb
Public IP: 24.188.233.50 <--not my real ip. LOL.
Local IP: 192.168.1.64
MAC Address for eth0: b8:27:eb:2a:e9:22All done in code, no calls to external web sites (which wouldn't be able to grab the MAC Address. I hope!), or executing shell commands.
I used libresolv for the DNS Query, and SOCKET & IOCTL calls to get the local IP and MAC Address of the adapter.
I took a slightly different approach to putting the module together; I wrote the core code in pure C and then called the Functions from within the module after compiling the C file along with the interface.c file (similar to what I did with the JSON and SLRE modules).
This is a much cleaner approach since I didn't have to re-write the core code to work within the BES macro system. All I had to do was plug in the Function calls and I was done.
Coded start to finish on my RasPi.
I'll push this up later today after some cleanup and sleep, it's 4:20am where I am right now!
AIR.