ulvis.paste.net

Paste Search Dynamic
Recent pastes
password
  1. import os
  2.  
  3. def main ( ) :
  4.         login = 'admin'
  5.         passw = 'admin'
  6.         ip_count = 50
  7.         path_to_inp_file = 'c: \\ test \\ IPs.txt'
  8.         path_to_out_file = 'c: \\ test \\ ip_out_'
  9.         print ( 'Use default settings? \ n Yes [y] / No [n]' )
  10.         if ( input ( ) ! = 'y' ) :
  11.                 select = menu ( )
  12.                 while select ! = 0 :
  13.                         if select == 1 :
  14.                                 os . system ( 'cls' )
  15.                                 print ( 'Login =' , end = '' )
  16.                                 login = input ( )
  17.                         elif select == 2 :
  18.                                 os . system ( 'cls' )
  19.                                 print ( 'Password =' , end = '' )
  20.                                 passw = input ( )
  21.                         elif select == 3 :
  22.                                 os . system ( 'cls' )
  23.                                 print ( 'Path to input file =' , end = '' )
  24.                                 path_to_inp_file = input ( )
  25.                         elif select == 4 :
  26.                                 os . system ( 'cls' )
  27.                                 print ( 'Path to output file =' , end = '' )
  28.                                 path_to_out_file = input ( )
  29.                         elif select == 5 :
  30.                                 os . system ( 'cls' )
  31.                                 print ( 'The number of IPs in the file =' , end = '' )
  32.                                 ip_count = int ( input ( ) )
  33.                         select = menu ( )
  34.  
  35.         file = open ( path_to_inp_file , 'r' )
  36.  
  37.         k = 0
  38.         j = 1        
  39.  
  40.         for line in file :
  41.                 csv = open ( path_to_out_file + str ( j ) + '.csv' , 'a' )
  42.                 temp = '"' + str ( k ) + '_ip", "0", " + line [ 0 : - 1 : 1 ] + '", "8000", "0", "' + login + '" "' + passw + '", "0", "1", "0", "0" ' + ' \ n '
  43.                csv . write ( temp )
  44.                k + = 1
  45.                if k% ip_count == 0 :
  46.                        j + = 1
  47.                csv . close ( )
  48.  
  49.        file . close ( )
  50.        print ( 'Done' )
  51.        print ( 'Press any key to continue ...' )
  52.        input ( )
  53.  
  54. def menu ( ) :
  55.        os . system ( 'cls' )
  56.        print ( 'What do we change?' , end = ' \ n ' )
  57.        print ( '[1] Login' , end = ' \ n ' )
  58.        print ( '[2] Password' , end = ' \ n ' )
  59.        print ( '[3] Path to input file' , end = ' \ n ' )
  60.        print ( '[4] Path to output file' , end = ' \ n ' )
  61.        print ( '[5] Number of IPs in the file' )
  62.        print ( '[0] Run' , end = ' \ n ' )
  63.        return int ( input ( ) )
  64.  
  65. if __name__ == '__main__' :
  66.        main ( )
  67.  
  68. # Python version 3.4 is used to use this script.
  69. # And, accordingly, to start it, it is necessary, we take from here https://www.python.org/ftp/python/3.4.3/python-3.4.3.msi.
  70. # Login and password will be substituted for all IP addresses (You can change them to any that you deem necessary)
  71. # Running the script - dubklik, on all questions in the comments to the post, in which you found a link to this script
  72.  
Parsed in 0.028 seconds