{ "cells": [ { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "b'{0000}iVBORw0KGgoAAA...pYPC/JLqiJrYPZjGUjsH'\n", "b'{0001}mH0pIKQFfwvN8R...yLgv+r3mfg0FgOr52dhT'\n", "b'{0002}QsSJps9VSwYtH4...7+IX/vcTyPKAh3cr6efq'\n", "b'{0003}yH09Nu9ySym8jX...a/1EC5eKJ/DakZM4PjoN'\n", "b'{0004}CF9vMC+UA35i6U...t4DoOvvPEM/B9lxfbY8F'\n" ] } ], "source": [ "try:\n", " import dns.resolver\n", "except ImportError:\n", " import pip\n", " if hasattr(pip, \"main\"):\n", " pip.main([\"install\", \"dnspython\"])\n", " else:\n", " pip._internal.main([\"install\", \"dnspython\"])\n", " import dns.resolver\n", "q = dns.resolver.query(\"logo.suv.id.au\",\"TXT\").response.answer[0]\n", "for line in sorted(_.strings[0] for _ in q)[:5]:\n", " print((line[:20] + b\"...\" + line[-20:]) if len(line) > 20 else line)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from IPython.display import HTML\n", "out = b\"\"\n", "for line in sorted(_.strings[0] for _ in q):\n", " if chr(line[0]) == \"{\":\n", " try:\n", " out += line.split(b\"}\",1)[1]\n", " except IndexError:\n", " pass\n", "HTML(\"\".format(out.decode('utf-8')))" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "b'{000}SUQzAwAAAAADJVR...VIAAAACAAAAMAAAAAAAA'\n", "b'{001}AAAAAAAAAAAAAAA...AAAAAAAAAAAAAAAAAAAA'\n", "b'{002}AAAAAAAAAAAAAAA...68R7p+O//k928HTZvEdc'\n", "b'{003}PwcOzWUEAEkpu4s...AAlOmYD7DibTkUoJkxGS'\n", "b'{004}E51MCRTwwCARnkj...a+V76LV/jYrN1613hjxj'\n" ] } ], "source": [ "hwg = dns.resolver.query(\"hwg.suv.id.au\",\"TXT\").response.answer[0]\n", "for line in sorted(_.strings[0] for _ in hwg)[:5]:\n", " print((line[:20] + b\"...\" + line[-20:]) if len(line) > 20 else line)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ " (the audio element does not render on github gist; download the .ipynb and run it through jupyter notebook)" ], "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "out = b\"\"\n", "for line in sorted(_.strings[0] for _ in hwg):\n", " if chr(line[0]) == \"{\":\n", " try:\n", " out += line.split(b\"}\",1)[1]\n", " except IndexError:\n", " pass\n", "HTML(\" (the audio element does not render on github gist; download the .ipynb and run it through jupyter notebook)\".format(out.decode('utf-8')))" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.6.5" } }, "nbformat": 4, "nbformat_minor": 4 }