{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "2945e4d9", "metadata": {}, "outputs": [], "source": [ "with open(\"./result.txt\", \"r\") as f:\n", " data = f.readlines()" ] }, { "cell_type": "code", "execution_count": 6, "id": "0cadbfac", "metadata": {}, "outputs": [], "source": [ "mac_data = {}\n", "for item in data:\n", " if \"(hex)\" in item:\n", " tem = item.split(\"(hex)\")\n", " mac_head = tem[0].strip()\n", " mac_info = tem[1].strip()\n", " mac_data[mac_head] = mac_info" ] }, { "cell_type": "code", "execution_count": 7, "id": "f4b26aba", "metadata": {}, "outputs": [], "source": [ "import json" ] }, { "cell_type": "code", "execution_count": 9, "id": "547be298", "metadata": {}, "outputs": [], "source": [ "with open(\"./mac_data.json\", \"r\") as f:\n", " f.read()" ] }, { "cell_type": "code", "execution_count": 13, "id": "022741d0", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0XEA.0XA0.0XED.0XFF.0XFE.0X5E.0X17.0X14." ] } ], "source": [ "for item in \"234.160.237.255.254.94.23.20\".split(\".\"):\n", " print(hex(int(item)).upper(), end=\".\")" ] }, { "cell_type": "code", "execution_count": null, "id": "d23bcc03", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "base", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.4" } }, "nbformat": 4, "nbformat_minor": 5 }