#!/usr/bin/env python2 # Some fucker infected all the php files on the server with by injecting some # obfuscated bullshit at the start of each file. This script pulls out the # crap and rewrites the file. import os import fnmatch import re infection = {} infected = [] skipped = [] for root, dirs, files in os.walk('.'): for pfile in fnmatch.filter( files, "*.php" ): fname = os.path.join( root, pfile ) content = "" fin = open( fname, 'r') content = fin.read() fin.close() if len(content) == 0: continue p = re.compile('(^<\?php .*\?>)