Skip to content

Commit de1bf54

Browse files
committed
Initial commit
0 parents  commit de1bf54

File tree

14 files changed

+399
-0
lines changed

14 files changed

+399
-0
lines changed

.ci/before.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
git clone --depth=1 https://gitlab.com/kaitaiStructCompile.py/kaitaiStructCompile.py.git
2+
export KSCP=./kaitaiStructCompile.py
3+
git clone --depth=1 https://gitlab.com/kaitaiStructCompile.py/kaitaiStructCompile.tests.ksys $KSCP/tests/ksys
4+
pip install --upgrade $KSCP

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = tab
6+
indent_size = 4
7+
insert_final_newline = true
8+
end_of_line = lf
9+
10+
[*.{yml,yaml,ksy}]
11+
indent_style = space
12+
indent_size = 2

.github/.templateMarker

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
KOLANICH/python_project_boilerplate.py

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
allow:
8+
- dependency-type: "all"

.github/workflows/CI.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- name: typical python workflow
13+
uses: KOLANICH-GHActions/typical-python-workflow@master
14+
with:
15+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
__pycache__
2+
*.pyc
3+
*.pyo
4+
/kaitaiStructCompile.egg-info
5+
/build
6+
/dist
7+
/.eggs
8+
/tests/output
9+
/tests/formats

.gitlab-ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
image: registry.gitlab.com/kaitaistructcompile.py/kaitai_struct_python_docker:latest
2+
3+
stages:
4+
- build
5+
- test
6+
7+
variables:
8+
GIT_DEPTH: "1"
9+
DOCKER_DRIVER: overlay2
10+
SAST_ANALYZER_IMAGE_TAG: latest
11+
SAST_DISABLE_DIND: "true"
12+
SAST_CONFIDENCE_LEVEL: 5
13+
CODECLIMATE_VERSION: latest
14+
15+
include:
16+
- template: SAST.gitlab-ci.yml
17+
- template: Code-Quality.gitlab-ci.yml
18+
19+
20+
build:
21+
tags:
22+
- shared
23+
- linux
24+
stage: build
25+
variables:
26+
PYTHONUSERBASE: ${CI_PROJECT_DIR}/python_user_packages
27+
KAITAI_STRUCT_COMPILE_FORCE_BACKEND: CLI
28+
29+
before_script:
30+
- export PYTHON_MODULES_DIR=${PYTHONUSERBASE}/lib/python3.7/site-packages
31+
- export EXECUTABLE_DEPENDENCIES_DIR=${PYTHONUSERBASE}/bin
32+
- export PATH="$PATH:$EXECUTABLE_DEPENDENCIES_DIR" # don't move into `variables` any of them, it is unordered
33+
- source ./.ci/before.sh
34+
35+
script:
36+
- python3 ./setup.py bdist_wheel
37+
- pip3 install --upgrade ./dist/*.whl
38+
- coverage run --branch --source=kaitaiStructCompile -m pytest --junitxml=./rspec.xml $KSCP/tests/test.py
39+
- mkdir ./wheels
40+
- mv ./dist/*.whl ./wheels/kaitaiStructCompile.backend.CLI-0.CI-py3-none-any.whl
41+
42+
cache:
43+
paths:
44+
- /lib/python3*/site-packages
45+
- tests/kaitai_struct_formats
46+
47+
artifacts:
48+
paths:
49+
- wheels
50+
- tests/output

Code_Of_Conduct.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
No codes of conduct!

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include UNLICENSE
2+
include *.md
3+
include tests
4+
include .editorconfig
5+
global-include *.json

ReadMe.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
kaitaiStructCompile.py CLI backend [![Unlicensed work](https://raw.githubusercontent.com/unlicense/unlicense.org/master/static/favicon.png)](https://unlicense.org/)
2+
==================================
3+
[![GitLab build status](https://gitlab.com/kaitaiStructCompile.py/kaitaiStructCompile.backend.CLI/badges/master/pipeline.svg)](https://gitlab.com/kaitaiStructCompile.py/kaitaiStructCompile.backend.CLI/commits/master)
4+
[![GitLab coverage](https://gitlab.com/kaitaiStructCompile.py/kaitaiStructCompile.backend.CLI/badges/master/coverage.svg)](https://gitlab.com/kaitaiStructCompile.py/kaitaiStructCompile.backend.CLI/commits/master)
5+
[![Code style: antiflash](https://img.shields.io/badge/code%20style-antiflash-FFF.svg)](https://github.com/KOLANICH-tools/antiflash.py)
6+
7+
This is a CLI backend for [`kaitaiStructCompile.py`](https://gitlab.com/kaitaiStructCompile.py/kaitaiStructCompile).
8+
9+
Cons:
10+
* insecure: uses subprocess.call, passes arguments via a command line; also races on access to files are possible: if an attacker wrote the temporary file between `ksc` have it unlocked and the app have not yet read, he can replace the file contents. If `importer` is used, it is code execution and injection attack.
11+
* slow: creates subprocesses, interacts via on-disk files and stdout;
12+
* burns in SSD - since it uses temporary files.
13+
14+
15+
Pros:
16+
* universal - should work on any OS
17+
* requires no dependencies
18+
* permissive license

0 commit comments

Comments
 (0)