-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplateVersion.py
More file actions
55 lines (38 loc) · 1.78 KB
/
templateVersion.py
File metadata and controls
55 lines (38 loc) · 1.78 KB
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
51
52
53
54
55
'''
Created on Apr 29, 2017
@author: sp977u
'''
class templateVer :
def getTemplateversion(self,logpath,ipadd):
loc =0
Final = "NF"
try :
sucFile = open(logpath + "\\" + ipadd + ".txt" , 'r')
while 1:
line = sucFile.readline()
if "banner" in line and ( "9." in line or "10." in line or "11." in line or "12." in line or "13." in line or "14." in line or "15." in line or "16." in line or "17." in line or "18." in line or "19." in line or "20." in line):
loc1 = line.find("/")
loc2 = line.rfind("/")
line = line[loc1 + 1 :loc2-1]
if (line.rfind("/") != -1 ):
line= line [ : line.rfind("/")]
Final = line.strip()
break
if ("system login announcement" in line or "announcement" in line ) and "/" in line:
loc1 = line.find("/")
loc2 = line.rfind("/")
line = line[loc1 + 1 :loc2-1]
if (line.rfind("/") != -1 ):
line= line [ : line.rfind("/")]
Final = line.strip()
break
if not line:
break
if line =="\n":
continue
sucFile.close()
return Final
except Exception as ex:
print(ex)
sucFile.close()
return "NF"