Advertisement
Fs0usa

Untitled

Jun 30th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.61 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. # colores
  5. cyan = '\033[1;36m'
  6. white = '\033[1;37m'
  7. red = '\033[1;31m'
  8. yellow = '\033[1;33m'
  9. blue = '\033[1;34m'
  10. green = '\033[1;32m'
  11. off_color = '\033[0;0m'
  12. # end colores
  13.    
  14. def Erro():
  15.     print(red+'Erro, an erro occurred'+off_color)
  16.  
  17. def ipRange(IP_PRIMARY, IP_SECUNDARY):
  18.    start = list(map(int, start_ip.split(".")))
  19.    end = list(map(int, end_ip.split(".")))
  20.    temp = start
  21.    ip_range = []
  22.    
  23.    ip_range.append(start_ip)
  24.    while temp != end:
  25.       start[3] += 1
  26.       for i in (3, 2, 1):
  27.          if temp[i] == 256:
  28.             temp[i] = 0
  29.             temp[i-1] += 1
  30.       ip_range.append(".".join(map(str, temp)))    
  31.      
  32.    return ip_range
  33.  
  34. class SSH():
  35.     def __init__(self):
  36.         self.ssh = SSHClient()
  37.         self.ssh.load_system_host_keys()
  38.         self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  39.  
  40.     def testing_conection(self, IP_ACTUALY):
  41.         self.ssh.connect(hostname=IP,username='root',password='SENHA_DE_ROOT')
  42.         stdin,stdout,stderr = self.ssh.exec_command(cmd)
  43.         if stderr.channel.recv_exit_status() != 0:
  44.             print stderr.read()
  45.         else:
  46.             print stdout.read()
  47.  
  48. print(red+'By @Fs0usa\n\n\n'+off_color)
  49. try:
  50.     from paramiko import SSHClient
  51.     import paramiko
  52. except:
  53.     Erro()
  54.  
  55. IP_PRIMARY = raw_input(white+'Please enter whit IP primary[]: '+off_color)
  56. IP_SECONDARY = raw_input(white+'Please enter with IP secundary[]: '+off_color)
  57.  
  58. ip_range = ipRange(IP_PRIMARY, IP_SECUNDARY)
  59.  
  60. #for ip in ip_range:
  61. #conection = SSH.testing_conection(ip)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement