-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwindows
executable file
·50 lines (45 loc) · 1.85 KB
/
windows
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
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
# encoding: utf-8
import os
import sys
def check_for_data_parts(mount, device):
found = False
if os.path.exists(mount):
if os.path.exists("%s/ProgramData/Microsoft/Windows/Start Menu/Programs/StartUp"%mount):
name = "Windows 8"
found=True
elif os.path.exists("%s/ProgramData/Microsoft/Windows/Start Menu/Programs/Startup"%mount):
name = "Windows 7"
found=True
elif os.path.exists("%s/Users"%mount):
name = "Windows Vista"
found=True
elif os.path.exists("%s/Documents and Settings"%mount):
if os.path.exists("%s/boot.ini"%mount):
number = device[-1]
print number
with open("%s/boot.ini"%mount) as file:
for f in file:
if f.startswith("multi"):
if f.split("partition(")[1].startswith(number):
entry = f.split('"')[1]
if "XP" in entry:
name = "Windows XP"
elif ".NET" in entry:
name = "Windows 2003 Server"
elif "2000 Server" in entry:
name = "Windows 2000 Server"
elif "2000" in entry:
name = "Windows 2000"
else:
name = entry
found=True
elif os.path.exists("%s/Winnt/Profiles/All Users/Start Menu/Programs/Startup"%mount):
name = "Windows NT"
found=True
if found:
return name
else:
return False
result = check_for_data_parts("/media/sda4", "/dev/sda4")
print result