Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python
- from telnetlib import Telnet
- from datetime import datetime
- import socket,os,sys
- def main():
- ClearCLI()
- About()
- strFile = raw_input("Please enter the filename:")
- blnSave = raw_input("Save result [y/n]?:")
- if os.path.exists(strFile):
- if len(strFile) != 0:
- File = open(strFile,'r+')
- Buffer = File.readlines()
- List = []
- print('\n[+]Scanning started!')
- print('[+]Current Time: ' + str(datetime.now()) + '\n')
- print('**********************************************')
- for lines in Buffer:
- try:
- tn = Telnet(lines.strip(), 23)
- strTemp = tn.read_some()
- if len(strTemp) != 0:
- if strTemp.find('MikroTik') != -1:
- if blnSave == 'y':
- List.append(lines)
- print('[+]Found Mikrotik on: {0}\n'.format(lines.strip())),
- print('[>]Header: {0}\n'.format(strTemp.strip()))
- else:
- print('[-]No Mikrotik found on: {0}\n'.format(lines.strip()))
- tn.close()
- except socket.timeout:
- print('[-]Timeout on: {0}\n'.format(lines.strip()))
- pass
- except socket.error:
- print('[-]Telnet port closed on: {0}\n'.format(lines.strip()))
- pass
- File.close()
- if len(List) != 0:
- File = open('Found Servers.txt','w')
- for ips in List:
- File.write(ips)
- File.close()
- print('**************Scanning finished!**************\n')
- sys.stdin.read(1)
- else:
- print('[-]File not found please check your filename again')
- sys.stdin.read(1)
- def About():#Information about the Script and Author.
- print('#----------------------------------------------------------------------#')
- print('# Script Name : MikScanner v0.1 #')
- print('# Author : Kreshnik Hasanaj #')
- print('# Mail : kresha7@hotmail.com #')
- print('# WebPage : http://selftaughtgeek.info #')
- print('# Purpose : Scans a list of ips for Mikrotik Server #')
- print('# Usage : At your own risk #')
- print('# Requirements: Python 2.7 #')
- print('#----------------------------------------------------------------------#\n')
- def ClearCLI():#Checking what platform we're running on to perform CLI cleaning.
- if sys.platform == ('win32' or 'win64'):
- os.system('cls')
- os.system('title MikScanner v0.1')
- elif sys.platform == ('linux' or 'linux2'):
- os.system('clear')
- if __name__ == '__main__':main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement