LinhVuu/Banking-Advanced-Authentication-System
0
1{2 "cells": [3 {4 "cell_type": "code",5 "execution_count": 3,6 "metadata": {},7 "outputs": [8 {9 "name": "stdout",10 "output_type": "stream",11 "text": [12 "1\n"13 ]14 }15 ],16 "source": [17 "TEST = 1\n",18 "test = 2\n",19 "print(TEST)"20 ]21 },22 {23 "cell_type": "code",24 "execution_count": 2,25 "metadata": {},26 "outputs": [27 {28 "name": "stdout",29 "output_type": "stream",30 "text": [31 "8c:7a:aa:f2:e5:88\n"32 ]33 }34 ],35 "source": [36 "from getmac import get_mac_address as gma\n",37 "print(gma())"38 ]39 },40 {41 "cell_type": "code",42 "execution_count": 54,43 "metadata": {},44 "outputs": [45 {46 "name": "stdout",47 "output_type": "stream",48 "text": [49 "Linhs-MacBook-Air-2.local\n"50 ]51 }52 ],53 "source": [54 "import platform\n",55 "print(platform.node())"56 ]57 },58 {59 "cell_type": "code",60 "execution_count": 15,61 "metadata": {},62 "outputs": [63 {64 "data": {65 "text/plain": [66 "'Apple, Inc.'"67 ]68 },69 "execution_count": 15,70 "metadata": {},71 "output_type": "execute_result"72 }73 ],74 "source": [75 "import requests\n",76 "from getmac import get_mac_address as gma\n",77 "mac_address = gma()\n",78 "\n",79 "def get_mac_details(mac_address):\n",80 " \n",81 " # We will use an API to get the vendor details\n",82 " url = \"https://api.macvendors.com/\"\n",83 " \n",84 " # Use get method to fetch details\n",85 " response = requests.get(url+mac_address)\n",86 " if response.status_code != 200:\n",87 " raise Exception(\"[!] Invalid MAC Address!\")\n",88 " return response.content.decode()\n",89 "\n",90 "get_mac_details(mac_address)"91 ]92 },93 {94 "cell_type": "code",95 "execution_count": 65,96 "metadata": {},97 "outputs": [98 {99 "name": "stdout",100 "output_type": "stream",101 "text": [102 "24291951679257\n"103 ]104 },105 {106 "data": {107 "text/plain": [108 "UUID('00000000-0000-0000-0000-1617e9269719')"109 ]110 },111 "execution_count": 65,112 "metadata": {},113 "output_type": "execute_result"114 }115 ],116 "source": [117 "import uuid\n",118 "import hashlib\n",119 "uuid_1 = c\n",120 "print(uuid_1)\n",121 "uuid.UUID(int=uuid.getnode())\n",122 "\n"123 ]124 },125 {126 "cell_type": "code",127 "execution_count": 72,128 "metadata": {},129 "outputs": [130 {131 "ename": "AttributeError",132 "evalue": "'int' object has no attribute 'encode'",133 "output_type": "error",134 "traceback": [135 "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",136 "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",137 "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",138 "\u001b[0;31mAttributeError\u001b[0m: 'int' object has no attribute 'encode'"139 ]140 }141 ],142 "source": [143 "hashlib.md5(uuid.getnode().encode()).hexdigest()"144 ]145 },146 {147 "cell_type": "code",148 "execution_count": 68,149 "metadata": {},150 "outputs": [],151 "source": [152 "import psutil\n",153 "import platform\n",154 "from datetime import datetime"155 ]156 },157 {158 "cell_type": "code",159 "execution_count": 25,160 "metadata": {},161 "outputs": [162 {163 "name": "stdout",164 "output_type": "stream",165 "text": [166 "======================================== System Information ========================================\n",167 "System: Darwin\n",168 "Node Name: Linhs-MacBook-Air-2.local\n",169 "Release: 21.6.0\n",170 "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",171 "Machine: arm64\n",172 "Processor: arm\n"173 ]174 }175 ],176 "source": [177 "print(\"=\"*40, \"System Information\", \"=\"*40)\n",178 "uname = platform.uname()\n",179 "print(f\"System: {uname.system}\")\n",180 "print(f\"Node Name: {uname.node}\")\n",181 "print(f\"Release: {uname.release}\")\n",182 "print(f\"Version: {uname.version}\")\n",183 "print(f\"Machine: {uname.machine}\")\n",184 "print(f\"Processor: {uname.processor}\")"185 ]186 },187 {188 "cell_type": "code",189 "execution_count": 39,190 "metadata": {},191 "outputs": [192 {193 "data": {194 "text/plain": [195 "{'system': 'Darwin',\n",196 " 'platform-release': '21.6.0',\n",197 " '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",198 " 'architecture': 'arm64',\n",199 " 'hostname': 'Linhs-MacBook-Air-2.local',\n",200 " 'platform': 'macOS-12.5.1-arm64-arm-64bit',\n",201 " 'ip-address': '192.168.1.8',\n",202 " 'mac-address': '16:17:e9:26:97:19',\n",203 " 'processor': 'arm',\n",204 " 'ram': '16 GB'}"205 ]206 },207 "execution_count": 39,208 "metadata": {},209 "output_type": "execute_result"210 }211 ],212 "source": [213 "import platform,socket,re,uuid,json,psutil,logging\n",214 "\n",215 "def getSystemInfo():\n",216 " try:\n",217 " info={}\n",218 " info['system']=platform.system()\n",219 " info['platform-release']=platform.release()\n",220 " info['platform-version']=platform.version()\n",221 " info['architecture']=platform.machine()\n",222 " info['hostname']=socket.gethostname()\n",223 " info['platform'] = platform.platform()\n",224 " info['ip-address']=socket.gethostbyname(socket.gethostname())\n",225 " info['mac-address']=':'.join(re.findall('..', '%012x' % uuid.getnode()))\n",226 " info['processor']=platform.processor()\n",227 " info['ram']=str(round(psutil.virtual_memory().total / (1024.0 **3)))+\" GB\"\n",228 " return json.dumps(info)\n",229 " except Exception as e:\n",230 " logging.exception(e)\n",231 "\n",232 "json.loads(getSystemInfo())"233 ]234 },235 {236 "cell_type": "code",237 "execution_count": 4,238 "metadata": {},239 "outputs": [240 {241 "name": "stdout",242 "output_type": "stream",243 "text": [244 "2001:ee0:4f84:6a70:652e:732d:859a:76e9\n"245 ]246 }247 ],248 "source": [249 "import urllib.request\n",250 "\n",251 "external_ip = urllib.request.urlopen('https://ident.me').read().decode('utf8')\n",252 "\n",253 "print(external_ip)"254 ]255 },256 {257 "cell_type": "code",258 "execution_count": 14,259 "metadata": {},260 "outputs": [261 {262 "name": "stdout",263 "output_type": "stream",264 "text": [265 "123.21.79.245\n",266 "My public IP address is: 123.21.79.245\n"267 ]268 }269 ],270 "source": [271 "from requests import get\n",272 "ip_v4 = get('https://api.ipify.org').content.decode('utf8')\n",273 "print(ip_v4)\n",274 "print('My public IP address is: {}'.format(ip_v4))"275 ]276 },277 {278 "cell_type": "code",279 "execution_count": 15,280 "metadata": {},281 "outputs": [282 {283 "data": {284 "text/plain": [285 "'123.21.79.245'"286 ]287 },288 "execution_count": 15,289 "metadata": {},290 "output_type": "execute_result"291 }292 ],293 "source": [294 "ip_v4"295 ]296 },297 {298 "cell_type": "code",299 "execution_count": 17,300 "metadata": {},301 "outputs": [302 {303 "data": {304 "text/plain": [305 "'2001:ee0:4f84:6a70:1897:c02c:2c98:6d33'"306 ]307 },308 "execution_count": 17,309 "metadata": {},310 "output_type": "execute_result"311 }312 ],313 "source": [314 "import requests\n",315 "url = \"https://ident.me\"\n",316 "\n",317 "# Use get method to fetch details\n",318 "ipv6 = requests.get(url)\n",319 "\n",320 "ipv6.content.decode()"321 ]322 },323 {324 "cell_type": "code",325 "execution_count": 25,326 "metadata": {},327 "outputs": [328 {329 "name": "stdout",330 "output_type": "stream",331 "text": [332 "{'ip': '123.21.79.245', 'security': {'vpn': False, 'proxy': False, 'tor': False, 'relay': False}, 'location': {'city': 'Ho Chi Minh City', 'region': 'Ho Chi Minh', 'country': 'Vietnam', 'continent': 'Asia', 'region_code': 'SG', 'country_code': 'VN', 'continent_code': 'AS', 'latitude': '10.8326', 'longitude': '106.6581', 'time_zone': 'Asia/Ho_Chi_Minh', 'locale_code': 'en', 'metro_code': '', 'is_in_european_union': False}, 'network': {'network': '123.16.0.0/13', 'autonomous_system_number': 'AS45899', 'autonomous_system_organization': 'VNPT Corp'}}\n",333 "{'vpn': False, 'proxy': False, 'tor': False, 'relay': False}\n"334 ]335 }336 ],337 "source": [338 "import json\n",339 "API_key = \"bc2fe06e10244a0797ceffc6b4ce4a09\"\n",340 "response = requests.get(\"https://vpnapi.io/api/\" + ip_v4 + \"?key=\" + API_key)\n",341 "data = json.loads(response.text)\n",342 "print(data) # Outputs everything\n",343 "print(data[\"security\"]) # Outputs just the security details"344 ]345 },346 {347 "cell_type": "code",348 "execution_count": 19,349 "metadata": {},350 "outputs": [351 {352 "data": {353 "text/plain": [354 "{'message': 'Invalid API key.'}"355 ]356 },357 "execution_count": 19,358 "metadata": {},359 "output_type": "execute_result"360 }361 ],362 "source": [363 "# isp[\"status\"]\n",364 "isp"365 ]366 },367 {368 "cell_type": "code",369 "execution_count": 45,370 "metadata": {},371 "outputs": [372 {373 "name": "stdout",374 "output_type": "stream",375 "text": [376 "[10.823, 106.6296]\n"377 ]378 }379 ],380 "source": [381 "import geocoder\n",382 "g = geocoder.ip('me')\n",383 "print(g.latlng)"384 ]385 },386 {387 "cell_type": "code",388 "execution_count": 47,389 "metadata": {},390 "outputs": [391 {392 "name": "stdout",393 "output_type": "stream",394 "text": [395 "CHC, Gosainganj, Sultanpur Road, गोसाईगंज, Lucknow, Uttar Pradesh, 227125, India\n",396 "Latitude = 26.7652312 \n",397 "\n",398 "Longitude = 81.1196719\n"399 ]400 }401 ],402 "source": [403 "# importing geopy library\n",404 "from geopy.geocoders import Nominatim\n",405 " \n",406 "# calling the Nominatim tool\n",407 "loc = Nominatim(user_agent=\"GetLoc\")\n",408 " \n",409 "# entering the location name\n",410 "getLoc = loc.geocode(\"Gosainganj Lucknow\")\n",411 " \n",412 "# printing address\n",413 "print(getLoc.address)\n",414 " \n",415 "# printing latitude and longitude\n",416 "print(\"Latitude = \", getLoc.latitude, \"\\n\")\n",417 "print(\"Longitude = \", getLoc.longitude)"418 ]419 },420 {421 "cell_type": "code",422 "execution_count": 1,423 "metadata": {},424 "outputs": [425 {426 "ename": "NameError",427 "evalue": "name '__file__' is not defined",428 "output_type": "error",429 "traceback": [430 "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",431 "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",432 "Cell \u001b[0;32mIn [1], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mos\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;66;03m# Set direction as current folder\u001b[39;00m\n\u001b[0;32m----> 3\u001b[0m sourceFileDir \u001b[38;5;241m=\u001b[39m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mdirname(os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mabspath(\u001b[38;5;18;43m__file__\u001b[39;49m))\n\u001b[1;32m 4\u001b[0m os\u001b[38;5;241m.\u001b[39mchdir(sourceFileDir)\n",433 "\u001b[0;31mNameError\u001b[0m: name '__file__' is not defined"434 ]435 }436 ],437 "source": [438 "import os\n",439 "# Set direction as current folder\n",440 "sourceFileDir = os.path.dirname(os.path.abspath(__file__))\n",441 "os.chdir(sourceFileDir)\n"442 ]443 },444 {445 "cell_type": "code",446 "execution_count": 34,447 "metadata": {},448 "outputs": [449 {450 "name": "stdout",451 "output_type": "stream",452 "text": [453 "Days: 0\n",454 "Microseconds: 854282\n",455 "seconds: 93\n",456 "Max: 999999999 days, 23:59:59.999999\n",457 "Min: -999999999 days, 0:00:00\n",458 "Resolution: 0:00:00.000001\n",459 "Total Seconds: 93.854282\n"460 ]461 }462 ],463 "source": [464 "# Import libraries\n",465 "import os\n",466 "import streamlit as st\n",467 "from PIL import Image\n",468 "from streamlit_extras.switch_page_button import switch_page\n",469 "from bokeh.models.widgets import Button\n",470 "from bokeh.models import CustomJS\n",471 "from streamlit_bokeh_events import streamlit_bokeh_events\n",472 "from datetime import timedelta\n",473 "from datetime import datetime\n",474 "# Stop counting time after the user finished entering username, password and clicked login button\n",475 "d1 = datetime.now()\n",476 "\n",477 "\n",478 "d2 = datetime(year=2022, month=9, day=26, hour=0, minute=40)\n",479 "\n",480 "# Get timedelta by subtracting two dates\n",481 "td = d2 - d1\n",482 "\n",483 "# access timedelta attributes\n",484 "print(\"Days:\", td.days)\n",485 "print(\"Microseconds:\", td.microseconds)\n",486 "print(\"seconds:\", td.seconds)\n",487 "print(\"Max:\", td.max)\n",488 "print(\"Min:\", td.min)\n",489 "print(\"Resolution:\", td.resolution)\n",490 "print(\"Total Seconds:\", td.total_seconds())"491 ]492 },493 {494 "cell_type": "code",495 "execution_count": 36,496 "metadata": {},497 "outputs": [498 {499 "data": {500 "text/plain": [501 "1664128185.102907"502 ]503 },504 "execution_count": 36,505 "metadata": {},506 "output_type": "execute_result"507 }508 ],509 "source": [510 "import time\n",511 "time.time()"512 ]513 },514 {515 "cell_type": "code",516 "execution_count": null,517 "metadata": {},518 "outputs": [],519 "source": []520 }521 ],522 "metadata": {523 "kernelspec": {524 "display_name": "Python 3.10.6 64-bit",525 "language": "python",526 "name": "python3"527 },528 "language_info": {529 "codemirror_mode": {530 "name": "ipython",531 "version": 3532 },533 "file_extension": ".py",534 "mimetype": "text/x-python",535 "name": "python",536 "nbconvert_exporter": "python",537 "pygments_lexer": "ipython3",538 "version": "3.10.6"539 },540 "orig_nbformat": 4,541 "vscode": {542 "interpreter": {543 "hash": "b0fa6594d8f4cbf19f97940f81e996739fb7646882a419484c72d19e05852a7e"544 }545 }546 },547 "nbformat": 4,548 "nbformat_minor": 2549}550 