|
| 1 | +#!/usr/bin/env python |
| 2 | +# -*- coding: utf-8 -*-4 |
| 3 | + |
| 4 | +import os |
| 5 | +import time |
| 6 | + |
| 7 | +pycpu_logo = """ |
| 8 | + Function Key |
| 9 | + / |
| 10 | + __n___ |
| 11 | + I I _________ |
| 12 | + Main _ I I Floppy disk I ___ I |
| 13 | + Storage I I ' I=(___)=I - Application Software |
| 14 | + I I I I_/ /__I |
| 15 | + I I I INPUT ~~\ \~~~ |
| 16 | + (____) I | /__/ |
| 17 | + II I___________ |
| 18 | + I(___/___________) - User Interface Debugging Tool |
| 19 | + (__ I \ __ |
| 20 | + I / II |
| 21 | + \ / - Central II |
| 22 | + ) / Processing II |
| 23 | + OUTPUT -- I ( Unit .-._ II |
| 24 | + I_________`, o_oo'_) II |
| 25 | + ~~~~~***&%~ `._ `._ II |
| 26 | + ###@^&&& `, \ | | |
| 27 | + ._____._ &&&%%## - Overflow //_(_)_/ ~~~~ |
| 28 | + I o) (I/O error) ~~ |
| 29 | + (_____,-' Mouse |
| 30 | + |
| 31 | + Backup System |
| 32 | +""" |
| 33 | + |
| 34 | +# ascii image design reference --> http://artscene.textfiles.com/asciiart/cpu.txt |
| 35 | + |
| 36 | +def author(): |
| 37 | + author = """ |
| 38 | + Central Processing Unit Information Gathering Tool |
| 39 | + Ismail Tasdelen |
| 40 | + github.com/ismailtasdelen linkedin.com/in/ismailtasdelen |
| 41 | + """ |
| 42 | + print author |
| 43 | + |
| 44 | +# Author : Ismail Tasdelen |
| 45 | +# https://github.com/ismailtasdelen |
| 46 | +# https://www.linkedin.com/in/ismailtasdelen/ |
| 47 | + |
| 48 | +def pycpu_menu(): |
| 49 | + pycpu_menu = """ |
| 50 | + [1] CPU All Information Gathering |
| 51 | + [2] Default Information Gathering |
| 52 | + [3] CPU Vulnerability Check |
| 53 | + [4] Exit |
| 54 | +""" |
| 55 | + print pycpu_menu |
| 56 | + |
| 57 | +def logo(): |
| 58 | + print pycpu_logo |
| 59 | + time.sleep(5) |
| 60 | + os.system("clear") |
| 61 | + |
| 62 | +def all_cpu(): |
| 63 | + os.system("cat /proc/cpuinfo") |
| 64 | + |
| 65 | +def cpu_info(): |
| 66 | + info_1 = "cat /proc/cpuinfo | grep 'vendor' | uniq && cat /proc/cpuinfo | grep 'model name' | uniq" # information 1 |
| 67 | + info_2 = "cat /proc/cpuinfo | grep 'microcode' | uniq && cat /proc/cpuinfo | grep 'cpu MHz' | uniq" # information 2 |
| 68 | + info_3 = "cat /proc/cpuinfo | grep 'cache size' | uniq" # information 3 |
| 69 | + os.system(info_1 + "&&" + info_2 + "&&" + info_3) # go to function and run |
| 70 | + |
| 71 | +def cpu_vulncheck(): |
| 72 | + vulncheck = "cat /proc/cpuinfo | grep 'bugs' | uniq" # cpu vulnerability check bash script code |
| 73 | + os.system(vulncheck) # go to function and run |
| 74 | + |
| 75 | +logo() |
| 76 | + |
| 77 | +# multi function use |
| 78 | + |
| 79 | +def run(all_cpu, cpu_info, cpu_vulncheck,author,pycpu_menu): |
| 80 | + |
| 81 | + author() |
| 82 | + pycpu_menu() |
| 83 | + |
| 84 | + choice = input("Which option number : ") |
| 85 | + |
| 86 | + if choice == 1: |
| 87 | + all_cpu() |
| 88 | + |
| 89 | + elif choice == 2: |
| 90 | + cpu_info() |
| 91 | + |
| 92 | + elif choice == 3: |
| 93 | + cpu_vulncheck() |
| 94 | + |
| 95 | +# batch arguments |
| 96 | +run(all_cpu, cpu_info, cpu_vulncheck,author,pycpu_menu) |
0 commit comments