通过文件头部的字符搜索zendcode加密的php文件

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import sys

search_head = b'<?php @Zend;'
if len(sys.argv) < 2:
	print('请输入要搜索的目录,注意不要有空格')
	sys.exit()
path = sys.argv[1]
if os.path.exists(path) == False:
	print('目录不存在')
	sys.exit()
for root, dir, files in os.walk(path):
	for file in files:
		if file.split('.')[-1] == 'php':
			full_path = os.path.join(root, file)
			with open(full_path, 'rb') as f:
				if f.read(len(search_head)) == search_head:
					print(full_path)