-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsearch_supported.py
More file actions
executable file
·41 lines (34 loc) · 996 Bytes
/
search_supported.py
File metadata and controls
executable file
·41 lines (34 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python3
import subprocess
import glob
def run_cmd(cmdstr):
cmd = cmdstr.split()
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
proc.wait()
return proc.stdout.read().decode('utf8')
def cpuid():
regs_raw = run_cmd("cpuid -l 1 -r -1").strip().split(":")[-1].strip().split()
regs = {}
for r in regs_raw:
x = r.split('=')
regs.update({x[0]: int(x[1], 16)})
print(regs['eax'])
return regs['eax']
def main():
c = 0
_id = hex(cpuid())[2:].upper()
print ("[!] Searching for supported microcodes...")
for line in glob.glob("Intel/*"):
tag = "Intel/cpu%s"%_id
if line.startswith(tag):
print("\t", c, line)
c += 1
_id = hex(cpuid())[2:].zfill(8).upper()
for line in glob.glob("AMD/*"):
tag = "AMD/cpu%s"%_id
if line.startswith(tag):
print(line)
print("\t", c, line)
c += 1
if __name__ == "__main__":
main()