FOSSLight Source Scanner

FOSSLight Source is released under the Apache-2.0 License. Current python package version. REUSE status

FOSSLight Source Scanner는 소스 코드 스캐너인 ScanCode, SCANOSS를 이용합니다. ScanCode를 이용하면 파일 안에 포함된 Copyright과 License 문구를 검출하고, SCANOSS를 이용하면 OSS Name, OSS Version, Download Location, Copyright, License 정보를 OSSKB에서 검색합니다. Build Script, Binary, Directory, 특정 Directory (ex-test) 안의 파일은 제외되고, 그리고 License 이름에서 "-only", "-old-style"와 같은 문구는 제거됩니다. 결과는 spreadsheet, csv 형태로 출력됩니다.

Github Repository : https://github.com/fosslight/fosslight_source_scanner
License : Apache-2.0

목차

📋 필요 조건

FOSSLight Source Scanner는 Python 3.8+ 기반에서 동작합니다.

🎉 설치 방법

FOSSLight Source Scanner는 pip3를 이용하여 설치할 수 있습니다.
python 3.8 + virtualenv 환경에서 설치할 것을 권장합니다.

$ pip3 install fosslight_source

🚀 실행 방법

1. fosslight_source

Source Code 분석을 실행한 후 FOSSLight Report 형식으로 출력합니다.

$ fosslight_source [option] <arg>

Options

  Optional
      -p <source_path>       Path to analyze source (Default: current directory)
      -h                     Print help message
      -v                     Print FOSSLight Source Scanner version
      -m                     Print additional information for scan result on separate sheets
      -o <output_path>       Output path (Path or file name)
      -f <format>            Output file format (excel, csv, opossum, yaml)
  Options only for FOSSLight Source Scanner
      -s <scanner>           Select which scanner to be run (scancode, scanoss, all)
      -j                     Generate raw result of scanners in json format
      -t <float>             Stop scancode scanning if scanning takes longer than a timeout in seconds.
      -c <core>              Select the number of cores to be scanned with ScanCode.

-s 옵션이 추가되지 않을 경우 모든 Scanner (ScanCode, SCANOSS)가 동작한 결과가 취합됩니다.

Example

Source Code 분석 후 FOSSLight Report와 json 형태의 ScanCode, SCANOSS 결과 출력

$ fosslight_source -p /home/source_path -j

2. fosslight_convert

json형태인 ScanCode 결과를 FOSSLight Report 형식으로 변환합니다.

$ fosslight_convert [option] <arg>

Options

        Optional
            -p <source_path>       Path to analyze source (Default: current directory)
            -h                     Print help message
            -v                     Print FOSSLight Source Scanner version
            -m                     Print additional information for scan result on separate sheets
            -o <output_path>       Output path (Path or file name)
            -f <format>            Output file format (excel, csv, opossum, yaml)
        Options only for FOSSLight Source Scanner
            -s <scanner>           Select which scanner to be run (scancode, scanoss, all)
            -j                     Generate raw result of scanners in json format
            -t <float>             Stop scancode scanning if scanning takes longer than a timeout in seconds.
            -c <core>              Select the number of cores to be scanned with ScanCode.
            --no_correction        Enter if you don't want to correct OSS information with sbom-info.yaml
            --correct_fpath <path> Path to the sbom-info.yaml file

Example

json 형태의 ScanCode 결과를 FOSSLight Report 형식으로 변환

$ fosslight_convert -p /home/jsonfile_dir

📁 결과

$ tree
.
├── fosslight_log_220103_1540.txt
├── fosslight_opossum_220103_1540.json
├── fosslight_report_220103_1540.xlsx
├── fosslight_report_220103_1540.csv
├── scancode_raw_result.json
├── scanner_output.wfp
└── scanoss_raw_result.json
  • fosslight_log_[datetime].txt : 실행 로그가 저장된 파일
  • fosslight_opossum_[datetime].json : OpossumUI에서 활용 가능한 Source Code 분석 결과
  • fosslight_report_[datetime].xlsx : FOSSLight Report 형태의 Source Code 분석 결과
  • fosslight_report_[datetime].csv : FOSSLight Report를 csv로 출력한 결과
  • scancode_raw_result.json : ScanCode 실행 결과 (fosslight_source 명령어에 -j 옵션이 포함된 경우에만 생성)
  • scanner_output.wfp : SCANOSS 실행 시 생성된 Finger Print (fosslight_source 명령어에 -j 옵션이 포함된 경우에만 생성)
  • scanoss_raw_result.json : SCANOSS 실행 결과 (fosslight_source 명령어에 -j 옵션이 포함된 경우에만 생성)