Kitz Forum

Computers & Hardware => Apple Related => Topic started by: Weaver on July 15, 2018, 06:12:13 AM

Title: MAC address lookup tool in Safari / iOS
Post by: Weaver on July 15, 2018, 06:12:13 AM
I had this idea of writing a javascript module that is installed as a 'bookmarklet' in Safari/iOS on my iPad. It finds every MAC address on a web page and turns them into friendly names or hostnames by looking them up in a database. The database could be hard-coded, at least to begin with.

Is this feasible? I would have to work out how to walk the DOM, find text in elements, do a regex based match on the text. I have done a tiny bit of javascript but not on a web page. I use regexes all the time. I suppose I could modify the DOM to make the page show the results in place of the MAC addresses or following them, in brackets. The layout would probably be really messed up as the text length would not be that short, unless I used lan dns hostnames instead of friendly-name type descriptions. Would that work, just getting the browser to alter the display to show dynamically modified text, poked by javascript?

The alternative to overwriting or altering and extending the text in place might be some kind of hovering translucent annotation box positioned near the original mac address but offset a little way, either above it or below it. I need to do something intelligent so that such a box will not be in danger of being off-screen, and there is also the requirement that boxes must not overwrite one another. Needs some thought. Getting too fancy anyway, unless clever css could be persuaded to do all the work for me, with a box and z-index positioning. But getting that graphical object relative to the text in question might be a problem in some cases.