Current Path :
/
proc
/
self
/
root
/
opt
/
yaclam
/
Or
Select Your Path :
Upload File :
New :
File
Dir
//proc/self/root/opt/yaclam/cleaner.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import sys rules = [ r'<\?.*?\$[a-zA-Z0-9]+[\t|\s|]*=[\t|\s|]*\".*?\"[\t|\s|]*;[\t|\s|]*\$[a-zA-Z0-9]+[\t|\s|]*=[\t|\s|]*strtolower[\t|\s|]*\([\t|\s|]*\$[a-zA-Z0-9]+\[.*?\].*?\{[\t|\s|]*eval[\t|\s|]*\([\t|\s|]*\$[a-zA-Z0-9]*[\t|\s|]*\([\t|\s|]*\$\{[\t|\s|]*\$[a-zA-Z0-9]+[\t|\s|]*\}[\t|\s|]*\[[\t|\s|]*\'[a-zA-Z0-9]+\'[\t|\s|]*\][\t|\s|]*\)[\t|\s|]*\)[\t|\s|]*;[\t|\s|]*\}.*?\?>', r'<\?.*[\n| ]\$[a-zA-Z0-9_]*[\t|\s| ]*=[\t|\s| ]*\"[a-zA-Z0-9_]*\"[\t|\s| ]*;[\t|\s| ]*\$[a-zA-Z0-9_]*[\t|\s| ]*=[\t|\s| ]*strtoupper[\t|\s| ]*\(.*\);[\t|\s| ]*if[\t|\s| ]*\([\t|\s| ]*isset[\t|\s| ]*\(.*?\)[\t|\s| ]*\)[\t|\s| ]*\{[\t|\s| ]*eval[\t|\s| ]*\(.*?\)[\t|\s| ]*;[\t|\s| ]*\}[\t|\s| ]*\?>' ] if len(sys.argv) == 2: checkfile = sys.argv[1] if os.path.exists(checkfile): with open(checkfile, 'r') as fileread : filedata = fileread.read() print ("Processing: %s" % checkfile) for rule in rules: regex = re.compile(rule) matches = regex.findall(filedata) if matches: match = matches[0] filedata = filedata.replace(match, '') with open(checkfile, 'w') as file: file.write(filedata) print "Cleaned" else: print "No file %s" % (checkfile) else: print "Please type 1 argument only" sys.exit(0)