{"id":13778968,"url":"https://github.com/hi-wenr0/mlcheckwebshell","last_synced_at":"2025-05-11T12:32:21.162Z","repository":{"id":217256690,"uuid":"119943442","full_name":"hi-WenR0/MLCheckWebshell","owner":"hi-WenR0","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-02T06:44:47.000Z","size":3,"stargazers_count":105,"open_issues_count":1,"forks_count":36,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-17T14:41:09.110Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hi-WenR0.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-02T06:41:49.000Z","updated_at":"2024-08-12T19:35:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"50fc4a5f-d4fc-47e8-86ec-30e795d2b2bc","html_url":"https://github.com/hi-WenR0/MLCheckWebshell","commit_stats":null,"previous_names":["hi-wenr0/mlcheckwebshell"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hi-WenR0%2FMLCheckWebshell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hi-WenR0%2FMLCheckWebshell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hi-WenR0%2FMLCheckWebshell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hi-WenR0%2FMLCheckWebshell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hi-WenR0","download_url":"https://codeload.github.com/hi-WenR0/MLCheckWebshell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253567032,"owners_count":21928768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T18:00:59.609Z","updated_at":"2025-05-11T12:32:20.886Z","avatar_url":"https://github.com/hi-WenR0.png","language":"Python","funding_links":[],"categories":["\u003ca id=\"39e5bd43766abbdbc518390d86b3a0a5\"\u003e\u003c/a\u003eWebshell检测"],"sub_categories":[],"readme":"# 机器学习检测Webshell\n\n# 简介\n\n提取PHP执行中的opcode，采用 opcode词袋 + tf-idf 进行关键信息提取\n\n采用朴素贝叶斯算法进行训练。\n\n进行 PHP WebShell 的检测。\n\n# 部署\n\n## step 1. Python环境部署\n\n```\npip install -r requirements.txt\n```\n\n## step 2. PHP opcode 部署\n\n    开启opcode模式\n\nwindows环境\n\n```\n1. 下载 vld.dll 插件并存放在php ext 目录下\n2. 配置 php.ini 激活vld.dll 文件\n```\n[VLD.dll下载地址](http://pecl.php.net/package/vld/0.14.0/windows)\n\n[PHP.ini 配置参考文章](http://blog.sina.com.cn/s/blog_4c8c58ce0102wi2h.html\n)\n\n# 第一次进行训练\n\n    将白名单的文件放入到 white-list 文件夹中\n    将黑名单文件放入到 black-list 文件夹中\n\n进行第一次训练\n```shell\npython train.py\n```\nNote:\n\n    避免每次生成opcode 的时间过长，每次训练完成后，会生成两个文件，black_opcodes.txt \u0026 white_opcodes.txt。\n\n    如果有新的白名单文件或者黑名单文件加入，先删除掉black_opcodes.txt 和 white_opcodes.txt 文件，然后再次进行训练。\n\n    训练完成后，会在save文件夹内，生成一个gnb.pkl文件，这个是训练好的缓存文件。\n\n\n# 检测\n\n检测单个文件\n```\npython check.py [filename]\n```\n\n\n# 重复训练\n\n1. 提供训练集\n在人工得到结果后，可以在white-list \u0026 black-list 文件夹中，添加已知的结果，再按照第一次训练的方法，进行再次训练。得到的结果便会更加准确。\n\n\n# 数据集（参考）\n\n白名单\n- https://github.com/WordPress/WordPress\n- https://github.com/typecho/typecho\n- https://github.com/phpmyadmin/phpmyadmin\n- https://github.com/laravel/laravel\n- https://github.com/top-think/framework\n- https://github.com/symfony/symfony\n- https://github.com/bcit-ci/CodeIgniter\n- https://github.com/yiisoft/yii2\n\n黑名单\n- https://github.com/tennc/webshell\n- https://github.com/ysrc/webshell-sample\n- https://github.com/xl7dev/WebShell","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhi-wenr0%2Fmlcheckwebshell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhi-wenr0%2Fmlcheckwebshell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhi-wenr0%2Fmlcheckwebshell/lists"}