{"id":22152268,"url":"https://github.com/auula/owl","last_synced_at":"2025-07-26T05:32:11.727Z","repository":{"id":38311254,"uuid":"500153945","full_name":"auula/owl","owner":"auula","description":"A file signature scanning tool for static analysis.","archived":false,"fork":false,"pushed_at":"2022-09-02T03:22:02.000Z","size":2488,"stargazers_count":48,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-19T00:40:18.530Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/auula.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-05T16:41:59.000Z","updated_at":"2024-02-25T15:16:18.000Z","dependencies_parsed_at":"2022-08-17T15:55:22.763Z","dependency_job_id":null,"html_url":"https://github.com/auula/owl","commit_stats":null,"previous_names":["auula/deepscan","auula/woodpecker"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auula%2Fowl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auula%2Fowl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auula%2Fowl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auula%2Fowl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auula","download_url":"https://codeload.github.com/auula/owl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227652567,"owners_count":17799235,"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-12-02T00:49:25.571Z","updated_at":"2024-12-02T00:49:26.317Z","avatar_url":"https://github.com/auula.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Owl🦉\n\nA dependency module feature scanning detection tool for static analysis.\n\n---\n\n[![DeepSource](https://deepsource.io/gh/auula/owl.svg/?label=active+issues\u0026show_trend=true\u0026token=2dqhjlFmox_IfR5zuVpSv64Q)](https://deepsource.io/gh/auula/owl/?ref=repository-badge)\n[![codecov](https://codecov.io/gh/auula/owl/branch/main/graph/badge.svg?token=0i8L7DuJlK)](https://codecov.io/gh/auula/owl)\n[![License](https://img.shields.io/badge/license-MIT-db5149.svg)](https://github.com/auula/owl/blob/master/LICENSE)\n[![Go Report Card](https://goreportcard.com/badge/github.com/auula/owl)](https://goreportcard.com/report/github.com/auula/owl)\n\n---\n\n### 介 绍\n\n`Owl`是一款开源项目依赖分析工具，可以快速在指定的项目目录下查找符合某些特征的源代码文件或者依赖文件。为何开发了这款工具？例如很多时候我们项目太大，项目文件夹下有很多依赖文件，如一个`Java`项目引入了`log4j`这个`jar`依赖，在项目中某文件存在循环依赖问题。当某个依赖包出现了漏洞时，本工具能快速扫描项目目录下存在的可疑依赖文件，并且给出依赖文件所在的地址，帮助开发者能快速进行定位到可疑文件。\n\n\n### 原 理\n\n目前版本的功能比较简单，工作原理很简单，工具会对特定目录进行扫描通过内置的特征码算法匹配到特定文件，然后收集与其特征码匹配的文件地址，然后展示出来，也可以重定向到一个固定`json`文件中保存。\n\n![](https://tva1.sinaimg.cn/large/e6c9d24egy1h2yvkgtmbwj20lo0ca0tl.jpg)\n\n`Owl`类似于杀毒软件一样，和杀毒软件的工作原理差不多，`Owl`会根据依赖文件的特征码来扫描整个项目，和杀毒病毒库工作原理类似。当然如果严格按照杀毒软件那种标准做的话，可能涉及一些汇编相关的，目前`owl`功能实现还没有那么复杂，后面会版本会加入`codeql`代码分析引擎，通过`codeql`的数据库来做静态分析功能增强。\n\n### 快速开始\n\n如何使用`owl`？你可以克隆仓库然后通过如下命令：\n\n```bash\ngit clone git@github.com:auula/owl.git\n```\n在仓库内部有一个`Makefile`文件可以快速帮助你构建相应平台的二进制文件，例如：\n\n```bash\n$: make help\nmake darwin\t| Compile executable binary for MacOS platform\nmake linux\t| Compile executable binary for Linux platform\nmake windows\t| Compile executable binary for Windows platform\nmake clean\t| Clean up executable binary\n```\n\n`Owl`起因也是为`CodeAnalysis`所编写的特征检测工具，所以你也可以在：[`https://github.com/Tencent/CodeAnalysis`](https://github.com/Tencent/CodeAnalysis/tree/main/tools/owl) 这个项目下面的`tools`目录找到已经编译好的二进制可执行文件，下载对应平台的二进制文件即可。\n\n### 如何使用\n\n程序构建完成会得到一个二进制文件，程序名称为`owl`，如下为`owl`执行效果，一些子命令参数都已经列出：\n\n```bash\n$: ./owl\n\n\t\t\t _____  _    _  __\n\t\t\t(  _  )( \\/\\/ )(  )\n\t\t\t )(_)(  )    (  )(__\n\t\t\t(_____)(__/\\__)(____) 🦉 v0.1.2\n\n A dependency module feature scanning detection tool for static analysis.\n\n\nUsage:\n  owl [command]\n\nAvailable Commands:\n  completion  Generate the autocompletion script for the specified shell\n  help        Help about any command\n  hex         File hex encoding\n  md5         Collection file md5\n  run         Execute the scanner\n  version     Version information\n\nFlags:\n  -h, --help   help for owl\n\nUse \"owl [command] --help\" for more information about a command.\n```\n\n如果不知道子命令如何使用，可以在对应的子命令后面参入`--help`参数，即可得到帮助信息：\n\n![](https://tva1.sinaimg.cn/large/e6c9d24egy1h2yz0laxdyj22ax0u07bb.jpg)\n\n例如如果你要查找`log4j`，你首先要通过`owl`计算`log4j`特征码，命令如下：\n\n```bash\n$: ./owl md5 --path=/Users/ding/Downloads/log4j-1.2.17.jar\n```\n\n**注意这里的特征码计算必须使用`owl`程序的算法，因为`owl`里面的算法针对大文件我是采用分数据块方案计算的，提升程序运行速度，所以如果使用其他软件的算法那么就会出现问题！**\n\n结果如下：\n\n![](https://tva1.sinaimg.cn/large/e6c9d24egy1h2yz54cg72j22gm0e0af2.jpg)\n\n你也可以使用十六进制字符串特征去查找：\n\n```bash\n$: ./owl hex --path=/Users/ding/Downloads/log4j-1.2.17.jar\n```\n\n程序会将对应的文件转成十六进制字符串展示，如下图：\n\n![](https://tva1.sinaimg.cn/large/e6c9d24egy1h2yz7v68cbj217g0u0h0x.jpg)\n\n现在就可以使用扫描器进行扫描了，匹配模式可以指定为`md5`或者`hex`，未来可能会添加跟多的模式，命令如下：\n\n```bash\n$: ./owl run --dir=/Users/ding/Downloads/ --mode=md5 --code=04a41f0a068986f0f73485cf507c0f40\n```\n\n搜索得到具体依赖文件：\n\n![](https://tva1.sinaimg.cn/large/e6c9d24egy1h2yze6emx3j21yq0dajwn.jpg)\n\n\n**搜索结果如果过多，可以通过`--out`参数将结果重定向保存到文件中保存，文件格式为`json`！**\n\n### SDK方式\n\n上面介绍完是`command line`方式进行的，`owl`程序本身就是一个`command line`，核心逻辑在 [`github.com/auula/owl/scan`](https://github.com/auula/owl/tree/main/scan) 这个包中编写的，如果想二次开发，那么就可以直接使用`go get github.com/auula/owl` 安装这个模块到你项目里面，然后直接通过硬编码的方式进行自定义编程；\n\n\n一个简单实例，通过自定义代码方式进行依赖文件扫描和收集：\n\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/auula/owl/scan\"\n)\n\nfunc main() {\n    // 创建扫描器\n    scanner := new(scan.Scanner)\n    // 设置扫描器路径     \n    scanner.SetPath(\"github.com/auula/owl\") \n    // 返回对应路径所有文件特征码\n    res, _ := scanner.List() \n    fmt.Println(res)\n\n    // 设置指定的匹配器，其他匹配器查看API文档\n    scanner.SetMatcher(new(scan.Md5Matcher))\n    // 搜索包含特征码文件，返回文件记录集合\n    res, _ = scanner.Search(\"xxxx\")\n\n    // 打开一个文件描述符\n    file, _ := os.OpenFile(\"res.json\", os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0666)\n    // 将结果保存到指定文件中\n    scanner.Output(file, res)\n}\n```\n\n**以上就是通过`SDK`方式自定义编码完成依赖特征检测。**\n\n\n### 其他\n\n有问题欢迎提`issue`，工具不错的话记得按一个`⭐`，另外更强代码分析工具使用：[`https://github.com/Tencent/CodeAnalysis`](https://github.com/Tencent/CodeAnalysis)。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauula%2Fowl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauula%2Fowl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauula%2Fowl/lists"}