├── .github └── workflows │ ├── build.yml │ └── release.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Doxyfile ├── Makefile ├── README.md ├── SBOM.json ├── cryptoDefs ├── 128-EEA1.txt ├── 2DES.txt ├── 3DES.txt ├── 3WAY.txt ├── A4.txt ├── A5-1 ├── ACE.txt ├── AES.txt ├── Anubis.txt ├── Aria.txt ├── Baton.txt ├── Bcrypt.txt ├── Blake.txt ├── Blake2.txt ├── Blowfish.txt ├── Blum-Goldwasser.txt ├── C2.txt ├── CAST.txt ├── CAST3.txt ├── CAST5.txt ├── CAST6.txt ├── CMEA.txt ├── CRC16.txt ├── CRC32.txt ├── Camellia.txt ├── ChaCha.txt ├── Cobra.txt ├── DCC.txt ├── DES.txt ├── DESX.txt ├── DESede.txt ├── DH.txt ├── DHE.txt ├── DHIES.txt ├── ECDH.txt ├── ECMQV.txt ├── ElGamal.txt ├── Enigma.txt ├── F8.txt ├── FASTHash.txt ├── FCrypt.txt ├── FNV1.txt ├── Feal.txt ├── Fletcher.txt ├── Fortezza.txt ├── Fortuna.txt ├── GEA.txt ├── GEA03.txt ├── GEA45.txt ├── GOST.txt ├── Grain.txt ├── GrainV1.txt ├── HAVAL.txt ├── HC128.txt ├── HC256.txt ├── ICE.txt ├── ISAAC.txt ├── Idea.txt ├── Juniper.txt ├── KHAZAD.txt ├── Kazumi.txt ├── Keccak.txt ├── LMHash.txt ├── LOKI91.txt ├── LUC.txt ├── Lucifer.txt ├── MD160.txt ├── MD2.txt ├── MD3.txt ├── MD4.txt ├── MD5.txt ├── MD6.txt ├── MDC2.txt ├── MISTY1.txt ├── MQV.txt ├── MSCASH.txt ├── MSCash2.txt ├── MULTI2.txt ├── McEliece.txt ├── NTRUEncrypt.txt ├── Nimbus.txt ├── Noekedon.txt ├── PBE.txt ├── PBES1.txt ├── PBES2.txt ├── Panama.txt ├── Quad.txt ├── RC2.txt ├── RC4.txt ├── RC4HMACxt ├── RC5.txt ├── RC6.txt ├── RIPEMD.txt ├── RSA-OAEP.txt ├── RSA.txt ├── RSAES-PKCS1-v1_5.txt ├── Rabbin.txt ├── Rabbit.txt ├── Rijndael.txt ├── SALSA10.txt ├── SALSA20.txt ├── SHS.txt ├── SMS4.txt ├── SNOW.txt ├── SNRF.txt ├── SOSEMANUK.txt ├── SSHA.txt ├── Seal.txt ├── Seed.txt ├── Sha.txt ├── Sha2.txt ├── Shacal.txt ├── Shark.txt ├── Skein.txt ├── Skipjack.txt ├── Sober.txt ├── TDES.txt ├── TEA.txt ├── TNEPRES.txt ├── Threefish.txt ├── Tiger.txt ├── Twofish.txt ├── VMPC.txt ├── Wake.txt ├── Whirlpool.txt ├── XTR.txt ├── Yarrow.txt ├── ZUC.txt ├── ZipCrypt.txt ├── dsa.txt ├── pbkdf1.txt ├── pbkdf2.txt ├── pkcs12.txt ├── pkcs7.txt ├── sapphire.txt ├── serpent.txt ├── srp.txt ├── tcryp.txt └── xtea.txt ├── doc ├── scanoss-logo.png └── style.css ├── external ├── inc │ ├── LICENSE │ ├── bsort.h │ ├── crc32c.h │ ├── json.h │ └── winnowing.h └── src │ ├── bsort.c │ ├── crc32c.c │ └── winnowing.c ├── inc ├── attributions.h ├── copyright.h ├── crc32c.h ├── crypto.h ├── crypto_loads.h ├── file.h ├── help.h ├── hex.h ├── ignored_extensions.h ├── ignored_files.h ├── ignored_wfp.h ├── ignorelist.h ├── import.h ├── license.h ├── minr.h ├── minr_log.h ├── mz.h ├── mz_mine.h ├── quality.h ├── scancode.h ├── trie.h ├── url.h └── wfp.h ├── licenses ├── AFL-2.0 │ ├── 01.txt │ └── 02.txt ├── AFL-2.1 │ ├── 01.txt │ └── 02.txt ├── AGPL-3.0-only │ ├── 01.txt │ └── 02.txt ├── AGPL-3.0-or-later │ ├── 01.txt │ └── 02.txt ├── Apache-1.0 │ ├── 01.txt │ └── 02.txt ├── Apache-1.1 │ ├── 01.txt │ └── 02.txt ├── Apache-2.0 │ ├── 01.txt │ ├── 02.txt │ └── 03.txt ├── Artistic-1.0-Perl │ ├── 01.txt │ └── 02.txt ├── BSD-2-Clause-Patent │ └── 01.txt ├── BSD-2-Clause │ └── 01.txt ├── BSD-3-Clause │ └── 01.txt ├── BSD-4-Clause-UC │ └── 01.txt ├── BSD-4-Clause │ └── 01.txt ├── BSL-1.0 │ └── 01.txt ├── CC0-1.0 │ └── 01.txt ├── CDDL-1.0 │ └── 01.txt ├── CPL-1.0 │ └── 01.txt ├── EFL-2.0 │ ├── 01.txt │ └── 02.txt ├── EPL-1.0 │ └── 01.txt ├── EPL-2.0 │ └── 1.txt ├── EUPL-1.1 │ └── 1.txt ├── Elastic │ ├── 1.txt │ └── 2.txt ├── FSFULLR │ └── 01.txt ├── FTL │ ├── 1.txt │ └── 2.txt ├── GPL-2.0-only │ ├── 01.txt │ ├── 02.txt │ ├── 03.txt │ ├── 04.txt │ ├── 05.txt │ ├── 06.txt │ ├── 07.txt │ ├── 08.txt │ └── GPL-2.0-only.txt ├── GPL-2.0-or-later │ └── 01.txt ├── GPL-3.0-only │ ├── 01.txt │ └── 02.txt ├── GPL-3.0-or-later │ └── 01.txt ├── HPND │ ├── 1.txt │ └── 2.txt ├── IBM-pibs │ └── 1.txt ├── ICU │ ├── 1.txt │ └── 2.txt ├── IJG │ ├── 1.txt │ └── 2.txt ├── IPL-1.0 │ └── 01.txt ├── ISC │ ├── 1.txt │ └── 2.txt ├── LGPL-2.1-only │ ├── 1.txt │ └── 2.txt ├── LGPL-2.1-or-later │ ├── 01.txt │ ├── 02.txt │ └── 03.txt ├── LGPL-3.0-only │ ├── 1.txt │ └── 2.txt ├── LGPL-3.0-or-later │ └── 01.txt ├── Libpng │ └── 1.txt ├── MIT-CMU │ └── 1.txt ├── MIT │ ├── 01.txt │ ├── 02.txt │ ├── 03.txt │ └── 04.txt ├── MPL-1.1 │ └── 01.txt ├── MPL-2.0-no-copyleft-exception │ └── 1.txt ├── MPL-2.0 │ └── 01.txt ├── MS-PL │ └── 01.txt ├── MS-RL │ └── 1.txt ├── MirOS │ └── 1.txt ├── NBPL-1.0 │ └── 1.txt ├── NTP │ ├── 1.txt │ └── 2.txt ├── OSL-3.0 │ ├── 1.txt │ └── 2.txt ├── OpenSSL │ ├── 1.txt │ ├── 2.txt │ └── 3.txt ├── PostgreSQL │ ├── 01.txt │ └── 02.txt ├── Python-2.0 │ └── 1.txt ├── Qhull │ └── 1.txt ├── RPL-1.5 │ ├── 1.txt │ └── 2.txt ├── SSPL │ └── 1.txt ├── UPL-1.0 │ ├── 1.txt │ └── 2.txt ├── Unicode-DFS-2015 │ └── 1.txt ├── Unicode-DFS-2016 │ └── 1.txt ├── WTFPL │ └── 01.txt ├── X11 │ ├── 1.txt │ └── 2.txt ├── XFree86-1.1 │ ├── 1.txt │ └── 2.txt ├── Zlib │ └── 01.txt ├── bzip2-1.0.5 │ └── 01.txt ├── bzip2-1.0.6 │ └── 01.txt ├── curl │ └── 01.txt ├── libtiff │ └── 1.txt └── zlib-acknowledgement │ └── 1.txt ├── package.sh ├── scripts ├── debpkg │ └── DEBIAN │ │ └── control └── rpmpkg │ └── minr.spec ├── src ├── attributions.c ├── copyright.c ├── crypto.c ├── file.c ├── help.c ├── hex.c ├── ignored_extensions.c ├── ignored_files.c ├── ignored_wfp.c ├── ignorelist.c ├── import.c ├── join.c ├── license.c ├── license_ids.c ├── main.c ├── minr.c ├── minr_log.c ├── mz_main.c ├── mz_mine.c ├── mz_optimise.c ├── quality.c ├── scancode.c ├── string.c ├── url.c └── wfp.c └── version.sh /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | branches: [ 'main' ] 7 | push: 8 | branches: 9 | - '*' 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - name: Install third party dependencies 18 | run: sudo apt update && sudo apt install build-essential zlib1g-dev libsqlite3-dev libz-dev curl gem ruby unzip p7zip-full unrar-free libgcrypt-dev 19 | 20 | - uses: actions/checkout@v3 21 | 22 | - name: Git Clone LDB 23 | uses: actions/checkout@v3 24 | with: 25 | repository: scanoss/ldb 26 | path: ldb 27 | fetch-depth: 0 28 | 29 | - name: Build LDB 30 | run: cd ldb && git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) && make all && sudo make install 31 | 32 | - name: LDB cleanup 33 | run: rm -rf ldb 34 | 35 | - name: make 36 | run: make 37 | 38 | - name: version 39 | run: echo "::set-output name=version::$(./minr -version)" 40 | id: version 41 | 42 | - name: Test output 43 | run: echo ${{ steps.version.outputs.version }} 44 | 45 | - name: 'Tar files' 46 | run: tar czvf minr-${{ steps.version.outputs.version }}-amd64.tar.gz minr mz licenses/GPL-2.0-only/GPL-2.0-only.txt 47 | 48 | - name: Upload a Build Artifact 49 | uses: actions/upload-artifact@v4 50 | with: 51 | name: minr-${{ steps.version.outputs.version }}-amd64.tar.gz 52 | path: | 53 | minr-${{ steps.version.outputs.version }}-amd64.tar.gz 54 | retention-days: 5 55 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "tagged-release" 3 | 4 | on: 5 | push: 6 | tags: 7 | - "v*.*.*" 8 | 9 | jobs: 10 | tagged-release: 11 | name: "Tagged Release" 12 | runs-on: ubuntu-20.04 13 | permissions: 14 | contents: write 15 | 16 | steps: 17 | - name: Install third party dependencies 18 | run: sudo apt update && sudo apt install -y build-essential zlib1g-dev libsqlite3-dev libz-dev curl gem ruby unzip p7zip-full unrar-free git libgcrypt-dev 19 | 20 | - uses: actions/checkout@v3 21 | with: 22 | fetch-depth: 0 23 | 24 | - name: Git Clone LDB 25 | uses: actions/checkout@v3 26 | with: 27 | repository: scanoss/ldb 28 | path: ldb 29 | fetch-depth: 0 30 | 31 | - name: Build & Install ldb 32 | run: cd ldb && git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) && make all && sudo make install 33 | 34 | - name: Build minr 35 | run: | 36 | make 37 | mkdir -p ./artifacts 38 | cp minr ./artifacts/minr 39 | cp LICENSE ./artifacts/LICENSE 40 | 41 | echo "Produced artifact at ${PWD}/artifacts/minr" 42 | 43 | - name: 'Tar files' 44 | run: tar czvf minr-${{ github.ref_name }}-linux-amd64.tar.gz -C ./artifacts/ . 45 | 46 | - name: Prepare deb package 47 | id: build_deb 48 | run: | 49 | make prepare_deb_package 50 | echo "debpkg_file_name=$(ls *.deb)" >> $GITHUB_OUTPUT 51 | 52 | - name: Prepare rpm package 53 | run: | 54 | make prepare_rpm_package 55 | echo "rpmpkg_file_name=$(ls dist/rpm/RPMS/x86_64/*.rpm)" >> $GITHUB_OUTPUT 56 | 57 | - name: Show the artifacts 58 | # Items placed in /artifacts in the container will be in 59 | # ${PWD}/artifacts on the host. 60 | run: | 61 | ls -al "${PWD}/artifacts" 62 | ls -al "${PWD}" 63 | ls -al "${PWD}/dist/rpm/RPMS/x86_64/" 64 | 65 | - name: Create Draft Release ${{ github.ref_type }} - ${{ github.ref_name }} 66 | if: github.ref_type == 'tag' 67 | uses: softprops/action-gh-release@v1 68 | with: 69 | draft: true 70 | files: | 71 | ./**.tar.gz 72 | ./*.deb 73 | ./dist/rpm/RPMS/x86_64/*.rpm 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | minr 2 | mz 3 | .gitignore 4 | *.o 5 | *.project 6 | *.d 7 | minr.txt 8 | mz.txt 9 | compile_flags.txt 10 | doc 11 | mined 12 | scancode_error.txt 13 | .vscode -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | - Using welcoming and inclusive language 18 | - Being respectful of differing viewpoints and experiences 19 | - Gracefully accepting constructive criticism 20 | - Focusing on what is best for the community 21 | - Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | - The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | - Trolling, insulting/derogatory comments, and personal or political attacks 28 | - Public or private harassment 29 | - Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | - Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at support@scanoss.co.uk. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Thank you for considering contributing to MINR. It's people like you that make MINR such a great tool. Feel welcome and read the following sections in order to know how to get involved, ask questions and more importantly how to work on something. 2 | 3 | MINR is an open source project and we love to receive contributions from our community. There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests, or writing code. 4 | A welcome addition to the project is an integration with a new source code repository. 5 | 6 | ### Submitting bugs 7 | 8 | If you are submitting a bug, please tell us: 9 | 10 | - Version of MINR you are using 11 | - Linux OS Version 12 | - GCC version 13 | - how to reproduce the bug. 14 | 15 | ### Pull requests 16 | 17 | Want to submit a pull request? Great! But please follow some basic rules: 18 | 19 | - Write a brief description that help us understand what you are trying to accomplish: what the change does, link to any relevant issue 20 | - If you are changing a source file please make sure that you only include in the changeset the lines changed by you (beware of your editor reformatting the file) 21 | - If you are adding functionality, please write a unit test. 22 | 23 | When reviewing your pull request, we will follow a checklist similar to this one: https://gist.github.com/audreyr/4feef90445b9680475f2 24 | 25 | We will also verify that the functionality implemented change serves the general public and not a particular interest group. 26 | 27 | ### Licensing 28 | 29 | The SCANOSS Platform is released under the GPL-2.0 license. If you wish to contribute, you must accept that you are aware of the license under which the project is released, and that your contribution will be released under the same license. Sometimes the GPL-2.0 license is incompatible with other licenses chosen by other projects. Therefore, you must accept that your contribution can also be released under the MIT license, which is the license we choose for those situations. Unless you expressly request otherwise, we may use your name, email address, username or URL for your attribution notice text. The submission of your contribution implies that you agree with these licensing terms. 30 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CWD=$(shell pwd) 2 | CC=gcc 3 | # Enable all compiler warnings. 4 | CCFLAGS?=-g -Wall -I./inc -I./external/inc -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 5 | 6 | # Linker flags 7 | LDFLAGS=-lz -lldb -lpthread -ldl 8 | 9 | BUILD_DIR =build 10 | SOURCES=$(wildcard src/*.c) $(wildcard src/**/*.c) $(wildcard external/*.c) $(wildcard external/**/*.c) 11 | 12 | SOURCES_MINR=$(filter-out src/mz_main.c, $(SOURCES)) 13 | OBJECTS_MINR=$(SOURCES_MINR:.c=.o) 14 | 15 | SOURCES_MZ=$(filter-out src/main.c, $(SOURCES)) 16 | OBJECTS_MZ=$(SOURCES_MZ:.c=.o) 17 | 18 | TARGET_MINR=minr 19 | TARGET_MZ=mz 20 | 21 | VERSION=$(shell ./version.sh) 22 | 23 | LDB_CURRENT_VERSION := $(shell ldb -v | sed 's/ldb-//' | head -c 3) 24 | LDB_TARGET_VERSION := 4.1 25 | VERSION_IS_LESS := $(shell echo $(LDB_CURRENT_VERSION) \< $(LDB_TARGET_VERSION) | bc) 26 | 27 | all: clean $(TARGET_MINR) $(TARGET_MZ) 28 | 29 | $(TARGET_MINR): $(OBJECTS_MINR) 30 | ifeq ($(VERSION_IS_LESS),1) 31 | @echo "Current LDB version: $(LDB_CURRENT_VERSION) is too old, please update to the lastest version to continue." 32 | exit 1 33 | endif 34 | $(CC) -o $@ $^ $(LDFLAGS) 35 | 36 | $(TARGET_MZ): $(OBJECTS_MZ) 37 | $(CC) -o $@ $^ $(LDFLAGS) 38 | 39 | .PHONY: minr 40 | 41 | %.o: %.c 42 | $(CC) $(CCFLAGS) -o $@ -c $< 43 | 44 | clean: 45 | rm -f src/*.o src/**/*.o external/src/*.o 46 | 47 | install: 48 | cp $(TARGET_MINR) /usr/bin 49 | cp $(TARGET_MZ) /usr/bin 50 | 51 | prepare_deb_package: all ## Prepares the deb Package 52 | @./package.sh deb $(VERSION) 53 | @echo deb package built 54 | 55 | prepare_rpm_package: all ## Prepares the rpm Package 56 | @./package.sh rpm $(VERSION) 57 | @echo rpm package built 58 | -------------------------------------------------------------------------------- /SBOM.json: -------------------------------------------------------------------------------- 1 | { 2 | "bomFormat": "CycloneDX", 3 | "specVersion": "1.2", 4 | "version": 1, 5 | "serialNumber": "minr:1600088466", 6 | "components": [ 7 | { 8 | "type": "application", 9 | "publisher": "scanoss", 10 | "group": "scanoss", 11 | "name": "minr", 12 | "url": "https://github.com/scanoss/minr", 13 | "licenses": [ 14 | { 15 | "id": "GPL-2.0-or-later" 16 | } 17 | ] 18 | }, 19 | { 20 | "type": "library", 21 | "publisher": "scanoss", 22 | "group": "ldb", 23 | "name": "ldb", 24 | "url": "https://github.com/scanoss/ldb", 25 | "licenses": [ 26 | { 27 | "id": "GPL-2.0-or-later" 28 | } 29 | ] 30 | }, 31 | { 32 | "type": "library", 33 | "publisher": "scanoss", 34 | "group": "wfp", 35 | "name": "wfp", 36 | "url": "https://github.com/scanoss/wfp", 37 | "licenses": [ 38 | { 39 | "id": "GPL-2.0-or-later" 40 | } 41 | ] 42 | }, 43 | { 44 | "type": "library", 45 | "publisher": "madler", 46 | "group": "madler", 47 | "name": "crc32c", 48 | "url": "https://stackoverflow.com/questions/17645167/implementing-sse-4-2s-crc32c-in-software#17646775", 49 | "licenses": [ 50 | { 51 | "id": "BSD-3-Clause" 52 | } 53 | ] 54 | }, 55 | { 56 | "type": "application", 57 | "publisher": "pelotoncycle", 58 | "group": "pelotoncycle", 59 | "name": "bsort", 60 | "url": "https://github.com/pelotoncycle/bsort", 61 | "licenses": [ 62 | { 63 | "id": "GPL-2.0" 64 | } 65 | ] 66 | } 67 | ] 68 | } 69 | 70 | -------------------------------------------------------------------------------- /cryptoDefs/128-EEA1.txt: -------------------------------------------------------------------------------- 1 | name=128-EEA1 2 | coding=128 3 | LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_128_EEA1 4 | 128-EEA1 5 | SRSLTE_LIBLTE_SECURITY_H 6 | 7 | -------------------------------------------------------------------------------- /cryptoDefs/2DES.txt: -------------------------------------------------------------------------------- 1 | name=2DES 2 | coding=96 3 | pyDes 4 | javax.crypto.* 5 | javax.crypto.spec.DESKeySpec 6 | DES.h 7 | -------------------------------------------------------------------------------- /cryptoDefs/3DES.txt: -------------------------------------------------------------------------------- 1 | name=3DES 2 | coding=128 3 | botan-3.dll 4 | botan.dll 5 | libbotan-3.dylib 6 | libbotan-2.dylib 7 | libbotan-3.so 8 | libbotan-2.so 9 | libbotan-2.s 10 | -------------------------------------------------------------------------------- /cryptoDefs/3WAY.txt: -------------------------------------------------------------------------------- 1 | name=3Way 2 | coding=128 3 | 3way.h 4 | CRYPTOPP_THREEWAY_H 5 | 6 | -------------------------------------------------------------------------------- /cryptoDefs/A4.txt: -------------------------------------------------------------------------------- 1 | name=3Way 2 | coding=128 3 | 3way.h 4 | CRYPTOPP_THREEWAY_H 5 | -------------------------------------------------------------------------------- /cryptoDefs/A5-1: -------------------------------------------------------------------------------- 1 | name=A5/1 2 | coding=128 3 | A5.c 4 | -------------------------------------------------------------------------------- /cryptoDefs/ACE.txt: -------------------------------------------------------------------------------- 1 | name=ACE 2 | coding=64 3 | USE_VIA_ACE_IF_PRESENT 4 | -------------------------------------------------------------------------------- /cryptoDefs/AES.txt: -------------------------------------------------------------------------------- 1 | name=AES 2 | coding=256 3 | aes.h 4 | tiny-AES-c 5 | _AES_HPP_ 6 | aesInit 7 | AES_set_encrypt_key 8 | AES_set_decrypt_key 9 | AES_ige_encrypt 10 | AES_ofb128_encrypt 11 | AES_ecb_encrypt 12 | AES_cbc_encrypt 13 | AES_cfb8_encrypt 14 | AES_cfb128_encrypt 15 | AES_wrap_key 16 | AES_cfb1_encrypt 17 | AES_unwrap_key 18 | -------------------------------------------------------------------------------- /cryptoDefs/Anubis.txt: -------------------------------------------------------------------------------- 1 | name=Anubis 2 | coding=128 3 | tomcrypt.h 4 | -------------------------------------------------------------------------------- /cryptoDefs/Aria.txt: -------------------------------------------------------------------------------- 1 | name=Aria 2 | coding=256 3 | aria.cpp 4 | aria.h 5 | r.re.nsri.aria 6 | ARIAEngine 7 | ossl_aria_set_encrypt_key 8 | ossl_aria_set_decrypt_key 9 | ossl_aria_encrypt 10 | -------------------------------------------------------------------------------- /cryptoDefs/Baton.txt: -------------------------------------------------------------------------------- 1 | name=Baton 2 | coding=320 3 | baton.h 4 | -------------------------------------------------------------------------------- /cryptoDefs/Bcrypt.txt: -------------------------------------------------------------------------------- 1 | name=Bcrypt 2 | coding=320 3 | bcrypt 4 | pycabcrypt.h 5 | BCrypt.java 6 | jBCrypt 7 | -------------------------------------------------------------------------------- /cryptoDefs/Blake.txt: -------------------------------------------------------------------------------- 1 | name=BlakeX 2 | coding=512 3 | blake3.h 4 | blake3_hasher_update 5 | blake3_impl.h 6 | BLAKE2b512 7 | BLAKE2b256 8 | -------------------------------------------------------------------------------- /cryptoDefs/Blake2.txt: -------------------------------------------------------------------------------- 1 | name=Blake2 2 | coding=256 3 | blake2 4 | pycabcrypt.h 5 | BCrypt.java 6 | jBCrypt 7 | -------------------------------------------------------------------------------- /cryptoDefs/Blowfish.txt: -------------------------------------------------------------------------------- 1 | name=Blowfish 2 | coding=320 3 | egoroof-blowfish 4 | /dist/blowfish 5 | -------------------------------------------------------------------------------- /cryptoDefs/Blum-Goldwasser.txt: -------------------------------------------------------------------------------- 1 | name=Blum-Goldwasser 2 | coding=320 3 | blumgoldwasser.py 4 | BlumGoldwasser 5 | sage.crypto.public_key.blum_goldwasser.BlumGoldwasser 6 | 7 | -------------------------------------------------------------------------------- /cryptoDefs/C2.txt: -------------------------------------------------------------------------------- 1 | name=C2 2 | coding=56 3 | -------------------------------------------------------------------------------- /cryptoDefs/CAST.txt: -------------------------------------------------------------------------------- 1 | name=CAST 2 | coding=320CAST_cfb64_encrypt 3 | CAST_ecb_encrypt 4 | CAST_encrypt 5 | CAST_decrypt 6 | CAST_cbc_encrypt 7 | CAST_ofb64_encrypt 8 | CAST_set_key 9 | 10 | -------------------------------------------------------------------------------- /cryptoDefs/CAST3.txt: -------------------------------------------------------------------------------- 1 | name=CAST3 2 | coding=320 3 | CAST3.h 4 | -------------------------------------------------------------------------------- /cryptoDefs/CAST5.txt: -------------------------------------------------------------------------------- 1 | name=CAST5 2 | coding=320 3 | cast5.h 4 | -------------------------------------------------------------------------------- /cryptoDefs/CAST6.txt: -------------------------------------------------------------------------------- 1 | name=CAST6 2 | coding=320 3 | pyCast6 4 | -------------------------------------------------------------------------------- /cryptoDefs/CMEA.txt: -------------------------------------------------------------------------------- 1 | name=CMEA 2 | coding=64 3 | startCMEA 4 | CmeaSys 5 | -------------------------------------------------------------------------------- /cryptoDefs/CRC16.txt: -------------------------------------------------------------------------------- 1 | name=CRC16 2 | coding=16 3 | CRC_16 4 | CRC_16CCITT 5 | CRC_16XModem 6 | CRC16 7 | -------------------------------------------------------------------------------- /cryptoDefs/CRC32.txt: -------------------------------------------------------------------------------- 1 | name=CRC32 2 | coding=32 3 | crc32h.h 4 | crc32.c 5 | crc32_table 6 | xcrc32 7 | -------------------------------------------------------------------------------- /cryptoDefs/Camellia.txt: -------------------------------------------------------------------------------- 1 | name=Camellia 2 | coding=256 3 | camellia.core 4 | CIPHERCAMELLIA256 5 | CAMELLIA-256-CBC 6 | camellia 7 | Camellia_cfb8_encrypt 8 | Camellia_ctr128_encrypt 9 | Camellia_set_key 10 | Camellia_EncryptBlock_Rounds 11 | Camellia_DecryptBlock 12 | Camellia_decrypt 13 | Camellia_DecryptBlock_Rounds 14 | Camellia_cfb128_encrypt 15 | Camellia_Ekeygen 16 | Camellia_EncryptBlock 17 | Camellia_cbc_encrypt 18 | Camellia_cfb1_encrypt 19 | Camellia_ecb_encrypt 20 | Camellia_encrypt 21 | Camellia_ofb128_encrypt 22 | -------------------------------------------------------------------------------- /cryptoDefs/ChaCha.txt: -------------------------------------------------------------------------------- 1 | name=ChaCha(Salsa) 2 | coding=256 3 | TLS_RSA_WITH_CHACHA20_SHA 4 | TLS_ECDHE_RSA_WITH_CHACHA20_SHA 5 | TLS_ECDHE_ECDSA_WITH_CHACHA20_SHA 6 | TLS_RSA_WITH_CHACHA20_POLY1305 7 | TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 8 | TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 9 | TLS_DHE_RSA_WITH_CHACHA20_POLY1305 10 | TLS_DHE_PSK_WITH_CHACHA20_POLY1305 11 | TLS_PSK_WITH_CHACHA20_POLY1305 12 | TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305 13 | TLS_RSA_PSK_WITH_CHACHA20_POLY1305 14 | chacha20_core 15 | ChaCha20_ctr32 16 | ChaCha20_ctr32_int 17 | ChaCha20_ctr32_vmx 18 | ChaCha20_ctr32_vsx 19 | ChaCha20_ctr32_vsx_p10 20 | -------------------------------------------------------------------------------- /cryptoDefs/Cobra.txt: -------------------------------------------------------------------------------- 1 | name=Cobra 2 | coding=128 3 | Cobra_algorithm 4 | cobra.java 5 | -------------------------------------------------------------------------------- /cryptoDefs/DCC.txt: -------------------------------------------------------------------------------- 1 | name=DCC 2 | coding=64 3 | DCC.py 4 | -------------------------------------------------------------------------------- /cryptoDefs/DES.txt: -------------------------------------------------------------------------------- 1 | name=DES 2 | coding=64 3 | des_setparity 4 | DESERR_NONE 5 | DES_encrypt3 6 | DES_ncbc_encrypt 7 | DES_set_odd_parity 8 | DES_cfb64_encrypt 9 | DES_ede3_ofb64_encrypt 10 | DES_decrypt3 11 | DES_ecb_encrypt 12 | DES_pcbc_encrypt 13 | DES_set_key 14 | DES_set_key_checked 15 | DES_ede3_cfb64_encrypt 16 | DES_random_key 17 | DES_ede3_cfb_encrypt 18 | DES_ecb3_encrypt 19 | DES_is_weak_key 20 | DES_set_key_unchecked 21 | DES_encrypt1 22 | DES_ede3_cbc_encrypt 23 | DES_ofb_encrypt 24 | DES_check_key_parity 25 | DES_key_sched 26 | DES_encrypt2 27 | DES_cfb_encrypt 28 | DES_crypt 29 | DES_quad_cksum 30 | DES_string_to_key 31 | DES_xcbc_encrypt 32 | DES_cbc_cksum 33 | DES_cbc_encrypt 34 | DES_ofb64_encrypt 35 | DES_string_to_2keys 36 | DES_fcrypt 37 | 38 | -------------------------------------------------------------------------------- /cryptoDefs/DESX.txt: -------------------------------------------------------------------------------- 1 | name=DESX 2 | coding=64 3 | desx 4 | desx.go 5 | desx.py 6 | des_x 7 | un_des_x 8 | -------------------------------------------------------------------------------- /cryptoDefs/DESede.txt: -------------------------------------------------------------------------------- 1 | name=DESEde 2 | coding=168 3 | javax.crypto.spec.DESedeKeySpec 4 | DESedeKeySpec 5 | DES_EDE_KEY_LEN 6 | -------------------------------------------------------------------------------- /cryptoDefs/DH.txt: -------------------------------------------------------------------------------- 1 | name=DiffieHellman 2 | coding=128 3 | getDhObjectFromEvent 4 | RSA_DH.cpp 5 | dh_cmp_parameters 6 | dh_pkey_import_from 7 | DH_get_ex_data 8 | DH_meth_set_flags 9 | dh_pkey_import_from_type 10 | DH_check_params_ex 11 | dh_gen_named_group 12 | dh_param_init 13 | DH_set_ex_data 14 | ossl_dh_new_by_nid_ex 15 | ossl_dh_get0_params 16 | DH_test_flags 17 | DH_meth_free 18 | DH_meth_set_generate_params 19 | DH_set0_key 20 | DH_security_bits 21 | ossl_dh_check_pairwise 22 | DH_set_default_method 23 | DH_meth_set_bn_mod_exp 24 | DH_get0_engine 25 | DH_meth_get0_app_data 26 | DH_meth_set_compute_key 27 | DH_get0_pqg 28 | dh_public_print 29 | -------------------------------------------------------------------------------- /cryptoDefs/DHE.txt: -------------------------------------------------------------------------------- 1 | name=DHE 2 | coding=128 3 | ECDHE-RSA-AES256-GCM-SHA384 4 | ECDHE-RSA-AES256-SHA384 5 | ECDHE-RSA-AES256-SHA 6 | DHE-RSA-AES256-GCM-SHA384 7 | DHE-RSA-AES256-SHA256 8 | DHE-RSA-AES256-SHA 9 | DHE-RSA-CAMELLIA256-SHA 10 | ECDHE-RSA-AES128-GCM-SHA256 11 | ECDHE-RSA-AES128-SHA256 12 | ECDHE-RSA-AES128-SHA 13 | DHE-RSA-AES128-GCM-SHA256 14 | DHE-RSA-AES128-SHA256 15 | DHE-RSA-AES128-SHA 16 | DHE-RSA-CAMELLIA128-SHA 17 | -------------------------------------------------------------------------------- /cryptoDefs/DHIES.txt: -------------------------------------------------------------------------------- 1 | name=DHIES 2 | coding=128 3 | DHIES 4 | -------------------------------------------------------------------------------- /cryptoDefs/ECDH.txt: -------------------------------------------------------------------------------- 1 | name=ECDH 2 | coding=128 3 | ecdh_generate_keys 4 | ecdh_shared_secret 5 | ECC_PRV_KEY_SIZE 6 | 7 | -------------------------------------------------------------------------------- /cryptoDefs/ECMQV.txt: -------------------------------------------------------------------------------- 1 | name=ECMQV 2 | coding=128 3 | ECMQV 4 | IEEEP1363 5 | 6 | 7 | -------------------------------------------------------------------------------- /cryptoDefs/ElGamal.txt: -------------------------------------------------------------------------------- 1 | name=ElGamal 2 | coding=128 3 | egKey 4 | elgamal.py 5 | elgamal.h 6 | ElGamalEncryptor 7 | ElGamalDecryptor 8 | CRYPTOPP_ELGAMAL_H 9 | 10 | -------------------------------------------------------------------------------- /cryptoDefs/Enigma.txt: -------------------------------------------------------------------------------- 1 | name=Enigma 2 | coding=48 3 | EnigmaMachine 4 | -------------------------------------------------------------------------------- /cryptoDefs/F8.txt: -------------------------------------------------------------------------------- 1 | name=F8 2 | coding=128 3 | SrtpCipherF8 4 | F8Context 5 | processPacketAesF8 6 | -------------------------------------------------------------------------------- /cryptoDefs/FASTHash.txt: -------------------------------------------------------------------------------- 1 | name=FastHash 2 | coding=256 3 | AQUAHASH_H 4 | -------------------------------------------------------------------------------- /cryptoDefs/FCrypt.txt: -------------------------------------------------------------------------------- 1 | name=FCrypt 2 | coding=128 3 | fcrypt.encrypt 4 | fcrypt.decrypt 5 | fcrypt_ctx 6 | fcrypt_mod_init 7 | F_ENCRYPT 8 | -------------------------------------------------------------------------------- /cryptoDefs/FNV1.txt: -------------------------------------------------------------------------------- 1 | name=FNV1 2 | coding=1024 3 | Fnv1a1024 4 | Fnv1a256 5 | Fnv1a512 6 | Fnv1aBigBase 7 | -------------------------------------------------------------------------------- /cryptoDefs/Feal.txt: -------------------------------------------------------------------------------- 1 | name=Feal 2 | coding=64 3 | FEAL_key_schedule 4 | FEAL_Encrypt 5 | FEAL_Decrypt 6 | feal8.h 7 | -------------------------------------------------------------------------------- /cryptoDefs/Fletcher.txt: -------------------------------------------------------------------------------- 1 | name=Fletcher 2 | coding=64 3 | fletcher64 4 | fletcher32 5 | fletcher16 6 | -------------------------------------------------------------------------------- /cryptoDefs/Fortezza.txt: -------------------------------------------------------------------------------- 1 | name=Fortezza 2 | coding=64 3 | kFZA 4 | aFZA 5 | eFZA 6 | -------------------------------------------------------------------------------- /cryptoDefs/Fortuna.txt: -------------------------------------------------------------------------------- 1 | name=Fortuna 2 | coding=64 3 | fortuna 4 | crypto/fortuna 5 | -------------------------------------------------------------------------------- /cryptoDefs/GEA.txt: -------------------------------------------------------------------------------- 1 | name=Feal 2 | coding=64 3 | FEAL_key_schedule 4 | FEAL_Encrypt 5 | FEAL_Decrypt 6 | feal8.h 7 | -------------------------------------------------------------------------------- /cryptoDefs/GEA03.txt: -------------------------------------------------------------------------------- 1 | name=GEA0-3 2 | coding=64 3 | LL_GEA0 4 | LL_GEA1 5 | LL_GEA2 6 | LL_GEA3 7 | hf_nas_eps_emm_gea0 8 | hf_nas_eps_emm_gea1 9 | hf_nas_eps_emm_gea2 10 | hf_nas_eps_emm_gea3 11 | -------------------------------------------------------------------------------- /cryptoDefs/GEA45.txt: -------------------------------------------------------------------------------- 1 | name=GEA4-5 2 | coding=128 3 | LL_GEA4 4 | LL_GEA5 5 | LL_GEA6 6 | hf_nas_eps_emm_gea5 7 | hf_nas_eps_emm_gea6 8 | hf_nas_eps_emm_gea4 9 | -------------------------------------------------------------------------------- /cryptoDefs/GOST.txt: -------------------------------------------------------------------------------- 1 | name=GOST 2 | coding=64 3 | gost_28147_89 4 | gost.hpp 5 | GOST28147_COMPRESSED_SBOX 6 | GOST28147EncryptCycle 7 | GOST28147EncryptBlock 8 | GOST28147SBoxTransformation 9 | -------------------------------------------------------------------------------- /cryptoDefs/Grain.txt: -------------------------------------------------------------------------------- 1 | name=Grain 2 | coding=128 3 | grain128aead.h 4 | Grain-128AEAD 5 | grain_data 6 | grain_state 7 | Grain128Engine 8 | -------------------------------------------------------------------------------- /cryptoDefs/GrainV1.txt: -------------------------------------------------------------------------------- 1 | name=GrainV1 2 | coding=64 3 | grain.h 4 | -------------------------------------------------------------------------------- /cryptoDefs/HAVAL.txt: -------------------------------------------------------------------------------- 1 | name=Haval 2 | coding=128 3 | haval.h 4 | haval_context 5 | Haval-160 6 | Haval-192 7 | Haval-224 8 | Haval-256 9 | Haval-128 10 | -------------------------------------------------------------------------------- /cryptoDefs/HC128.txt: -------------------------------------------------------------------------------- 1 | name=HC128 2 | coding=128 3 | CRYPTOPP_HC128_H 4 | HC-128 5 | HC128Info 6 | Hc128Rng 7 | -------------------------------------------------------------------------------- /cryptoDefs/HC256.txt: -------------------------------------------------------------------------------- 1 | name=HC256 2 | coding=256 3 | hc256_generate 4 | hc256_setkey 5 | hc256_crypt 6 | CRYPTOPP_HC256_H 7 | -------------------------------------------------------------------------------- /cryptoDefs/ICE.txt: -------------------------------------------------------------------------------- 1 | name=ICE 2 | coding=128 3 | node-ice 4 | iceKey 5 | __RUBY_ICE_KEY_H 6 | ice_cipher_create_key 7 | ice_cipher_deallocate 8 | ice_cipher_allocate 9 | ice_cipher_initialize 10 | ice_cipher_set_key 11 | ice_cipher_key_size 12 | ice_cipher_block_size 13 | ice_cipher_encrypt 14 | ice_cipher_decrypt 15 | IceSubkey 16 | -------------------------------------------------------------------------------- /cryptoDefs/ISAAC.txt: -------------------------------------------------------------------------------- 1 | name=ISAAC 2 | coding=256 3 | isaacCSPRNG 4 | isaacRandomPool.h 5 | -------------------------------------------------------------------------------- /cryptoDefs/Idea.txt: -------------------------------------------------------------------------------- 1 | name=Idea 2 | coding=64 3 | IdeaMode_h 4 | IdeaEncryptStreamStatus 5 | IdeaStreamEncryptInit 6 | IdeaStreamDecryptInit 7 | IdeaStreamCTRRandomAccessInit 8 | IdeaStreamEncryptDelete 9 | IdeaStreamPCBCDecrypt 10 | IdeaStreamCFBEncrypt 11 | -------------------------------------------------------------------------------- /cryptoDefs/Juniper.txt: -------------------------------------------------------------------------------- 1 | name=Juniper 2 | Juniper 3 | mod_Juniper_Decrypt 4 | juniper_decrypt 5 | -------------------------------------------------------------------------------- /cryptoDefs/KHAZAD.txt: -------------------------------------------------------------------------------- 1 | name=Khazad 2 | coding=16 3 | KHAZAD_ROUNDS 4 | khazad_setkey 5 | khazad_crypt 6 | khazad_encrypt 7 | khazad_decrypt 8 | khazad_mod_fini 9 | khazad-min.h 10 | KHAZAD_H 11 | KHAZAD_BLOCK_SIZE 12 | KHAZAD_NUM_ROUNDS 13 | KHAZAD_KEY_SIZE 14 | KHAZAD_KEY_SCHEDULE_SIZE 15 | -------------------------------------------------------------------------------- /cryptoDefs/Kazumi.txt: -------------------------------------------------------------------------------- 1 | name=Kazumi 2 | coding=64 3 | __KASUMI_H__ 4 | kasumi.h 5 | kasumi_desc 6 | -------------------------------------------------------------------------------- /cryptoDefs/Keccak.txt: -------------------------------------------------------------------------------- 1 | name=Keccak 2 | coding=256 3 | KeccakHash.h 4 | Keccak_HashFinal 5 | KeccakSum 6 | -------------------------------------------------------------------------------- /cryptoDefs/LMHash.txt: -------------------------------------------------------------------------------- 1 | name=Feal 2 | coding=64 3 | lmhashConstant 4 | unKnownLMHashes 5 | createLMHash 6 | -------------------------------------------------------------------------------- /cryptoDefs/LOKI91.txt: -------------------------------------------------------------------------------- 1 | name=LOKI91 2 | coding=64 3 | loki.h 4 | loki.i 5 | loki_lib_ver 6 | setlokikey 7 | setlokikey 8 | -------------------------------------------------------------------------------- /cryptoDefs/LUC.txt: -------------------------------------------------------------------------------- 1 | name=LUC 2 | coding=64 3 | CRYPTOPP_LUC_H 4 | LUCFunction 5 | luc.h 6 | -------------------------------------------------------------------------------- /cryptoDefs/Lucifer.txt: -------------------------------------------------------------------------------- 1 | name=Lucifer 2 | coding=128 3 | lucifer.h 4 | lucifer 5 | -------------------------------------------------------------------------------- /cryptoDefs/MD160.txt: -------------------------------------------------------------------------------- 1 | name=MD160 2 | coding=64 3 | ripemd160.h 4 | ripemd160_Init 5 | ripemd160_process 6 | ripemd160_update 7 | -------------------------------------------------------------------------------- /cryptoDefs/MD2.txt: -------------------------------------------------------------------------------- 1 | name=MD2 2 | coding=256 3 | MD2.py 4 | md2_block 5 | MD2_Init 6 | MD2_Update 7 | MD2_Final 8 | -------------------------------------------------------------------------------- /cryptoDefs/MD3.txt: -------------------------------------------------------------------------------- 1 | name=MD2 2 | coding=256 3 | MD2.py 4 | -------------------------------------------------------------------------------- /cryptoDefs/MD4.txt: -------------------------------------------------------------------------------- 1 | name=MD4 2 | coding=128 3 | MD4.h 4 | MD4_HMAC_BLOCK_SIZE 5 | MD4_BLOCK_WORDS 6 | MD4_HASH_WORDS 7 | MD4_DIGEST_SIZE 8 | md4_update 9 | md4_init 10 | md4_final 11 | MD4_Init 12 | md4_block_data_order 13 | -------------------------------------------------------------------------------- /cryptoDefs/MD5.txt: -------------------------------------------------------------------------------- 1 | name=MD5 2 | coding=128 3 | md5_file 4 | md5 5 | md5crypt 6 | aprcrypt 7 | md5_encrypt 8 | md5_block_data_order 9 | ossl_md5_sha1_init 10 | ossl_md5_sha1_ctrl 11 | MD5_Init 12 | ossl_md5_sha1_update 13 | ossl_md5_sha1_final 14 | -------------------------------------------------------------------------------- /cryptoDefs/MD6.txt: -------------------------------------------------------------------------------- 1 | name=MD6 2 | coding=512 3 | MD6.py 4 | md6_encrypt 5 | CatMD6Crypto 6 | md6Crypto.hash 7 | 8 | -------------------------------------------------------------------------------- /cryptoDefs/MDC2.txt: -------------------------------------------------------------------------------- 1 | name=MDC2 2 | coding=128 3 | MDC2.h 4 | mdc2 5 | mdc2_with_aes.py 6 | MDC2_Init 7 | MDC2_Update 8 | MDC2_Final 9 | mdc2_body 10 | 11 | -------------------------------------------------------------------------------- /cryptoDefs/MISTY1.txt: -------------------------------------------------------------------------------- 1 | name=MISTY1 2 | coding=32 3 | misty1_keyinit 4 | misty1_encrypt_block 5 | MISTY1_KEYSIZE 6 | -------------------------------------------------------------------------------- /cryptoDefs/MQV.txt: -------------------------------------------------------------------------------- 1 | name=MQV 2 | coding=512 3 | mqv.h 4 | hmqv.h 5 | ECMQV 6 | EQV_Domain 7 | ECHMQV512 8 | ECHMQV384 9 | ECHMQV256 10 | ECHMQV128 11 | FHMQV 12 | FHMQV512 13 | FHMQV384 14 | FHMQV256 15 | FHMQV128 16 | -------------------------------------------------------------------------------- /cryptoDefs/MSCASH.txt: -------------------------------------------------------------------------------- 1 | name=MSCash 2 | coding=256 3 | mscash.x.gz 4 | mscash 5 | -------------------------------------------------------------------------------- /cryptoDefs/MSCash2.txt: -------------------------------------------------------------------------------- 1 | name=MSCash2 2 | coding=128 3 | mascash2 4 | -------------------------------------------------------------------------------- /cryptoDefs/MULTI2.txt: -------------------------------------------------------------------------------- 1 | name=MULTI2 2 | coding=128 3 | multi2.h 4 | LTC_MULTI2 5 | multi2_desc 6 | multi2_setup 7 | multi2_ecb_encrypt 8 | multi2_ecb_decrypt 9 | -------------------------------------------------------------------------------- /cryptoDefs/McEliece.txt: -------------------------------------------------------------------------------- 1 | name=McEliece 2 | coding=64 3 | MCELIECE_H 4 | mceliece.h 5 | mceliece_init 6 | delete_mceliece 7 | mceliececipher.py 8 | -------------------------------------------------------------------------------- /cryptoDefs/NTRUEncrypt.txt: -------------------------------------------------------------------------------- 1 | name=NTRUEncrypt 2 | coding=128 3 | NTRU_NTRU_H 4 | ntru.h 5 | ntruprime_gen_key_pair 6 | ntru_gen_key_pair_multi 7 | ntru_gen_pub 8 | ntru_encrypt 9 | ntru_decrypt 10 | net.sf.ntru.util 11 | -------------------------------------------------------------------------------- /cryptoDefs/Nimbus.txt: -------------------------------------------------------------------------------- 1 | name=Nimbus 2 | coding=256 3 | nimbusds.jose 4 | JOSEObjectType 5 | -------------------------------------------------------------------------------- /cryptoDefs/Noekedon.txt: -------------------------------------------------------------------------------- 1 | name=Noekeon 2 | coding=128 3 | NoekeonIndirectRef 4 | noekeon.h 5 | NoekeonEngine 6 | NoekeonEngine.cs 7 | 8 | -------------------------------------------------------------------------------- /cryptoDefs/PBE.txt: -------------------------------------------------------------------------------- 1 | name=PBE 2 | coding=128 3 | org.xeustechnologies.crypto.kpbe 4 | PBE 5 | KPBE 6 | -------------------------------------------------------------------------------- /cryptoDefs/PBES1.txt: -------------------------------------------------------------------------------- 1 | name=PBES1 2 | coding=128 3 | PBEWithMD5AndDES 4 | getPBES1EncryptionObject 5 | getPBES1Hash 6 | getPBES1KDF 7 | PKCS5_SCHEME_PBES1 8 | -------------------------------------------------------------------------------- /cryptoDefs/PBES2.txt: -------------------------------------------------------------------------------- 1 | name=PBES2 2 | coding=256 3 | getPBES2EncryptionObject 4 | id-PBES2 5 | PBES2HS256A128KW 6 | PBES2AESKW 7 | PBES2-HS256+A128K 8 | -------------------------------------------------------------------------------- /cryptoDefs/Panama.txt: -------------------------------------------------------------------------------- 1 | name=Panama 2 | coding=128 3 | panama.h 4 | panama_LTX__mcrypt_set_key 5 | panama_LTX__mcrypt_encrypt 6 | panama_LTX__mcrypt_decrypt 7 | panama_LTX__mcrypt_get_size 8 | panama_LTX__mcrypt_get_block_size 9 | panama_LTX__is_block_algorithm 10 | -------------------------------------------------------------------------------- /cryptoDefs/Quad.txt: -------------------------------------------------------------------------------- 1 | name=QUAD 2 | coding=128 3 | QUAD.pack 4 | QUAD.unpack 5 | -------------------------------------------------------------------------------- /cryptoDefs/RC2.txt: -------------------------------------------------------------------------------- 1 | name=RC2 2 | coding=128 3 | rc2_LTX__mcrypt_set_key 4 | rc2_LTX__mcrypt_encrypt 5 | rc2_LTX__mcrypt_decrypt 6 | rc2_LTX__mcrypt_get_size 7 | rc2_LTX__mcrypt_get_block_size 8 | rc2_LTX__is_block_algorithm 9 | rc2_LTX__mcrypt_get_key_size 10 | RC2_encrypt 11 | RC2_decrypt 12 | RC2_ecb_encrypt 13 | RC2_set_key 14 | RC2_cfb64_encrypt 15 | RC2_ofb64_encrypt 16 | RC2_cbc_encrypt 17 | -------------------------------------------------------------------------------- /cryptoDefs/RC4.txt: -------------------------------------------------------------------------------- 1 | name=RC4 2 | coding=2048 3 | RC4_H 4 | RC4_KEY_S 5 | RC4_key 6 | RC4 7 | RC4_set_key 8 | 9 | -------------------------------------------------------------------------------- /cryptoDefs/RC4HMACxt: -------------------------------------------------------------------------------- 1 | name=RC4-HMAC 2 | coding=2048 3 | RC4-HMAC-MD5 4 | RC4HMAC 5 | RC4-HMAC.go 6 | -------------------------------------------------------------------------------- /cryptoDefs/RC5.txt: -------------------------------------------------------------------------------- 1 | name=RC5 2 | coding=128 3 | RC5.new 4 | rc5.rb 5 | RC5Enc 6 | RC5Dec 7 | RC5Enc.java 8 | RC5Dec.java 9 | RC5_32_decrypt 10 | RC5_32_set_key 11 | RC5_32_cfb64_encrypt 12 | RC5_32_ofb64_encrypt 13 | RC5_32_ecb_encrypt 14 | RC5_32_cbc_encrypt 15 | RC5_32_encrypt 16 | -------------------------------------------------------------------------------- /cryptoDefs/RC6.txt: -------------------------------------------------------------------------------- 1 | name=RC6 2 | coding=128 3 | AlgorithmRC6 4 | RC6.encrypt 5 | RC6.decript 6 | RC6_HPP__ 7 | -------------------------------------------------------------------------------- /cryptoDefs/RIPEMD.txt: -------------------------------------------------------------------------------- 1 | name=RIPEMD 2 | coding=128 3 | RIPEMD160_CTX 4 | ripemd160_Init 5 | ripemd160_process 6 | ripemd160_Update 7 | RIPEMD160_Init 8 | ripemd160_block_data_order 9 | ripemd160_block_x86 10 | ripemd160_block 11 | -------------------------------------------------------------------------------- /cryptoDefs/RSA-OAEP.txt: -------------------------------------------------------------------------------- 1 | name=RSA-OAEP 2 | coding=128 3 | encryptRSAWithOAEP 4 | decryptRSAWithOAEP 5 | RSA_OAEP_H 6 | RSA_OAEP 7 | -------------------------------------------------------------------------------- /cryptoDefs/RSA.txt: -------------------------------------------------------------------------------- 1 | name=RSA 2 | coding=128 3 | RSACRYPT_H 4 | RSAcrypt 5 | RSAdecrypt 6 | JSEncryptRSAKey 7 | ossl_rsa_acvp_test_free 8 | RSA_size 9 | rsa_priv_print 10 | ossl_rsa_acvp_test_gen_params_new 11 | ossl_rsa_acvp_test_gen_params_free 12 | RSA_verify_PKCS1_PSS 13 | RSA_get0_crt_params 14 | RSA_meth_set_keygen 15 | RSA_meth_free 16 | RSA_padding_check_none 17 | RSA_meth_set_pub_enc 18 | pkey_rsa_ctrl_str 19 | ossl_rsa_check_pminusq_diff 20 | ossl_rsa_pss_get_param_unverified 21 | rsa_pkey_dirty_cnt 22 | rsa_int_import_from 23 | rsa_pkey_import_from 24 | ossl_rsa_dup 25 | rsa_new_intern 26 | RSA_set_method 27 | RSA_sign_ASN1_OCTET_STRIN 28 | rsa_validate_rng_strength 29 | rsa_validate_keypair_multiprime 30 | RSA_meth_new 31 | RSA_verify_ASN1_OCTET_STRING 32 | RSA_X931_generate_key_ex 33 | RSA_generate_multi_prime_key 34 | RSA_get_ex_data 35 | RSA_padding_add_PKCS1_type_2 36 | rsa_pub_encode 37 | rsa_item_sign 38 | EVP_PKEY_CTX_set_rsa_keygen_primes 39 | RSA_meth_set_flags 40 | RSA_meth_set_pub_dec 41 | RSA_padding_add_PKCS1_OAEP 42 | -------------------------------------------------------------------------------- /cryptoDefs/RSAES-PKCS1-v1_5.txt: -------------------------------------------------------------------------------- 1 | name=RSAES-PKCS1-V1_5 2 | coding=128 3 | RSAES-PKCS1-V1_5-ENCRYPT 4 | RSAES-PKCS1-V1_5 5 | -------------------------------------------------------------------------------- /cryptoDefs/Rabbin.txt: -------------------------------------------------------------------------------- 1 | name=Rabin 2 | coding=128 3 | Rabin.genKey 4 | Rabin.encrypt 5 | Rabin.decrypt 6 | -------------------------------------------------------------------------------- /cryptoDefs/Rabbit.txt: -------------------------------------------------------------------------------- 1 | name=Rabbit 2 | coding=128 3 | Rabbit_Util 4 | Rabbit_ctx 5 | Rabbit_state 6 | Rabbit_Cipher.py 7 | -------------------------------------------------------------------------------- /cryptoDefs/Rijndael.txt: -------------------------------------------------------------------------------- 1 | name=Rijndael 2 | coding=256 3 | Rijndael.h 4 | Rijndael256 5 | -------------------------------------------------------------------------------- /cryptoDefs/SALSA10.txt: -------------------------------------------------------------------------------- 1 | name=SALSA10 2 | coding=64 3 | salsa10 4 | salsa10-src.bin 5 | salsa10-nonce.bin 6 | -------------------------------------------------------------------------------- /cryptoDefs/SALSA20.txt: -------------------------------------------------------------------------------- 1 | name=Salsa20 2 | coding=128 3 | ESTREAM_SALSA20 4 | wrap_salsa20_set_nonce 5 | c_salsa20_crypt 6 | -------------------------------------------------------------------------------- /cryptoDefs/SHS.txt: -------------------------------------------------------------------------------- 1 | name=SHS 2 | coding=128 3 | secret-handshake 4 | shsInit 5 | shs1 6 | shsInit 7 | SHS_CTX 8 | shsUpdate 9 | shs.h 10 | -------------------------------------------------------------------------------- /cryptoDefs/SMS4.txt: -------------------------------------------------------------------------------- 1 | name=SMS4 2 | coding=128 3 | sm4_encdec 4 | CRYPTOPP_SM4_H 5 | CRYPTOPP_SM4_ADVANCED_PROCESS_BLOCKS 6 | sms4.h 7 | SMS4CROL 8 | SMS4MASK3 9 | SMS4MASK2 10 | SMS4MASK1 11 | SMS4MASK0 12 | -------------------------------------------------------------------------------- /cryptoDefs/SNOW.txt: -------------------------------------------------------------------------------- 1 | name=SNOW 2 | coding=128 3 | snow5_aes_round 4 | snow-3g.h 5 | RTE_CRYPTO_CIPHER_SNOW3G_UEA2 6 | RTE_CRYPTO_AUTH_SNOW3G_UIA2 7 | -------------------------------------------------------------------------------- /cryptoDefs/SNRF.txt: -------------------------------------------------------------------------------- 1 | name=SNERFU 2 | coding=256 3 | Snefru 4 | -------------------------------------------------------------------------------- /cryptoDefs/SOSEMANUK.txt: -------------------------------------------------------------------------------- 1 | name=Sosemanuk 2 | coding=128 3 | SOSEMANUK_H__ 4 | sosemanuk_key_context 5 | sosemanuk_schedule 6 | sosemanuk_init 7 | sosemanuk_encrypt 8 | SosemanukSlow 9 | SosemanukFast 10 | -------------------------------------------------------------------------------- /cryptoDefs/SSHA.txt: -------------------------------------------------------------------------------- 1 | name=SSHA 2 | coding=128 3 | checkssha 4 | SSHA 5 | SSHA224PasswordEncoder 6 | SSHA224PasswordDecoder 7 | SSHA256PasswordEncoder 8 | SSHA256PasswordDecoder 9 | -------------------------------------------------------------------------------- /cryptoDefs/Seal.txt: -------------------------------------------------------------------------------- 1 | name=Seal 2 | coding=128 3 | SEALContext 4 | seal.h 5 | SEALWrapper 6 | toSealObject 7 | fromSealObject 8 | -------------------------------------------------------------------------------- /cryptoDefs/Seed.txt: -------------------------------------------------------------------------------- 1 | name=Seed 2 | coding=256 3 | seed128Cipher 4 | seed.go 5 | -------------------------------------------------------------------------------- /cryptoDefs/Sha.txt: -------------------------------------------------------------------------------- 1 | name=SHA1 2 | coding=128 3 | SHA-1 4 | -------------------------------------------------------------------------------- /cryptoDefs/Sha2.txt: -------------------------------------------------------------------------------- 1 | name=SHAx 2 | coding=512 3 | SHA-1 4 | SHA-224 5 | SHA-256 6 | SHA-384 7 | SHA-512 8 | SHA3-224 9 | SHA3-256 10 | SHA3-384 11 | SHA3-512 12 | jsSHA1 13 | jsSHA256 14 | jsSHA512 15 | jsSHA3 16 | sha.ts 17 | SHA512_Update 18 | SHA512_Init 19 | sha512_block_data_order 20 | SHA512_Transform 21 | sha512_block_p8 22 | SHA512_Final 23 | SHA256_Init 24 | SHA224_Update 25 | SHA224_Final 26 | sha512_256_init 27 | sha512_block_ppc 28 | -------------------------------------------------------------------------------- /cryptoDefs/Shacal.txt: -------------------------------------------------------------------------------- 1 | name=SHACAL 2 | coding=128 3 | Shacal 4 | isShacal1 5 | CRYPTOPP_SHACAL2_H 6 | SHACAL2Encryption 7 | SHACAL2 8 | -------------------------------------------------------------------------------- /cryptoDefs/Shark.txt: -------------------------------------------------------------------------------- 1 | name=Shark 2 | coding=64 3 | voipshark 4 | shark.h 5 | SHARKTransform 6 | CRYPTOPP_SHARK_H 7 | -------------------------------------------------------------------------------- /cryptoDefs/Skein.txt: -------------------------------------------------------------------------------- 1 | name=Skein 2 | coding=256 3 | skeincrypto.h 4 | skein 5 | sk_init 6 | sk_encrypt 7 | sk_decrypt 8 | -------------------------------------------------------------------------------- /cryptoDefs/Skipjack.txt: -------------------------------------------------------------------------------- 1 | name=Skipjack 2 | coding=32 3 | FastSkipJack 4 | SkipJack 5 | skipjackCipher 6 | skipjack.go 7 | -------------------------------------------------------------------------------- /cryptoDefs/Sober.txt: -------------------------------------------------------------------------------- 1 | name=Sober 2 | coding=128 3 | LTC_SOBER128 4 | sober128_start 5 | sober128_add_entropy 6 | sober128_ready 7 | sober128_read 8 | sober128_done 9 | sober128_export 10 | sober128_import 11 | sober128_test 12 | -------------------------------------------------------------------------------- /cryptoDefs/TDES.txt: -------------------------------------------------------------------------------- 1 | name=TDES 2 | coding=128 3 | TDES_FLAGS_ENCRYPT 4 | TDES_FLAGS_OPMODE_MASK 5 | TDES_FLAGS_ECB 6 | TDES_FLAGS_CBC 7 | TDES_FLAGS_OFB 8 | TDES_FLAGS_CFB64 9 | TDES_FLAGS_CFB32 10 | TDES_FLAGS_CFB16 11 | TDES_FLAGS_CFB8 12 | -------------------------------------------------------------------------------- /cryptoDefs/TEA.txt: -------------------------------------------------------------------------------- 1 | name=TEA 2 | coding=128 3 | tea_encrypt 4 | tea_decrypt 5 | tea_cbc_mode 6 | tea_ofb_mode 7 | -------------------------------------------------------------------------------- /cryptoDefs/TNEPRES.txt: -------------------------------------------------------------------------------- 1 | name=TNEPRES 2 | coding=256 3 | TnepresEngine 4 | Cipher.Tnepres 5 | KeyGenerator.Tnepres 6 | AlgorithmParameters.Tnepres 7 | 8 | -------------------------------------------------------------------------------- /cryptoDefs/Threefish.txt: -------------------------------------------------------------------------------- 1 | name=Threefish 2 | coding=1024 3 | Crypto.Threefish.Common 4 | newThreefish256 5 | newThreefish512 6 | newThreefish1024 7 | threefish_mod_fini 8 | threefish_algs 9 | threefish_round 10 | threefish_roundinv 11 | threefish_encrypt_generic 12 | -------------------------------------------------------------------------------- /cryptoDefs/Tiger.txt: -------------------------------------------------------------------------------- 1 | name=Tiger 2 | coding=256 3 | tiger_compress_macro 4 | tiger_compress 5 | ausTigerTokens1 6 | 7 | -------------------------------------------------------------------------------- /cryptoDefs/Twofish.txt: -------------------------------------------------------------------------------- 1 | name=Twofish 2 | coding=64 3 | twofish.h 4 | Twofish_fatal 5 | Twofish_Byte 6 | exp_Twofish_prepare_key 7 | Twofish_prepare_key 8 | twofish.h 9 | 10 | -------------------------------------------------------------------------------- /cryptoDefs/VMPC.txt: -------------------------------------------------------------------------------- 1 | name=VMPC 2 | CODING=96 3 | VMPCEngine.java 4 | VMPCrypt.py 5 | _VMPC_H_ 6 | VmpcInitKeyRound 7 | VmpcInitKey 8 | VmpcInitKeyBASIC 9 | VmpcEncrypt 10 | VmpcEncryptMAC 11 | VmpcDecryptMAC 12 | VmpcOutputMAC 13 | -------------------------------------------------------------------------------- /cryptoDefs/Wake.txt: -------------------------------------------------------------------------------- 1 | name=Wake 2 | coding=64 3 | WAKE.h 4 | WAKE_TestInstantiations 5 | WAKE_Base 6 | WAKE_Policy 7 | WAKE_Output 8 | -------------------------------------------------------------------------------- /cryptoDefs/Whirlpool.txt: -------------------------------------------------------------------------------- 1 | name=Whirpool 2 | coding=128 3 | whirlpool.New 4 | whirpool.go 5 | rhash_whirlpool_init 6 | rhash_whirlpool_sbox 7 | rhash_whirlpool_process_block 8 | WHIRLPOOL_OP 9 | WHIRLPOOL_Update 10 | WHIRLPOOL_BitUpdate 11 | WHIRLPOOL_Final 12 | whirlpool_block_mmx 13 | whirlpool_block 14 | WHIRLPOOL_Init 15 | -------------------------------------------------------------------------------- /cryptoDefs/XTR.txt: -------------------------------------------------------------------------------- 1 | name=XTR 2 | coding=64 3 | CRYPTOPP_XTR_H 4 | XTR_FindPrimesAndGenerator 5 | XTR_Exponentiate 6 | -------------------------------------------------------------------------------- /cryptoDefs/Yarrow.txt: -------------------------------------------------------------------------------- 1 | name=Yarrow 2 | coding=160 3 | yarrow_start 4 | yarrow_desc 5 | yarrow_start 6 | yarrow_add_entropy 7 | yarrow_ready 8 | yarrow_read 9 | yarrow_done 10 | yarrow_export 11 | yarrow_import 12 | yarrow_test 13 | LTC_YARROW 14 | LTC_YARROW_AES 15 | LTC_YARROW_AES1 16 | LTC_YARROW_AES2 17 | LTC_YARROW_AES3 18 | LTC_YARROW_AES4 19 | LTC_YARROW_AES5 20 | -------------------------------------------------------------------------------- /cryptoDefs/ZUC.txt: -------------------------------------------------------------------------------- 1 | name=ZUC 2 | coding=128 3 | ZUC_H 4 | __ZUC_H__ 5 | zuc.asm 6 | _zuc_init 7 | _zuc_generate_keystream 8 | -------------------------------------------------------------------------------- /cryptoDefs/ZipCrypt.txt: -------------------------------------------------------------------------------- 1 | name=ZipCrypt 2 | coding=64 3 | zipcloak 4 | zipbare 5 | -------------------------------------------------------------------------------- /cryptoDefs/dsa.txt: -------------------------------------------------------------------------------- 1 | name=DSA 2 | coding=128 3 | ossl_dsa_generate_ffc_parameters 4 | DSA_set_method 5 | ossl_dsa_sign_int 6 | DSA_set_ex_data 7 | DSA_print 8 | DSA_SIG_new 9 | DSA_do_sign 10 | dsa_finish 11 | ossl_dsa_key_from_pkcs8 12 | DSA_bits 13 | dsa_pkey_ctrl 14 | dsa_keygen_pairwise_test 15 | pkey_dsa_keygen 16 | pkey_dsa_copy 17 | dsa_param_print 18 | dsa_pub_print 19 | DSA_meth_set_sign 20 | DSA_meth_set_bn_mod_exp 21 | DSA_meth_set_finish 22 | ossl_dsa_key_fromdata 23 | DSA_set_default_method 24 | pkey_dsa_cleanup 25 | pkey_dsa_ctrl_str 26 | ossl_dsa_is_foreign 27 | ossl_dsa_check_pairwise 28 | DSA_meth_set0_app_data 29 | DSA_meth_set_sign_setup 30 | DSA_meth_set_verify 31 | pkey_dsa_init 32 | dsa_sign_setup 33 | DSA_sign_setup 34 | ossl_dsa_check_params 35 | DSA_up_ref 36 | DSA_set0_key 37 | DSA_meth_set1_name 38 | dsa_init 39 | dsa_mod_inverse_fermat 40 | ossl_dsa_ffc_params_fromdata 41 | DSA_meth_new 42 | pkey_dsa_verify 43 | DSA_generate_key 44 | ossl_dsa_get0_params 45 | DSA_meth_get0_app_data 46 | dsa_pub_encode 47 | ossl_ffc_params_cmp 48 | DSAparams_dup 49 | DSA_generate_parameters 50 | DSA_meth_dup 51 | EVP_PKEY_CTX_set_dsa_paramgen_md 52 | dsa_priv_decode 53 | int_dsa_free 54 | ossl_dsa_check_pub_key 55 | ossl_dsa_check_priv_key 56 | DSA_clear_flags 57 | DSA_verify 58 | i2d_DSAparams 59 | DSA_test_flags 60 | DSA_meth_get_flags 61 | DSA_meth_set_init 62 | dsa_sign_setup_no_digest 63 | dsa_priv_encode 64 | dsa_copy_parameters -------------------------------------------------------------------------------- /cryptoDefs/pbkdf1.txt: -------------------------------------------------------------------------------- 1 | name=pbkdf1 2 | coding=128 3 | pbkdf1.js 4 | -------------------------------------------------------------------------------- /cryptoDefs/pbkdf2.txt: -------------------------------------------------------------------------------- 1 | name=pbkdf2 2 | coding=128 3 | pbkdf2.js 4 | Ikonoshirt_Pbkdf2_Model_Encryption 5 | _pbkdf2 6 | -------------------------------------------------------------------------------- /cryptoDefs/pkcs12.txt: -------------------------------------------------------------------------------- 1 | name=PKCS12 2 | coding=128 3 | PKCS7_digest_from_attributes 4 | PKCS7_set_content 5 | ossl_x509_add_cert_new 6 | PKCS7_add_attrib_smimecap 7 | PKCS7_type_is_other 8 | PKCS7_find_digest 9 | pkcs7_ecdsa_or_dsa_sign_verify_setup 10 | pkcs7_rsa_sign_verify_setup 11 | PKCS7_RECIP_INFO_set 12 | i2d_PKCS7_bio_stream 13 | PKCS7_final 14 | ASN1_INTEGER_cmp 15 | PKCS7_dataDecode 16 | PKCS7_encrypt_ex 17 | ossl_err_load_PKCS7_strings 18 | PKCS7_RECIP_INFO_get0_alg 19 | PKCS7_sign_add_signer 20 | PKCS7_verify 21 | pkcs7_cmp_ri 22 | PKCS7_SIGNER_INFO_sign 23 | PKCS7_set_type 24 | PKCS7_add_recipient 25 | PKCS7_encrypt 26 | PKCS7_dataInit 27 | PKCS7_set_attributes 28 | PKCS7_SIGNER_INFO_set 29 | pkcs7_bio_add_digest 30 | PKCS7_add_signed_attribute 31 | PKCS7_add_crl 32 | PKCS7_add_signer 33 | PKCS7_add_signature 34 | ossl_pkcs7_ctx_propagate 35 | PKCS7_stream 36 | PKCS7_decrypt 37 | PKCS7_get_octet_string 38 | PKCS7_get_attribute 39 | PKCS7_content_new 40 | ossl_pkcs7_set0_libctx 41 | ossl_pkcs7_ctx_get0_libctx 42 | PKCS7_SIGNER_INFO_get0_algs 43 | PKCS7_sign 44 | PKCS7_new 45 | pkcs7_decrypt_rinfo 46 | PKCS7_dataFinal 47 | ossl_pkcs7_resolve_libctx 48 | PEM_write_bio_PKCS7_stream 49 | PKCS7_ctrl 50 | PKCS7_add_certificate 51 | SMIME_write_PKCS7 52 | SMIME_write_ASN1_ex 53 | PKCS7_add1_attrib_digest 54 | PKCS7_get_issuer_and_serial 55 | PKCS7_get_signed_attribute 56 | PKCS7_sign_ex 57 | PKCS12_get0_mac 58 | PKCS12_pack_p7encdata 59 | PKCS12_add_localkeyid 60 | PKCS12_PBE_keyivgen_ex 61 | PKCS12_PBE_keyivgen 62 | PKCS12_item_i2d_encrypt 63 | PKCS12_init 64 | PKCS12_gen_mac 65 | PKCS12_decrypt_skey 66 | PKCS12_add_friendlyname_uni 67 | PKCS12_add1_attr_by_NID 68 | PKCS12_add_key_ex 69 | PKCS12_key_gen_utf8_ex 70 | PKCS12_get_attr 71 | PKCS12_add_friendlyname_utf8 72 | PKCS12_add_secret 73 | PKCS8_get_attr 74 | PKCS12_SAFEBAG_create0_pkcs8 75 | PKCS12_add_cert 76 | PKCS12_add_safe_ex 77 | PKCS12_init_ex 78 | parse_pk12 79 | PKCS12_pack_authsafes 80 | PKCS12_add_safes 81 | PKCS12_item_i2d_encrypt_ex 82 | PKCS12_verify_mac 83 | PKCS12_SAFEBAG_get_nid 84 | OPENSSL_asc2uni 85 | PKCS12_SAFEBAG_create_pkcs8_encrypt 86 | PKCS12_pack_p7encdata_ex 87 | PKCS8_decrypt_ex 88 | PKCS12_PBE_add 89 | PKCS12_key_gen_asc_ex 90 | pkcs12_gen_mac 91 | PKCS8_decrypt 92 | PKCS12_decrypt_skey_ex -------------------------------------------------------------------------------- /cryptoDefs/pkcs7.txt: -------------------------------------------------------------------------------- 1 | name=PKCS7 2 | coding=128 3 | PKCS7_digest_from_attributes 4 | PKCS7_set_content 5 | ossl_x509_add_cert_new 6 | PKCS7_add_attrib_smimecap 7 | PKCS7_type_is_other 8 | PKCS7_find_digest 9 | pkcs7_ecdsa_or_dsa_sign_verify_setup 10 | pkcs7_rsa_sign_verify_setup 11 | PKCS7_RECIP_INFO_set 12 | i2d_PKCS7_bio_stream 13 | PKCS7_final 14 | ASN1_INTEGER_cmp 15 | PKCS7_dataDecode 16 | PKCS7_encrypt_ex 17 | ossl_err_load_PKCS7_strings 18 | PKCS7_RECIP_INFO_get0_alg 19 | PKCS7_sign_add_signer 20 | PKCS7_verify 21 | pkcs7_cmp_ri 22 | PKCS7_SIGNER_INFO_sign 23 | PKCS7_set_type 24 | PKCS7_add_recipient 25 | PKCS7_encrypt 26 | PKCS7_dataInit 27 | PKCS7_set_attributes 28 | PKCS7_SIGNER_INFO_set 29 | pkcs7_bio_add_digest 30 | PKCS7_add_signed_attribute 31 | PKCS7_add_crl 32 | PKCS7_add_signer 33 | PKCS7_add_signature 34 | ossl_pkcs7_ctx_propagate 35 | PKCS7_stream 36 | PKCS7_decrypt 37 | PKCS7_get_octet_string 38 | PKCS7_get_attribute 39 | PKCS7_content_new 40 | ossl_pkcs7_set0_libctx 41 | ossl_pkcs7_ctx_get0_libctx 42 | PKCS7_SIGNER_INFO_get0_algs 43 | PKCS7_sign 44 | PKCS7_new 45 | pkcs7_decrypt_rinfo 46 | PKCS7_dataFinal 47 | ossl_pkcs7_resolve_libctx 48 | PEM_write_bio_PKCS7_stream 49 | PKCS7_ctrl 50 | PKCS7_add_certificate 51 | SMIME_write_PKCS7 52 | SMIME_write_ASN1_ex 53 | PKCS7_add1_attrib_digest 54 | PKCS7_get_issuer_and_serial 55 | PKCS7_get_signed_attribute 56 | PKCS7_sign_ex 57 | -------------------------------------------------------------------------------- /cryptoDefs/sapphire.txt: -------------------------------------------------------------------------------- 1 | name=Sapphire 2 | coding=256 3 | sapphire.h 4 | sapphire::keyrand 5 | sapphire::initialize 6 | sapphire::init_hash 7 | -------------------------------------------------------------------------------- /cryptoDefs/serpent.txt: -------------------------------------------------------------------------------- 1 | name=Serpent 2 | coding=128 3 | serpent_subkey_t 4 | serpent_blk 5 | -------------------------------------------------------------------------------- /cryptoDefs/srp.txt: -------------------------------------------------------------------------------- 1 | name=SRP 2 | coding=128 3 | SRP_VBASE_get1_by_user 4 | SRP_create_verifier_BN_ex 5 | SRP_Calc_client_key 6 | SRP_get_gN_by_id 7 | SRP_VBASE_get_by_user 8 | SRP_create_verifier_BN 9 | SRP_Calc_x_ex 10 | SRP_Verify_B_mod_N 11 | SRP_user_pwd_set_gN 12 | SRP_user_pwd_set1_ids 13 | SRP_VBASE_add0_user 14 | SRP_Calc_server_key 15 | SRP_Calc_B_ex 16 | SRP_get_default_gN 17 | SRP_VBASE_new 18 | SRP_user_pwd_set_sv 19 | SRP_VBASE_free 20 | SRP_gN_free 21 | SRP_create_verifier_ex 22 | SRP_gN_new_init 23 | SRP_gN_place_bn 24 | SRP_VBASE_init 25 | SRP_Calc_u_ex 26 | SRP_Calc_x 27 | SRP_check_known_gN_param 28 | srp_user_pwd_dup 29 | SRP_Calc_B 30 | SRP_Verify_A_mod_N 31 | SRP_user_pwd_new 32 | SRP_user_pwd_set0_sv 33 | SRP_create_verifier 34 | SRP_Calc_A 35 | SRP_Calc_client_key_ex 36 | SRP_user_pwd_free 37 | SRPClient 38 | SRPServer 39 | libsrp 40 | srp 41 | _pysrp 42 | _ctsrp 43 | -------------------------------------------------------------------------------- /cryptoDefs/tcryp.txt: -------------------------------------------------------------------------------- 1 | name=TCRYPT 2 | coding=128 3 | tcrypt.h 4 | _CRYPTO_TCRYPT_H 5 | -------------------------------------------------------------------------------- /cryptoDefs/xtea.txt: -------------------------------------------------------------------------------- 1 | name=XTEA 2 | coding=128 3 | xtea_setkey 4 | xtea.h 5 | xtea_encodeecb 6 | xtea_decodecbc 7 | xtea_declen 8 | -------------------------------------------------------------------------------- /doc/scanoss-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scanoss/minr/174e974a05dac495198300e3a67098c8d991ebbf/doc/scanoss-logo.png -------------------------------------------------------------------------------- /doc/style.css: -------------------------------------------------------------------------------- 1 | #projectlogo { 2 | vertical-align: middle; 3 | } 4 | -------------------------------------------------------------------------------- /external/inc/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (C) 2012, 2013 James McLaughlin et al. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 | SUCH DAMAGE. 26 | 27 | -------------------------------------------------------------------------------- /external/inc/bsort.h: -------------------------------------------------------------------------------- 1 | #ifndef __BSORT_H 2 | #define __BSORT_H 3 | 4 | int bsort(char *file_path); 5 | 6 | #endif -------------------------------------------------------------------------------- /external/inc/crc32c.h: -------------------------------------------------------------------------------- 1 | #ifndef __CRC32C_H 2 | #define __CRC32C_H 3 | 4 | uint32_t calc_crc32c (char *data, size_t len); 5 | 6 | #endif -------------------------------------------------------------------------------- /external/inc/winnowing.h: -------------------------------------------------------------------------------- 1 | #ifndef __WINNOWING_H 2 | #define __WINNOWING_H 3 | 4 | #include 5 | 6 | uint32_t winnowing (char *src, uint32_t *hashes, uint32_t *lines, uint32_t limit); 7 | extern uint8_t GRAM; // Winnowing gram size in bytes 8 | extern uint8_t WINDOW; // Winnowing window size in bytes 9 | extern uint32_t MAX_UINT32; 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /external/src/bsort.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "bsort.h" 13 | 14 | #define SWITCH_TO_SHELL 20 15 | 16 | struct sort 17 | { 18 | int fd; 19 | off_t size; 20 | void *buffer; 21 | }; 22 | 23 | static inline void shellsort(unsigned char *a, const int n, const int record_size, const int key_size) 24 | { 25 | int i, j; 26 | char temp[record_size]; 27 | 28 | for (i = 3; i < n; i++) 29 | { 30 | memcpy(&temp, &a[i * record_size], record_size); 31 | for (j = i; j >= 3 && memcmp(a + (j - 3) * record_size, &temp, key_size) > 0; j -= 3) 32 | { 33 | memcpy(a + j * record_size, a + (j - 3) * record_size, record_size); 34 | } 35 | memcpy(a + j * record_size, &temp, record_size); 36 | } 37 | 38 | for (i = 1; i < n; i++) 39 | { 40 | memcpy(&temp, &a[i*record_size], record_size); 41 | for(j = i; j >= 1 && memcmp(a + (j - 1) * record_size, &temp, key_size) > 0; j -= 1) 42 | { 43 | memcpy(a + j * record_size, a + (j - 1) * record_size, record_size); 44 | } 45 | memcpy(a + j * record_size, &temp, record_size); 46 | } 47 | } 48 | 49 | void radixify(unsigned char *buffer, 50 | const long count, 51 | const long digit, 52 | const long char_start, 53 | const long char_stop, 54 | const long record_size, 55 | const long key_size, 56 | const long stack_size, 57 | const long cut_off) 58 | { 59 | long counts[char_stop+1]; 60 | long offsets[char_stop+1]; 61 | long starts[char_stop+1]; 62 | long ends[char_stop+1]; 63 | long offset=0; 64 | unsigned char temp[record_size]; 65 | long target, x; 66 | long stack[stack_size]; 67 | long stack_pointer; 68 | 69 | for (x = char_start; x <= char_stop; x++) 70 | { 71 | counts[x] = 0; 72 | offsets[x] = 0; 73 | } 74 | 75 | // Compute starting positions 76 | for (x=0; x SWITCH_TO_SHELL) 132 | { 133 | radixify(&buffer[starts[x] * record_size], 134 | ends[x] - starts[x], 135 | digit+1, 136 | char_start, 137 | char_stop, 138 | record_size, 139 | key_size, 140 | stack_size, 141 | cut_off); 142 | } 143 | else 144 | { 145 | if (ends[x] - starts[x] <= 1) continue; 146 | shellsort(&buffer[starts[x] * record_size], ends[x] - starts[x], record_size, key_size); 147 | } 148 | } 149 | } 150 | else 151 | { 152 | for (x=char_start; x<=char_stop; x++) 153 | { 154 | if (ends[x] - starts[x] > 1) 155 | shellsort(&buffer[starts[x] * record_size], ends[x] - starts[x], record_size, key_size); 156 | } 157 | } 158 | } 159 | 160 | bool open_sort(char *path, struct sort *sort) 161 | { 162 | void *buffer = NULL; 163 | 164 | int fd = open(path, O_RDWR); 165 | if (fd == -1) return false; 166 | 167 | struct stat stats; 168 | if (fstat(fd, &stats) == -1) 169 | { 170 | if (fd != -1) close(fd); 171 | return false; 172 | } 173 | 174 | if (!(buffer = mmap(NULL, stats.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0))) 175 | { 176 | perror(path); 177 | if (buffer) munmap(buffer, stats.st_size); 178 | if (fd != -1) close(fd); 179 | sort->buffer = 0; 180 | sort->fd = 0; 181 | return false; 182 | } 183 | 184 | madvise(buffer, stats.st_size, POSIX_MADV_WILLNEED | POSIX_MADV_SEQUENTIAL); 185 | 186 | sort->buffer = buffer; 187 | sort->size = stats.st_size; 188 | sort->fd = fd; 189 | return true; 190 | } 191 | 192 | void close_sort(struct sort *sort) 193 | { 194 | if (sort->buffer) 195 | { 196 | munmap(sort->buffer, sort->size); 197 | sort->buffer = 0; 198 | sort->size = 0; 199 | } 200 | if (sort->fd) 201 | { 202 | close(sort->fd); 203 | sort->fd = 0; 204 | } 205 | } 206 | 207 | int bsort(char *file_path) 208 | { 209 | int char_start = 0; 210 | int char_stop = 255; 211 | int record_size=21; 212 | int key_size=21; 213 | int stack_size=5; 214 | int cut_off = 4; 215 | 216 | struct sort sort; 217 | if (!open_sort(file_path, &sort)) return false; 218 | 219 | radixify(sort.buffer, 220 | sort.size / record_size, 221 | 0, 222 | char_start, 223 | char_stop, 224 | record_size, 225 | key_size, 226 | stack_size, 227 | cut_off); 228 | close_sort(&sort); 229 | optind++; 230 | 231 | return true; 232 | } 233 | -------------------------------------------------------------------------------- /external/src/winnowing.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/main.c 4 | * 5 | * Winnowing algorithm implementation 6 | * 7 | * Copyright (C) 2018-2020 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include "crc32c.h" 29 | #include "winnowing.h" 30 | 31 | uint8_t GRAM = 30; // Winnowing gram size in bytes 32 | uint8_t WINDOW = 64; // Winnowing window size in bytes 33 | uint32_t MAX_UINT32 = 4294967295; 34 | 35 | /* Convert case to lowercase, and return zero if it isn't a letter or number 36 | Do it fast and independent from the locale configuration (avoid string.h) */ 37 | static uint8_t normalize (uint8_t byte) 38 | { 39 | if (byte < '0') return 0; 40 | if (byte > 'z') return 0; 41 | if (byte <= '9') return byte; 42 | if (byte >= 'a') return byte; 43 | if ((byte >= 'A') && (byte <= 'Z')) return byte + 32 ; 44 | return 0; 45 | } 46 | 47 | /* Select smaller hash for the given window */ 48 | static uint32_t smaller_hash(uint32_t *window) 49 | { 50 | uint32_t hash = MAX_UINT32; 51 | for (uint32_t h = 0; h < WINDOW; h++) 52 | { 53 | if (window[h] < hash) hash = window[h]; 54 | } 55 | return hash; 56 | } 57 | 58 | /* Add the given "hash" to the "hashes" array and the corresponding "line" to the "lines" array 59 | updating the hash counter and returning the last added hash */ 60 | static uint32_t add_hash(uint32_t hash, uint32_t line, uint32_t *hashes, uint32_t *lines, uint32_t last, uint32_t *counter) 61 | { 62 | 63 | /* Consecutive repeating hashes are ignored */ 64 | if (hash != last) 65 | { 66 | /* Hashing the hash will result in a better balanced resulting data set 67 | as it will counter the winnowing effect which selects the "minimum" 68 | hash in each window */ 69 | 70 | hashes [*counter] = calc_crc32c((char *)&hash, 4); 71 | lines [*counter] = line; 72 | 73 | last = hash; 74 | (*counter)++; 75 | } 76 | 77 | return last; 78 | } 79 | 80 | /* Performs winning on the given FILE, limited to "limit" hashes. The provided array 81 | "hashes" is filled with hashes and "lines" is filled with the respective line numbers. 82 | The function returns the number of hashes found */ 83 | 84 | uint32_t winnowing(char *src, uint32_t *hashes, uint32_t *lines, uint32_t limit) 85 | { 86 | uint32_t hash = MAX_UINT32; 87 | uint32_t last = 0; 88 | 89 | uint8_t *grams = calloc(limit, 1); 90 | uint32_t *windows = calloc (limit * 4,1); 91 | 92 | if (!grams || !windows) 93 | { 94 | free(grams); 95 | free(windows); 96 | return 0; 97 | } 98 | 99 | uint8_t *gram = grams; 100 | uint32_t *window = windows; 101 | 102 | uint32_t gram_ptr = 0; 103 | uint32_t window_ptr = 0; 104 | 105 | /* Process one byte at a time */ 106 | uint32_t line = 1; 107 | uint32_t counter = 0; 108 | uint32_t line_char = 0; 109 | while (*src) 110 | { 111 | if (*src == '\n') 112 | { 113 | line++; 114 | line_char = 0; 115 | } 116 | else 117 | { 118 | line_char++; 119 | } 120 | 121 | if (line > 65384 || line_char > 16384) 122 | { 123 | break; 124 | } 125 | 126 | uint8_t byte = normalize(*(src++)); 127 | if (!byte) continue; 128 | 129 | /* Add byte to the gram */ 130 | gram[gram_ptr++] = byte; 131 | 132 | /* Got a full gram? */ 133 | if (gram_ptr >= GRAM) 134 | { 135 | /* Add fingerprint to the window */ 136 | window[window_ptr++] = calc_crc32c((char *) gram, GRAM); 137 | 138 | /* Got a full window? */ 139 | if (window_ptr >= WINDOW) 140 | { 141 | /* Add hash */ 142 | hash = smaller_hash(window); 143 | last = add_hash(hash, line, hashes, lines, last, &counter); 144 | 145 | if (counter >= limit) 146 | break; 147 | 148 | window++; 149 | if (window - windows >= limit * 4) 150 | break; 151 | 152 | window_ptr = WINDOW - 1; 153 | } 154 | gram++; 155 | if (gram - grams >= limit) 156 | break; 157 | gram_ptr = GRAM - 1; 158 | } 159 | } 160 | 161 | free (windows); 162 | free (grams); 163 | return counter; 164 | } 165 | -------------------------------------------------------------------------------- /inc/attributions.h: -------------------------------------------------------------------------------- 1 | #ifndef __ATTRIB_H 2 | #define __ATTRIB_H 3 | 4 | void mine_attribution_notice(struct minr_job *job, char *path); 5 | bool is_attribution_notice(char *path); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /inc/copyright.h: -------------------------------------------------------------------------------- 1 | #ifndef __COPYRIGHT_H 2 | #define __COPYRIGHT_H 3 | 4 | void mine_copyright(char *mined_path, char *md5, char *src, uint64_t src_ln, bool license_file); 5 | void char_replace(char *string, char replace, char with); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /inc/crc32c.h: -------------------------------------------------------------------------------- 1 | #ifndef __CRC32C_H 2 | #define __CRC32C_H 3 | #include 4 | uint32_t calc_crc32c (char *data, size_t len); 5 | 6 | #endif -------------------------------------------------------------------------------- /inc/crypto.h: -------------------------------------------------------------------------------- 1 | #ifndef __CRYPTO_H 2 | #define __CRYPTO_H 3 | 4 | #include 5 | #include 6 | void mine_crypto(char *mined_path, char *md5, char *src, uint64_t src_ln); 7 | void load_crypto_definitions(void); 8 | void create_crypto_definitions(char * path); 9 | void clean_crypto_definitions(void); 10 | #endif 11 | -------------------------------------------------------------------------------- /inc/file.h: -------------------------------------------------------------------------------- 1 | #ifndef __FILE_H 2 | #define __FILE_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | uint64_t get_file_size(char *path); 9 | void read_file(char *out, char *path, uint64_t maxlen); 10 | bool is_file(char *path); 11 | bool is_dir(char *path); 12 | uint64_t file_size(char *path); 13 | int *open_snippet (char *base_path); 14 | bool not_a_dot (char *path); 15 | bool create_dir(char *path); 16 | bool valid_path(char *dir, char *file); 17 | bool check_disk_free(char *file, uint64_t needed); 18 | FILE **open_file (char *mined_path, char * set_name); 19 | int append_to_csv_file(char *mined_path, char * set_name, int sector, char * line); 20 | void rm_dir(char *path); 21 | #endif -------------------------------------------------------------------------------- /inc/help.h: -------------------------------------------------------------------------------- 1 | #ifndef __HELP_H 2 | #define __HELP_H 3 | 4 | void show_help (void); 5 | 6 | 7 | #endif -------------------------------------------------------------------------------- /inc/hex.h: -------------------------------------------------------------------------------- 1 | #ifndef __HEX_H 2 | #define __HEX_H 3 | 4 | void hex_to_bin(char *hex, uint32_t len, uint8_t *out); 5 | 6 | char *bin_to_hex(uint8_t *bin, uint32_t len); 7 | uint16_t uint16(uint8_t *data); 8 | void uint32_reverse(uint8_t *data); 9 | #endif -------------------------------------------------------------------------------- /inc/ignored_extensions.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/ignored_extensions.h 4 | * 5 | * Ignored file extensions 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | extern char *IGNORED_EXTENSIONS[]; 24 | extern char *SKIP_MZ_EXTENSIONS[]; 25 | -------------------------------------------------------------------------------- /inc/ignored_files.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/ignored_wfp.h 4 | * 5 | * Ignored snippet IDs 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | #ifndef __IGNORED_FILE_H 24 | #define __IGNORED_FILE_H 25 | 26 | #include 27 | 28 | extern uint8_t IGNORE_FILE[]; 29 | bool ignored_file(char *file_id); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /inc/ignored_wfp.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/ignored_wfp.h 4 | * 5 | * Ignored snippet IDs 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | #ifndef __IGNORED_WFP_H 24 | #define __IGNORED_WFP_H 25 | 26 | #include 27 | 28 | extern uint8_t IGNORED_WFP[]; 29 | extern long IGNORED_WFP_LN; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /inc/ignorelist.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/ignorelist.h 4 | * 5 | * Ignoring/skipping data structures and routines 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | /* File paths to be skipped in results */ 24 | #ifndef __IGNORELIST_H 25 | #define __IGNORELIST_H 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | /* File squareness ranking */ 32 | typedef struct ranking 33 | { 34 | int length; 35 | int counter; 36 | } ranking; 37 | 38 | /* Squareness check affects files over MIN_LINES 39 | with a bigger SQUARENESS percent */ 40 | #define SQUARENESS_MIN_LINES 500 41 | #define MAX_SQUARENESS 70 42 | 43 | extern char *IGNORED_PATHS[]; 44 | extern char *IGNORED_HEADERS[]; 45 | extern char *IGNORED_EXTENSIONS[]; 46 | extern char *IGNORE_KEYWORDS[]; 47 | 48 | char *extension(char *path); 49 | bool stricmp(char *a, char *b); 50 | bool ignored_extension(char *name); 51 | bool unwanted_path(char *path); 52 | bool headicmp(char *a, char *b); 53 | bool unwanted_header(char *src); 54 | bool too_much_squareness(char *src); 55 | bool skip_mz_extension(char *name); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /inc/import.h: -------------------------------------------------------------------------------- 1 | #ifndef __MINR_IMPORT_H 2 | #define __MINR_IMPORT_H 3 | 4 | #include 5 | 6 | #define DECODE_BASE64 8 7 | extern int (*decode) (int op, unsigned char *key, unsigned char *nonce, 8 | const char *buffer_in, int buffer_in_len, unsigned char *buffer_out); 9 | 10 | void mined_import(struct minr_job *job); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /inc/license.h: -------------------------------------------------------------------------------- 1 | #ifndef __LICENSE_H 2 | #define __LICENSE_H 3 | 4 | #include 5 | #include 6 | #include "minr.h" 7 | 8 | bool is_spdx_license_identifier(char *src); 9 | void mine_license(struct minr_job *job, char *id, bool license_file); 10 | void generate_license_ids_c(char *path); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /inc/minr.h: -------------------------------------------------------------------------------- 1 | #ifndef __MINR_H 2 | #define __MINR_H 3 | // SPDX-License-Identifier: GPL-2.0-or-later 4 | /* 5 | * src/minr.h 6 | * 7 | * Global minr declarations 8 | * 9 | * Copyright (C) 2018-2021 SCANOSS.COM 10 | * 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation, either version 2 of the License, or 14 | * (at your option) any later version. 15 | 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program. If not, see . 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | /* Definitions */ 32 | #define MINR_VERSION "2.6.0" 33 | #define FILE_FILES 256 34 | #define MAX_ARG_LEN 1024 35 | #define MIN_FILE_REC_LEN 70 36 | #define MAX_PATH_LEN 4096 37 | #define MAX_FILE_SIZE (8 * 1048576) 38 | #define MAX_FILE_HEADER 4096 39 | #define MAX_HEADER_LINES 30 40 | #define MAX_CSV_LINE_LEN 1024 41 | #define MIN_FILE_SIZE 256 // files below this size will be ignored 42 | #define DISCARD_PATH_IF_LONGER_THAN 1024 43 | #define MD5_LEN 16 44 | #define MD5_LEN_HEX 32 45 | #define NODE_PTR_LEN 5 46 | #define REC_SIZE_LEN 2 47 | #define LDB_KEY_LN 4 48 | #define MAX_COPYRIGHT_LEN 256 49 | #define MAX_NONALNUM_IN_COPYRIGHT 10 // Maximum amount of non alphanumeric bytes accepted in a copyright statement 50 | #define MIN_ALNUM_IN_COPYRIGHT 3 // Minimum amount of alphanumeric bytes required in a copyright statement 51 | 52 | /* Set best practices to twice the average (calculated over entire OSSKB) */ 53 | #define BEST_PRACTICES_MAX_LINES (210 * 2) 54 | #define BEST_PRACTICES_MAX_LINE_LN (36 * 2) 55 | #define BEST_PRACTICES_MAX_LINES_PER_COMMENT (27 * 2) 56 | 57 | #define MAX_LICENSE_ID 64 58 | #define MAX_LICENSE_TEXT 1024 59 | 60 | #define TABLE_NAME_FILE "file" 61 | #define TABLE_NAME_URL "url" 62 | #define TABLE_NAME_LICENSE "license" 63 | #define TABLE_NAME_CRYPTOGRAPHY "cryptography" 64 | #define TABLE_NAME_QUALITY "quality" 65 | #define TABLE_NAME_DEPENDENCY "dependency" 66 | #define TABLE_NAME_COPYRIGHT "copyright" 67 | #define TABLE_NAME_ATTRIBUTION "attribution" 68 | #define TABLE_NAME_NOTICES "notices" 69 | #define TABLE_NAME_VULNERABILITY "vulnerability" 70 | #define TABLE_NAME_WFP "wfp" 71 | #define TABLE_NAME_PURL "purl" 72 | #define TABLE_NAME_SOURCES "sources" 73 | #define TABLE_NAME_PIVOT "pivot" 74 | 75 | 76 | #define LDB_ROOT "/var/lib/ldb" 77 | 78 | /* Structures */ 79 | typedef struct normalized_license 80 | { 81 | char spdx_id[MAX_LICENSE_ID]; 82 | char text[MAX_LICENSE_TEXT]; 83 | int ln; 84 | } normalized_license; 85 | 86 | struct minr_job 87 | { 88 | uint8_t md5[MD5_LEN]; 89 | char fileid[MD5_LEN * 2 + 1]; 90 | 91 | uint8_t purl_md5[MD5_LEN]; // purl md5 92 | char purlid[MD5_LEN * 2 + 1]; // purl md5 hex 93 | 94 | uint8_t version_md5[MD5_LEN]; // purl@version md5 95 | char versionid[MD5_LEN * 2 + 1]; // purl@version md5 hex 96 | 97 | char path[MAX_PATH_LEN]; 98 | bool is_attribution_notice; 99 | char url[MAX_ARG_LEN]; 100 | char urlid[MD5_LEN * 2 + 1]; 101 | char download_url[MAX_ARG_LEN]; // Manually specified download URL (-U) 102 | char metadata[MAX_ARG_LEN]; 103 | char license[MAX_ARG_LEN]; // Declared url license 104 | char mined_path[MAX_ARG_LEN]; // Location of output mined/ directory 105 | char mined_extra_path[MAX_ARG_LEN]; // Location of output mined/extra directory 106 | char tmp_dir[MAX_ARG_LEN]; // Temporary directory for decompressing files 107 | bool all_extensions; 108 | bool exclude_mz; 109 | bool exclude_detection; 110 | bool scancode_mode; 111 | char local_mining; 112 | 113 | // minr -i 114 | char dbname[MAX_PATH_LEN]; 115 | char import_path[MAX_PATH_LEN]; 116 | char import_table[MAX_PATH_LEN]; 117 | bool import_overwrite; 118 | bool skip_sort; // Do not sort before importing 119 | bool skip_csv_check; // Do not check number of CSV fields 120 | bool skip_delete; // Do not delete, -k(eep) files after importing 121 | bool mine_all; 122 | bool bin_import; 123 | 124 | // minr -f -t 125 | char join_from[MAX_PATH_LEN]; 126 | char join_to[MAX_PATH_LEN]; 127 | 128 | // minr -z 129 | char mz[MAX_PATH_LEN]; 130 | 131 | // Memory allocation 132 | char *src; // for uncompressed source 133 | uint8_t *zsrc; // for compressed source 134 | uint64_t src_ln; 135 | uint64_t zsrc_ln; 136 | struct mz_cache_item *mz_cache; // for mz cache 137 | struct mz_cache_item * mz_cache_extra; 138 | normalized_license *licenses; // Array of known license identifiers 139 | int license_count; // Number of known license identifiers 140 | 141 | FILE **out_file; 142 | FILE **out_file_extra; 143 | FILE * out_pivot; 144 | FILE *out_pivot_extra; 145 | 146 | }; 147 | 148 | typedef enum { none, license, copyright, quality } metadata; 149 | 150 | 151 | /* File descriptor arrays */ 152 | extern char tmp_path[MAX_ARG_LEN]; 153 | extern int min_file_size; 154 | extern char *ATTRIBUTION_NOTICES[]; 155 | 156 | bool check_dependencies(void); 157 | bool download(struct minr_job *job); 158 | void recurse(struct minr_job *job, char *path); 159 | void minr_join(struct minr_job *job); 160 | void minr_join_mz(char * table, char *source, char *destination, bool skip_delete, bool encrypted); 161 | void mine_license(struct minr_job *job, char *id, bool license_file); 162 | bool mine_license_exec(struct minr_job *job); 163 | void mine_copyright(char *mined_path, char *md5, char *src, uint64_t src_ln, bool license_file); 164 | void mine_quality(char *mined_path, char *md5, char *src, long size); 165 | normalized_license *load_licenses(int *count); 166 | void mine_local_directory(struct minr_job *job, char* root); 167 | void mine_local_file(struct minr_job *job, char *path); 168 | void extract_csv(char *out, char *in, int n, long limit); 169 | int count_chr(char chr, char *str); 170 | int load_file(struct minr_job *job, char *path); 171 | void print_md5(uint8_t *md5); 172 | bool check_file_extension(char * path, bool bin_mode); 173 | #endif 174 | -------------------------------------------------------------------------------- /inc/minr_log.h: -------------------------------------------------------------------------------- 1 | #ifndef __MINR_LOG_H 2 | #define __MINR_LOG_H 3 | #include 4 | 5 | void minr_log(const char *fmt, ...); 6 | void minr_log_path(char * path); 7 | #endif -------------------------------------------------------------------------------- /inc/mz.h: -------------------------------------------------------------------------------- 1 | #ifndef __MINR_MZ_H 2 | #define __MINR_MZ_H 3 | 4 | void mz_cat(struct mz_job *job, char *key); 5 | 6 | typedef enum 7 | { 8 | MZ_OPTIMISE_ALL = 0, 9 | MZ_OPTIMISE_DUP = 1, 10 | MZ_OPTIMISE_ORPHAN = 2, 11 | MZ_OPTIMISE_SQUARENESS = 4, 12 | MZ_OPTIMISE_UNWANTED_HEADER = 16 13 | }mz_optimise_mode_t; 14 | 15 | void mz_optimise(struct mz_job *job, mz_optimise_mode_t mode); 16 | void mz_extract(struct mz_job *job); 17 | 18 | #endif -------------------------------------------------------------------------------- /inc/mz_mine.h: -------------------------------------------------------------------------------- 1 | #ifndef __MZ_MINE_H 2 | #define __MZ_MINE_H 3 | 4 | 5 | void mz_mine_copyright(struct mz_job *job); 6 | void mz_mine_quality(struct mz_job *job); 7 | void mz_mine_license(struct mz_job *job); 8 | void mz_mine_crypto(struct mz_job *job); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /inc/quality.h: -------------------------------------------------------------------------------- 1 | #ifndef __QUALITY_H 2 | #define __QUALITY_H 3 | 4 | void mine_quality(char *mined_path, char *md5, char *src, long size); 5 | #endif 6 | -------------------------------------------------------------------------------- /inc/scancode.h: -------------------------------------------------------------------------------- 1 | #ifndef __SCANCODE_H 2 | #define __SCANCODE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "minr.h" 10 | 11 | bool scancode_prepare_tmp_dir(char * id); 12 | bool scancode_remove_tmp_dir(char *id); 13 | bool scancode_copy_to_tmp(char *path, char *id); 14 | bool scancode_run(char * id, char *csv_file); 15 | bool scancode_check(void); 16 | #endif -------------------------------------------------------------------------------- /inc/trie.h: -------------------------------------------------------------------------------- 1 | /* 2 | // SPDX-License-Identifier: GPL-2.0-or-later 3 | * @file trie.h 4 | * @description Functions to create and search for keywords related to the 5 | * use of cryptographic alorithms 6 | * @date January 29th 2021 7 | * @author Quique 8 | */ 9 | 10 | #ifndef TRIE_H_ 11 | #define TRIE_H_ 12 | #include "malloc.h" 13 | #include 14 | #include 15 | #include 16 | 17 | #define SINIT 0 18 | #define SWORD 1 19 | #define LEAF_COUNT 40 20 | 21 | struct T_TrieNode; 22 | struct T_TrieNode{ 23 | int type; 24 | int ocurrences; 25 | unsigned short coding; 26 | struct T_TrieNode * nodos[LEAF_COUNT]; 27 | //char algorithmName[20]; 28 | char *algorithmName; 29 | }; 30 | 31 | FILE *fp; 32 | char currentName[100]; 33 | unsigned short currentCode=0; 34 | extern struct T_TrieNode * root; 35 | char currWord[50]; 36 | unsigned char currWordLen=0; 37 | unsigned char defState = SINIT; 38 | int isValidChar(char c){ 39 | if(((c>='a')&& (c<='z'))||((c>='A')&& (c<='Z'))) 40 | return 1; 41 | else return 0; 42 | } 43 | 44 | int isValidJoiningChar(char c){ 45 | if(((c=='-')&& (c=='.'))||((c=='_'))) 46 | return 1; 47 | else return 0; 48 | } 49 | /** 50 | @brief Returns the index for a specific valid character 51 | */ 52 | char indexOf(char c){ 53 | if ((c >= 'A') && (c <= 'Z')) c = c + 32; 54 | if((c>='a')&&(c<='z')) return c-'a'; 55 | char sig = 'z'-'a'; 56 | switch(c){ 57 | case '*':return sig+1; 58 | case '.':return sig+2; 59 | case '_':return sig+3; 60 | case '-':return sig+4; 61 | case '0':return sig+5; 62 | case '1':return sig+6; 63 | case '2':return sig+7; 64 | case '3':return sig+8; 65 | case '4':return sig+9; 66 | case '5':return sig+10; 67 | case '6':return sig+11; 68 | case '7':return sig+12; 69 | case '8':return sig+13; 70 | case '9':return sig+14; 71 | default: 72 | return -1; 73 | } 74 | } 75 | /** 76 | @brief inserts a keyword into the seach structure 77 | @description Insert a keyword by following the branches of the tree until a \0 is found. 78 | */ 79 | 80 | 81 | void insert(char *token, struct T_TrieNode *currNode,char* algorithmName, unsigned short coding) 82 | { 83 | 84 | //if(token[0]=='\0') { 85 | if (!*token && !currNode->algorithmName) 86 | { asprintf(&currNode->algorithmName,algorithmName); 87 | currNode->type=1; 88 | currNode->coding=coding; 89 | return; 90 | } 91 | 92 | unsigned int realIndex=indexOf(token[0]); 93 | 94 | if((realIndex<0)||(realIndex >39)) 95 | { 96 | return; 97 | } 98 | if(currNode->nodos[realIndex]==0) 99 | { 100 | currNode->nodos[realIndex]= (struct T_TrieNode*)calloc (1,sizeof (struct T_TrieNode)); 101 | for(int i =0;inodos[realIndex]->nodos[i]=NULL; 103 | currNode->nodos[realIndex]->ocurrences=0; 104 | currNode->nodos[realIndex]->type = -1; 105 | 106 | } 107 | insert(&token[1],currNode->nodos[realIndex],algorithmName,coding); 108 | 109 | } 110 | /** 111 | * @brief Searches a token on the index 112 | * @description Given a T_TrieNode, searches recursively the (sub) token 113 | * deep into the structure. If the whole token manages to 114 | * reach a leaf (type!=-1), the keyword token belongs to an 115 | * encryption algorithm. 116 | * Otherwise, is just a sub string of an algorithm 117 | * (coincidence) */ 118 | struct T_TrieNode * searchAlgorithm(char *token, struct T_TrieNode *node) 119 | { 120 | 121 | 122 | if(token[0]=='\0') 123 | { 124 | if((node!=NULL) && (node->type==-1)) 125 | { 126 | return NULL; 127 | } 128 | else 129 | return node; 130 | } 131 | int indexValid=0; 132 | while(indexOf(token[indexValid])==-1) 133 | { 134 | indexValid++; 135 | 136 | } 137 | unsigned char index = indexOf(token[indexValid]); 138 | if((index<0)||(index >LEAF_COUNT)) 139 | { 140 | return NULL; 141 | } 142 | if(node->nodos[index]==0) 143 | return NULL; 144 | return searchAlgorithm(&token[1],node->nodos[index]); 145 | 146 | } 147 | 148 | /** 149 | * @brief Normalizes the text to lower case. 150 | * @note Expects a \0 to end the normalization. 151 | * It lowers only letters from a to z 152 | */ 153 | 154 | void toLower(char *strToLow) 155 | { 156 | int index=0; 157 | int i=strlen(strToLow); 158 | while(strToLow[index]!='\0'&& i= 'A') && (strToLow[index] <= 'Z')) 161 | strToLow[index]=strToLow[index] + 32 ; 162 | index++; 163 | } 164 | } 165 | 166 | /** 167 | * @brief Loads algotithm definitions from a file 168 | * @param path Scanning directory 169 | * @param fileName name of the file to be scanned. 170 | * @note The absolute path is formed by path/filename. File content is as follows: 171 | * name=. Spaces are NOT allowed. Ends with 172 | coding= a number in bits. There is no validation on this number 173 | */ 174 | void parseFile(char *path,char *fileName,bool destIsSrc) 175 | { 176 | 177 | char include[50]; 178 | char *absolutePath; 179 | asprintf(&absolutePath,"%s/%s",path,fileName); 180 | FILE *fp2; 181 | if ((fp = fopen(absolutePath,"r")) == NULL){ 182 | printf("Error loading crypto definitions file\n"); 183 | free(absolutePath); 184 | exit(1); 185 | } 186 | 187 | if(destIsSrc==true) 188 | { 189 | if ((fp2 = fopen("./inc/crypto_loads.h","a")) == NULL){ 190 | printf("Error creating source definitions file"); 191 | free(absolutePath); 192 | exit(1); 193 | } 194 | 195 | } 196 | while(!feof(fp)){ 197 | char auxName[50]; 198 | char auxLn[50]; 199 | unsigned short auxCode=0; 200 | char match; 201 | fscanf(fp,"%s\r\n",auxLn); 202 | match=sscanf(auxLn,"name=%s",auxName); 203 | if(match==1){ 204 | memset(currentName,0,50); 205 | strcpy(currentName,auxName); 206 | 207 | } else { 208 | match=sscanf(auxLn,"coding=%hd\r\n",&auxCode); 209 | if(match==1){ 210 | currentCode=auxCode; 211 | } else { 212 | match=sscanf(auxLn,"%s",include); 213 | if(match==-1) break; 214 | if(match==1){ 215 | toLower(include); 216 | 217 | if(destIsSrc==true) 218 | fprintf(fp2,"\tinsert(\"%s\",root,\"%s\",%d);\n", include,currentName,currentCode); 219 | else 220 | insert(include,root,currentName,currentCode); 221 | } 222 | } 223 | } 224 | } 225 | fclose(fp); 226 | if(destIsSrc) fclose(fp2); 227 | free(absolutePath); 228 | } 229 | /** 230 | @brief Parses a system directory looking for files containing 231 | * cryptographic keywords 232 | */ 233 | void parseDirectory(char* root,bool destIsSrc){ 234 | struct dirent *de; // Pointer for directory entry 235 | DIR *dr = opendir(root); 236 | printf("Scanning %s\n",root); 237 | if (dr == NULL) { 238 | printf("Could not open current directory" ); 239 | return ; 240 | } 241 | 242 | 243 | while ((de = readdir(dr)) != NULL){ 244 | if(de->d_name[0]=='.') 245 | continue; 246 | parseFile(root,de->d_name,destIsSrc); 247 | } 248 | closedir(dr); 249 | printf("Done!\n"); 250 | // All files have been parsed 251 | } 252 | 253 | void cleanCrypto(struct T_TrieNode *node){ 254 | for(int i=0;inodos[i]!=NULL) 256 | cleanCrypto(node->nodos[i]); 257 | free (node->algorithmName); 258 | free(node); 259 | } 260 | 261 | 262 | 263 | #endif /* TRIE_H_ */ 264 | -------------------------------------------------------------------------------- /inc/url.h: -------------------------------------------------------------------------------- 1 | #ifndef __URL_H 2 | #define __URL_H 3 | 4 | void url_download(struct minr_job *job); 5 | #endif 6 | -------------------------------------------------------------------------------- /inc/wfp.h: -------------------------------------------------------------------------------- 1 | #ifndef __WFP_H 2 | #define __WFP_H 3 | 4 | void wfp_init(char * base_path); 5 | void wfp_free(void); 6 | void mz_wfp_extract(char *path); 7 | 8 | #endif -------------------------------------------------------------------------------- /licenses/AFL-2.0/01.txt: -------------------------------------------------------------------------------- 1 | Licensed under the Academic Free License version 2.0 2 | -------------------------------------------------------------------------------- /licenses/AFL-2.0/02.txt: -------------------------------------------------------------------------------- 1 | The Academic Free License 2 | v. 2.0 3 | -------------------------------------------------------------------------------- /licenses/AFL-2.1/01.txt: -------------------------------------------------------------------------------- 1 | The Academic Free License 2 | v.2.1 3 | -------------------------------------------------------------------------------- /licenses/AFL-2.1/02.txt: -------------------------------------------------------------------------------- 1 | Licensed under the Academic Free License version 2.1 2 | -------------------------------------------------------------------------------- /licenses/AGPL-3.0-only/01.txt: -------------------------------------------------------------------------------- 1 | http://www.gnu.org/licenses/agpl-3.0.txt 2 | -------------------------------------------------------------------------------- /licenses/AGPL-3.0-only/02.txt: -------------------------------------------------------------------------------- 1 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details 2 | -------------------------------------------------------------------------------- /licenses/AGPL-3.0-or-later/01.txt: -------------------------------------------------------------------------------- 1 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 2 | -------------------------------------------------------------------------------- /licenses/AGPL-3.0-or-later/02.txt: -------------------------------------------------------------------------------- 1 | GNU Affero General Public License (GNU AGPL) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version 2 | -------------------------------------------------------------------------------- /licenses/Apache-1.0/01.txt: -------------------------------------------------------------------------------- 1 | http://www.apache.org/licenses/LICENSE-1.0 2 | -------------------------------------------------------------------------------- /licenses/Apache-1.0/02.txt: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 2 | 3 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 4 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 5 | 3. All advertising materials mentioning features or use of this software must display the following acknowledgment: "This product includes software developed by the Apache Group for use in the Apache HTTP server project (http://www.apache.org/)." 6 | 4. The name "Apache Server" and "Apache Group" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 7 | 5. Products derived from this software may not be called "Apache" nor may "Apache" appear in their name, without prior written permission of the Apache Group. 8 | 6. Redistributions of any form whatsoever must retain the following acknowledgment: 9 | 10 | "This product includes software developed by the Apache Group for use in the Apache HTTP server project (http://www.apache.org/)." 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 13 | -------------------------------------------------------------------------------- /licenses/Apache-1.1/01.txt: -------------------------------------------------------------------------------- 1 | http://apache.org/licenses/LICENSE-1.1 2 | -------------------------------------------------------------------------------- /licenses/Apache-1.1/02.txt: -------------------------------------------------------------------------------- 1 | Apache License 1.1 2 | -------------------------------------------------------------------------------- /licenses/Apache-2.0/01.txt: -------------------------------------------------------------------------------- 1 | Apache License, Version 2.0 2 | 3 | -------------------------------------------------------------------------------- /licenses/Apache-2.0/02.txt: -------------------------------------------------------------------------------- 1 | http://www.apache.org/licenses/LICENSE-2.0 2 | -------------------------------------------------------------------------------- /licenses/Apache-2.0/03.txt: -------------------------------------------------------------------------------- 1 | Source code in this repository is covered by one of three licenses: (i) the 2 | Apache License 2.0 (ii) an Apache License 2.0 compatible license (iii) the 3 | Elastic License. 4 | -------------------------------------------------------------------------------- /licenses/Artistic-1.0-Perl/01.txt: -------------------------------------------------------------------------------- 1 | Preamble 2 | 3 | The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. 4 | 5 | Definitions: 6 | 7 | "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. 8 | 9 | "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. 10 | 11 | "Copyright Holder" is whoever is named in the copyright or copyrights for the package. 12 | 13 | "You" is you, if you're thinking about copying or distributing this Package. 14 | 15 | "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) 16 | 17 | "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 18 | 19 | 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 20 | 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 21 | 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: 22 | a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. 23 | b) use the modified Package only within your corporation or organization. 24 | c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. 25 | d) make other distribution arrangements with the Copyright Holder. 26 | 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: 27 | a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. 28 | b) accompany the distribution with the machine-readable source of the Package with your modifications. 29 | c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. 30 | d) make other distribution arrangements with the Copyright Holder. 31 | 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 32 | 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 33 | 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 34 | 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 35 | 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 36 | 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 37 | 38 | -------------------------------------------------------------------------------- /licenses/Artistic-1.0-Perl/02.txt: -------------------------------------------------------------------------------- 1 | Artistic License 1.0 2 | -------------------------------------------------------------------------------- /licenses/BSD-2-Clause-Patent/01.txt: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 2 | 3 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 4 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 5 | 6 | Subject to the terms and conditions of this license, each copyright holder and contributor hereby grants to those receiving rights under this license a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except for failure to satisfy the conditions of this license) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer this software, where such license applies only to those patent claims, already acquired or hereafter acquired, licensable by such copyright holder or contributor that are necessarily infringed by: 7 | 8 | (a) their Contribution(s) (the licensed copyrights of copyright holders and non-copyrightable additions of contributors, in source or binary form) alone; or 9 | (b) combination of their Contribution(s) with the work of authorship to which such Contribution(s) was added by such copyright holder or contributor, if, at the time the Contribution is added, such addition causes such combination to be necessarily infringed. The patent license shall not apply to any other combinations which include the Contribution. 10 | 11 | Except as expressly stated above, no rights or licenses from any copyright holder or contributor is granted under this license, whether expressly, by implication, estoppel or otherwise. 12 | -------------------------------------------------------------------------------- /licenses/BSD-2-Clause/01.txt: -------------------------------------------------------------------------------- 1 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3 | -------------------------------------------------------------------------------- /licenses/BSD-3-Clause/01.txt: -------------------------------------------------------------------------------- 1 | nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 2 | -------------------------------------------------------------------------------- /licenses/BSD-4-Clause-UC/01.txt: -------------------------------------------------------------------------------- 1 | The Regents of the University of California. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 7 | 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by the University of California, Berkeley and its contributors. 8 | 4. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 9 | 10 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 11 | -------------------------------------------------------------------------------- /licenses/BSD-4-Clause/01.txt: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 2 | 3 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 4 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 5 | 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: 6 | This product includes software developed by the organization. 7 | 4. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 8 | 9 | THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 10 | -------------------------------------------------------------------------------- /licenses/BSL-1.0/01.txt: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: 2 | 3 | The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. 4 | 5 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 6 | -------------------------------------------------------------------------------- /licenses/CC0-1.0/01.txt: -------------------------------------------------------------------------------- 1 | CC0 1.0 Universal 2 | -------------------------------------------------------------------------------- /licenses/CDDL-1.0/01.txt: -------------------------------------------------------------------------------- 1 | COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) 2 | -------------------------------------------------------------------------------- /licenses/CPL-1.0/01.txt: -------------------------------------------------------------------------------- 1 | Common Public License 2 | -------------------------------------------------------------------------------- /licenses/EFL-2.0/01.txt: -------------------------------------------------------------------------------- 1 | Eiffel Forum License, version 2 2 | -------------------------------------------------------------------------------- /licenses/EFL-2.0/02.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1. Permission is hereby granted to use, copy, modify and/or distribute this package, provided that: 4 | - copyright notices are retained unchanged, 5 | - any distribution of this package, whether modified or not, includes this license text. 6 | 2. Permission is hereby also granted to distribute binary programs which depend on this package. If the binary program depends on a modified version of this package, you are encouraged to publicly release the modified version of this package. 7 | 8 | THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT WARRANTY. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS PACKAGE. 9 | -------------------------------------------------------------------------------- /licenses/EPL-1.0/01.txt: -------------------------------------------------------------------------------- 1 | Eclipse Public License v1.0 2 | 3 | -------------------------------------------------------------------------------- /licenses/EPL-2.0/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Eclipse Public License - v 2.0 4 | 5 | -------------------------------------------------------------------------------- /licenses/EUPL-1.1/1.txt: -------------------------------------------------------------------------------- 1 | European Union Public Licence V. 1.1 2 | 3 | -------------------------------------------------------------------------------- /licenses/Elastic/1.txt: -------------------------------------------------------------------------------- 1 | Source code in this repository is covered by one of three licenses: (i) the 2 | Apache License 2.0 (ii) an Apache License 2.0 compatible license (iii) the 3 | Elastic License. 4 | -------------------------------------------------------------------------------- /licenses/Elastic/2.txt: -------------------------------------------------------------------------------- 1 | Elastic License 2 | -------------------------------------------------------------------------------- /licenses/FSFULLR/01.txt: -------------------------------------------------------------------------------- 1 | Free Software Foundation gives unlimited permission to copy and/or distribute it, with or without modifications, as long as this notice is preserved. 2 | -------------------------------------------------------------------------------- /licenses/FTL/1.txt: -------------------------------------------------------------------------------- 1 | The FreeType Project LICENSE 2 | -------------------------------------------------------------------------------- /licenses/FTL/2.txt: -------------------------------------------------------------------------------- 1 | The FreeType Project is distributed in several archive packages; some of them may contain, in addition to the FreeType font engine, various tools and contributions which rely on, or relate to, the FreeType Project. 2 | 3 | This license applies to all files found in such packages, and which do not fall under their own explicit license. The license affects thus the FreeType font engine, the test programs, documentation and makefiles, at the very least. 4 | -------------------------------------------------------------------------------- /licenses/GPL-2.0-only/01.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2. This program 2 | -------------------------------------------------------------------------------- /licenses/GPL-2.0-only/02.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms version 2 of the GNU General Public License as published by the Free Software Foundation. 2 | -------------------------------------------------------------------------------- /licenses/GPL-2.0-only/03.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. 2 | 3 | -------------------------------------------------------------------------------- /licenses/GPL-2.0-only/04.txt: -------------------------------------------------------------------------------- 1 | is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditionsof the GNU General Public License, v. 2.0. 2 | 3 | -------------------------------------------------------------------------------- /licenses/GPL-2.0-only/05.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation. 2 | -------------------------------------------------------------------------------- /licenses/GPL-2.0-only/06.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. 2 | -------------------------------------------------------------------------------- /licenses/GPL-2.0-only/07.txt: -------------------------------------------------------------------------------- 1 | http://www.gnu.org/licenses/gpl-2.0.html 2 | -------------------------------------------------------------------------------- /licenses/GPL-2.0-only/08.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE Version 2, June 1991 2 | 3 | -------------------------------------------------------------------------------- /licenses/GPL-2.0-or-later/01.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 2 | 3 | -------------------------------------------------------------------------------- /licenses/GPL-3.0-only/01.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 3. This program 2 | -------------------------------------------------------------------------------- /licenses/GPL-3.0-only/02.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation 2 | -------------------------------------------------------------------------------- /licenses/GPL-3.0-or-later/01.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation either version 3 2 | -------------------------------------------------------------------------------- /licenses/HPND/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Historical Permission Notice and Disclaimer 4 | 5 | -------------------------------------------------------------------------------- /licenses/HPND/2.txt: -------------------------------------------------------------------------------- 1 | Permission to use, copy, modify and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies, and that both that the copyright notice and this permission notice appear in supporting documentation, and that the name of not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. 2 | 3 | DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS . IN NO EVENT SHALL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 4 | 5 | -------------------------------------------------------------------------------- /licenses/IBM-pibs/1.txt: -------------------------------------------------------------------------------- 1 | This source code has been made available to you by IBM on an AS-IS basis. Anyone receiving this source is licensed under IBM copyrights to use it in any way he or she deems fit, including copying it, modifying it, compiling it, and redistributing it either with or without modifications. No license under IBM patents or patent applications is to be implied by the copyright license. 2 | 3 | Any user of this software should understand that IBM cannot provide technical support for this software and will not be responsible for any consequences resulting from the use of this software. 4 | 5 | Any person who transfers this source code or any derivative work must include the IBM copyright notice, this paragraph, and the preceding two paragraphs in the transferred software. 6 | -------------------------------------------------------------------------------- /licenses/ICU/1.txt: -------------------------------------------------------------------------------- 1 | ICU License - ICU 1.8.1 and later 2 | -------------------------------------------------------------------------------- /licenses/ICU/2.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. 4 | 5 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 6 | 7 | Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. 8 | 9 | -------------------------------------------------------------------------------- /licenses/IJG/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Independent JPEG Group License 4 | 5 | -------------------------------------------------------------------------------- /licenses/IJG/2.txt: -------------------------------------------------------------------------------- 1 | In plain English: 2 | 3 | 1. We don't promise that this software works. (But if you find any bugs, please let us know!) 4 | 2. You can use this software for whatever you want. You don't have to pay us. 5 | 3. You may not pretend that you wrote this software. If you use it in a program, you must acknowledge somewhere in your documentation that you've used the IJG code. 6 | 7 | In legalese: 8 | 9 | The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy. 10 | -------------------------------------------------------------------------------- /licenses/IPL-1.0/01.txt: -------------------------------------------------------------------------------- 1 | IBM Public License 2 | -------------------------------------------------------------------------------- /licenses/ISC/1.txt: -------------------------------------------------------------------------------- 1 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 2 | 3 | THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 4 | -------------------------------------------------------------------------------- /licenses/ISC/2.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | ISC License 4 | 5 | -------------------------------------------------------------------------------- /licenses/LGPL-2.1-only/1.txt: -------------------------------------------------------------------------------- 1 | 2 | GNU LESSER GENERAL PUBLIC LICENSE 3 | 4 | Version 2.1, February 1999 5 | 6 | -------------------------------------------------------------------------------- /licenses/LGPL-2.1-only/2.txt: -------------------------------------------------------------------------------- 1 | This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; version 2.1. 2 | 3 | This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 4 | -------------------------------------------------------------------------------- /licenses/LGPL-2.1-or-later/01.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 2 | -------------------------------------------------------------------------------- /licenses/LGPL-2.1-or-later/02.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 2 | -------------------------------------------------------------------------------- /licenses/LGPL-2.1-or-later/03.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2.1 2 | 3 | -------------------------------------------------------------------------------- /licenses/LGPL-3.0-only/1.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | -------------------------------------------------------------------------------- /licenses/LGPL-3.0-only/2.txt: -------------------------------------------------------------------------------- 1 | This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 2 | -------------------------------------------------------------------------------- /licenses/LGPL-3.0-or-later/01.txt: -------------------------------------------------------------------------------- 1 | you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation either version 3 2 | -------------------------------------------------------------------------------- /licenses/Libpng/1.txt: -------------------------------------------------------------------------------- 1 | This copy of the libpng notices is provided for your convenience. In case of any discrepancy between this copy and the notices in the file png.h that is included in the libpng distribution, the latter shall prevail. 2 | -------------------------------------------------------------------------------- /licenses/MIT-CMU/1.txt: -------------------------------------------------------------------------------- 1 | By obtaining, using, and/or copying this software and/or its associated documentation, you agree that you have read, understood, and will comply with the following terms and conditions: 2 | 3 | Permission to use, copy, modify, and distribute this software and its associated documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appears in all copies, and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the copyright holder not be used in advertising or publicity pertaining to distribution of the software without specific, written permission. 4 | 5 | THE COPYRIGHT HOLDER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM THE LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 6 | -------------------------------------------------------------------------------- /licenses/MIT/01.txt: -------------------------------------------------------------------------------- 1 | to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 2 | 3 | The above copyright notice and this permission notice 4 | -------------------------------------------------------------------------------- /licenses/MIT/02.txt: -------------------------------------------------------------------------------- 1 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 5 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 7 | SOFTWARE. 8 | -------------------------------------------------------------------------------- /licenses/MIT/03.txt: -------------------------------------------------------------------------------- 1 | MIT license 2 | -------------------------------------------------------------------------------- /licenses/MIT/04.txt: -------------------------------------------------------------------------------- 1 | Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 2 | 3 | -------------------------------------------------------------------------------- /licenses/MPL-1.1/01.txt: -------------------------------------------------------------------------------- 1 | The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. 2 | -------------------------------------------------------------------------------- /licenses/MPL-2.0-no-copyleft-exception/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3.3. Distribution of a Larger Work 4 | You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 5 | -------------------------------------------------------------------------------- /licenses/MPL-2.0/01.txt: -------------------------------------------------------------------------------- 1 | * This Source Code Form is subject to the terms of the Mozilla Public 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | -------------------------------------------------------------------------------- /licenses/MS-PL/01.txt: -------------------------------------------------------------------------------- 1 | Microsoft Public License 2 | -------------------------------------------------------------------------------- /licenses/MS-RL/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Microsoft Reciprocal License (Ms-RL) 4 | 5 | -------------------------------------------------------------------------------- /licenses/MirOS/1.txt: -------------------------------------------------------------------------------- 1 | Provided that these terms and disclaimer and all copyright notices are retained or reproduced in an accompanying document, permission is granted to deal in this work without restriction, including unlimited rights to use, publicly perform, distribute, sell, modify, merge, give away, or sublicence. 2 | 3 | This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to the utmost extent permitted by applicable law, neither express nor implied; without malicious intent or gross negligence. In no event may a licensor, author or contributor be held liable for indirect, direct, other damage, loss, or other issues arising in any way out of dealing in the work, even if advised of the possibility of such damage or existence of a defect, except proven that it results out of said person's immediate fault when using the work as intended. 4 | -------------------------------------------------------------------------------- /licenses/NBPL-1.0/1.txt: -------------------------------------------------------------------------------- 1 | Net Boolean Public License 2 | 3 | -------------------------------------------------------------------------------- /licenses/NTP/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | NTP License 4 | 5 | -------------------------------------------------------------------------------- /licenses/NTP/2.txt: -------------------------------------------------------------------------------- 1 | Permission to use, copy, modify, and distribute this software and its documentation for any purpose with or without fee is hereby granted, provided that the above copyright notice appears in all copies and that both the copyright notice and this permission notice appear in supporting documentation, and that the name 2 | -------------------------------------------------------------------------------- /licenses/OSL-3.0/1.txt: -------------------------------------------------------------------------------- 1 | Open Software License v. 3.0 2 | -------------------------------------------------------------------------------- /licenses/OSL-3.0/2.txt: -------------------------------------------------------------------------------- 1 | Licensed under the Open Software License version 3.0 2 | -------------------------------------------------------------------------------- /licenses/OpenSSL/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | OpenSSL License 4 | 5 | -------------------------------------------------------------------------------- /licenses/OpenSSL/2.txt: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 2 | 3 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 4 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 5 | 3. All advertising materials mentioning features or use of this software must display the following acknowledgment: "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 6 | 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact openssl-core@openssl.org. 7 | 5. Products derived from this software may not be called "OpenSSL" nor may "OpenSSL" appear in their names without prior written permission of the OpenSSL Project. 8 | 6. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/)" 9 | 10 | -------------------------------------------------------------------------------- /licenses/OpenSSL/3.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package is an SSL implementation written by Eric Young (eay@cryptsoft.com). The implementation was written so as to conform with Netscapes SSL. 4 | 5 | This library is free for commercial and non-commercial use as long as the following conditions are aheared to. The following conditions apply to all code found in this distribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code. The SSL documentation included with this distribution is covered by the same copyright terms except that the holder is Tim Hudson (tjh@cryptsoft.com). 6 | 7 | Copyright remains Eric Young's, and as such any Copyright notices in the code are not to be removed. If this package is used in a product, Eric Young should be given attribution as the author of the parts of the library used. This can be in the form of a textual message at program startup or in documentation (online or textual) provided with the package. 8 | -------------------------------------------------------------------------------- /licenses/PostgreSQL/01.txt: -------------------------------------------------------------------------------- 1 | This software is released under the PostgreSQL Licence 2 | -------------------------------------------------------------------------------- /licenses/PostgreSQL/02.txt: -------------------------------------------------------------------------------- 1 | Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies. IN NO EVENT SHALL 2 | -------------------------------------------------------------------------------- /licenses/Python-2.0/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 4 | 5 | -------------------------------------------------------------------------------- /licenses/Qhull/1.txt: -------------------------------------------------------------------------------- 1 | This software includes Qhull from The Geometry Center. Qhull is copyrighted as noted above. Qhull is free software and may be obtained via http from www.qhull.org. It may be freely copied, modified, and redistributed under the following conditions: 2 | -------------------------------------------------------------------------------- /licenses/RPL-1.5/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Reciprocal Public License 1.5 4 | -------------------------------------------------------------------------------- /licenses/RPL-1.5/2.txt: -------------------------------------------------------------------------------- 1 | The Reciprocal Public License (RPL) is based on the concept of reciprocity or, if you prefer, fairness. 2 | -------------------------------------------------------------------------------- /licenses/SSPL/1.txt: -------------------------------------------------------------------------------- 1 | Server Side Public License 2 | -------------------------------------------------------------------------------- /licenses/UPL-1.0/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | -------------------------------------------------------------------------------- /licenses/UPL-1.0/2.txt: -------------------------------------------------------------------------------- 1 | The above copyright notice and either this complete permission notice or at a minimum a reference to the UPL must be included in all copies or substantial portions of the Software. 2 | -------------------------------------------------------------------------------- /licenses/Unicode-DFS-2015/1.txt: -------------------------------------------------------------------------------- 1 | UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE 2 | 3 | Unicode Data Files include all data files under the directories http://www.unicode.org/Public/, http://www.unicode.org/reports/, and http://www.unicode.org/cldr/data/. Unicode Data Files do not include PDF online code charts under the directory http://www.unicode.org/Public/. Software includes any source code published in the Unicode Standard or under the directories http://www.unicode.org/Public/, http://www.unicode.org/reports/, and http://www.unicode.org/cldr/data/. 4 | -------------------------------------------------------------------------------- /licenses/Unicode-DFS-2016/1.txt: -------------------------------------------------------------------------------- 1 | UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE 2 | 3 | Unicode Data Files include all data files under the directories http://www.unicode.org/Public/, http://www.unicode.org/reports/, http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, http://www.unicode.org/ivd/data/, and http://www.unicode.org/utility/trac/browser/. 4 | -------------------------------------------------------------------------------- /licenses/WTFPL/01.txt: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | -------------------------------------------------------------------------------- /licenses/X11/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | X11 License 4 | 5 | -------------------------------------------------------------------------------- /licenses/X11/2.txt: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 2 | 3 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 4 | 5 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 6 | 7 | Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. 8 | 9 | X Window System is a trademark of X Consortium, Inc. 10 | -------------------------------------------------------------------------------- /licenses/XFree86-1.1/1.txt: -------------------------------------------------------------------------------- 1 | XFree86 License 2 | -------------------------------------------------------------------------------- /licenses/XFree86-1.1/2.txt: -------------------------------------------------------------------------------- 1 | Except as contained in this notice, the name of The XFree86 Project, Inc shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The XFree86 Project, Inc. 2 | -------------------------------------------------------------------------------- /licenses/Zlib/01.txt: -------------------------------------------------------------------------------- 1 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3 | 3. This notice may not be removed or altered from any source distribution. 4 | -------------------------------------------------------------------------------- /licenses/bzip2-1.0.5/01.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | • The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 7 | • Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 8 | • The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. 9 | 10 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 11 | 12 | PATENTS: To the best of my knowledge, bzip2 and libbzip2 do not use any patented algorithms. However, I do not have the resources to carry out a patent search. Therefore I cannot give any guarantee of the above statement. 13 | -------------------------------------------------------------------------------- /licenses/bzip2-1.0.6/01.txt: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 2 | 3 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 4 | 2. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 5 | 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 6 | 4. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. 7 | 8 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 9 | 10 | Julian Seward, jseward@bzip.org bzip2/libbzip2 version 1.0.6 of 6 September 2010 11 | -------------------------------------------------------------------------------- /licenses/curl/01.txt: -------------------------------------------------------------------------------- 1 | Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 2 | 3 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 4 | 5 | Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. 6 | -------------------------------------------------------------------------------- /licenses/libtiff/1.txt: -------------------------------------------------------------------------------- 1 | Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in all copies of the software and related documentation, and (ii) the names of Sam Leffler and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Sam Leffler and Silicon Graphics. 2 | 3 | THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 4 | 5 | IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 6 | -------------------------------------------------------------------------------- /licenses/zlib-acknowledgement/1.txt: -------------------------------------------------------------------------------- 1 | This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. 2 | 3 | Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 4 | 5 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment (see the following) in the product documentation is required. 6 | 7 | Portions Copyright (c) 2002-2007 Charlie Poole or Copyright (c) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright (c) 2000-2002 Philip A. Craig 8 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 9 | 3. This notice may not be removed or altered from any source distribution. 10 | 11 | -------------------------------------------------------------------------------- /package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ### 3 | # SPDX-License-Identifier: GPL-2.0-or-later 4 | # 5 | # Copyright (C) 2018-2023 SCANOSS.COM 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 2 of the License, or 10 | # (at your option) any later version. 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | ### 18 | # 19 | # Package up the local binaries into deb or rpm packages for deployment on a server 20 | # 21 | 22 | if [ "$1" = "-h" ] || [ "$1" = "-help" ] ; then 23 | echo "$0 [-help] " 24 | echo " Create a package of minr" 25 | echo " the package type (deb, rpm)" 26 | echo " version number of the package" 27 | exit 1 28 | fi 29 | if [[ -z "$1" || ( "$1" != "deb" && "$1" != "rpm" ) ]] ; then 30 | echo "ERROR: Please provide a package type: deb or rpm" 31 | exit 1 32 | fi 33 | if [ -z "$2" ] ; then 34 | echo "ERROR: Please provide a package version" 35 | exit 1 36 | fi 37 | 38 | if [ "$1" = "deb" ] ; then 39 | # Add binaries 40 | mkdir -p dist/.debpkg/bin 41 | cp minr dist/.debpkg/bin/minr 42 | chmod +x dist/.debpkg/bin/minr 43 | # Add control file 44 | mkdir -p dist/.debpkg/DEBIAN 45 | cp scripts/debpkg/DEBIAN/control dist/.debpkg/DEBIAN/control 46 | sed -i 's/\MINR_VERSION/'"$2"'/g' dist/.debpkg/DEBIAN/control 47 | # Build package 48 | dpkg-deb -Zxz --root-owner-group --build ./dist/.debpkg/ . 49 | fi 50 | 51 | if [ "$1" = "rpm" ] ; then 52 | mkdir -p dist/.rpmpkg/ 53 | cp minr dist/.rpmpkg/minr 54 | chmod +x ./dist/.rpmpkg/minr 55 | cp scripts/rpmpkg/minr.spec dist/.rpmpkg/minr.spec 56 | sed -i 's/\MINR_VERSION/'"$2"'/g' dist/.rpmpkg/minr.spec 57 | rpmbuild -ba --build-in-place --define "_topdir $(pwd)/dist/rpm" dist/.rpmpkg/minr.spec 58 | fi 59 | 60 | -------------------------------------------------------------------------------- /scripts/debpkg/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: minr 2 | Version: MINR_VERSION 3 | Maintainer: SCANOSS 4 | Architecture: amd64 5 | Depends: libssl1.1 (>= 1.1.0), libc6 (>= 2.4), zlib1g (>= 1:1.1.4) 6 | Description: SCANOSS Mining tool 7 | Minr is a multi-purpose command line tool used for data mining. Minr downloads, indexes and imports source code metadata into the knowledge base. Minr can be also used locally for detecting licences and cryptographic algorithms usage. 8 | License: GPL-2+ 9 | -------------------------------------------------------------------------------- /scripts/rpmpkg/minr.spec: -------------------------------------------------------------------------------- 1 | Name: minr 2 | Version: MINR_VERSION 3 | Release: 1%{?dist} 4 | Summary: SCANOSS Minr 5 | License: GPLv2 6 | BuildArch: x86_64 7 | 8 | %description 9 | Minr is a multi-purpose command line tool used for data mining. Minr downloads, indexes and imports source code metadata into the knowledge base. Minr can be also used locally for detecting licences and cryptographic algorithms usage. 10 | 11 | %prep 12 | 13 | %build 14 | 15 | %install 16 | mkdir -p %{buildroot}/%{_bindir} 17 | install -m 0755 %{name} %{buildroot}/%{_bindir}/%{name} 18 | 19 | %files 20 | %{_bindir}/%{name} 21 | 22 | %changelog -------------------------------------------------------------------------------- /src/attributions.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/attributions.c 4 | * 5 | * Attribution notices functions 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | /** 24 | * @file attributions.c 25 | * @date 19 October 2021 26 | * @brief Contains the functions for processing attribution and notices. 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include "hex.h" 33 | #include "ignorelist.h" 34 | #include "ldb.h" 35 | #include "minr.h" 36 | #include "scancode.h" 37 | #include "file.h" 38 | #include 39 | #include 40 | 41 | char *ATTRIBUTION_NOTICES[] = 42 | { 43 | "COPYING", 44 | "COPYING.lib", 45 | "LICENSE", 46 | "LICENSE.md", 47 | "LICENSE.txt", 48 | "LICENSE-Community.txt", 49 | "LICENSES", 50 | "NOTICE", 51 | NULL}; 52 | 53 | const char *LICENSE_PATTERN[] = {"LIC", "COPY"}; 54 | const char *LICENSE_PATTERN_START_WITH[] = {"NOTICE"}; 55 | 56 | /** 57 | * @brief Verify if the filename is an attribution notice 58 | * 59 | * @param path 60 | * @return true 61 | */ 62 | bool is_attribution_notice(char *path) 63 | { 64 | char *file = basename(path); 65 | if (!file) 66 | return true; 67 | if (!*file) 68 | return true; 69 | 70 | int i = 0; 71 | while (ATTRIBUTION_NOTICES[i]) 72 | if (stricmp(ATTRIBUTION_NOTICES[i++], file)) 73 | return true; 74 | 75 | return false; 76 | } 77 | 78 | /** 79 | * @brief Write entry id to attribution.csv 80 | * 81 | * @param job pointer to minr job 82 | */ 83 | void attribution_add(struct minr_job *job) 84 | { 85 | char path[MAX_PATH_LEN] = "\0"; 86 | sprintf(path, "%s/%s.csv", job->mined_path, TABLE_NAME_ATTRIBUTION); 87 | 88 | char notice_id[MD5_LEN * 2 + 1] = "\0"; 89 | ldb_bin_to_hex(job->md5, MD5_LEN, notice_id); 90 | 91 | FILE *fp = fopen(path, "a"); 92 | if (!fp) 93 | { 94 | printf("Cannot create file %s\n", path); 95 | exit(EXIT_FAILURE); 96 | } 97 | fprintf(fp, "%s,%s\n", job->purlid, notice_id); 98 | fclose(fp); 99 | } 100 | 101 | 102 | /** 103 | * @brief Check if a given file meets one of the name patter specified in LICENSE_PATTERN 104 | * 105 | * @param path Path to the file 106 | */ 107 | static bool validate_file(char *path) 108 | { 109 | if (!is_file(path)) 110 | return false; 111 | 112 | char *file_name = strrchr(path, '/'); //find the las / 113 | if (!file_name) //if there is not / then point to the path 114 | file_name = path; 115 | else 116 | file_name++; //skip the bar 117 | 118 | char upper_file_name[strlen(file_name) + 1]; 119 | memset(upper_file_name, 0, sizeof(upper_file_name)); 120 | int i = 0; 121 | while (*file_name) 122 | { 123 | upper_file_name[i] = toupper(*file_name); 124 | i++; 125 | file_name++; 126 | } 127 | 128 | for (int j = 0; j < sizeof(LICENSE_PATTERN)/sizeof(LICENSE_PATTERN[0]); j++) 129 | { 130 | if (strstr(upper_file_name, LICENSE_PATTERN[j])) 131 | { 132 | return true; 133 | } 134 | } 135 | 136 | for (int j = 0; j < sizeof(LICENSE_PATTERN_START_WITH)/sizeof(LICENSE_PATTERN_START_WITH[0]); j++) 137 | { 138 | if (!strncmp(upper_file_name, LICENSE_PATTERN_START_WITH[j], strlen(LICENSE_PATTERN_START_WITH[j]))) 139 | { 140 | return true; 141 | } 142 | } 143 | 144 | 145 | return false; 146 | } 147 | 148 | /** 149 | * @brief Find files in to a give directory that math the name patter specified in LICENSE_PATTERN and process those. 150 | * 151 | * @param job pointer to miner job struct 152 | * @return true if at least one file was found 153 | */ 154 | static bool find_files(struct minr_job *job) 155 | { 156 | DIR *dp; 157 | struct dirent *entry; 158 | 159 | bool found = false; 160 | char *path = job->tmp_dir; 161 | if (!(dp = opendir(path))) 162 | return found; 163 | 164 | while ((entry = readdir(dp))) 165 | { 166 | if (valid_path(path, entry->d_name)) 167 | { 168 | /* Assemble path */ 169 | char tmp_path[MAX_PATH_LEN] = "\0"; 170 | sprintf(tmp_path, "%s/%s", path, entry->d_name); 171 | 172 | /* File discrimination check #1: Is this an actual file? */ 173 | if (validate_file(tmp_path)) 174 | { 175 | if (job->scancode_mode) 176 | scancode_copy_to_tmp(tmp_path, job->versionid); 177 | 178 | if (load_file(job, tmp_path)) 179 | mine_license(job, job->versionid, true); 180 | found = true; 181 | } 182 | } 183 | } 184 | 185 | if (dp) 186 | closedir(dp); 187 | return found; 188 | } 189 | /** 190 | * @brief Execute the licese detection for a minr job over the matching files with the LICENSE_PATTERN. 191 | * 192 | * @param path Path to the file 193 | */ 194 | bool mine_license_exec(struct minr_job *job) 195 | { 196 | char *csv_path = NULL; 197 | /* Assemble csv path */ 198 | if (!job->local_mining) 199 | asprintf(&csv_path, "%s/%s.csv", job->mined_path, TABLE_NAME_LICENSE); 200 | 201 | if (job->scancode_mode) 202 | scancode_prepare_tmp_dir(job->versionid); 203 | 204 | if (find_files(job)) 205 | { 206 | if (job->scancode_mode) 207 | scancode_run(job->versionid, csv_path); 208 | } 209 | 210 | if (job->scancode_mode) 211 | scancode_remove_tmp_dir(job->versionid); 212 | 213 | 214 | free(csv_path); 215 | 216 | return true; 217 | } 218 | 219 | /** 220 | * @brief Append attribution notice to archive 221 | * 222 | * @param job pointer to mnir job 223 | * @param path string path 224 | */ 225 | void mine_attribution_notice(struct minr_job *job, char *path) 226 | { 227 | /* Reload file after license analysis */ 228 | if (!load_file(job, path)) 229 | return; 230 | 231 | /* Write entry to mined/attribution.csv */ 232 | attribution_add(job); 233 | 234 | /* Create sources directory */ 235 | char mzpath[LDB_MAX_PATH * 2]; 236 | sprintf(mzpath, "%s/notices", job->mined_path); 237 | 238 | ldb_prepare_dir(mzpath); 239 | 240 | /* Compress data */ 241 | job->zsrc_ln = compressBound(job->src_ln + 1); 242 | job->zsrc =calloc((job->zsrc_ln + 128), 1); 243 | 244 | /* Save the first bytes of zsrc to accomodate the MZ header */ 245 | compress(job->zsrc + MZ_HEAD, &job->zsrc_ln, (uint8_t *)job->src, job->src_ln + 1); 246 | uint32_t zln = job->zsrc_ln; 247 | 248 | /* Only the last 14 bytes of the MD5 go to the mz record (first two bytes are the file name) */ 249 | memcpy(job->zsrc, job->md5 + 2, MZ_MD5); 250 | 251 | /* Add the 32-bit compressed file length */ 252 | memcpy(job->zsrc + MZ_MD5, (char *)&zln, MZ_SIZE); 253 | 254 | int mzid = uint16(job->md5); 255 | int mzlen = job->zsrc_ln + MZ_HEAD; 256 | 257 | sprintf(mzpath, "%s/notices/%04x.mz", job->mined_path, mzid); 258 | FILE *f = fopen(mzpath, "a"); 259 | if (f) 260 | { 261 | size_t written = fwrite(job->zsrc, mzlen, 1, f); 262 | if (!written) 263 | { 264 | printf("Error writing %s\n", mzpath); 265 | exit(EXIT_FAILURE); 266 | } 267 | fclose(f); 268 | } 269 | 270 | mine_copyright(job->mined_path, job->purlid, job->src, job->src_ln, true); 271 | free(job->src); 272 | free(job->zsrc); 273 | 274 | } 275 | -------------------------------------------------------------------------------- /src/copyright.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/copyright.c 4 | * 5 | * SCANOSS Copyright detection subroutines 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | 24 | /** 25 | * @file copyright.c 26 | * @date 9 June 2021 27 | * @brief Implement functions used for copyright processing. 28 | */ 29 | 30 | #include 31 | 32 | #include "minr.h" 33 | #include "copyright.h" 34 | 35 | bool is_file(char *path); 36 | bool is_dir(char *path); 37 | bool not_a_dot(char *path); 38 | bool strn_icmp(char *a, char *b, int len); 39 | int count_nonalnum(char *str); 40 | int count_alnum(char *str); 41 | int linelen(char *str); 42 | 43 | /** 44 | * @brief Determines whether a string begins with the characters of a specified string 45 | * 46 | * @param str Long string 47 | * @param start Short string 48 | * @return true if the given characters are found at the beginning of the string; otherwise, false. 49 | */ 50 | bool string_starts_with(char *str, char *start) 51 | { 52 | int len = strlen(start); 53 | if (strn_icmp(str, start, len)) return true; 54 | return false; 55 | } 56 | 57 | /** 58 | * @brief Returns true if word copyright is followed by non wanted words 59 | * 60 | * @param str 61 | * @return true 62 | * @return false 63 | */ 64 | bool ignore_copyright(char *str) 65 | { 66 | if (string_starts_with(str, "copyright notice")) return true; 67 | if (string_starts_with(str, "copyright ownership")) return true; 68 | if (string_starts_with(str, "copyright laws")) return true; 69 | if (string_starts_with(str, "copyright law.")) return true; 70 | if (string_starts_with(str, "copyright_")) return true; 71 | if (string_starts_with(str, "copyright and ")) return true; 72 | return false; 73 | } 74 | 75 | /** 76 | * @brief Search in src an '@author' doxygen tag 77 | * 78 | * @param src String to search the tag 79 | * @return true exists the tag, false otherwise. 80 | */ 81 | bool is_author(char *src) 82 | { 83 | int tag_len = 0; 84 | 85 | if (strn_icmp(src,"@author", 7)) 86 | { 87 | tag_len = 7; // length of "@author" 88 | } 89 | 90 | if (!tag_len) return false; 91 | 92 | if (linelen(src) > MAX_COPYRIGHT_LEN) return false; 93 | 94 | if (count_alnum(src + tag_len) < MIN_ALNUM_IN_COPYRIGHT) return false; 95 | if (count_nonalnum(src + tag_len) > MAX_NONALNUM_IN_COPYRIGHT) return false; 96 | 97 | return true; 98 | } 99 | 100 | 101 | /** 102 | * @brief Verify if the string src contains a copyright declaration 103 | * 104 | * @param src String to search the copyright 105 | * @return true If the string contains a copyright declaration, false otherwise. 106 | */ 107 | bool is_copyright(char *src) 108 | { 109 | int tag_len = 0; 110 | 111 | if (strn_icmp(src,"(C)", 3)) 112 | { 113 | tag_len = 3; // length of "(C)" 114 | } 115 | 116 | if (!tag_len) if (strn_icmp(src,"Copyright", 9)) 117 | { 118 | tag_len = 9; // length of "Copyright" 119 | if (ignore_copyright(src)) return false; 120 | } 121 | 122 | if (!tag_len) return false; 123 | 124 | if (linelen(src) > MAX_COPYRIGHT_LEN) return false; 125 | 126 | if (count_alnum(src + tag_len) < MIN_ALNUM_IN_COPYRIGHT) return false; 127 | if (count_nonalnum(src + tag_len) > MAX_NONALNUM_IN_COPYRIGHT) return false; 128 | 129 | return true; 130 | } 131 | 132 | /** 133 | * @brief Calculate the length of the copyright until end of line or end of txt or MAX_COPYRIGHT_LEN 134 | * 135 | * @param txt 136 | * @return int 137 | */ 138 | int copyright_len(char *txt) 139 | { 140 | for (int i = 0; i < MAX_COPYRIGHT_LEN; i++) 141 | { 142 | if (txt[i] == 0 || txt[i] == '\n') return i + 1; 143 | } 144 | return MAX_COPYRIGHT_LEN; 145 | } 146 | 147 | /** 148 | * @brief Allocates memory, copies copyright declaration and returns pointer (or NULL) 149 | * 150 | * @param txt 151 | * @return char* 152 | */ 153 | char *extract_copyright(char *txt) 154 | { 155 | int len = copyright_len(txt); 156 | if (!len) return NULL; 157 | 158 | char *copyright = malloc(len + 1); 159 | memcpy(copyright, txt, len); 160 | copyright[len] = 0; 161 | if (copyright[len - 1] == '\n') copyright[len - 1] = 0; 162 | 163 | char_replace(copyright, ',', ';'); 164 | 165 | return copyright; 166 | } 167 | 168 | /** 169 | * @brief Extract a copyright statement from src 170 | * Copyright sources 171 | * 0 = Declared in component 172 | * 1 = Detected in file header 173 | * 2 = Declared in LICENSE file 174 | * 175 | * @param mined_path 176 | * @param md5 177 | * @param src 178 | * @param src_ln 179 | * @param license_file 180 | */ 181 | void mine_copyright(char *mined_path, char *md5, char *src, uint64_t src_ln, bool license_file) 182 | { 183 | /* Max bytes/lines to analyze */ 184 | int max_bytes = MAX_FILE_HEADER; 185 | if (src_ln < max_bytes) max_bytes = src_ln; 186 | int max_lines = 20; 187 | int line = 0; 188 | 189 | /* Assemble csv path */ 190 | char csv_path[MAX_PATH_LEN] = "\0"; 191 | if (mined_path) 192 | { 193 | strcpy(csv_path, mined_path); 194 | strcat(csv_path, "/"TABLE_NAME_COPYRIGHT".csv"); 195 | } 196 | 197 | char *s = src; 198 | while (*s) 199 | { 200 | bool extract = false; 201 | 202 | /* If we find an opening bracket, we assume the header already ended */ 203 | if (*s == '{') break; 204 | if (*s == '\n') line++; 205 | 206 | else 207 | { 208 | if (is_copyright(s)) extract = true; 209 | if (!extract) if (is_author(s)) 210 | { 211 | extract = true; 212 | s += 8; // Skip "@author " 213 | } 214 | } 215 | 216 | if (extract) 217 | { 218 | char *copyright = extract_copyright(s); 219 | if (copyright) 220 | { 221 | if (*csv_path) 222 | { 223 | FILE *fp = fopen(csv_path, "a"); 224 | if (license_file) 225 | fprintf(fp, "%s,2,%s\n", md5, copyright); 226 | else 227 | fprintf(fp, "%s,1,%s\n", md5, copyright); 228 | fclose(fp); 229 | } 230 | else printf("%s,%s\n", md5, copyright); 231 | 232 | free(copyright); 233 | return; 234 | } 235 | } 236 | 237 | if (((s++)-src) > max_bytes || line > max_lines) return; 238 | } 239 | return; 240 | } 241 | -------------------------------------------------------------------------------- /src/help.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/help.c 4 | * 5 | * Minr help 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | /** 24 | * @file help.c 25 | * @date 19 October 2021 26 | * @brief Contains the help function 27 | */ 28 | 29 | #include "minr.h" 30 | #include "help.h" 31 | void show_help () 32 | { 33 | printf("\n"); 34 | printf("SCANOSS minr v%s\n", MINR_VERSION); 35 | printf("\n"); 36 | 37 | printf("Description:\n"); 38 | printf("\n"); 39 | printf("Minr is used to data mine a URL or file. Information is saved in a mined/ directory for\n"); 40 | printf("importation into the SCANOSS Knowledgebase. Minr collects metadata and code snippet\n"); 41 | printf("fingerprints for the provided URL or file. Output is saved in different data structures\n"); 42 | printf("in ./mined/ or in the directory specified.\n"); 43 | printf("\n"); 44 | 45 | printf("Mining URLs: Minr performs download, extraction, indexing and archive of files for the provided URL.\n"); 46 | printf("minr -d METADATA -u URL\n"); 47 | printf("\n"); 48 | printf("-d METADATA Comma separated list of vendor,component,version,release_date,license,purl\n"); 49 | printf("-u URL Url to be mined (it also accepts a local folder)\n"); 50 | printf("-U URL Optional URL to be recorded instead of the mined one (-u)\n"); 51 | printf("-S For SCANCODE license mining\n"); 52 | printf("-A For extra-tables mode (mine everything). The ignored files will be mined inside the mined/extra directory\n"); 53 | printf("\n"); 54 | 55 | printf("Mining configuration:\n"); 56 | printf("\n"); 57 | printf("-a Process all files, regardless of their extensions (default: off)\n"); 58 | printf("-x Exclude .mz generation (do not keep a copy of the original source code)\n"); 59 | printf("-X Exclude metadata detection (license, copyright, quality, etc)\n"); 60 | printf("\n"); 61 | 62 | printf("Mining snippet WFP: Minr extracts snippet fingerprint from all code in a .mz arhive (mined/sources/)\n"); 63 | printf("into mined/%s/\n", TABLE_NAME_WFP); 64 | printf("-z DIRECTORY Indicates the location of the mined/ directory\n"); 65 | printf("\n"); 66 | 67 | printf("Merging mined/ data: Mined data is organized in directories and contained in files with:\n"); 68 | printf(".csv (components, files, licenses, vulnerabilities, quality, etc),\n"); 69 | printf(".bin (wfp snippets)\n"); 70 | printf(".mz (original source code).\n"); 71 | printf("\n"); 72 | 73 | printf("All these formats can be aggregated by concatenation. Minr provides a mined/ joining function:\n"); 74 | printf("\n"); 75 | printf("-f DIR Merge source DIR\n"); 76 | printf("-t DIR into destination DIR (and erase source DIR)\n"); 77 | printf("\n"); 78 | printf("Example minr -f dir1/mined -t dir2/mined\n"); 79 | printf("\n"); 80 | 81 | printf("Importing mined/ data into the LDB:\n"); 82 | printf("\n"); 83 | 84 | printf("-i DIR Import the mined DIRectory into the LDB database.\n\ 85 | A JSON file called \"version.json\" must be present into the mined directory with the following format:\n\ 86 | {\"monthly\":\"YY.MM\", \"daily\":\"YY.MM.DD\"}. NOTE 1: It is mandatory at lest one of these keys in version.json\n"); 87 | printf(" Note 2: data in DIR is wiped after imported)\n"); 88 | printf("-b Import in binary mode: take a base64 encoded csv and insert in the KB as binary. libscanoss-encoder must be present in the system\n"); 89 | printf("-D Set the OSS DB name (default: oss)\n"); 90 | printf("-I TABLE Restrict importation to a specific table\n"); 91 | printf("-O Overwrite destination data rather than appending (MAY LEAD TO DATA LOSS)\n"); 92 | printf("\n\n"); 93 | printf("Local mining:\n\n"); 94 | printf("-L TARGET Analyse file/directory (and sub directories) to detect license license declarations \n"); 95 | printf("-C TARGET Analyse file/directory (and sub directories) to detect copyrigths \n"); 96 | printf("-Q TARGET Analyse file/directory (and sub directories) for evaluating code quality\n"); 97 | printf("-Y TARGET Analyse file/directory (and sub directories) to detect cryptographic algorithms usage. \n"); 98 | printf("\n"); 99 | printf("Misc options:\n"); 100 | printf("\n"); 101 | 102 | printf("-l DIR Auto-generates license_ids.c (used by unmz for license detection) from DIR\n"); 103 | printf("-c DIR Auto-generates crypto_loads.h (used by crypto.c for cryptographic detection) from DIR\n"); 104 | printf("-o Set location for the mined/ output directory (defaults to current directory)\n"); 105 | printf("-s Skip sorting of .csv and .bin files before importing (-i)\n"); 106 | printf("-T Set absolute temporary directory (defaults to /dev/shm)\n"); 107 | printf("-n Skip number of csv fields checking in url and file importation (-i)\n"); 108 | printf("-k Keep files after merging or importing\n"); 109 | printf("-V FILE Print verbose output to file\n"); 110 | printf("-v Display version and exit\n"); 111 | printf("-h Display this help and exit\n"); 112 | printf("\n"); 113 | printf("Copyright (C) 2018-2021 SCANOSS.COM\n"); 114 | printf("\n"); 115 | } 116 | 117 | -------------------------------------------------------------------------------- /src/hex.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/hex.c 4 | * 5 | * Hexadecimal and numeric conversions 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | /** 24 | * @file hex.c 25 | * @date 7 Feb 2021 26 | * @brief Helper functions to work with Hex and Dec conversions 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | #include "hex.h" 34 | /** 35 | * @brief Prints a hexdump of 'len' bytes from 'data' organized 'width' columns 36 | * 37 | * @param data pointer to data buffer 38 | * @param len data lenght 39 | * @param width columns width 40 | */ 41 | void hexprint(uint8_t *data, uint32_t len, uint8_t width) 42 | { 43 | uint8_t b16[] = "0123456789abcdef"; 44 | for (int i = 0; i <= width * (int)((len + width) / width); i++) 45 | if (i && !(i % width)) 46 | { 47 | printf("%04d ", i - width); 48 | for (int t = i - width; t < i; t++) 49 | printf("%c%c", t < len ? b16[(data[t] & 0xF0) >> 4] : 32, t < len ? b16[data[t] & 0x0F] : 32); 50 | printf(" "); 51 | for (int t = i - width; t < i; t++) 52 | printf("%c", t < len ? ((data[t] > 31 && data[t] < 127) ? data[t] : 46) : 32); 53 | printf("\n"); 54 | if (i == len) 55 | break; 56 | } 57 | } 58 | 59 | 60 | /** 61 | * @brief Returns a hexadecimal representation of the first "len" bytes in "bin" 62 | * 63 | * @param bin pointer to data buffer 64 | * @param len data buffer len 65 | * @return string with hexadecimal representation 66 | */ 67 | char *bin_to_hex(uint8_t *bin, uint32_t len) 68 | { 69 | char digits[] = "0123456789abcdef"; 70 | char *out = malloc (2 * len + 1); 71 | uint32_t ptr = 0; 72 | 73 | for (uint32_t i = 0; i < len; i++) 74 | { 75 | out[ptr++] = digits[(bin[i] & 0xF0) >> 4]; 76 | out[ptr++] = digits[bin[i] & 0x0F]; 77 | } 78 | 79 | out[ptr]=0; 80 | return out; 81 | } 82 | 83 | /** 84 | * @brief Joins two chars into a single int. It does c1 | c2 << 8 85 | * 86 | * IMPORTANT: data must be an array of at least 2 bytes. 87 | * 88 | * @param data A pointer to the first char 89 | * @return return a uint16_t 90 | */ 91 | uint16_t uint16(uint8_t *data) 92 | { 93 | return 256 * data[0] + data[1]; 94 | } 95 | 96 | 97 | /** 98 | * @brief Reverse an uint32 number 99 | * Example: AABBCCDD -> DDCCBBAA 100 | * 101 | * @param data pointer to the number to be inverted 102 | */ 103 | void uint32_reverse(uint8_t *data) 104 | { 105 | uint8_t tmp = data[0]; 106 | data[0] = data[3]; 107 | data[3] = tmp; 108 | tmp = data[1]; 109 | data[1] = data[2]; 110 | data[2] = tmp; 111 | } 112 | -------------------------------------------------------------------------------- /src/ignored_extensions.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/ignored_extensions.c 4 | * 5 | * Ignored file extensions 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | /** 24 | * @file ignored_extensions.c 25 | * @date 26 October 2021 26 | * @brief Define the extension to be ignored 27 | */ 28 | 29 | #include 30 | 31 | /* File extensions to be skipped */ 32 | char *IGNORED_EXTENSIONS[] = { 33 | 34 | /* File extensions */ 35 | ".1", ".2", ".3", ".4", ".5", ".6", ".7", ".8", ".9", ".ac", ".adoc", ".am", 36 | ".asc", ".asciidoc", ".bmp", ".build", ".cfg", ".chm", ".cmake", 37 | ".cnf", ".conf", ".config", ".contributors", ".copying", ".crt", ".csproj", 38 | ".css", ".csv", ".cvsignore", ".dat", ".data", ".db", ".doc", ".ds_store", 39 | ".dtd", ".dts", ".dtsi", ".dump", ".eot", ".eps", ".geojson", ".gdoc", ".gif", 40 | ".gitignore", ".glif", ".gmo", ".gradle", ".guess", ".hex", ".htm", ".html", 41 | ".ico", ".in", ".inc", ".info", ".ini", ".ipynb", ".jpeg", ".jpg", ".json", 42 | ".jsonld", ".log", ".m4", ".map", ".markdown", ".md", ".md5", ".meta", ".mk", 43 | ".mxml", ".o", ".otf", ".out", ".pbtxt", ".pdf", ".pem", ".phtml", ".plist", 44 | ".png", ".po", ".ppt", ".prefs", ".properties", ".pyc", ".qdoc", ".result", 45 | ".rgb",".rst", ".rtf", ".scss", ".sha", ".sha1", ".sha2", ".sha256", ".sln", 46 | ".spec", ".sql", ".sub", ".svg", ".svn-base", ".tab", ".template", ".test", 47 | ".tex", ".tiff", ".toml", ".ttf", ".txt", ".utf-8", ".vim", ".wav", ".whl", 48 | ".woff", ".xht", ".xhtml", ".xls", ".xml", ".xpm", ".xsd", ".xul", ".yaml", 49 | ".yml", ".LAS",".adk",".asc",".cif",".cli",".cosmo",".deploy", 50 | ".dfm",".dmm",".fa",".fasta",".fcb",".flm",".fna",".gbr",".gen",".gro", 51 | ".hgtags",".hh",".ihex",".kp",".mpx",".pdb",".poly",".prn",".ps",".ref", 52 | ".resx",".smp",".stg",".tfa",".tsv",".vcf",".vhd",".xy",".xyz", 53 | 54 | 55 | /* File endings */ 56 | "-DOC", "CHANGELOG", "CONFIG", "COPYING", "COPYING.LIB", "LICENSE", 57 | "LICENSE.MD", "LICENSE.TXT", "LICENSES", "MAKEFILE", "NOTICE", "NOTICE", 58 | "README", "SWIFTDOC", "TEXIDOC", "TODO", "VERSION", 59 | 60 | /* End with null */ 61 | NULL 62 | }; 63 | 64 | /* Extensions that will skip snippet mining */ 65 | char *SKIP_MZ_EXTENSIONS[] = {".min.js", ".MF", ".base64", ".s", NULL}; 66 | -------------------------------------------------------------------------------- /src/ignored_files.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/ignore_file.c 4 | * 5 | * Big blob with file IDs to ignore 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | /** 24 | * @file ignored_files.c 25 | * @date 28 June 2021 26 | * @brief Define the files to be ignores 27 | */ 28 | 29 | #include 30 | #include "minr.h" 31 | 32 | char IGNORE_FILE[] = "\ 33 | 0962291d6d367570bee5454721c17e11\ 34 | 0f3006e20d30987b4fdd49c4a0adf342\ 35 | 1244d3f2f28ecc6619157927aca95200\ 36 | 2c58c801945b382ae168280eb80092b6\ 37 | 327711a461a30ba31b918dc30a08ccae\ 38 | 34ea47c60598f102697b4476b742f873\ 39 | 375ddea382b6c56a7be2a967a20e0ab5\ 40 | 3a55d95595a6f9e37dee53826b4daff2\ 41 | 41876349cb12d6db992f1309f22df3f0\ 42 | 42679f369206e3da1495ed8abf870cee\ 43 | 443141a90f711430c1423855b273d2fa\ 44 | 448c34a56d699c29117adc64c43affeb\ 45 | 4a010b8264c9873452f055748133bb29\ 46 | 54542dc54ebae0de4502a1319144538f\ 47 | 72b0b8f922dc7f125c7aaed79f9d274a\ 48 | 76cdb2bad9582d23c1f6f4d868218d6c\ 49 | 80cb6cf2fe634fe0eaa8a32ce59bee73\ 50 | 8111d301bde6dd4875417be5a9d12fd5\ 51 | 86bc7f6bce545c75611d599acec5d494\ 52 | 8f68037672effa2917b28650c7cbce1f\ 53 | 93fb6cea8fc778af4030da1ceb7d4f60\ 54 | 96ba0a444d087ae06f32319ca4f0a3e4\ 55 | 97471e1a0beb9650905b574145ae4638\ 56 | 9c64fec71a86faf860632aca64da7ef1\ 57 | a670520d9d36833b3e28d1e4b73cbe22\ 58 | abd1ac26aaea8b55ff1eefd6caca1e55\ 59 | b03f60eea43420aef3ecd1f96c455d97\ 60 | c9eb740112b98a4ffa4b6e8965caa81f\ 61 | d3e3748e06793d488ae92138dd974ef8\ 62 | de8ffdb592ab304b14832467aef77cb3\ 63 | e24114dd1624e26140c00c0d49ba9837\ 64 | e909b282419acd3b63f5fb68db3bbc9b\ 65 | f10f4e8a24a6f29f60f73caf7341f44d\ 66 | fdb446fc9fbdb44dd511ce3d449504b0"; 67 | 68 | /** 69 | * @brief 70 | * 71 | * @param file_id 72 | * @return true 73 | */ 74 | bool ignored_file(char *file_id) 75 | { 76 | char *ignore_id = IGNORE_FILE; 77 | while (*ignore_id) 78 | { 79 | if (!memcmp(file_id, ignore_id, MD5_LEN_HEX)) return true; 80 | ignore_id += MD5_LEN_HEX; 81 | } 82 | return false; 83 | } 84 | -------------------------------------------------------------------------------- /src/minr_log.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "minr_log.h" 5 | 6 | static char log_file[FILENAME_MAX] = "\0"; 7 | 8 | void minr_log_path(char * path) 9 | { 10 | strcpy(log_file, path); 11 | } 12 | 13 | /** 14 | * @brief Print the logs in stderr 15 | * @param fmt string to be printed 16 | * @param ... //TODO 17 | */ 18 | void minr_log(const char *fmt, ...) 19 | { 20 | if (!*log_file) return; 21 | 22 | va_list args; 23 | va_start(args, fmt); 24 | 25 | FILE *log = fopen(log_file, "a"); 26 | if (!log) 27 | { 28 | fprintf(stderr, "Warning: Cannot access the log file\n"); 29 | return; 30 | } 31 | /* Add entry to log */ 32 | if (*fmt) 33 | vfprintf(log, fmt, args); 34 | 35 | fclose(log); 36 | va_end(args); 37 | } -------------------------------------------------------------------------------- /src/mz_mine.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/mz_mine.c 4 | * 5 | * Meta functions to mine data from MZ archives 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | /** 24 | * @file mz_mine.c 25 | * @date 9 June 2021 26 | * @brief Implement the mz mine functions 27 | */ 28 | 29 | #include 30 | #include "minr.h" 31 | #include "ldb.h" 32 | #include "copyright.h" 33 | #include "quality.h" 34 | #include "license.h" 35 | #include "mz_mine.h" 36 | #include "crypto.h" 37 | 38 | /** 39 | * @brief 40 | * 41 | * @param job 42 | * @return true 43 | * @return false 44 | */ 45 | bool mz_quality_handler(struct mz_job *job) 46 | { 47 | /* Decompress */ 48 | mz_deflate(job); 49 | 50 | /* Fill MD5 with item id */ 51 | mz_id_fill(job->md5, job->id); 52 | 53 | /* Mine license */ 54 | mine_quality(NULL, job->md5, job->data, job->data_ln); 55 | 56 | return true; 57 | } 58 | 59 | /** 60 | * @brief 61 | * 62 | * @param job 63 | */ 64 | void mz_mine_quality(struct mz_job *job) 65 | { 66 | /* Extract first two MD5 bytes from the file name */ 67 | memcpy(job->md5, basename(job->path), 4); 68 | 69 | /* Read source mz file into memory */ 70 | job->mz = file_read(job->path, &job->mz_ln); 71 | 72 | /* Launch quality mining */ 73 | mz_parse(job, mz_quality_handler); 74 | 75 | free(job->mz); 76 | } 77 | 78 | 79 | /** 80 | * @brief License types 81 | * 0 = Declared in component 82 | * 1 = Declared in file with SPDX-License-Identifier 83 | * 2 = Detected in header 84 | * 3 = Detected in LICENSE file 85 | * 86 | * @param job 87 | * @return true 88 | * @return false 89 | */ 90 | bool mz_license_handler(struct mz_job *job) 91 | { 92 | /* Decompress */ 93 | mz_deflate(job); 94 | 95 | /* Fill MD5 with item id */ 96 | mz_id_fill(job->md5, job->id); 97 | 98 | /* Mine license */ 99 | struct minr_job license_job; 100 | license_job.local_mining = true; 101 | license_job.licenses = job->licenses; 102 | license_job.license_count = job->license_count; 103 | license_job.src = job->data; 104 | license_job.src_ln = job->data_ln; 105 | mine_license(&license_job, job->md5, false); 106 | 107 | return true; 108 | } 109 | 110 | /** 111 | * @brief 112 | * 113 | * @param job 114 | */ 115 | void mz_mine_license(struct mz_job *job) 116 | { 117 | /* Extract first two MD5 bytes from the file name */ 118 | memcpy(job->md5, basename(job->path), 4); 119 | 120 | /* Read source mz file into memory */ 121 | job->mz = file_read(job->path, &job->mz_ln); 122 | 123 | /* Launch license mining */ 124 | mz_parse(job, mz_license_handler); 125 | 126 | free(job->mz); 127 | } 128 | 129 | /** 130 | * @brief 131 | * 132 | * @param job 133 | * @return true 134 | * @return false 135 | */ 136 | bool mz_copyright_handler(struct mz_job *job) 137 | { 138 | /* Decompress */ 139 | mz_deflate(job); 140 | 141 | /* Fill MD5 with item id */ 142 | mz_id_fill(job->md5, job->id); 143 | 144 | /* Mine copyrights */ 145 | mine_copyright(NULL, job->md5, job->data, job->data_ln, false); 146 | 147 | return true; 148 | } 149 | 150 | /** 151 | * @brief 152 | * 153 | * @param job 154 | */ 155 | void mz_mine_copyright(struct mz_job *job) 156 | { 157 | /* Extract first two MD5 bytes from the file name */ 158 | memcpy(job->md5, basename(job->path), 4); 159 | 160 | /* Read source mz file into memory */ 161 | job->mz = file_read(job->path, &job->mz_ln); 162 | 163 | /* Launch copyright mining */ 164 | mz_parse(job, mz_copyright_handler); 165 | 166 | free(job->mz); 167 | } 168 | 169 | /** 170 | * @brief Handler for mz with cryptography 171 | * 172 | * @param job 173 | * @return true 174 | */ 175 | bool mz_crypto_handler(struct mz_job *job) 176 | { 177 | /* Decompress */ 178 | mz_deflate(job); 179 | 180 | /* Fill MD5 with item id */ 181 | mz_id_fill(job->md5, job->id); 182 | unsigned char aux[10]; 183 | memcpy(aux,job->data, 10); 184 | /* Mine cryptographic algorithms */ 185 | mine_crypto(NULL, job->md5, job->data, job->data_ln); 186 | return true; 187 | } 188 | 189 | /** 190 | * @brief MZ mine with cryptography 191 | * 192 | * @param job pinter to mz job 193 | */ 194 | void mz_mine_crypto(struct mz_job *job) 195 | { 196 | /* Extract first two MD5 bytes from the file name */ 197 | memcpy(job->md5, basename(job->path), 4); 198 | 199 | /* Read source mz file into memory */ 200 | job->mz = file_read(job->path, &job->mz_ln); 201 | 202 | /* Launch crypto mining */ 203 | mz_parse(job, mz_crypto_handler); 204 | 205 | free(job->mz); 206 | } 207 | 208 | -------------------------------------------------------------------------------- /src/mz_optimise.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/mz_optimise.c 4 | * 5 | * SCANOSS .mz optimisation functions 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | /** 24 | * @file mz_optimize.c 25 | * @date 26 Oct 2021 26 | * @brief Implement MZ optimization functions 27 | */ 28 | 29 | #include 30 | #include 31 | 32 | #include "minr.h" 33 | #include 34 | #include "hex.h" 35 | #include "ignorelist.h" 36 | #include "mz.h" 37 | 38 | 39 | /** 40 | * @brief Check if job->id is found in job->xkeys (see -X) 41 | * 42 | * @param job pointer to mz job 43 | * @return true if it was found 44 | */ 45 | bool mz_id_excluded(struct mz_job *job) 46 | { 47 | if (!job->xkeys_ln) return false; 48 | 49 | for (uint64_t i = 0; i < job->xkeys_ln; i += MD5_LEN) 50 | { 51 | /* Compare job id (bytes 3-16) */ 52 | if (!memcmp(job->xkeys + i + 2, job->id, MD5_LEN - 2)) 53 | { 54 | /* Compare mz id (bytes 1-2) */ 55 | if (!memcmp(job->xkeys + i, job->mz_id, 2)) return true; 56 | } 57 | } 58 | 59 | return false; 60 | } 61 | 62 | /** 63 | * @brief Check if job->id is found in the LDB 64 | * 65 | * @param job pointee to mz job. 66 | * @return true if exist 67 | */ 68 | bool mz_id_exists_in_ldb(struct mz_job *job) 69 | { 70 | if (!job->orphan_rm) return true; 71 | 72 | struct ldb_table oss_file; 73 | strcpy(oss_file.db, "oss"); 74 | strcpy(oss_file.table, TABLE_NAME_FILE); 75 | oss_file.key_ln = 16; 76 | oss_file.rec_ln = 0; 77 | oss_file.ts_ln = 2; 78 | oss_file.tmp = false; 79 | 80 | uint8_t file_id[16]; 81 | ldb_hex_to_bin(job->md5, 4, file_id); 82 | memcpy(file_id + 2, job->id, MZ_MD5); 83 | 84 | if (!ldb_key_exists(oss_file, file_id)) return false; 85 | 86 | return true; 87 | } 88 | 89 | /** 90 | * @brief Check a md5 match 91 | * 92 | * @param mz1 input 1 93 | * @param mz2 input 2 94 | * @return true if they match 95 | */ 96 | bool mz_md5_match(uint8_t *mz1, uint8_t *mz2) 97 | { 98 | for (int i = 0; i < MZ_MD5; i++) 99 | if (mz1[i] != mz2[i]) return false; 100 | 101 | return true; 102 | } 103 | 104 | /** 105 | * @brief Handler function to be passed to mz_parse() 106 | * Eliminates duplicated data, unwanted content and (optionally) orphan files (not found in the KB) 107 | * 108 | * @param job pointer to mz job 109 | * @return true 110 | */ 111 | static bool mz_optimise_handler(struct mz_job *job) 112 | { 113 | /* Uncompress */ 114 | MZ_DEFLATE(job); 115 | job->data[job->data_ln] = 0; 116 | 117 | uint8_t md5[16]; 118 | MD5((uint8_t *)job->data, job->data_ln, md5); 119 | 120 | /* Skip if corrupted file */ 121 | if (!mz_md5_match(job->id, md5 + 2)) 122 | { 123 | job->igl_c++; 124 | } 125 | 126 | /* Check if data contains unwanted header */ 127 | else if (job->data_ln < MIN_FILE_SIZE) 128 | { 129 | job->min_c++; 130 | } 131 | 132 | /* Check if data is too square */ 133 | else if (too_much_squareness(job->data)) 134 | { 135 | job->igl_c++; 136 | } 137 | 138 | /* Check if data contains unwanted header */ 139 | else if (unwanted_header(job->data)) 140 | { 141 | job->igl_c++; 142 | } 143 | 144 | /* Check if file is not duplicated */ 145 | else if (mz_id_exists(job->ptr, job->ptr_ln, job->id)) 146 | { 147 | job->dup_c++; 148 | } 149 | 150 | /* Check if mz_id is to be excluded (see -X) */ 151 | else if (mz_id_excluded(job)) 152 | { 153 | job->exc_c++; 154 | } 155 | 156 | /* Check if file exists in the LDB */ 157 | else if (!mz_id_exists_in_ldb(job)) 158 | { 159 | job->orp_c++; 160 | } 161 | 162 | else 163 | { 164 | memcpy(job->ptr + job->ptr_ln, job->id, job->ln); 165 | job->ptr_ln += job->ln; 166 | } 167 | free(job->data); 168 | return true; 169 | } 170 | 171 | static bool mz_optimise_dup_handler(struct mz_job *job) 172 | { 173 | /* Uncompress */ 174 | MZ_DEFLATE(job); 175 | job->data[job->data_ln] = 0; 176 | 177 | uint8_t md5[16]; 178 | MD5((uint8_t *)job->data, job->data_ln, md5); 179 | 180 | /* Check if file is not duplicated */ 181 | if (mz_id_exists(job->ptr, job->ptr_ln, job->id)) 182 | { 183 | job->dup_c++; 184 | } 185 | else 186 | { 187 | memcpy(job->ptr + job->ptr_ln, job->id, job->ln); 188 | job->ptr_ln += job->ln; 189 | } 190 | 191 | free(job->data); 192 | 193 | return true; 194 | } 195 | 196 | 197 | /** 198 | * @brief Optimise an mz file removing duplicated data 199 | * 200 | * @param job pointer to mz job 201 | */ 202 | void mz_optimise(struct mz_job *job, mz_optimise_mode_t mode) 203 | { 204 | /* Extract first two MD5 bytes from the file name */ 205 | memcpy(job->md5, basename(job->path), 4); 206 | ldb_hex_to_bin(job->md5, 4, job->mz_id); 207 | 208 | /* Read source mz file into memory */ 209 | job->mz = file_read(job->path, &job->mz_ln); 210 | 211 | /* Reserve memory for destination mz */ 212 | job->ptr = calloc(job->mz_ln, 1); 213 | 214 | /* Launch optimisation */ 215 | switch (mode) 216 | { 217 | case MZ_OPTIMISE_ALL: 218 | mz_parse(job, mz_optimise_handler); 219 | break; 220 | case MZ_OPTIMISE_DUP: 221 | mz_parse(job, mz_optimise_dup_handler); 222 | break; 223 | 224 | default: 225 | break; 226 | } 227 | 228 | /* Write updated mz file */ 229 | file_write(job->path, job->ptr, job->ptr_ln); 230 | 231 | if (job->dup_c) printf("%u duplicated files eliminated\n", job->dup_c); 232 | if (job->orp_c) printf("%u orphan files eliminated\n", job->orp_c); 233 | if (job->igl_c) printf("%u ignored files eliminated\n", job->igl_c); 234 | if (job->min_c) printf("%u small files eliminated\n", job->min_c); 235 | if (job->exc_c) printf("%u keys excluded\n", job->exc_c); 236 | 237 | free(job->mz); 238 | } 239 | 240 | 241 | -------------------------------------------------------------------------------- /src/quality.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/quality.c 4 | * 5 | * SCANOSS Quality assessment subroutines 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | /* Make quality assessment on an individual file */ 24 | 25 | /** 26 | * @file quality.c 27 | * @date 7 Feb 2021 28 | * @brief Contains functions used to mine quality 29 | */ 30 | 31 | #include "minr.h" 32 | #include "license.h" 33 | #include "quality.h" 34 | 35 | /** 36 | * @brief Mine quality statistics from the code 37 | * 38 | * @param mined_path path to mine 39 | * @param md5 file mdz 40 | * @param src pointer to data source 41 | * @param size data size 42 | */ 43 | void mine_quality(char *mined_path, char *md5, char *src, long size) 44 | { 45 | /* Skip files below MIN_FILE_SIZE */ 46 | if (size < MIN_FILE_SIZE) return; 47 | 48 | char *s = src; 49 | int bytes = 0; 50 | int lines = 0; 51 | int comments = 0; 52 | int longest_line = 0; 53 | int line_length = 0; 54 | int relevant_bytes = 0; 55 | bool line_start = true; 56 | bool tab_start = false; 57 | bool space_start = false; 58 | bool spdx_tag = false; 59 | 60 | /* Ready byte by byte */ 61 | while (*s) 62 | { 63 | if (line_start) 64 | { 65 | /* Deal with leading spaces and tabs */ 66 | if (*s == ' ') space_start = true; 67 | else if (*s == '\t') tab_start = true; 68 | 69 | /* Deal with slash star or double slash */ 70 | else if (*s == '/') 71 | { 72 | char *next = s + 1; 73 | if (*next == '/' || *next == '*') comments++; 74 | line_start = false; 75 | } 76 | 77 | /* Deal with "#" */ 78 | else if (*s == '#') 79 | { 80 | comments++; 81 | line_start = false; 82 | } 83 | 84 | else line_start = false; 85 | } 86 | 87 | /* Deal with new line */ 88 | if (*s == '\n') 89 | { 90 | if (line_length > longest_line) longest_line = line_length; 91 | if (line_length > 2) relevant_bytes += line_length; 92 | lines++; 93 | line_start = true; 94 | line_length = 0; 95 | } 96 | else line_length++; 97 | 98 | /* Search for SPDX-License-Identifier */ 99 | if (!spdx_tag) if (bytes < MAX_FILE_HEADER) spdx_tag = is_spdx_license_identifier(s); 100 | 101 | bytes++; 102 | s++; 103 | } 104 | 105 | /* Skip binaries */ 106 | if (size == bytes && lines) 107 | { 108 | int average_line = relevant_bytes / lines; 109 | int score = 0; 110 | if (lines <= BEST_PRACTICES_MAX_LINES) score++; 111 | if (average_line <= BEST_PRACTICES_MAX_LINE_LN) score++; 112 | if (comments <= BEST_PRACTICES_MAX_LINES_PER_COMMENT) score++; 113 | if (!(tab_start && space_start)) score++; 114 | if (spdx_tag) score++; 115 | 116 | /* Assemble csv path */ 117 | char csv_path[MAX_PATH_LEN] = "\0"; 118 | if (mined_path) 119 | { 120 | strcpy(csv_path, mined_path); 121 | strcat(csv_path, "/"TABLE_NAME_QUALITY".csv"); 122 | } 123 | 124 | /* Output quality score */ 125 | if (*csv_path) 126 | { 127 | FILE *fp = fopen(csv_path, "a"); 128 | fprintf(fp, "%s,0,%d\n", md5, score); 129 | fclose(fp); 130 | } 131 | else printf("%s,0,%d\n", md5, score); 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /src/scancode.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/quality.c 4 | * 5 | * SCANOSS Quality assessment subroutines 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | /* Make quality assessment on an individual file */ 24 | 25 | /** 26 | * @file scancode.c 27 | * @date 12 Dec 2021 28 | * @brief Contains functions used to call scancode external module 29 | */ 30 | 31 | #include "license.h" 32 | #include "scancode.h" 33 | #include "file.h" 34 | #define TMP_DIR "/tmp/minr" 35 | 36 | /** 37 | * @brief Preparare the directory for temporary file 38 | * 39 | * @param id string id used as directory name 40 | */ 41 | bool scancode_prepare_tmp_dir(char *id) 42 | { 43 | FILE *sc_file; 44 | char *command; 45 | asprintf(&command, "mkdir -p %s/%s && rm -f %s/%s/*", TMP_DIR, id, TMP_DIR, id); // create tmp or erase content 46 | sc_file = popen(command, "r"); 47 | 48 | fclose(sc_file); 49 | free(command); 50 | return true; 51 | } 52 | 53 | /** 54 | * @brief Remove the directory for temporary file 55 | * 56 | * @param id string id used as directory name 57 | */ 58 | bool scancode_remove_tmp_dir(char *id) 59 | { 60 | char *path; 61 | asprintf(&path, "%s/%s", TMP_DIR, id); // create tmp or erase content 62 | rm_dir(path); 63 | free(path); 64 | return true; 65 | } 66 | 67 | /** 68 | * @brief Copy a file to the tmp dir 69 | * 70 | * @param path path to the file 71 | * @param id id of the tmp dir 72 | */ 73 | bool scancode_copy_to_tmp(char *path, char *id) 74 | { 75 | FILE *sc_file; 76 | char *command; 77 | asprintf(&command, "cp %s %s/%s/", path, TMP_DIR, id); // copy 78 | sc_file = popen(command, "r"); 79 | 80 | fclose(sc_file); 81 | free(command); 82 | return true; 83 | } 84 | 85 | /** 86 | * @brief Call scancode process 87 | * @param id id of the tmp dir 88 | * @param csv_file result file 89 | */ 90 | bool scancode_run(char *id, char *csv_file) 91 | { 92 | char *command; 93 | /* execute scancode, process the json output, and erase tmp */ 94 | if (csv_file) 95 | asprintf(&command, "scancode -cl --quiet -n 6 --timeout 2 --json %s/%s/scancode.json %s/%s 2> scancode_error.txt &&\ 96 | jq -r '.files[] | \"\\(.path),5,\\(.detected_license_expression_spdx)\"' %s/%s/scancode.json | sort -u | grep -v ',null$' | sed 's/\\/[^:/:,]*,/,/g' 1>> %s", 97 | TMP_DIR, id, TMP_DIR, id, TMP_DIR, id, csv_file); 98 | 99 | FILE *sc_file = popen(command, "r"); 100 | fclose(sc_file); 101 | free(command); 102 | return true; 103 | } 104 | 105 | /** 106 | * @brief Check is a version of scancode is present in the system 107 | * @return true if it is present 108 | */ 109 | bool scancode_check(void) 110 | { 111 | FILE *sc_file; 112 | sc_file = popen("scancode --version 2>scancode_error.txt && jq --version 2>scancode_error.txt", "r"); 113 | char *line = NULL; 114 | size_t len = 0; 115 | int read = 0; 116 | bool scancode_present = false; 117 | bool jq_present = false; 118 | 119 | while ((read = getline(&line, &len, sc_file)) != -1) 120 | { 121 | if (read > 0 && strstr(line, "ScanCode version")) 122 | { 123 | scancode_present = true; 124 | } 125 | 126 | if (read > 0 && strstr(line, "jq-")) 127 | { 128 | jq_present = true; 129 | } 130 | } 131 | free(line); 132 | fclose(sc_file); 133 | 134 | return (scancode_present && jq_present); 135 | } -------------------------------------------------------------------------------- /src/string.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/string.c 4 | * 5 | * String handling functions 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | 24 | /** 25 | * @file string.c 26 | * @date 26 Oct 2021 27 | * @brief Implements useful string functions 28 | */ 29 | 30 | 31 | #include 32 | #include 33 | #include 34 | #include "minr.h" 35 | 36 | /** 37 | * @brief Replace character 38 | * 39 | * @param string input string 40 | * @param replace char to be replaced 41 | * @param with replacement char 42 | */ 43 | void char_replace(char *string, char replace, char with) 44 | { 45 | char *s = string; 46 | while (*s) 47 | { 48 | if (*s == replace) *s = with; 49 | s++; 50 | } 51 | } 52 | 53 | /** 54 | * @brief Case insensitive string comparison 55 | * 56 | * @param a string a 57 | * @param b string b 58 | * @param len string len 59 | * @return true if they are the equals 60 | */ 61 | bool strn_icmp(char *a, char *b, int len) 62 | { 63 | for (int i = 0; i < len; i++) if (tolower(a[i]) != tolower(b[i])) return false; 64 | return true; 65 | } 66 | 67 | /** 68 | * @brief Normalize string removed unwanted characters 69 | * 70 | * @param src input string 71 | * @param src_ln string size 72 | * @param out out string 73 | * @param max_in max input characters 74 | * @param max_out max output characters 75 | */ 76 | void normalize_src(char *src, uint64_t src_ln, char *out, int max_in, int max_out) 77 | { 78 | int out_ptr = 0; 79 | 80 | for (int i = 0; i < max_in; i++) 81 | { 82 | if (!src[i]) break; 83 | if (isalnum(src[i])) out[out_ptr++] = tolower(src[i]); 84 | else if (src[i] == '+') out[out_ptr++] = src[i]; 85 | if (out_ptr >= max_out) break; 86 | } 87 | out[out_ptr] = 0; 88 | } 89 | 90 | /** 91 | * @brief Count number of non alphanumeric (nor spaces) characters in string until EOL 92 | * 93 | * @param str input string 94 | * @return int number of non alphanumeric characters 95 | */ 96 | int count_nonalnum(char *str) 97 | { 98 | char *s = str; 99 | int count = 0; 100 | while (*s && *s != '\n') 101 | { 102 | if (!isalnum(*s) && *s != ' ') count++; 103 | s++; 104 | } 105 | return count; 106 | } 107 | 108 | /** 109 | * @brief Count number of alphanumeric characters in string until EOL 110 | * 111 | * @param str input string 112 | * @return int numbre of alphanumeric 113 | */ 114 | int count_alnum(char *str) 115 | { 116 | char *s = str; 117 | int count = 0; 118 | while (*s && *s != '\n') 119 | { 120 | if (isalnum(*s)) count++; 121 | s++; 122 | } 123 | return count; 124 | } 125 | 126 | /** 127 | * @brief Count number of chr occurrences in str 128 | * 129 | * @param chr wanted char 130 | * @param str input string 131 | * @return int number of ocurrences 132 | */ 133 | int count_chr(char chr, char *str) 134 | { 135 | char *s = str; 136 | int count = 0; 137 | while (*s) 138 | { 139 | if (*s == chr) count++; 140 | s++; 141 | } 142 | return count; 143 | } 144 | 145 | /** 146 | * @brief Count number of chars in str until EOL 147 | * 148 | * @param str input string 149 | * @return int number of chars 150 | */ 151 | int linelen(char *str) 152 | { 153 | char *s = str; 154 | int count = 0; 155 | while (*s && *s != '\n') 156 | { 157 | count++; 158 | s++; 159 | } 160 | return count; 161 | } 162 | -------------------------------------------------------------------------------- /src/wfp.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | /* 3 | * src/wfp.c 4 | * 5 | * Functions handling wfp extraction 6 | * 7 | * Copyright (C) 2018-2021 SCANOSS.COM 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 2 of the License, or 12 | * (at your option) any later version. 13 | 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | /** 24 | * @file wfp.c.c 25 | * @date 28 Oct 2021 26 | * @brief ??? 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include "ldb.h" 35 | #include "minr.h" 36 | #include "ignorelist.h" 37 | #include "winnowing.h" 38 | #include "hex.h" 39 | #include "wfp.h" 40 | #include "file.h" 41 | #include "mz.h" 42 | 43 | int *out_snippet; 44 | 45 | void wfp_init(char * base_path) 46 | { 47 | if (base_path) 48 | out_snippet = open_snippet(base_path); 49 | } 50 | 51 | void wfp_free(void) 52 | { 53 | if (out_snippet) 54 | { 55 | /* Close files */ 56 | for (int i=0; i < 256; i++) 57 | close(out_snippet[i]); 58 | } 59 | free(out_snippet); 60 | } 61 | 62 | #define WFP_BUFFER_SIZE 1048576 63 | 64 | /** 65 | * @brief Extrac wfp from a surce 66 | * 67 | * @param md5 file md5 68 | * @param src data source 69 | * @param length data lenght 70 | */ 71 | void extract_wfp(uint8_t *md5, char *src, uint32_t length, bool check_mz) 72 | { 73 | /* File discrimination check: Unwanted header? */ 74 | if (unwanted_header(src)) return; 75 | 76 | /* Check if data is too square */ 77 | if (too_much_squareness(src)) return; 78 | 79 | /* File discrimination check: Binary? */ 80 | uint32_t src_ln = strlen(src); 81 | 82 | if (length != src_ln || !strchr(src, '\n')) return; 83 | 84 | /* Store buffer lengths */ 85 | long buffer_ln[256]; 86 | for (int i = 0; i < 256; i++) 87 | buffer_ln[i]=0; 88 | 89 | uint32_t mem_alloc = src_ln > MAX_FILE_SIZE ? src_ln : MAX_FILE_SIZE; 90 | 91 | uint8_t *buffer = malloc(WFP_BUFFER_SIZE * 256); 92 | uint32_t *hashes = malloc(mem_alloc); 93 | uint32_t *lines = malloc(mem_alloc); 94 | 95 | if (!buffer || !hashes || !lines) 96 | { 97 | free(buffer); 98 | free(hashes); 99 | free(lines); 100 | return; 101 | } 102 | 103 | /* Capture hashes (Winnowing) */ 104 | uint32_t size = winnowing(src, hashes, lines, mem_alloc); 105 | 106 | uint8_t n = 0; 107 | uint16_t line = 0; 108 | 109 | for (uint32_t i = 0; i < size; i++) 110 | { 111 | /* Copy remaining 3 bytes of the crc32 (inverting) */ 112 | uint32_reverse((uint8_t *)&hashes[i]); 113 | n = *(uint8_t *)(&hashes[i]); 114 | 115 | memcpy(buffer + (WFP_BUFFER_SIZE * n) + buffer_ln[n], (char *) &hashes[i] + 1, 3); 116 | buffer_ln[n] += 3; 117 | 118 | /* Copy md5 hash (16 bytes) */ 119 | memcpy(buffer + (WFP_BUFFER_SIZE * n) + buffer_ln[n], (char *) md5, 16); 120 | buffer_ln[n] += 16; 121 | 122 | /* Copy originating line number */ 123 | line = (lines[i] > 65535) ? 65535 : lines[i]; 124 | memcpy(buffer + (WFP_BUFFER_SIZE * n) + buffer_ln[n], (char *)&line, 2); 125 | buffer_ln[n] += 2; 126 | 127 | /* Flush buffer */ 128 | if (buffer_ln[n] + 21 >= WFP_BUFFER_SIZE) 129 | { 130 | if (!write(out_snippet[n], buffer + (n * WFP_BUFFER_SIZE), buffer_ln[n])) 131 | printf("Warning: error writing snippet sector\n"); 132 | buffer_ln[n] = 0; 133 | } 134 | } 135 | 136 | /* Flush buffer */ 137 | for (int i = 0; i < 256; i++) 138 | if (buffer_ln[i]) if (!write(out_snippet[i], buffer + (WFP_BUFFER_SIZE * i), buffer_ln[i])) 139 | printf("Warning: error writing snippet sector\n"); 140 | 141 | free (buffer); 142 | free (hashes); 143 | free (lines); 144 | } 145 | 146 | /** 147 | * @brief MZ wfp extract handler 148 | * 149 | * @param job pointer mz job 150 | * @return true 151 | */ 152 | bool mz_wfp_extract_handler(struct mz_job *job) 153 | { 154 | /* Fill MD5 with item id */ 155 | memcpy(job->ptr + 2, job->id, MZ_MD5); 156 | 157 | /* Decompress */ 158 | MZ_DEFLATE(job); 159 | job->data[job->data_ln] = 0; 160 | extract_wfp(job->ptr, job->data, job->data_ln, true); 161 | free(job->data); 162 | 163 | return true; 164 | } 165 | 166 | /** 167 | * @brief Extracts wfps from the given mz file path 168 | * 169 | * @param path path to mz file 170 | */ 171 | void mz_wfp_extract(char *path) 172 | { 173 | uint8_t mzid[MD5_LEN] = "\0"; 174 | uint8_t mzkey[MD5_LEN] = "\0"; 175 | 176 | /* Create job structure */ 177 | struct mz_job job; 178 | memset(&job, 0, sizeof(job)); 179 | strcpy(job.path, path); 180 | memset(job.mz_id, 0, 2); 181 | job.mz = NULL; 182 | job.mz_ln = 0; 183 | job.id = mzid; 184 | job.ln = 0; 185 | job.data = NULL; // Uncompressed data 186 | job.data_ln = 0; 187 | job.zdata = NULL; // Compressed data 188 | job.zdata_ln = 0; 189 | job.md5[MD5_LEN * 2 + 1] = 0; 190 | job.key = NULL; 191 | job.ptr = mzkey; 192 | 193 | /* Extract first two MD5 bytes from the file name */ 194 | memcpy(job.md5, basename(job.path), 4); 195 | ldb_hex_to_bin(job.md5, 4, job.ptr); 196 | 197 | /* Read source mz file into memory */ 198 | job.mz = file_read(job.path, &job.mz_ln); 199 | 200 | /* Launch wfp extraction */ 201 | mz_parse(&job, mz_wfp_extract_handler); 202 | free(job.mz); 203 | } 204 | -------------------------------------------------------------------------------- /version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ### 3 | # SPDX-License-Identifier: GPL-2.0-or-later 4 | # 5 | # Copyright (C) 2018-2023 SCANOSS.COM 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 2 of the License, or 10 | # (at your option) any later version. 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | ### 18 | # 19 | # Determine the latest tag associated with this repo and echo to stdout 20 | # 21 | version=$(git describe --tags --abbrev=0) 22 | if [[ -z "$version" ]] ; then 23 | version=$(git describe --tags "$(git rev-list --tags --max-count=1)") 24 | fi 25 | if [[ -z "$version" ]] ; then 26 | echo "Error: Failed to determine a valid version number" >&2 27 | exit 1 28 | fi 29 | echo "$version" | sed 's/^v//' 30 | exit 0 --------------------------------------------------------------------------------