{ "cells": [ { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1\n" ] } ], "source": [ "TEST = 1\n", "test = 2\n", "print(TEST)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "8c:7a:aa:f2:e5:88\n" ] } ], "source": [ "from getmac import get_mac_address as gma\n", "print(gma())" ] }, { "cell_type": "code", "execution_count": 54, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Linhs-MacBook-Air-2.local\n" ] } ], "source": [ "import platform\n", "print(platform.node())" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Apple, Inc.'" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import requests\n", "from getmac import get_mac_address as gma\n", "mac_address = gma()\n", "\n", "def get_mac_details(mac_address):\n", " \n", " # We will use an API to get the vendor details\n", " url = \"https://api.macvendors.com/\"\n", " \n", " # Use get method to fetch details\n", " response = requests.get(url+mac_address)\n", " if response.status_code != 200:\n", " raise Exception(\"[!] Invalid MAC Address!\")\n", " return response.content.decode()\n", "\n", "get_mac_details(mac_address)" ] }, { "cell_type": "code", "execution_count": 65, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "24291951679257\n" ] }, { "data": { "text/plain": [ "UUID('00000000-0000-0000-0000-1617e9269719')" ] }, "execution_count": 65, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import uuid\n", "import hashlib\n", "uuid_1 = c\n", "print(uuid_1)\n", "uuid.UUID(int=uuid.getnode())\n", "\n" ] }, { "cell_type": "code", "execution_count": 72, "metadata": {}, "outputs": [ { "ename": "AttributeError", "evalue": "'int' object has no attribute 'encode'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn [72], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m hashlib\u001b[38;5;241m.\u001b[39mmd5(\u001b[43muuid\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetnode\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencode\u001b[49m())\u001b[38;5;241m.\u001b[39mhexdigest()\n", "\u001b[0;31mAttributeError\u001b[0m: 'int' object has no attribute 'encode'" ] } ], "source": [ "hashlib.md5(uuid.getnode().encode()).hexdigest()" ] }, { "cell_type": "code", "execution_count": 68, "metadata": {}, "outputs": [], "source": [ "import psutil\n", "import platform\n", "from datetime import datetime" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "======================================== System Information ========================================\n", "System: Darwin\n", "Node Name: Linhs-MacBook-Air-2.local\n", "Release: 21.6.0\n", "Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8101\n", "Machine: arm64\n", "Processor: arm\n" ] } ], "source": [ "print(\"=\"*40, \"System Information\", \"=\"*40)\n", "uname = platform.uname()\n", "print(f\"System: {uname.system}\")\n", "print(f\"Node Name: {uname.node}\")\n", "print(f\"Release: {uname.release}\")\n", "print(f\"Version: {uname.version}\")\n", "print(f\"Machine: {uname.machine}\")\n", "print(f\"Processor: {uname.processor}\")" ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'system': 'Darwin',\n", " 'platform-release': '21.6.0',\n", " 'platform-version': 'Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8101',\n", " 'architecture': 'arm64',\n", " 'hostname': 'Linhs-MacBook-Air-2.local',\n", " 'platform': 'macOS-12.5.1-arm64-arm-64bit',\n", " 'ip-address': '192.168.1.8',\n", " 'mac-address': '16:17:e9:26:97:19',\n", " 'processor': 'arm',\n", " 'ram': '16 GB'}" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import platform,socket,re,uuid,json,psutil,logging\n", "\n", "def getSystemInfo():\n", " try:\n", " info={}\n", " info['system']=platform.system()\n", " info['platform-release']=platform.release()\n", " info['platform-version']=platform.version()\n", " info['architecture']=platform.machine()\n", " info['hostname']=socket.gethostname()\n", " info['platform'] = platform.platform()\n", " info['ip-address']=socket.gethostbyname(socket.gethostname())\n", " info['mac-address']=':'.join(re.findall('..', '%012x' % uuid.getnode()))\n", " info['processor']=platform.processor()\n", " info['ram']=str(round(psutil.virtual_memory().total / (1024.0 **3)))+\" GB\"\n", " return json.dumps(info)\n", " except Exception as e:\n", " logging.exception(e)\n", "\n", "json.loads(getSystemInfo())" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2001:ee0:4f84:6a70:652e:732d:859a:76e9\n" ] } ], "source": [ "import urllib.request\n", "\n", "external_ip = urllib.request.urlopen('https://ident.me').read().decode('utf8')\n", "\n", "print(external_ip)" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "123.21.79.245\n", "My public IP address is: 123.21.79.245\n" ] } ], "source": [ "from requests import get\n", "ip_v4 = get('https://api.ipify.org').content.decode('utf8')\n", "print(ip_address)\n", "print('My public IP address is: {}'.format(ip_address))" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'123.21.79.245'" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ip_v4" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'2001:ee0:4f84:6a70:652e:732d:859a:76e9'" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import requests\n", "url = \"https://ident.me\"\n", "\n", "# Use get method to fetch details\n", "ipv6 = requests.get(url)\n", "\n", "ipv6.content.decode()" ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [], "source": [ "import json\n", "isp = requests.get(\"http://ip-api.com/json/\" + ip_v4)\n", "isp = isp.content.decode()\n", "isp = json.loads(isp)" ] }, { "cell_type": "code", "execution_count": 43, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'status': 'success',\n", " 'country': 'Vietnam',\n", " 'countryCode': 'VN',\n", " 'region': 'SG',\n", " 'regionName': 'Ho Chi Minh',\n", " 'city': 'Ho Chi Minh City',\n", " 'zip': '',\n", " 'lat': 10.8326,\n", " 'lon': 106.6581,\n", " 'timezone': 'Asia/Ho_Chi_Minh',\n", " 'isp': 'VietNam Post and Telecom Corporation',\n", " 'org': 'Vietnam Posts and Telecommunications Group',\n", " 'as': 'AS45899 VNPT Corp',\n", " 'query': '123.21.79.245'}" ] }, "execution_count": 43, "metadata": {}, "output_type": "execute_result" } ], "source": [ "isp[\"status\"]\n", "isp" ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[10.823, 106.6296]\n" ] } ], "source": [ "import geocoder\n", "g = geocoder.ip('me')\n", "print(g.latlng)" ] }, { "cell_type": "code", "execution_count": 47, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CHC, Gosainganj, Sultanpur Road, गोसाईगंज, Lucknow, Uttar Pradesh, 227125, India\n", "Latitude = 26.7652312 \n", "\n", "Longitude = 81.1196719\n" ] } ], "source": [ "# importing geopy library\n", "from geopy.geocoders import Nominatim\n", " \n", "# calling the Nominatim tool\n", "loc = Nominatim(user_agent=\"GetLoc\")\n", " \n", "# entering the location name\n", "getLoc = loc.geocode(\"Gosainganj Lucknow\")\n", " \n", "# printing address\n", "print(getLoc.address)\n", " \n", "# printing latitude and longitude\n", "print(\"Latitude = \", getLoc.latitude, \"\\n\")\n", "print(\"Longitude = \", getLoc.longitude)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "ename": "ImportError", "evalue": "\n\nIMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!\n\nImporting the numpy C-extensions failed. This error can happen for\nmany reasons, often due to issues with your setup or how NumPy was\ninstalled.\n\nWe have compiled some common reasons and troubleshooting tips at:\n\n https://numpy.org/devdocs/user/troubleshooting-importerror.html\n\nPlease note and check the following:\n\n * The Python version is: Python3.10 from \"/Users/linhvuu/miniforge3/bin/python\"\n * The NumPy version is: \"1.22.4\"\n\nand make sure that they are the versions you expect.\nPlease carefully study the documentation linked above for further help.\n\nOriginal error was: dlopen(/Users/linhvuu/miniforge3/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so, 0x0002): Library not loaded: '@rpath/libcblas.3.dylib'\n Referenced from: '/Users/linhvuu/miniforge3/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so'\n Reason: tried: '/Users/linhvuu/miniforge3/lib/python3.10/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/linhvuu/miniforge3/lib/python3.10/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/linhvuu/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/Users/linhvuu/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/usr/local/lib/libcblas.3.dylib' (no such file), '/usr/lib/libcblas.3.dylib' (no such file)\n", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", "File \u001b[0;32m~/miniforge3/lib/python3.10/site-packages/numpy/core/__init__.py:23\u001b[0m, in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 23\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m multiarray\n\u001b[1;32m 24\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n", "File \u001b[0;32m~/miniforge3/lib/python3.10/site-packages/numpy/core/multiarray.py:10\u001b[0m, in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mfunctools\u001b[39;00m\n\u001b[0;32m---> 10\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m overrides\n\u001b[1;32m 11\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m _multiarray_umath\n", "File \u001b[0;32m~/miniforge3/lib/python3.10/site-packages/numpy/core/overrides.py:6\u001b[0m, in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mos\u001b[39;00m\n\u001b[0;32m----> 6\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcore\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_multiarray_umath\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m 7\u001b[0m add_docstring, implement_array_function, _get_implementing_args)\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcompat\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_inspect\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m getargspec\n", "\u001b[0;31mImportError\u001b[0m: dlopen(/Users/linhvuu/miniforge3/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so, 0x0002): Library not loaded: '@rpath/libcblas.3.dylib'\n Referenced from: '/Users/linhvuu/miniforge3/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so'\n Reason: tried: '/Users/linhvuu/miniforge3/lib/python3.10/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/linhvuu/miniforge3/lib/python3.10/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/linhvuu/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/Users/linhvuu/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/usr/local/lib/libcblas.3.dylib' (no such file), '/usr/lib/libcblas.3.dylib' (no such file)", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", "Input \u001b[0;32mIn [1]\u001b[0m, in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mnp\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mpandas\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mpd\u001b[39;00m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01msklearn\u001b[39;00m\n", "File \u001b[0;32m~/miniforge3/lib/python3.10/site-packages/numpy/__init__.py:144\u001b[0m, in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[38;5;66;03m# Allow distributors to run custom init code\u001b[39;00m\n\u001b[1;32m 142\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m _distributor_init\n\u001b[0;32m--> 144\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m core\n\u001b[1;32m 145\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcore\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[1;32m 146\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m compat\n", "File \u001b[0;32m~/miniforge3/lib/python3.10/site-packages/numpy/core/__init__.py:49\u001b[0m, in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01msys\u001b[39;00m\n\u001b[1;32m 26\u001b[0m msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\"\"\u001b[39m\n\u001b[1;32m 27\u001b[0m \n\u001b[1;32m 28\u001b[0m \u001b[38;5;124mIMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!\u001b[39m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 47\u001b[0m \u001b[38;5;124m\"\"\"\u001b[39m \u001b[38;5;241m%\u001b[39m (sys\u001b[38;5;241m.\u001b[39mversion_info[\u001b[38;5;241m0\u001b[39m], sys\u001b[38;5;241m.\u001b[39mversion_info[\u001b[38;5;241m1\u001b[39m], sys\u001b[38;5;241m.\u001b[39mexecutable,\n\u001b[1;32m 48\u001b[0m __version__, exc)\n\u001b[0;32m---> 49\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m(msg)\n\u001b[1;32m 50\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[1;32m 51\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m envkey \u001b[38;5;129;01min\u001b[39;00m env_added:\n", "\u001b[0;31mImportError\u001b[0m: \n\nIMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!\n\nImporting the numpy C-extensions failed. This error can happen for\nmany reasons, often due to issues with your setup or how NumPy was\ninstalled.\n\nWe have compiled some common reasons and troubleshooting tips at:\n\n https://numpy.org/devdocs/user/troubleshooting-importerror.html\n\nPlease note and check the following:\n\n * The Python version is: Python3.10 from \"/Users/linhvuu/miniforge3/bin/python\"\n * The NumPy version is: \"1.22.4\"\n\nand make sure that they are the versions you expect.\nPlease carefully study the documentation linked above for further help.\n\nOriginal error was: dlopen(/Users/linhvuu/miniforge3/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so, 0x0002): Library not loaded: '@rpath/libcblas.3.dylib'\n Referenced from: '/Users/linhvuu/miniforge3/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so'\n Reason: tried: '/Users/linhvuu/miniforge3/lib/python3.10/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/linhvuu/miniforge3/lib/python3.10/site-packages/numpy/core/../../../../libcblas.3.dylib' (no such file), '/Users/linhvuu/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/Users/linhvuu/miniforge3/bin/../lib/libcblas.3.dylib' (no such file), '/usr/local/lib/libcblas.3.dylib' (no such file), '/usr/lib/libcblas.3.dylib' (no such file)\n" ] } ], "source": [ "import numpy as np\n", "import pandas as pd\n", "import sklearn\n", "import tensorflow as tf\n", "import matplotlib.pyplot as plt\n", "\n", "# Check for TensorFlow GPU access\n", "print(tf.config.list_physical_devices())\n", "\n", "# See TensorFlow version\n", "print(tf.__version__)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.10.6" }, "vscode": { "interpreter": { "hash": "b0fa6594d8f4cbf19f97940f81e996739fb7646882a419484c72d19e05852a7e" } } }, "nbformat": 4, "nbformat_minor": 2 }