后门这东西好让人蛋疼,第一文件太多了,不容易找,第二,难找,需要特征匹配啊。搞了一个python版查杀php webshell后门工具,大家可以增加后门的特征码,然后甩到后台给他查杀就可以了。
这个代码比较简单,大家可以继续完善下。
#!/usr/bin/python # -*- coding: utf-8 -*- #blog:www.jincon.com import os import sys import re rulelist = [ '(\$_(GET|POST|REQUEST)\[.{0,15}\]\(\$_(GET|POST|REQUEST)\[.{0,15}\]\))', '(base64_decode\([\'"][\w\+/=]{200,}[\'"]\))', 'eval\(base64_decode\(', '(eval\(\$_(POST|GET|REQUEST)\[.{0,15}\]\))', '(assert\(\$_(POST|GET|REQUEST)\[.{0,15}\]\))', '(\$[\w_]{0,15}\(\$_(POST|GET|REQUEST)\[.{0,15}\]\))', '(wscript\.shell)', '(gethostbyname\()', '(cmd\.exe)', '(shell\.application)', '(documents\s+and\s+settings)', '(system32)', '(serv-u)', '(提权)', '(phpspy)', '(后门)', '(webshell)', '(Program\s+Files)' ] def Scan(path): for root,dirs,files in os.walk(path): for filespath in files: isover = False if '.' in filespath: ext = filespath[(filespath.rindex('.')+1):] if ext=='php': file= open(os.path.join(root,filespath)) filestr = file.read() file.close() for rule in rulelist: result = re.compile(rule).findall(filestr) if result: print '文件:'+os.path.join(root,filespath) print '恶意代码:'+str(result[0]) print '\n\n' break if os.path.lexists(sys.argv[1]): print('\n\n开始扫描:'+sys.argv[1]) print(' 可疑文件 ') print('########################################') Scan(sys.argv[1]) print('提示:扫描完成-- O(∩_∩)O哈哈~') else: print '提示:指定的扫描目录不存在--- 我靠( \'o′)!!凸'
原文地址:http://www.jincon.com/archives/147/
from www.waitalone.cn.thanks for it.
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论