Title / Description
Code #------------------------------------------------------------------------------- # Name: drf2txt # Purpose: Decodes a Control-M DRF file to text # # # Created: 16/03/2008 # Licence: public domain # see : http://www.control-musage.com/modules.php?name=Forums&file=viewtopic&t=248 # Comment: Currently only decrypts, but should be easy to make it re-crypt. #------------------------------------------------------------------------------- #!/usr/bin/env python import sys def decryptChar(x,idx): if idx % 2 == 0: return chr(ord(x) - 2) else: return chr(ord(x) + 2) def cryptChar(x,idx): if idx % 2 == 0: return chr(ord(x) + 2) else: return chr(ord(x) - 2) def main(): line_number = 0 for line in file(sys.argv[1], "rU"): if line_number > 0: newline = [] char_number = 0 for c in line[line.find(';')+1:-1]: newline.append(decryptChar(c, char_number)) char_number += 1 element = ''.join(newline) print element else: pass line_number += 1 if __name__ == '__main__': if (len(sys.argv) > 1): main()
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code