151 |
152 |
153 |
154 | 결과 출력 항목
155 | 포맷에 따라 결과로 출력되는 항목이 다를 수 있습니다.(Default 포맷 : yaml)
156 |
157 | - **Compliant**: lint 결과가 Compliant한지 여부 (OK or Not OK)
158 | - **Files without copyright**: Copyright가 없는 파일 리스트
159 | - **Files without license**: License가 없는 파일 리스트
160 | - **Files without license and copyright**: Copyright와 License 모두 없는 파일 리스트
161 | - **Summary**
162 | - **Detected Licenses**: 검출된 License
163 | - **Files without copyright / total:** Copyright 없는 파일 수 / 전체 파일 수
164 | - **Files without license / total**: License 없는 파일 수 / 전체 파일 수
165 | - **Files without copyright / total**: Copyright 없는 파일 수 / 전체 파일 수
166 | - **Open Source Package File**: sbom-info*.yaml 또는 oss-pkg-info*.yaml 파일 리스트
167 | - **Tool Info**
168 | - **Analysis path**: 분석 진행한 path
169 | - **OS**: FOSSLight Prechecker가 실행된 OS 버전
170 | - **Python version**: FOSSLight Prechecker가 실행된 Python 버전
171 | - **fosslight_prechecker version**: FOSSLight Prechecker 버전
172 |
173 | >
174 | >파일 개수 산정 시, 제외 항목
175 | >
176 | > - 숨김 파일
177 | > - 파일 내 Code가 전혀 없는 파일
178 | > - .gitignore에 정의된 파일
179 | > - git repo 기준 untracked 파일
180 | > - FOSSLight의 산출물
181 | > - sbom-info.yaml 또는 oss-pkg-info.yaml 내에 exclude가 True인 path
182 | >
183 |
184 |
185 |
186 |
187 |
188 | Demo 영상 (lint)
189 |
190 |
191 |
192 |
193 | ### 🔖 convert mode
194 | **1) Path 내 존재하는 sbom-info.yaml 또는 oss-pkg-info.yaml (여러개인 경우 전체 해당) -> fosslight_report.xlsx 변환 예시**
195 | ```
196 | $ fosslight_prechecker convert -p tests/
197 | ```
198 |
199 | **2) 실행 결과 파일 예시**
200 |
201 | >
202 | > oss-pkg-info.yaml 파일
203 | > yaml 파일 내 경로 작성 시, 특수 문자({, }, [, ], &, *, #, ?, |, -, <, >, =, !, %, @)로 시작하는 경우 쌍따옴표("")를 사용하여 작성해주시기 바랍니다.
204 | ```yaml
205 | glibc:
206 | - version: '2.3'
207 | source name or path:
208 | - tests/b.c
209 | - tests/a.c
210 | license:
211 | - GPL-3.0
212 | - LGPL-2.1
213 | download location: https://github.com/fsfe/glibc
214 | dbus:
215 | - version: '1.3'
216 | source name or path:
217 | - tests/src/*
218 | license:
219 | - GPL-2.0
220 | download location: https://github.com/fsfe/dbus
221 | copyright text: 'Copyright (c) 2020 Test Copyright (c) 2020 Sample'
222 | reuse-tool:
223 | - version: ''
224 | source name or path:
225 | - tests/
226 | license:
227 | - MIT
228 | download location: https://github.com/fsfe/reuse
229 | homepage: http://google.com
230 | copyright text: Copyright (c) 2020 Test
231 | build-tool:
232 | - version: ''
233 | source name or path:
234 | - tests/
235 | license:
236 | - Apache-2.0
237 | download location: http://gihub.com/bazel
238 | exclude: true
239 | ```
240 | >
241 |
242 | >
243 | > fosslight_report.xlsx 파일
244 |
245 | >
246 |
247 |
248 | Demo 영상 (convert)
249 |
250 |
251 |
252 |
253 |
254 | ### 🔖 add mode
255 | **1) 특정 경로 내 파일에 저작권과 라이선스 추가 예시**
256 | ```
257 | (venv)$ fosslight_prechecker add -p tests/add -c "2019-2021 LG Electronics Inc." -l "GPL-3.0-only" -u "https://www.testurl.com"
258 | ```
259 |
260 | **2) 특정 파일에 저작권과 라이선스 추가 예시**
261 | ```
262 | (venv)$ fosslight_prechecker add -p "tests/add/test_both_have_1.py,tests/add/test_both_have_2.py,tests/add/test_no_copyright.py,tests/add/test_no_license.py" -c "2019-2021 LG Electronics Inc." -l "GPL-3.0-only" -u "https://www.testurl.com"
263 | ```
264 |
265 | **3) 실행 결과**
266 | ▪️ 파일 변경 사항 : 상단에 저작권과 라이선스 추가
267 |
268 | |Before |After |
269 | |:---------------|:--------------|
270 | |||
271 |
272 | ```bash
273 | # File list that have both license and copyright : 3 / 7
274 | # __init__.py
275 | * License:
276 | * Copyright:
277 |
278 | # test_both_have_1.py
279 | * License: GPL-3.0-only
280 | * Copyright: SPDX-FileCopyrightText: Copyright 2019-2021 LG Electronics Inc.
281 |
282 | # test_both_have_2.py
283 | * License: MIT
284 | * Copyright: SPDX-FileCopyrightText: Copyright (c) 2011 LG Electronics Inc.
285 |
286 | # Missing license File(s)
287 | * test_no_license.py
288 | * Your input license : GPL-3.0-only
289 | Successfully changed header of tests/add_result/test_no_license.py
290 |
291 | # Missing Copyright File(s)
292 | * test_no_copyright.py
293 | * Your input Copyright : Copyright 2019-2021 LG Electronics Inc.
294 | Successfully changed header of tests/add_result/test_no_copyright.py
295 |
296 | # Adding Download Location into your files
297 | * Your input DownloadLocation : https://www.testurl.com
298 | Successfully changed header of tests/add_result/test_no_copyright.py
299 | Successfully changed header of tests/add_result/test_no_license.py
300 | Successfully changed header of tests/add_result/test_both_have_1.py
301 | Successfully changed header of tests/add_result/test_both_have_2.py
302 | ```
303 |
304 |
305 | Demo 영상 (add)
306 |
307 |
308 |
309 | ### 🔖 download mode
310 | **1) sbom-info.yaml 내 기입된 라이선스를 Text 파일로 Download 예시**
311 | ```
312 | (venv)$ fosslight_prechecker download -p tests/src
313 | ```
314 |
315 | **2) sbom-info.yaml 내 기입된 라이선스를 Text 파일로 Download + 대표 라이선스 파일 생성 예시**
316 | ```
317 | (venv)$ fosslight_prechecker download -p tests/src -l "Apache-2.0"
318 | ```
319 |
320 |
321 | ## 🔍 동작 방식
322 | ### 🔖 lint mode
323 | 1. OSS Package Information 파일 존재 여부 체크
324 |
325 | 하기 파일 중 1개 이상 존재하는지 체크 (대소문자 구분 없음)
326 |
327 |
sbom-info.yaml (or .yml)
328 |
oss-pkg-info.yaml (or .yml
329 |
requirement.txt
330 |
requirements.txt
331 |
package.json
332 |
pom.xml
333 |
build.gradle
334 |
Podfile.lock
335 |
Cartfile.resolved
336 |
pubspec.yaml
337 |
Package.resolved
338 |
go.mod
339 |
packages.config
340 |
package.assets.json
341 |
oss-package.info
342 |
"MODULE_LICENSE_ "로 시작하는 파일
343 |
344 |
345 |
346 | 2. fsfe-reuse lint 실행
347 | 2-1. path 단위로 실행하는 경우
348 | - ./reuse/dep5 파일 없으면 생성
349 | - ./reuse/dep5 파일이 이미 존재하는 경우 bk 파일을 복사하고 기본 설정값 추가
350 | - dep5 파일 생성하여 binary 또는 .json, venv/, node_modules/,. */ 파일을 체크 대상에서 제외시킴
351 | - fsfe-reuse lint 실행 (OSS Package Information file이 존재하면, license 정보 없는 파일 목록은 출력하지 않음)
352 | - ./reuse/dep5 파일을 원래대로 복구 (원래 존재한 경우 기존 파일로 복구, 존재하지 않은 경우 삭제)
353 |
354 | 2-2. file 단위로 실행하는 경우
355 | - 파일별 저작권, License 출력
356 | - 단, 파일이 존재하지 않거나 파일이 binary 또는 .json인 경우 출력되지 않음
357 | 3. 결과를 출력하여 지정한 포맷으로 파일로 저장(Default : yaml)
358 |
359 | ### 🔖 convert mode
360 | 1. 변환할 파일의 존재 여부 확인
361 | * 파일 예시 : [sbom-info.yaml][sbom_info], [oss-pkg-info.yaml][oss_pkg_info]
362 |
363 | [sbom_info]: https://github.com/fosslight/fosslight_prechecker/blob/main/tests/convert/sbom-info.yaml
364 | [oss_pkg_info]: https://github.com/fosslight/fosslight_prechecker/blob/main/tests/convert/oss-pkg-info.yaml
365 |
366 | 2. 파일을 변환
367 | 2-1. Path 단위로 실행하는 경우
368 | - 경로 내 존재하는 모든 sbom-info.yaml 또는 oss-pkg-info.yaml 파일을 fosslight_report.xlsx로 변환
369 |
370 | 2-2. 입력한 파일을 변환
371 | - 입력한 yaml 파일을 fosslight_report.xlsx로 변환
372 | - 단, -o 로 output file 명을 지정한 경우 해당 이름으로 결과 파일이 생성
373 |
374 |
375 | ### 🔖 add mode
376 | 1. 추가할 저작권과 라이선스 확인
377 | 2. 저작권과 라이선스 탐색 및 추가
378 | - 저작권과 라이선스가 모두 존재하는 파일 리스트 출력(Add 대상에서 제외)
379 | - -c와 -l 옵션을 이용하여 저작권 또는 라이선스가 없는 파일의 상단에 저작권과 라이선스를 추가
380 | - -u 옵션을 이용하여 Download Location을 파일의 상단에 추가
381 |
382 |
383 | ### 🔖 download mode
384 | 1. 옵션없이 실행시 실행 path 내 sbom-info.yaml을 찾아 yaml 파일 내 작성된 라이선스를 Text 파일로 Download
385 | 2. -l 옵션 사용시, 대표 라이선스로 Download
386 | - 이미 대표 라이선스 파일(LICENSE, LICENSE.txt 등) 존재할 경우, 대표 라이선스 파일을 생성하지 않음.
387 | - 대표 라이선스 파일 존재하지 않을 경우, 해당 라이선스 Text 파일 LICENSE 파일로 생성
388 |
389 |
--------------------------------------------------------------------------------
/scanner/2_source.md:
--------------------------------------------------------------------------------
1 | ---
2 | published: true
3 | ---
4 | # FOSSLight Source Scanner
5 |
6 | [](https://api.reuse.software/info/github.com/fosslight/fosslight_source_scanner)
7 |
8 | [**FOSSLight Source Scanner**](https://github.com/fosslight/fosslight_source_scanner)는 소스 코드 스캐너인 [ScanCode][sc], [SCANOSS][scanoss]를 이용합니다. [ScanCode][sc]를 이용하면 파일 안에 포함된 Copyright과 License 문구를 검출하고, [SCANOSS][scanoss]를 이용하면 OSS Name, OSS Version, Download Location, Copyright, License 정보를 [OSSKB][osskb]에서 검색합니다.
9 | Build Script, Binary, Directory, 특정 Directory (ex-test) 안의 파일은 제외되고, 그리고 License 이름에서 "-only", "-old-style"와 같은 문구는 제거됩니다. 결과는 spreadsheet, csv 형태로 출력됩니다.
10 |
11 | [sc]: https://github.com/nexB/scancode-toolkit
12 | [scanoss]: https://github.com/scanoss/scanoss.py
13 | [osskb]: https://osskb.org/
14 |
15 | **Github Repository** : [https://github.com/fosslight/fosslight_source_scanner](https://github.com/fosslight/fosslight_source_scanner)
16 | **License** : [Apache-2.0](https://github.com/fosslight/fosslight_source_scanner/blob/main/LICENSE)
17 |
18 | ## 목차
19 | - [필요 조건](#-필요-조건)
20 | - [설치 방법](#-설치-방법)
21 | - [실행 방법](#-실행-방법)
22 | - [결과](#-결과)
23 |
24 | ## 📋 필요 조건
25 | [**FOSSLight Source Scanner**](https://github.com/fosslight/fosslight_source_scanner)는 Python 3.8+ 기반에서 동작합니다.
26 |
27 |
28 | ## 🎉 설치 방법
29 | FOSSLight Source Scanner는 pip3를 이용하여 설치할 수 있습니다.
30 | [python 3.8 + virtualenv](etc/guide_virtualenv.md) 환경에서 설치할 것을 권장합니다.
31 |
32 | ```
33 | $ pip3 install fosslight_source
34 | ```
35 |
36 | ## 🚀 실행 방법
37 | Source Code 분석을 실행한 후 FOSSLight Report 형식으로 출력합니다.
38 | ````
39 | $ fosslight_source [option]
40 | ````
41 | #### Options
42 | ```
43 | Optional
44 | -p Path to analyze source (Default: current directory)
45 | -h Print help message
46 | -v Print FOSSLight Source Scanner version
47 | -m Print additional information for scan result on separate sheets
48 | -e Path to exclude from analysis (file and directory, pattern matching is available)
49 | -o Output path (Path or file name)
50 | -f Output file format (excel, csv, opossum, yaml)
51 | Options only for FOSSLight Source Scanner
52 | -s Select which scanner to be run (scancode, scanoss, all)
53 | -j Generate raw result of scanners in json format
54 | -t Stop scancode scanning if scanning takes longer than a timeout in seconds.
55 | -c Select the number of cores to be scanned with ScanCode.
56 | --no_correction Enter if you don't want to correct OSS information with sbom-info.yaml
57 | --correct_fpath Path to the sbom-info.yaml file
58 | ```
59 | - -s 옵션이 추가되지 않을 경우 모든 Scanner (ScanCode, SCANOSS)가 동작한 결과가 취합됩니다.
60 | - 📃 [Pattern 매칭 가이드](https://scancode-toolkit.readthedocs.io/en/stable/cli-reference/scan-options-pre.html?highlight=ignore#glob-pattern-matching)
61 |
62 | #### Example
63 | Source Code 분석 후 FOSSLight Report와 json 형태의 ScanCode, SCANOSS 결과 출력
64 | ```
65 | $ fosslight_source -p /home/source_path -j
66 | ```
67 |
68 | ## 📁 결과
69 |
70 | ```
71 | $ tree
72 | .
73 | ├── fosslight_log_220103_1540.txt
74 | ├── fosslight_opossum_220103_1540.json
75 | ├── fosslight_report_220103_1540.xlsx
76 | ├── fosslight_report_220103_1540.csv
77 | ├── scancode_raw_result.json
78 | ├── scanner_output.wfp
79 | └── scanoss_raw_result.json
80 | ```
81 | - fosslight_log_[datetime].txt : 실행 로그가 저장된 파일
82 | - fosslight_opossum_[datetime].json : [OpossumUI](https://github.com/opossum-tool/OpossumUI)에서 활용 가능한 Source Code 분석 결과
83 | - fosslight_report_[datetime].xlsx : FOSSLight Report 형태의 Source Code 분석 결과
84 | - fosslight_report_[datetime].csv : FOSSLight Report를 csv로 출력한 결과
85 | - scancode_raw_result.json : ScanCode 실행 결과 (fosslight_source 명령어에 -j 옵션이 포함된 경우에만 생성)
86 | - scanner_output.wfp : SCANOSS 실행 시 생성된 Finger Print (fosslight_source 명령어에 -j 옵션이 포함된 경우에만 생성)
87 | - scanoss_raw_result.json : SCANOSS 실행 결과 (fosslight_source 명령어에 -j 옵션이 포함된 경우에만 생성)
88 |
--------------------------------------------------------------------------------
/scanner/3_dependency.md:
--------------------------------------------------------------------------------
1 | ---
2 | published: true
3 | title: FOSSLight Dependency Scanner
4 | ---
5 | # FOSSLight Dependency Scanner
6 |
7 | [](https://api.reuse.software/info/github.com/fosslight/fosslight_dependency_scanner)
8 |
9 | [**FOSSLight Dependency Scanner**](https://github.com/fosslight/fosslight_dependency_scanner)는 여러 패키지 매니저에 대한 종속성 분석을 지원하는 도구입니다. 패키지 매니저의 Manifest 파일을 자동으로 감지하고 오픈 소스 도구를 사용하여 종속성을 분석합니다. 그 후 종속성의 OSS 정보가 포함된 보고서 파일을 생성합니다.
10 |
11 | {::options parse_block_html="true" /}
12 |
13 | 지원하는 Package Manager
14 | - [Gradle](https://gradle.org/) (Java/Android)
15 | - [Maven](http://maven.apache.org/) (Java)
16 | - [NPM](https://www.npmjs.com/) (Node.js)
17 | - [PNPM](https://pnpm.io/) (Node.js)
18 | - [PyPi](https://pip.pypa.io/) (Python)
19 | - [Pub](https://pub.dev/) (Dart with flutter)
20 | - [Cocoapods](https://cocoapods.org/) (Swift/Obj-C)
21 | - [Swift](https://swift.org/package-manager/) (Swift)
22 | - [Carthage](https://github.com/Carthage/Carthage) (Carthage)
23 | - [Go](https://pkg.go.dev/) (Go)
24 | - [Nuget](https://www.nuget.org/) (.NET)
25 | - [Helm](https://helm.sh/) (Kubernetes)
26 | - [Unity](https://unity.com/) (Unity
27 | - [Cargo](https://crates.io/) (Rust)
28 |
29 | {::options parse_block_html="false" /}
30 |
31 | **Github Repository** : [https://github.com/fosslight/fosslight_dependency_scanner](https://github.com/fosslight/fosslight_dependency_scanner)
32 | **License** : [Apache-2.0](https://github.com/fosslight/fosslight_dependency_scanner/blob/main/LICENSE)
33 |
34 | ## 목차
35 | - [필요 조건](#-필요-조건)
36 | - [설치 방법](#-설치-방법)
37 | - [실행 방법](#-실행-방법)
38 | - [결과](#-결과)
39 | - [동작 방식](#-동작-방식)
40 | - [패키지별 지원 레벨](#-패키지별-지원-레벨)
41 |
42 |
43 | ## 📋 필요 조건
44 | 각 패키지 매니저마다 다른 오픈소스 소프트웨어를 이용하여 Dependency 분석을 수행하고 있습니다. 이에 분석하고자 하는 패키지 매니저에 따라 각각의 Prerequisite 단계를 수행하시기 바랍니다.
45 |
46 | {::options parse_block_html="true" /}
47 |
48 | **Prerequisite for Npm**
49 | 1. Npm dependency 분석을 수행하기 위해 NPM License Checker를 설치합니다.
50 | ```
51 | $ npm install -g license-checker
52 | ```
53 | > license-checker를 전역 패키지로 설치하기 위해서는, 반드시 '-g' option을 추가해 주어야 합니다. 만약 'sudo' 권한이 없는 경우, 다음 명령어를 통해 전역 모듈이 설치되는 기본 path를 변경하여 이용하실 수 있습니다.
54 | ```
55 | $ npm set prefix ~/.npm
56 | $ PATH=~/.npm/bin:$PATH
57 | ```
58 |
59 | 2. dependency를 설치하기 위해 다음 명령어를 실행합니다. (optional)
60 | ```
61 | $ npm install
62 | ```
63 | > 아래 케이스 중 해당하는 경우, 이 단계는 skip 가능합니다.
64 | > - package.json 파일이 input directory에 존재하는 경우 : FOSSLight Dependency Scanner에서 자동으로 패키지 설치하여 실행 가능합니다.
65 | > - 이미 dependency들이 설치된 node_modules 디렉토리가 존재하는 경우 : node_modules폴더가 존재하는 path를 input directory로 설정하여 실행 가능합니다.
66 |
67 |
68 |
69 | **Prerequisite for Pnpm**
70 | ```tip
71 | FOSSLight Dependency Scanner 내부에서 'pnpm install' 및 'pnpm ls' 명령어를 통해 패키지 목록 및 license, repository와 같은 오픈소스 정보를 취합하고 있습니다. 이에 별도의 prerequisite단계없이, 바로 fosslight_dependency 명령어 실행하여 이용하실 수 있습니다.
72 | ```
73 |
74 |
75 |
76 | **Prerequisite for Gradle**
77 | 1. 'build.gradle' 파일에 License Gradle Plugin을 추가합니다.
78 | ```
79 | plugins {
80 | id 'com.github.hierynomus.license' version '0.16.1' // gradle 버전이 6.x 이하인 경우에는 version '0.15.0'을 이용해야 합니다.
81 | }
82 | downloadLicenses {
83 | includeProjectDependencies = true
84 | dependencyConfiguration = 'runtimeClasspath' // gradle 버전이 4.6 이하인 경우에는 'runtimeClasspath' 대신 'runtime'으로 추가합니다.
85 | }
86 | ```
87 |
88 | 2. 'downloadLicenses' task를 실행합니다.
89 | ```
90 | $ gradlew downloadLicenses
91 | ```
92 |
93 |
94 |
95 | **Prerequisite for Android (gradle)**
96 | ```tip
97 | Android (gradle)의 경우, input directory에 gradlew 실행 파일 및 build.gradle 파일이 존재하는 경우, plugin 추가 및 실행을 FOSSLight Dependency Scanner 내부에서 자동으로 수행하므로 다음은 skip하셔도 됩니다.
98 | ```
99 | 1. 'build.gradle' 파일에 android-dependency-scanning Plugin을 추가합니다.
100 | ```
101 | buildscript {
102 | repositories {
103 | mavenCentral()
104 | }
105 | dependencies {
106 | classpath 'org.fosslight:android-dependency-scanning:1.0.0'
107 | }
108 | }
109 | ```
110 |
111 | 2. 플러그인이 적용되는 app 디렉토리 내에 위치한 build.gradle 파일 내에 다음과 같이 추가합니다. 이때 plugins 블록 (또는 apply plugin:'com.android.application') 하위 라인에 추가되어야 에러가 발생하지 않습니다.
112 | ```
113 | apply plugin: 'org.fosslight'
114 | ```
115 |
116 | 3. 'generateLicenseTxt' task를 실행합니다.
117 | ```
118 | $ gradlew generateLicenseTxt
119 | ```
120 |
121 |
122 |
123 | **Prerequisite for Pypi**
124 | ```tip
125 | - 시스템 내 전역으로 설치된 파이썬 dependency로부터 분석하고자 하는 프로젝트 dependency를 분리하기 위해 가상환경을 설정하여 이용하기를 권장합니다.
126 | - 만약 input path내 requirements.txt가 존재한다면, FOSSLight Dependency Scanner가 자동으로 dependency 설치하여 분석 실행 가능하므로, 2번 단계부터는 skip합니다.
127 | ```
128 |
129 | 1. python3-venv를 설치합니다.
130 | ```
131 | $ sudo apt-get install python3-venv
132 | ```
133 | 2. 가상환경을 생성하고 활성화합니다.
134 | ```
135 | // virtualenv example
136 | $ virtualenv -p /usr/bin/python3.7 venv
137 | $ source venv/bin/activate
138 | // conda example
139 | $ conda create --name {venv name}
140 | $ conda activate {venv name}
141 | ```
142 | 3. 가상환경 내 분석하고자 하는 프로젝트에서 사용된 패키지를 설치합니다.
143 | 4. FOSSLight Dependency Scanner 실행 시, '-a', '-d' 옵션을 이용하여 해당 가상환경 activate, deactivate 명령어를 추가합니다.
144 |
145 |
146 |
147 | **Prerequisite for Maven**
148 | ```tip
149 | Maven의 경우, input directory에 pom.xml 파일이 존재하는 경우, plugin 추가 및 실행을 FOSSLight Dependency Scanner 내부에서 자동으로 수행하므로 다음은 skip하셔도 됩니다.
150 | ```
151 |
152 |
184 |
185 |
186 |
187 |
188 | **Prerequisite for Pub**
189 | > FOSSLight Dependency Scanner 실행하는 환경에서 flutter pub 명령어 사용 가능하지 않은 경우, flutter pub 사용 가능한 환경에서 미리 아래 과정을 수행하시기 바랍니다.
190 | 1. 다음 명령어를 통해 flutter_oss_licenses를 실행합니다. (optional)
191 | ```
192 | $ flutter pub add dev:flutter_oss_licenses:'^2.0.1'
193 | $ flutter pub get
194 | $ flutter pub deps --json > tmp_deps.json
195 | $ flutter pub deps --no-dev -s compact > tmp_no_dev_deps.txt
196 | $ flutter pub run flutter_oss_licenses:generate.dart -o tmp_flutter_oss_licenses.json --json
197 | ```
198 | 2. 1번 수행 결과에서 생성된 파일이 존재하는 path에서 FOSSLight Dependency Scanner를 실행합니다.
199 |
200 |
201 |
202 | **Prerequisite for Cocoapods**
203 | 1. Podfile을 통해 pod package를 설치합니다.
204 | ```
205 | $ pod install
206 | ```
207 |
208 |
209 |
210 | **Prerequisite for Swift**
211 | 1. Github personal access token을 생성하여 FOSSLight Dependency Scanner 실행 시 '-t' 파라미터로 사용합니다. 이 토큰은 Github repository의 license정보를 가져오기 위해 Github API를 사용하기 위해 필요합니다.
212 | Token생성 방법은 [Github docs 가이드](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token)를 참조하시기 바랍니다.
213 |
214 |
215 |
216 | **Prerequisite for Carthage**
217 | 1. 다음과 같이 패키지 설치 명령어를 수행하여 'Cartfile.resolved' 파일을 생성합니다.
218 | ```
219 | $ carthage update
220 | ```
221 | 2. Github personal access token을 생성하여 FOSSLight Dependency Scanner 실행 시 '-t' 파라미터로 사용합니다. 이 토큰은 Github repository의 license정보를 가져오기 위해 Github API를 사용하기 위해 필요합니다.
222 | Token생성 방법은 [Github docs 가이드](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token)를 참조하시기 바랍니다.
223 |
224 |
225 |
226 | **Prerequisite for Go**
227 | ```tip
228 | Go의 경우, go module에 한해 dependency 분석을 지원합니다. FOSSLight Dependency Scanner 내부에서 자동으로 'go list -m all' 명령어를 수행하여 dependency 목록을 얻은 뒤, license, repository와 같은 오픈소스 정보를 취합하고 있습니다. 이에 별도의 prerequisite단계없이, 바로 fosslight_dependency 명령어 실행하여 이용하실 수 있습니다.
229 | ```
230 |
231 |
232 |
233 | **Prerequisite for Nuget**
234 | ```tip
235 | FOSSLight Dependency Scanner 내부에서 packages.config 파일 또는 PackageReference형태로 이용하는 경우 obj/project.assets.json 파일을 통해 패키지 목록을 확인하고, nuget api를 통해 license, repository와 같은 오픈소스 정보를 취합하고 있습니다. 이에 별도의 prerequisite단계없이, 바로 fosslight_dependency 명령어 실행하여 이용하실 수 있습니다.
236 | ```
237 |
238 |
239 |
240 | **Prerequisite for Helm**
241 | ```tip
242 | FOSSLight Dependency Scanner 내부에서 Chart.yaml 파일과 helm dependency build 명령어를 통해 패키지 목록 및 license, repository와 같은 오픈소스 정보를 취합하고 있습니다. 이에 별도의 prerequisite단계없이, 바로 fosslight_dependency 명령어 실행하여 이용하실 수 있습니다.
243 | ```
244 |
245 |
246 |
247 | **Prerequisite for Unity**
248 | ```tip
249 | FOSSLight Dependency Scanner 내부에서 Library/PackageManager/ProjectCache 파일과 Library/PackageCache 디렉토리 내 각 패키지 디렉토리에서 패키지 목록 및 license, repository와 같은 오픈소스 정보를 취합하고 있습니다. 이에 해당 파일들이 존재하는 환경에서 fosslight_dependency 명령어 실행하여 이용하실 수 있습니다.
250 | ```
251 |
252 |
253 |
254 | **Prerequisite for Cargo**
255 | ```tip
256 | FOSSLight Dependency Scanner 내부에서 Cargo.toml 파일과 'cargo metadata' 명령어를 통해 패키지 목록 및 license, repository와 같은 오픈소스 정보를 취합하고 있습니다. 이에 별도의 prerequisite단계없이, 바로 fosslight_dependency 명령어 실행하여 이용하실 수 있습니다.
257 | ```
258 |
259 | {::options parse_block_html="false" /}
260 |
261 | ## 🎉 설치 방법
262 |
263 | FOSSLight Dependency Scanner는 pip3를 이용하여 설치할 수 있습니다.
264 | [python 3.7 + virtualenv](etc/guide_virtualenv.md) 환경에서 설치할 것을 권장합니다.
265 |
266 | ```
267 | $ pip3 install fosslight_dependency
268 | ```
269 |
270 |
271 | ## 🚀 실행 방법
272 |
273 | FOSSLight Dependency Scanner는 패키지 매니저에 따라 다음 option들을 이용하여 실행할 수 있습니다.
274 |
275 | ```
276 | $ fosslight_dependency [option]
277 | ```
278 | ### Options
279 | ```
280 | Optional
281 | -h Print help message.
282 | -v Print the version of the script.
283 | -m Enter the package manager.
284 | (npm, maven, gradle, pypi, pub, cocoapods, android, swift, carthage, go, nuget, helm, unity, cargo, pnpm)
285 | -p Enter the path where the script will be run.
286 | -e Enter the path where the analysis will not be performed.(Pattern matching is available)
287 | -o Output path
288 | (If you want to generate the specific file name, add the output path with file name.)
289 | -f [ ...] Output formats (excel, csv, opossum, yaml, spdx-tag, spdx-yaml, spdx-json, spdx-xml)
290 | Multiple formats can be specified separated by space.
291 | --graph-path Enter the path where the graph image will be saved
292 | (ex. /your/directory/path/filename.{pdf, jpg, png}) (recommend pdf extension)
293 | --graph-size Enter the size of the graph image (The size unit is pixels)
294 | --graph-path option is required
295 | --direct Print the direct/transitive dependency type in comment.
296 | Choice 'True' or 'False'. (default:True)
297 | --notice Print the open source license notice text.
298 |
299 | Required only for swift, carthage
300 | -t Enter the github personal access token.
301 |
302 | Optional only for pypi
303 | -a Virtual environment activate command(ex, 'conda activate (venv name)')
304 | -d Virtual environment deactivate command(ex, 'conda deactivate')
305 |
306 | Optional only for gradle, maven
307 | -c Enter the customized build output directory name
308 | -Default name : 'build' for gradle, 'target' for maven
309 |
310 | Optional only for android
311 | -n Enter the application directory name where the plugin output file is located(default: app)
312 |
313 | ```
314 | - 📃 [Pattern 매칭 가이드](https://scancode-toolkit.readthedocs.io/en/stable/cli-reference/scan-options-pre.html?highlight=ignore#glob-pattern-matching)
315 |
316 | ### Tips to run
317 | FOSSLight Dependency Scanner 실행 시, input path('-p' 옵션)는 dependency 분석을 수행하고자 하는 패키지 매니저의 manifest 파일이 존재하는 프로젝트의 top directory로 지정해 주어야 합니다.
318 | 각 패키지 매니저별 manifest 파일은 다음과 같습니다.
319 | ```
320 | - Npm : package.json
321 | - Pnpm : pnpm-lock.yaml
322 | - Pypi : requirements.txt / setup.py / pyproject.toml
323 | - Maven : pom.xml
324 | - Gradle (Android) : build.gradle
325 | - Pub : pubspec.yaml
326 | - Cocoapods : Podfile
327 | - Swift : Package.resolved
328 | - Carthage : Cartfile.resolved
329 | - Go : go.mod
330 | - Nuget : packages.config / {project name}.csproj
331 | - Helm : Chart.yaml
332 | - Unity : Library/PackageManager/ProjectCache
333 | - Cargo : Cargo.toml
334 | ```
335 |
336 | - Android (gradle)
337 | - module name이 default인 app이 아닌 경우, module name을 '-n' 옵션으로 지정하여 실행하셔야 합니다. (fosslight_dependency -n {module_name})
338 | - Swift package manager
339 | - 예외적으로 Swift package manager는 {프로젝트명}.xcodeproj 파일이 위치한 path에서 "fosslight_dependency -m swift -t {token}" 명령어를 실행하실 수 있습니다.
340 | - 이 경우에는 {프로젝트명}.xcodeproj/project.xcworkspace/xcshareddata/swiftpm path에서 'Package.resolved' 파일을 자동으로 찾고 프로그램이 실행됩니다.
341 | - Unity
342 | - Library 폴더 존재하는 directory에서 "fosslight_dependency -m unity" 명령어를 실행하시면 됩니다.
343 |
344 | ## 📁 결과
345 | ```
346 | $ tree
347 | .
348 | ├── fosslight_report_dep_210503_0039.xlsx
349 | ├── fosslight_log_210503_0039.txt
350 | └── fosslight_opossum_210503_0039.json
351 | ```
352 | - fosslight_report_dep_[datetime].xlsx : FOSSLight Report 형태의 Dependency 분석 결과
353 | - fosslight_log_dep_[datetime].txt: 실행 로그가 저장된 파일
354 | - fosslight_opossum_dep_[datetime].json : [OpossumUI](https://github.com/opossum-tool/OpossumUI)에서 활용 가능한 Dependency 분석 결과 (-f opossum 결과)
355 | - third_party_notice.txt : Unity로 실행한 경우에만 생성되는 파일로써, 각 패키지의 third party notice를 모아서 출력함
356 |
357 | ### Graph Network 생성 결과
358 | ``` bash
359 | # $ fosslight_dependency -p /project/path --graph-path ~/temp/graph.png --graph-size 1000 1000
360 | $ cd ~/temp
361 | $ tree
362 | .
363 | └── graph.png
364 | ```
365 |
366 |
367 | - fosslight_report_dep_[datetime].xlsx 파일의 결과 중 Depends On 부분을 이용하여 각 Dependency 간의 의존 관계 그래프 이미지 저장
368 |
369 | ### 결과 파일 내용
370 | FOSSLight Report 결과 파일에는 transitive dependency들을 포함한 모든 분석된 dependency들의 manifest 파일을 기반으로 OSS 정보가 기록됩니다.
371 | 이때, 고유한 OSS명을 작성하기 위해, OSS명은 (패키지 매니저):(OSS명) 또는 (group id):(artifact id) 양식으로 기록됩니다.
372 |
373 | | Package manager | OSS Name | Download Location | Homepage |
374 | | ------------------------------ | ------------------------ | -------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
375 | | Npm, Pnpm | npm:(oss name) | 우선순위1. repository in package.json 우선순위2. npmjs.com/package/(oss name)/v/(oss version) | npmjs.com/package/(oss name) |
376 | | Pypi | pypi:(oss name) | pypi.org/project/(oss name)/(version) | homepage in (pip show) information |
377 | | Maven & Gradle & Android | (group_id):(artifact_id) | mvnrepository.com/artifact/(group id)/(artifact id)/(version) | mvnrepository.com/artifact/(group id)/(artifact id) |
378 | | Pub | pub:(oss name) | pub.dev/packages/(oss name)/versions/(version) | homepage in (pub information) |
379 | | Cocoapods | cocoapods:(oss name) | source in (pod spec information) | cocoapods.org/pods/(oss name) |
380 | | Swift | swift:(oss name) | repositoryURL in Package.resolved | repositoryURL in Package.resolved |
381 | | Carthage | carthage:(oss name) | github repository in Cartfile.resolved | github repository in Cartfile.resolved |
382 | | Go | go:(oss name) | pkg.go.dev/(oss name)@(oss version) | repository in pkg.go.dev/(oss name)@(oss version) |
383 | | Nuget | nuget:(oss name) | 우선순위1. repository in nuget.org/packages/(oss name)/(oss version) 우선순위2. projectUrl in nuget.org/packages/(oss name)/(oss version) 우선순위3. nuget.org/packages/(oss name)/(oss version) | nuget.org/packages/(oss name) |
384 | | Helm | helm:(oss name) | first url of sources in (Chart.yaml) | home in (Chart.yaml) |
385 | | Unity | (oss name) | url in repository in ProjectCache | url in repository in ProjectCache |
386 | | Cargo | cargo:(oss name) | repository of the package in the result file for 'cargo metadata' | crates.io/crates/(oss name) |
387 |
388 |
389 | ```warning
390 | - Npm, Maven, gradle의 결과 파일 내용 중, Local path나 local repository를 통해 설치된(npmjs.com / mvnrepository에 배포되지 않은) 패키지의 경우, download location이 실제와 다를 수 있습니다.
391 | - Helm은 root 프로젝트의 Chart.yaml파일에 작성된 dependencies 항목에 대해서만 출력 가능하며, 각 dependency의 dependency 항목 출력은 현재 지원하지 않고 있습니다. 또한, 'helm dependency build' 명령어 수행 후 charts/ 디렉토리 내 다운로드된 .tgz 파일 내 Chart.yaml 파일 정보에서 각 dependency의 OSS 정보를 얻어오고 있습니다.
392 | 따라서 Chart.yaml에 License 또는 Homepage와 같은 정보가 누락된 경우, 해당 정보 얻어올 수 없기에 사용자가 수기로 확인 및 보완하는 작업이 필요합니다.
393 | ```
394 |
395 | ## 🧐 동작 방식
396 | FOSSLight Dependency Scanner는 패키지 매니저에 따른 dependency를 분석하기 위해 오픈 소스 소프트웨어를 활용합니다. 이때 활용되는 오픈 소스 소프트웨어는 direct dependency뿐만 아니라 transitive dependency까지 추출 가능하며, 오픈소스명, 버전, 라이선스명을 추출 가능합니다.
397 |
398 | 각 패키지 매니저별 사용하는 소프트웨어는 다음과 같습니다:
399 |
400 | - NPM : [NPM License Checker](https://github.com/davglass/license-checker)
401 | - Pypi : [pip-licenses](https://github.com/raimon49/pip-licenses)
402 | - Gradle : [License Gradle Plugin](https://github.com/hierynomus/license-gradle-plugin)
403 | - Maven : [license-maven-plugin](https://github.com/mojohaus/license-maven-plugin)
404 | - Pub : [flutter_oss_licenses](https://github.com/espresso3389/flutter_oss_licenses)
405 | - Android(gradle) : [android-dependency-scanning](https://github.com/fosslight/android-dependency-scanning)
406 |
407 | 이에 패키지 매니저마다 각기 다른 오픈 소스 소프트웨어를 활용함으로써, FOSSLight Dependency Scanner를 실행하기 위해 패키지 매니저별 **Prerequisite** 단계를 먼저 수행해야 합니다.
408 |
409 | ## 👀 패키지별 지원 레벨
410 |
411 |
412 |
413 |
Language/ Project
414 |
Package Manager
415 |
Manifest file
416 |
Direct dependencies
417 |
Transitive dependencies
418 |
Relationship of dependencies (Dependencies of each dependency)
419 |
420 |
421 |
422 |
423 |
Javascript
424 |
Npm
425 |
package.json
426 |
O
427 |
O
428 |
O
429 |
430 |
431 |
Pnpm
432 |
pnpm-lock.yaml
433 |
O
434 |
O
435 |
O
436 |
437 |
438 |
Java
439 |
Gradle
440 |
build.gradle
441 |
O
442 |
O
443 |
O
444 |
445 |
446 |
Maven
447 |
pom.xml
448 |
O
449 |
O
450 |
O
451 |
452 |
453 |
Java (Android)
454 |
Gradle
455 |
build.gradle
456 |
O
457 |
O
458 |
O
459 |
460 |
461 |
ObjC, Swift (iOS)
462 |
Cocoapods
463 |
Podfile.lock
464 |
O
465 |
O
466 |
O
467 |
468 |
469 |
Carthage
470 |
Cartfile.resolved
471 |
O
472 |
O
473 |
X
474 |
475 |
476 |
Swift (iOS)
477 |
Swift
478 |
Package.resolved
479 |
O
480 |
O
481 |
O
482 |
483 |
484 |
Dart, Flutter
485 |
Pub
486 |
pubspec.yaml
487 |
O
488 |
O
489 |
O
490 |
491 |
492 |
Go
493 |
Go
494 |
go.mod
495 |
O
496 |
O
497 |
O
498 |
499 |
500 |
Python
501 |
Pypi
502 |
requirements.txt, setup.py, pyproject.toml
503 |
O
504 |
O
505 |
O
506 |
507 |
508 |
.NET
509 |
Nuget
510 |
packages.config, obj/project.assets.json
511 |
O
512 |
O
513 |
O
514 |
515 |
516 |
Kubernetes
517 |
Helm
518 |
Chart.yaml
519 |
O
520 |
X
521 |
X
522 |
523 |
524 |
Unity
525 |
Unity
526 |
Library/PackageManager/ProjectCache
527 |
O
528 |
O
529 |
X
530 |
531 |
532 |
Rust
533 |
Cargo
534 |
Cargo.toml
535 |
O
536 |
O
537 |
O
538 |
539 |
540 |
541 |
--------------------------------------------------------------------------------
/scanner/4_binary.md:
--------------------------------------------------------------------------------
1 | ---
2 | published: true
3 | ---
4 | # FOSSLight Binary Scanner
5 |
6 | [](https://api.reuse.software/info/github.com/fosslight/fosslight_binary_scanner)
7 |
8 | [**FOSSLight Binary Scanner**](https://github.com/fosslight/fosslight_binary_scanner)는 Binary를 찾아 출력하고 Binary DB에 동일하거나 비슷한 Binary가 있으면 해당 OSS 정보를 출력합니다.
9 | jar 파일에 대한 오픈 소스 분석 시, 오픈 소스인 [**Dependency-check-py**](https://github.com/jhermann/dependency-check-py)를 이용합니다.
10 |
11 | **Github Repository** : [https://github.com/fosslight/fosslight_binary_scanner](https://github.com/fosslight/fosslight_binary_scanner)
12 | **License** : [Apache-2.0](https://github.com/fosslight/fosslight_binary_scanner/blob/main/LICENSE)
13 |
14 | ## 목차
15 | - [필요 조건](#-필요-조건)
16 | - [설치 방법](#-설치-방법)
17 | - [실행 방법](#-실행-방법)
18 | - [결과](#-결과)
19 | - [동작 방식](#-동작-방식)
20 |
21 |
22 | ## 📋 필요 조건
23 | [**FOSSLight Binary Scanner**](https://github.com/fosslight/fosslight_binary_scanner)는 Python 3.7+ 기반에서 동작합니다.
24 | OSS 정보(OSS Name, OSS Version, License)를 Binary DB로부터 추출하는 기능을 사용하려면 [DB 세팅 가이드](etc/binary_db.md)를 참고하세요.
25 |
26 | Jar 파일에 대한 분석을 위해서는 [**Java**](https://openjdk.java.net)를 설치해야 합니다.(Open Source JDK를 설치)
27 |
28 | ## 🎉 설치 방법
29 | ### 방법 1. 실행 파일 다운로드
30 | OS(Operating System)에 맞는 실행 파일을 다운로드 받습니다.
31 | - [FOSSLight Binary Scanner - Release](https://github.com/fosslight/fosslight_binary_scanner/releases)
32 |
33 | 단, 지원하지 않는 OS인 경우 '방법 2'로 설치합니다.
34 |
35 | ### 방법 2. Python 환경 기반 fosslight_binary 설치
36 | 0. (windows의 경우) https://visualstudio.microsoft.com/ko/vs/older-downloads/ > 재배포 가능 패키지 및 빌드 도구에서 Microsoft Build Tools 설치
37 | 1. [python 3.7 + virtualenv](etc/guide_virtualenv.md) 환경 세팅
38 | 2. Python package인 fosslight_binary 설치
39 | ```
40 | $ pip3 install fosslight_binary
41 | ```
42 |
43 | ## 🚀 실행 방법
44 | ### 방법 1. windows에서 실행 파일로 실행하는 경우
45 | binary 분석할 path에 fosslight_bin_windows.exe 파일 위치시킨 후, 더블 클릭하여 실행합니다.
46 |
47 | ### 방법 2. 그 외, command로 실행하는 경우
48 | ````
49 | $ fosslight_binary [option]
50 | ````
51 |
52 | ### Options
53 | ````
54 | Options:
55 | -p Path to analyze binaries (Default: current directory)
56 | -h Print help message
57 | -v Print FOSSLight Binary Scanner version
58 | -s Extract only the binary list in simple mode
59 | -e Path to exclude from analysis (files and directories, pattern matching is available)
60 | -o Output path
61 | (If you want to generate the specific file name, add the output path with file name.)
62 | -f [ ...] Output file formats (excel, csv, opossum, yaml)
63 | Multiple formats can be specified separated by space.
64 | -d DB Connection(format :'postgresql://username:password@host:port/database_name')
65 | --notice Print the open source license notice text.
66 | --no_correction Enter if you don't want to correct OSS information with sbom-info.yaml
67 | --correct_fpath Path to the sbom-info.yaml file
68 | ````
69 | - 📃 [Pattern 매칭 가이드](https://scancode-toolkit.readthedocs.io/en/stable/cli-reference/scan-options-pre.html?highlight=ignore#glob-pattern-matching)
70 |
71 |
72 | ## 📁 결과
73 |
74 | ```
75 | $ tree
76 | .
77 | ├── fosslight_log_220904_0912.txt
78 | ├── fosslight_report_220904_0912.xlsx
79 | └── fosslight_opossum_220904_0912.json
80 |
81 | ```
82 | - fosslight_log_[datetime].txt : 실행 log
83 | - fosslight_report_[datetime].xlsx : FOSSLight binary의 결과 (FOSSLight Report 형태)
84 | - jar 파일 분석 시, Vulnerability Link Column에 보안취약점 정보가 추가됨.
85 | - Binary별 checksum, tlsh Column은 기본적으로 숨김 처리 되어 있음.
86 | - fosslight_opossum_[datetime].json : [OpossumUI](https://github.com/opossum-tool/OpossumUI)에서 활용 가능한 Binary 분석 결과
87 |
88 | ## 🧐 동작 방식
89 | 1. 아래 항목들은 Binary 분석 과정에서 제외됩니다.
90 |
91 | |제외 항목 | 설명 |
92 | |------------------------|-------------------------------------------------------------------------------------------------------------------------------|
93 | |symbolic link, FIFO 파일| file open으로 읽을 수 없음. 이로 인해 file type이나 binary인지 체크할 때, FOSSLight Binary Scanner가 멈춤. |
94 | |Binary가 아닌 확장자 | 'qm', 'xlsx', 'pdf', 'pptx', 'jfif', 'docx', 'doc', 'whl', 'xls', 'xlsm', 'ppt', 'mp4', 'pyc', 'plist', 'dat', 'json', 'js' 등|
95 | |특정 파일 Type | 'data','timezone data', 'apple binary property list'로 시작하는 파일들 |
96 | |특정 경로 | '.git'의 경로 |
97 |
98 | 2. 아래 사항에 대하여 FOSSLight Report에 "**Exclude**"를 체크합니다.
99 |
100 | |Exclude 항목 |설명 |
101 | |----------------------------------------------------------------------|-----------------------------------------------------|
102 | |Binary가 ['fosslight_bin', 'fosslight_bin.exe']에 포함되는 경우 | - |
103 | |경로가 ["test", "tests", "doc", "docs", "intermediates"]에 포함되는 경우| 실제 배포에 포함되는 소스 코드 / 바이너리의 결과만 출력 |
104 | |directory가 숨긴 폴더인 경우 (폴더명이 .로 시작하는 경우) | - |
105 | |특정 확장자인 경우 | 최종 빌드 산출물이 아님(ex, .class) |
106 |
107 | 3. Binary별 checksum과 tlsh를 출력합니다.
108 | 4. OSS 정보를 Binary DB로 부터 불러옵니다.
109 | 5. 결과 Report 파일을 생성합니다.
110 |
--------------------------------------------------------------------------------
/scanner/5_yocto.md:
--------------------------------------------------------------------------------
1 | ---
2 | published: true
3 | ---
4 | # FOSSLight Yocto Scanner
5 |
6 | [](https://api.reuse.software/info/github.com/fosslight/fosslight_yocto_scanner)
7 |
8 | [**FOSSLight Yocto Scanner**](https://github.com/fosslight/fosslight_yocto_scanner)는 Yocto Project에 기반하여 build 시, rootfs 이미지에 포함되는 Package에 대한 OSS 정보를 FOSS Report형식으로 출력해주는 Python Script입니다.
9 |
10 | - Package별 OSS 정보 출력 방법 : Recipe에 정의된 OSS 정보(OSS Name, OSS Version, LICENSE, Download Location)를 출력합니다.
11 | 이 때, OSS Name은 Recipe name으로 출력합니다.
12 | - ⚠️**rootfs 이미지 외 target에 탑재되는 이미지 (ex- 커널, 부트로더)에 대해서는 Script가 OSS 정보를 출력해주지 않습니다.** 이에 대해서는 사용자가 직접 OSS Report에 OSS 정보를 추가해야 합니다.
13 |
14 | **Github Repository** : [https://github.com/fosslight/fosslight_yocto_scanner](https://github.com/fosslight/fosslight_yocto_scanner)
15 | **License** : [Apache-2.0](https://github.com/fosslight/fosslight_yocto_scanner/blob/main/LICENSE)
16 |
17 | ## 목차
18 | - [필요 조건](#-필요-조건)
19 | - [설치 방법](#-설치-방법)
20 | - [실행 방법](#-실행-방법)
21 | - [결과](#-결과)
22 | - [동작 방식](#-동작-방식)
23 |
24 |
25 | ## 📋 필요 조건
26 | [**FOSSLight Yocto Scanner**](https://github.com/fosslight/fosslight_yocto_scanner)는 Python 3.8+ 기반에서 동작합니다.
27 | OSS 정보(OSS Name, OSS Version, License)를 Binary DB로부터 추출하는 기능을 사용하려면 [DB 세팅 가이드](etc/binary_db.md)를 참고하세요.
28 |
29 |
30 | ## 🎉 설치 방법
31 | 0. (windows의 경우) https://visualstudio.microsoft.com/ko/vs/older-downloads/ > 재배포 가능 패키지 및 빌드 도구에서 Microsoft Build Tools 설치
32 | 1. [python 3.8 + virtualenv](etc/guide_virtualenv.md) 환경 세팅
33 | 2. Python package인 fosslight_yocto 설치
34 | ```
35 | $ pip3 install fosslight_yocto
36 | ```
37 |
38 | ## 🚀 실행 방법
39 | ### 방법 1. bom.bbclass를 이용하는 방법
40 |
41 | ---
42 | [bom.bbclass](https://github.com/fosslight/fosslight_yocto_scanner/blob/main/files_for_preparation/bom.bbclass) 를 이용하여 추출한 결과를 FOSSLight Yocto를 이용하여 OSS Report형태로 변환합니다.
43 | - Sheet 별 출력 사항:
44 | - SRC Sheet : Installed package 목록을 추출하고 OSS 정보를 출력합니다.
45 | - BIN Sheet : rootfs image를 압축 해제한 폴더에서 binary를 추출한 후 binary별 OSS 정보를 출력합니다.
46 |
47 | ---
48 |
49 | #### 준비 사항
50 | 1. build directory (ex-poky/build)로 이동한 후, conf/local.conf에 buildhistory와 bom을 inherit시킵니다.
51 | ```
52 | $ cd poky/build
53 | poky/build$ vi conf/local.conf
54 | INHERIT += "buildhistory"
55 | BUILDHISTORY_COMMIT = "1"
56 |
57 | INHERIT += "bom"
58 | ```
59 | 2. 최상위 directory 아래 meta/classes 디렉토리에 [bom.bbclass](https://github.com/fosslight/fosslight_yocto_scanner/blob/main/files_for_preparation/bom.bbclass) 파일을 다운로드합니다.
60 | - meta/classes 가 없는 경우 build에 포함되는 meta layer의 classes폴더에 bom.bbclass를 다운로드합니다.
61 | ```
62 | poky/meta/classes$ wget -O bom.bbclass "https://github.com/fosslight/fosslight_yocto_scanner/raw/main/files_for_preparation/bom.bbclass"
63 | ```
64 | - yocto 2.5 이전 버전의 경우, --runall 기능을 지원하지 않아 build시 bom.bbclass를 출력하기 위하여 bom.bbclass를 하기와 같이 수정합니다.
65 | ```
66 | addtask write_bom_info -> addtask write_bom_info before do_build
67 | ```
68 | 3. 이미지를 build한 후, write_bom_info를 실행합니다.
69 | - yocto 2.5 이후 버전
70 | ```
71 | poky/build $ bitbake
72 | poky/build $ bitbake --runall=write_bom_info (eg. bitbake --runall=write_bom_info core-image-minimal)
73 | ```
74 | - yocto 2.5 이전 버전
75 | ```
76 | poky/build $ bitbake
77 | ```
78 | 4. ${TOPDIR}/에 bom.json 파일과 buildhistory 폴더가 생성됩니다.
79 |
80 | #### 실행
81 | fosslight_yocto 명령어를 실행합니다.
82 | ```
83 | $ fosslight_yocto -i [installed-package-names.txt] -b [bom.json] -p [buildhistory/packages] -a [path_to_binary_analysis]
84 | ```
85 |
86 | - Options
87 | ```
88 | Mandatory
89 | -p Path of buildhistory/package
90 | -b bom.json
91 | -i installed-package-names.txt
92 | -ip installed-packages.txt
93 |
94 | Optional
95 | -h Print help message
96 | -v Print FOSSLight yocto version
97 | -y oss-pkg-info.yaml
98 | -a Path to analyze the binaries
99 | -n Print result in BIN(Android) format
100 | -s Analyze source code for unconfirmed Open Source
101 | -c Analyze all the source code
102 | -e Top build output path with bom.json to compress all the source code (ex. /data001/projectA/build)
103 | -o Output Path
104 | -f Output file format (excel, csv, opossum)
105 | -pr Print all data of bom.json
106 | ```
107 |
108 | ### 방법 2. meta-doubleopen을 이용하는 방법
109 | ---
110 | [meta-doubleopen](https://github.com/doubleopen-project/meta-doubleopen)를 이용하여 spdx.json으로 추출하고 FOSSLight Yocto를 이용하여 FOSS Report 형식으로 변환합니다.
111 | - Sheet 별 출력 사항:
112 | - SRC_distributed: rootfs 이미지에 포함되는 Package
113 | - SRC_recipe: build에 포함되는 Recipe
114 | - SRC_not_distributed: rootfs 이미지에 포함되지 않는 Package
115 |
116 | - Package별 OSS 정보 출력 방법 : Recipe에 정의된 OSS 정보(OSS Name, OSS Version, LICENSE, Download Location, Homepage)를 출력합니다. 이 때, OSS Name은 Recipe name으로 출력합니다.
117 |
118 | ---
119 |
120 | #### 준비 사항
121 | [meta-doubleopen](https://github.com/doubleopen-project/meta-doubleopen)을 이용하여 이미지에 대한 spdx.json 파일을 생성합니다.
122 |
123 | #### 실행
124 | fosslight_doubleopen 명령어를 실행합니다.
125 | ```
126 | $ source venv/bin/activate
127 | (.venv) $ fosslight_doubleopen -f core-image-minimal.spdx.json
128 | ```
129 | - Option f {[image].spdx.json} : meta-doubleopen 실행 결과 생성되는 spdx.json 파일
130 |
131 | ## 📁 결과
132 |
133 | ```
134 | $ tree
135 | .
136 | ├── fosslight_log_220904_0912.txt
137 | ├── fosslight_report_220904_0912.xlsx
138 | └── fosslight_opossum_220904_0912.json
139 |
140 | ```
141 | - fosslight_log_[datetime].txt : 실행 log
142 | - fosslight_report_[datetime].xlsx : FOSSLight Yocto의 결과 (FOSSLight Report 형태)
143 | - Binary별 checksum, tlsh 값은 report에 기본적으로 숨김 처리 되어 있음.
144 | - fosslight_opossum_[datetime].json : [OpossumUI](https://github.com/opossum-tool/OpossumUI)에서 활용 가능한 Binary 분석 결과
145 |
--------------------------------------------------------------------------------
/scanner/6_android.md:
--------------------------------------------------------------------------------
1 | ---
2 | published: true
3 | ---
4 | # FOSSLight Android Scanner
5 |
6 | [](https://api.reuse.software/info/github.com/fosslight/fosslight_android_scanner)
7 |
8 | [**FOSSLight Android Scanner**](https://github.com/fosslight/fosslight_android_scanner)는 Android 모델에 탑재되는 Binary를 모두 나열하여 각 Binary별로 Open Source가 사용되었는지 확인하고, 고지해야 할 사항이 OSS 고지문(ex. NOTICE.html)에 적절하게 포함되었는지 확인하기 위해 수행합니다.
9 |
10 | **Github Repository** : [https://github.com/fosslight/fosslight_android_scanner](https://github.com/fosslight/fosslight_android_scanner)
11 | **License** : [Apache-2.0](https://github.com/fosslight/fosslight_android_scanner/blob/main/LICENSE)
12 |
13 | ## 목차
14 | - [필요 조건](#-필요-조건)
15 | - [설치 방법](#-설치-방법)
16 | - [실행 방법](#-실행-방법)
17 | - [결과](#-결과)
18 | - [추가 기능](#-추가-기능)
19 |
20 |
21 | ## 📋 필요 조건
22 | [**FOSSLight Android Scanner**](https://github.com/fosslight/fosslight_android_scanner)는 Python 3.8+ 기반에서 동작합니다.
23 | OSS 정보(OSS Name, OSS Version, License)를 Binary DB로부터 추출하는 기능을 사용하려면 [DB 세팅 가이드](etc/binary_db.md)를 참고하세요.
24 |
25 | ## 🎉 설치 방법
26 | 1. [python 3.8 + virtualenv](etc/guide_virtualenv.md) 환경 세팅
27 | 2. Python package인 fosslight_android 설치
28 | ```
29 | $ pip3 install fosslight_android
30 | ```
31 |
32 | ## 🚀 실행 방법
33 | FOSSLight Android를 실행합니다. (이때, build 산출물 (/out directory) 및 build log file (android.log) 가 android source path 에 존재해야 합니다.)
34 |
35 | #### 준비 사항
36 | Android Build
37 | Android 모델을 build clean 상태에서 build하여 산출물(/out directory) 및 build log(android.log)를 확보합니다.
38 | ```
39 | (Android native source build 예)
40 | $ source ./build/envsetup.sh
41 | $ make clean
42 | $ lunch aosp_hammerhead-user
43 | $ make -j4 2>&1 | tee android.log
44 | ```
45 |
46 | {::options parse_block_html="true" /}
47 |
48 | **Android 7.0 이전 version의 모델**
49 |
50 | Android 7.0 이전 version의 모델일 경우, 먼저 module-info.mk 파일을 build/core/tasks/하위에 위치시킨 후 build합니다. (build시 module-info.json 파일을 생성하게 하기 위함)
51 |
52 | ```
53 | $ wget https://raw.githubusercontent.com/aosp-mirror/platform_build/android-cts-7.0_r33/core/tasks/module-info.mk
54 | $ mv ./module-info.mk ./build/core/tasks
55 | ```
56 |
57 |
58 |
59 | #### 실행
60 | fosslight_android 명령어를 실행합니다.
61 | 이때, build 산출물 (/out directory) 및 build log file (android.log) 가 android source path 에 존재해야 합니다.
62 |
63 | ```
64 | (venv)$ fosslight_android -s [android source path] -a [build log file name]
65 | ```
66 |
67 | - Options
68 | ```
69 | Options:
70 | Mandatory
71 | -s Path to analyze
72 | -a The file must be located in the android source path.
73 |
74 | Optional
75 | -h Print help message
76 | -m Analyze the source code for the path where the license could not be found.
77 | -e Path to exclude from source analysis.
78 | -p Check files that should not be included in the Packaging file.
79 | -f Print result of Find Command for binary that can not find Source Code Path.
80 | -i Disable the function to automatically convert OSS names based on AOSP.
81 | -r result.txt file with a list of binaries to remove.
82 | ```
83 |
84 |
85 | ## 📁 결과
86 | - fosslight_report_[datetime].xlsx : FOSSLight Android 분석 결과 (FOSSLight Report 형태)
87 | - Binary별 checksum, tlsh 값은 report에 기본적으로 숨김 처리 되어 있음.
88 | - fosslight_log_[datetime].txt : 실행 log
89 | - notice file
90 | - notice_to_fosslight_hub_{datetime}.zip : notice file이 1개 이상인 경우 .zip으로 압축됨
91 | - notice_to_fosslight_hub_{datetime}.{extension} : notice file이 1개인 경우(ex. NOTICE.html)
92 | - REMOVED_BIN_BY_DUPLICATION_[datetime].txt : output path내 binary name과 checksum이 동일한 파일이 2개 이상 존재하여 FOSSLight Report에서 중복 제거된 목록입니다.
93 | 더불어 -r 옵션으로 추가로 제거된 목록도 출력됩니다.
94 |
95 |
96 |
97 | | Column | 내용 |
98 | |:-----------------|:----------------------------------------------------------------------------------------------|
99 | | Binary Name | out directory 내 존재하는 Binary 목록 (binary, library, APK, font 등 ) |
100 | | Source Code Path | Binary를 구성하는 Source Code의 Path 정보 (LOCAL_PATH) |
101 | | Notice | NOTICE 파일에 Binary 정보가 표시되었는지 여부를 표시합니다. Open Source가 사용된 Binary라면, ok여야 합니다. - ok : Source Path에 NOTICE 파일이 있고, 최종 output NOTICE (ex. NOTICE.html)에 Binary 포함 - ok(NA) : Source Path에 NOTICE 파일이 없으나, 최종 output NOTICE (ex. NOTICE.html)에 Binary 포함 - nok : Source Path에 NOTICE 파일이 없고, 최종 output NOTICE (ex. NOTICE.html)에 Binary가 포함되어 있지 않음 - nok(NA) : Source Path에 NOTICE 파일이 있음에도, 최종 output NOTICE (ex. NOTICE.html)에 Binary가 포함되어 있지 않음 - CANNOT_FIND_NOTICE_HTML : NOTICE.html 파일을 찾을 수 없음. (이 경우, Script 실행 시, -n [NOTICE.html_path]를 주어 NOTICE.html 파일 위치를 Parameter로 줘야 함) |
102 | | OSS Name | LGE Binary DB에서 매칭하는 Binary의 정보를 가져와서 보여줍니다. |
103 | | OSS Version | LGE Binary DB에서 매칭하는 Binary의 정보를 가져와서 보여줍니다. |
104 | | License | 하기 정보로 부터 추출한 Open Source License 를 보여줍니다. - LGE Binary DB에서 매칭되는 Binary의 정보 - Source Code Path 내 "MODULE_LICENSE_xxxxxx"와 같이 License를 명시한 file을 읽어서 표시 - output의 {MODULE_NAME}.meta_lic에서 찾은 정보 |
105 | | Need Check | 'O'인 경우, 검토가 필요합니다. |
106 | | Comment | 검토가 필요한 사항을 출력합니다. - Fill in [Column명] : 기입이 필요한 Column을 표시. ex) Fill in OSS Name : 'OSS Name' Column에 사용한 OSS의 이름을 기입해야 함. - Add NOTICE to path : Source Code Path에 NOTICE 파일이 없으므로, NOTICE 파일을 해당 binary의 Source Code Path에 추가해야함. 단, NOTICE 파일을 Source code path에 추가하기 어렵거나 NOTICE파일을 추가해도 최종 target에 탑재되는 NOTICE에 포함되지 않는 경우 FOSSLight Hub를 통해 Project를 리뷰 받은 후 Supplement NOTICE.html 기능을 통해 추가되어야하는 NOTICE를 다운로드 받은 후 Android 모델 OSS 고지문 > '별도 생성한 NOTICE를 OSS 고지문에 추가' 방법을 통해 보완이 필요합니다.|
107 | | (TLSH) | Binary의 TLSH 값을 출력합니다. |
108 | | (SHA1) | Binary의 Checksum 값을 출력합니다. |
109 |
110 |
111 |
112 | ## 🚗 추가 기능
113 | ---
114 | 하기 옵션을 통해 부가 기능을 활용할 수 있습니다.
115 | - Option: -p : Packaging 파일에 포함되지 않아야 하는 파일을 확인합니다.
116 | - Option: -f : Source Code Path를 찾지 못하는 binary에 대하여 Find Command 실행 결과를 출력해줍니다.
117 | - Option: -i : Android reference 의 repository기준으로 OSS Name의 자동 출력을 비활성화합니다.
118 | - Option: -r : 특정 binary가 FOSSLight Report에서 중복되는것을 제거합니다. Android native와 vendor가 분리되어 build되는 구조에서 사용하는 옵션으로 중복으로 포함되는 Binary를 제거합니다. vendor에 대한 FOSSLight Android 실행시 -r 옵션으로 android native 결과 생성되는 result_*.txt 파일을 parameter로 추가합니다.
119 | - Option: -m : License가 빈칸인 부분에 대해 자동으로 Source path 내 Source code 분석(소스 파일 내 License text 기반 License 검출)을 실행하여 License 값을 채워줍니다. (그러나 분석에 시간이 오래 걸립니다. Android native에서 44개 Path기준 약 35분 소요)
120 |
121 |
122 | ---
123 |
124 |
125 |
126 | ### -p: Packaging 파일에 포함되지 않아야 하는 파일 확인
127 | 공개할 Source Code 취합시, 포함되지 말아야 하는 파일 이름, 확장자, 디렉토리를 체크합니다.
128 |
129 |
130 | #### 사전 준비
131 |
132 | 1. Packaging Config File : 체크할 항목을 json 형식의 pkgConfig.json 파일 이름으로 생성합니다.
133 | Example : pkgConfig.json
134 |
135 | ```
136 | {
137 | "Prohibited_File_Names":[
138 | "key_file",
139 | "confidential_key"
140 | ],
141 | "Prohibited_File_Extensions":[
142 | "exe",
143 | "jar"
144 | ],
145 | "Prohibited_Path":[
146 | "confidential",
147 | ".git"
148 | ]
149 | }
150 | ```
151 |
152 | 2. 항목 별 설명 : 항목 별 작성할 사항이 1개 이상인 경우 "," 로 구분하여 작성합니다.
153 | - Prohibited_File_Names : 검출하려는 파일 이름
154 | - Prohibited_File_Extensions : 검출하려는 파일 확장자
155 | - Prohibited_Path : 검출할 파일 디렉토리
156 |
157 | 3. 공개할 소스 코드를 취합한 디렉토리 위치 혹은 압축 파일 확인
158 | - 공개할 소스 코드 취합한 디렉토리나 압축 파일 내 압축된 파일이 있을 경우, 압축을 해제하여 검색합니다.
159 | - 압축 해제 지원 확장자 : tar, tar.gz, zip
160 | - tar, tar.gz, zip 외의 압축 파일이 있다면, 압축 해제를 미리 수동으로 해야합니다.
161 |
162 |
163 |
164 |
165 | #### 실행방법
166 | 1. Packaging Config File을 pkgConfig.json 파일명(json 형식)으로 준비합니다.
167 | 2. -p 옵션을 추가하여 실행합니다. (-p : 공개할 소스 코드를 취합한 Path 혹은 압축 파일)
168 | ```
169 | (venv)$ fosslight_android -p [A path or compressed file containing the source code to be disclosed]
170 |
171 | ex
172 | (venv)$ fosslight_android -p /home/test/sourceCodeToBeDisclosed.tar.gz
173 | ```
174 |
175 | #### 결과 확인
176 | 1. 검출된 항목별로 추출된 목록을 보여줍니다.
177 | 2. 결과 example :
178 |
179 | ```
180 | (venv)$ fosslight_android -p /home/test/sourceCodeToBeDisclosed.tar.gz
181 | 1. Prohibited file names : 1
182 | sourceCode/executable/LgeOscClient/confidential_key
183 | 2. Prohibited file extension : 4
184 | sourceCode/executable/Report_Jenkins_ubuntu.exe
185 | sourceCode/executable/ReportTool_v3.03_181128U.jar
186 | sourceCode/executable/Protex_Create_Upload_Analyze_v3.03_181128U.jar
187 | sourceCode/executable/ReportTool_CLI_v3.03_181128U.jar
188 | 3. Prohibited Path : 2
189 | sourceCode/.git
190 | sourceCode/executable/LgeOscClient/confidential
191 | 4. Fail to read : 0
192 | ```
193 |
194 | - Prohibited file names : 공개할 소스 코드 중 파일명에 pkgConfig.json의 Prohibited_File_Names 값을 포함하는 경우 출력합니다.
195 | - Prohibited file extension : 공개할 소스 코드 중 파일 확장자가 pkgConfig.json의 Prohibited_File_Extensions 값인 경우 출력합니다.
196 | - Prohibited Path : 공개할 소스 코드 중 파일 Path 중 pkgConfig.json의 Prohibited_Path 값을 포함하는 경우 출력합니다.
197 | - Fail to read : 압축 해제에 실패한 파일 목록을 출력합니다.
198 |
199 |
200 |
201 |
202 |
203 |
204 | ### -f: Source Code Path를 찾지 못하는 binary에 대하여 Find Command 실행 결과 출력
205 | Source Code Path를 찾지 못하는 Binary에 대하여 Android의 Source Path내 폴더 (out directory, .으로 시작하는 숨김 directory 제외)별로 Find Command 실행 결과를 출력합니다.
206 |
207 | #### 실행방법
208 | 1. -f 옵션을 추가하여 실행합니다.
209 | ```commandline
210 | (venv)$ fosslight_android -s [android source path] -a [build log file name] -f
211 |
212 | ex
213 | (venv)$ fosslight_android -s /home/soim/android/source -a android.log -f
214 | ```
215 |
216 | #### 결과 확인
217 | 1. Source Code Path를 찾지 못하는 Binary별 Find command 실행 결과는 'FIND_RESULT_OF_BINARIES.txt' 파일로 생성됩니다.
218 | 2. 단, Source Code Path를 찾지 못하는 Binary가 없을 경우 해당 파일은 생성되지 않습니다.
219 |
220 |
221 |
222 |
223 | ### -i: OSS Name 자동 완성 기능 끄기
224 | FOSSLight Android는 Binary DB에서 OSS 정보를 찾을 수 없는 경우이거나 OSS Name이 "Android Open Source Project"인 경우, Source Code Path를 기준으로 [Android Native](https://android.googlesource.com/platform)에 있는 저장소라면 OSS Name을 자동으로 출력해줍니다.
225 | OSS Name 자동 완성 기능을 끄고자 할 경우 선택합니다.
226 |
227 | #### 실행방법
228 | 1. -i 옵션을 추가하여 실행합니다.
229 | ```commandline
230 | (venv)$ fosslight_android -s [android source path] -a [build log file name] -i
231 |
232 | ex
233 | (venv)$ fosslight_android -s /home/soim/android/source -a android.log -i
234 | ```
235 |
236 | #### 결과 확인
237 | 1. 생성 파일명 : RESULT_COMPARE_I_OPTION.xlsx
238 | - Sheet "Ref_with_i_option" : i 옵션으로 android reference 소스에서 FOSSLight Android 분석 결과
239 | - Sheet "Ref_without_i_option" : android reference 소스에서 FOSSLight Android 분석 결과
240 |
241 |
242 |
243 |
244 |
245 | ### -r: 특정 binary를 FOSSLight Report에서 중복 제거
246 | 하나의 Model에 탑재하는 Android native와 vendor가 분리된 output으로 생성되는 경우에 한하여 활용합니다. vendor에 대한 FOSSLight Android 실행시 -r 옵션을 이용하여 Android native에도 포함되는 binary를 중복 제거합니다.
247 | - 중복 제거 조건 : Binary name이 같고 checksum이 같거나, Binary name이 같고 TLSH 값 차이가 120이하인 경우
248 | - 중복 제거된 binary는 REMOVED_BIN_BY_DUPLICATION.txt에 출력됩니다.
249 |
250 |
251 |
252 |
253 | #### 실행방법
254 | 1. FOSSLight Android 분석 실행시 -r 옵션을 추가합니다.
255 | ```commandline
256 | (venv)$ fosslight_android -s [vendor_source_path] -a [android_build_log_file] -r [android_native_result.txt]
257 |
258 | ex
259 | (venv)$ fosslight_android -s [vendor_source_path] -a android.log -r android_native_result.txt
260 | ```
261 |
262 | #### 결과 확인
263 | 1. android_native_result.txt와 중복된 binary는 FOSSLight-Report.xlsx에서 제거되고, REMOVED_BIN_BY_DUPLICATION.txt에 출력됩니다.
264 |
265 |
266 |
267 |
268 | ### -m: 소스 코드 분석하여 License 출력
269 | License 정보를 못 찾은 경우에 한하여 FOSSLight Source를 이용하여 Source code를 분석한 결과를 License란에 출력합니다.
270 |
271 | #### 실행방법
272 | 1. -m 옵션을 추가합니다.
273 | ```commandline
274 | (venv)$ fosslight_android -s [vendor_source_path] -a [android_build_log_file] -m
275 |
276 | ex
277 | (venv)$ fosslight_android -s [vendor_source_path] -a android.log -m
278 | ```
279 |
280 | #### 결과 확인
281 | 1. FOSSLight Report의 License column에 분석한 결과가 채워집니다.
282 | 2. 추가로 source_analyzed_[datetime] 폴더에 소스 코드별 분석한 결과가 생성됩니다.
283 |
--------------------------------------------------------------------------------
/scanner/7_scanner_service.md:
--------------------------------------------------------------------------------
1 | ---
2 | published: true
3 | ---
4 |
5 | # (Enterprise Only) FOSSLight Scanner Service
6 |
7 | ## 개요
8 | {: .left-bar-title}
9 | 웹서비스로 [FOSSLight Scanner](https://fosslight.org/fosslight-guide/scanner/)를 이용하여 Source, Binary, Dependency 분석을 수행합니다. 분석 결과는 [FOSSLight Report](https://fosslight.org/hub-guide/learn/2_fosslight_report.html)형태로 생성됩니다.
10 | - URL : [http://fs.lge.com](http://fs.lge.com)
11 | - 분석 항목
12 | - [FOSSLight Source Scanner](https://fosslight.org/fosslight-guide/scanner/2_source.html)
13 | - [FOSSLight Binary Scanner](https://fosslight.org/fosslight-guide/scanner/4_binary.html)
14 | - [FOSSLight Dependency Scanner](https://fosslight.org/fosslight-guide/scanner/3_dependency.html)
15 | - 지원하는 package manager : npm, pypi, maven, pub, go, nuget, cargo.
16 | (그 외 package manager은 검증 진행 중)
17 | - 미지원 항목
18 | - [FOSSLight Android Scanner](https://fosslight.org/fosslight-guide/scanner/6_android.html)
19 | - [FOSSLight Yocto Scanner](https://fosslight.org/fosslight-guide/scanner/5_yocto.html)
20 |
21 |
22 | ## 사용 방법
23 | {: .left-bar-title}
24 |
25 | ### 로그인
26 | {: .specific-title}
27 | - [http://fs.lge.com](http://fs.lge.com)에서 AD 계정 ID와 비밀번호를 입력하여 접속합니다.
28 | {: .styled-image}
29 |
30 | ### Create a Project
31 | {: .specific-title}
32 | 1. 우측 상단의 "New Project" 버튼을 클릭하여 Project를 생성합니다.
33 | {: .styled-image}
34 |
35 | 2. "Create a Project"에 내용을 입력합니다.
36 | {: .styled-image}
37 | - **Name** : Project 이름을 입력합니다.
38 | - **Inputs** : 분석할 소스를 선택합니다.
39 | - **Upload files** : 분석할 파일을 압축하여 업로드합니다. (1개만 업로드)
40 | - **Download URLs** : 분석할 소스 링크 (wget 또는 git clone 하여 받을 수 있는 링크)를 입력합니다.
41 | - **Public** : 공개된 Repository인 경우
42 | - 입력값 예시
43 | - wget : github.com/LGE-OSS/example/archive/refs/tags/v1.0.0.zip
44 | - git clone : github.com/LGE-OSS/example
45 | - **Private Git** : Private git 인 경우
46 | - **http://** 또는 **https://** : user name과 PAT 값을 입력합니다. (PAT 값에는 /가 포함되면 안 됨)
47 | - **ssh://** : 제공되는 ssh key 값을 복사하여 private git repository에 등록합니다. ⚠️ github 는 ssh 대신 PAT 를 이용합니다.
48 | {: .styled-image}
49 | - **Pipeline**
50 | - scan_all : source, binary, dependency 분석
51 | - source : source code만 분석
52 | - binary : binary만 분석
53 | - **권한 설정**
54 | - Private : 생성자만 조회 가능
55 | - Public : 링크를 통해 해당 Project를 다른 사람이 볼 수 있고 분석 결과를 다운로드할 수 있음
56 |
57 |
58 | ### 분석 결과
59 | {: .specific-title}
60 | {: .styled-image}
61 | 1. **Download results** : 분석 결과 파일을 다운로드 받을 수 있습니다.
62 | - FOSSLight Scanner Result : FOSSLight Hub의 [Identification](https://fosslight.org/hub-guide/tutorial/1_project/2_Identification/) 과정에서 업로드 할 수 있는 리포트입니다.
63 | 2. **Files** : 분석한 파일별 검출 결과를 File Tree 포맷으로 확인할 수 있습니다. (FOSSLight Dependency 결과는 미포함)
64 | 3. **Detected Open Source** : 분석 결과를 list로 확인할 수 있습니다. (FOSSLight Dependency 결과는 미포함)
65 | {: .styled-image}
66 |
--------------------------------------------------------------------------------
/scanner/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | sort: 5
3 | published: true
4 | title: 🚩FOSSLight Scanner
5 | ---
6 | # FOSSLight Scanner
7 |
8 |
9 |
10 | FOSSLight Scanner는 로컬 소스코드 또는 입력받은 링크를 통해 소스를 다운로드 받은 후 소스코드, 바이너리 및 디펜던시에 대한 오픈 소스 분석을 수행할 수 있습니다.
11 |
12 | 오픈 소스 분석을 위해 사용하는 툴은 다음과 같습니다.
13 |
14 | 1. [FOSSLight Source Scanner](2_source.md) : 소스 코드를 분석하여 오픈 소스 분석 결과를 생성합니다.
15 | 2. [FOSSLight Dependency Scanner](3_dependency.md) : Package manager 또는 빌드 시스템을 통해 사용되는 dependency의 오픈 소스 분석 결과를 생성합니다.
16 | 3. [FOSSLight Binary Scanner](4_binary.md) : Binary를 분석하여 오픈 소스 분석 결과를 생성합니다.
17 |
18 |
19 |
20 | **Github Repository** : [https://github.com/fosslight/fosslight_scanner](https://github.com/fosslight/fosslight_scanner)
21 | **License** : [Apache-2.0](https://github.com/fosslight/fosslight_scanner/blob/main/LICENSE)
22 |
23 | ## 목차
24 | - [📋 필요 조건](#-필요-조건)
25 | - [🎉 설치 방법](#-설치-방법)
26 | - [🚀 실행 방법](#-실행-방법)
27 | - [📁 결과](#-결과)
28 | - [🐳 Docker를 이용하여 설치 및 실행 방법](#-docker를-이용하여-설치-및-실행-방법)
29 |
30 | ## 📋 필요 조건
31 | 1. [**FOSSLight Scanner**](https://github.com/fosslight/fosslight_scanner)는 Python 3.8+ 기반에서 동작합니다.
32 | 2. Jar 파일에 대한 분석을 위해서는 [**Java**](https://openjdk.java.net)를 설치해야 합니다.(Open Source JDK를 설치)
33 | 3. (windows의 경우) Microsoft Build Tools (Microsoft Visual C++ 14.0+) from https://visualstudio.microsoft.com/ko/visual-cpp-build-tools/ 를 설치해야 합니다.
34 |
35 | ## 🎉 설치 방법
36 | FOSSLight Scanner는 pip3를 이용하여 설치할 수 있습니다.
37 | [python 3.8 + virtualenv](etc/guide_virtualenv.md) 환경에서 설치할 것을 권장합니다.
38 |
39 | ```
40 | $ pip3 install fosslight_scanner
41 | ```
42 |
43 | ### ⚠️ 설치 에러 발생 시
44 | 'Cargo, the Rust package manager, is not installed or is not on PATH.' 에러 발생 시, cargo, rust를 아래와 같이 설치한 이후, 다시 FOSSLight Scanner를 설치합니다.
45 | ```
46 | $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
47 | $ export PATH="$HOME/.cargo/bin:$PATH"
48 | ```
49 |
50 |
51 | ## 🚀 실행 방법
52 | ### Mode별 실행 방법 및 Parameters
53 | ```
54 | $ fosslight [Mode] [option1] [option2] ...
55 | ```
56 | ```
57 | Parameters:
58 | Mode: Multiple modes can be entered by separating them with , (ex. source,binary)
59 | all Run all scanners(Default)
60 | source Run FOSSLight Source Scanner
61 | dependency Run FOSSLight Dependency Scanner
62 | binary Run FOSSLight Binary Scanner
63 | compare Compare two FOSSLight reports
64 |
65 | Options:
66 | -h Print help message
67 | -p Path to analyze (ex, -p {input_path})
68 | * Compare mode input file: Two FOSSLight reports (supports excel, yaml)
69 | (ex, -p {before_name}.xlsx {after_name}.xlsx)
70 | -w Link to be analyzed can be downloaded by wget or git clone
71 | -f [ ...] FOSSLight Report file format (excel, csv, opossum, yaml, spdx-tag, spdx-yaml, spdx-json, spdx-xml)
72 | * Compare mode result file: supports excel, json, yaml, html
73 | * Multiple formats can be specified separated by space.
74 | -e Path to exclude from analysis (ex, -e {dir} {file})
75 | -o