Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from exempelkodhtmltabell import thomas
- def router_config():
- router = open('C:\\Users\\felic\\Desktop\\Lab3\\router_configuration.txt')
- printRouter = router.readlines()
- lcc = 'Last configuration change'
- hostName = "hostname"
- ip = 'ip address'
- noip = 'no ip address'
- for sLine in printRouter:
- if ip in sLine and not noip in sLine:
- print(sLine[11:])
- ip_a = sLine[11:]
- if hostName in sLine:
- print(sLine[8:15])
- hn = sLine[8:15]
- if lcc in sLine:
- print(sLine[30:])
- cc = sLine[30:]
- return cc, hn, ip_a
- def router_version():
- version = open('C:\\Users\\felic\\Desktop\\Lab3\\router_show_version.txt')
- printVersion = version.readlines()
- # ger strängarna som vi ska plocka från filen ett variabel namn
- rom = 'ROM: System'
- time = 'uptime'
- for sLine in printVersion:
- if rom in sLine:
- print(sLine[23:])
- rom_a = sLine[23:]
- if time in sLine:
- print(sLine[15:])
- tid = sLine[15:]
- return rom_a, tid
- cc, hn, ip_a = router_config()
- rom_a, tid = router_version()
- thomas(cc, hn, ip_a,rom_a, tid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement