Advertisement
Guest User

Untitled

a guest
Jul 19th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.66 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. __author__    = 'FierceFuzion'
  4. __license__   = 'BSD'
  5. __version__   = '0.1'
  6. __date__      = '17/7/13'
  7.  
  8. import hashlib
  9.  
  10. def main():
  11.  
  12.     print '''
  13.                       __ __         __   _____             ___
  14.                      / // /__ ____ / /  / ___/__ ___  _  _<  /
  15.                     / _  / _ `(_-</ _ \/ (_ / -_) _ \| |/ / /
  16.                    /_//_/\_,_/___/_//_/\___/\__/_//_/|___/_/
  17.  
  18.                          Copyright (c) FierceFuzion 2013
  19.  
  20.                           #############################  
  21.                        # 1 = MD5      | 5 = SHA384 #
  22.                        # 2 = SHA1     | 6 = SHA512 #
  23.                        # 3 = SHA224   |-more to    #
  24.                        # 4 = SHA256   | come.      #
  25.                           #############################
  26.                
  27.                     TYPE "EXIT" TO EXIT
  28.  
  29. '''
  30.     hashs = 0
  31.    
  32.     numlines = 0
  33.    
  34.     counter = 0
  35.    
  36.     read = input('Please enter fielname for input : ')
  37.  
  38.     output = input('Please enter filename for output : ' )
  39.  
  40.     hashs = input('Select a Hash to convert to : ')
  41.  
  42.     if (output != ''):
  43.         fileObj = open(output,"a")
  44.        
  45.     if (read != ''):
  46.  
  47.         for line in open(read):
  48.  
  49.             numlines +=1
  50.            
  51.         print ('Found ', numlines, ' lines to convert\n')
  52.  
  53.    
  54.         while (counter < numlines):
  55.  
  56.             fp = open(read)
  57.            
  58.             for i, line in enumerate(fp):
  59.  
  60.                 if i == counter:
  61.                    
  62.                     print(line)
  63.  
  64.                 if hashs == 1:
  65.                     line = line.encode('UTF-8')
  66.                     hashc = hashlib.md5(line).hexdigest()
  67.  
  68.                 if hashs == 2:
  69.                     line = line.encode('UTF-8')
  70.                     hashc = hashlib.sha1(line).hexdigest()
  71.  
  72.                 if hashs == 3:
  73.                     line = line.encode('UTF-8')
  74.                     hashc = hashlib.sha224(line).hexdigest()
  75.  
  76.                 if hashs == 4:
  77.                     line = line.encode('UTF-8')
  78.                     hashc = hashlib.sha256(line).hexdigest()
  79.  
  80.                 if hashs == 5:
  81.                     line = line.encode('UTF-8')
  82.                     hashc = hashlib.sha384(line).hexdigest()
  83.  
  84.                 if hashs == 6:
  85.                     line.encode('UTF-8')
  86.                     hashc = hashlib.sha512(line).hexdigest()
  87.            
  88.                    
  89.             if (output != ''):
  90.  
  91.                 fileObj.write(hashc)
  92.                 fileObj.write('\n')
  93.  
  94.             else:
  95.                 print(hashc)
  96.  
  97.                 counter += 1
  98.        
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109. if __name__ == '__main__':
  110.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement