Skip to content

Commit ddd4062

Browse files
authored
Feature/actionmods (#34)
* Enabled multiple sources to be specified and Docker (#33) * Enabled multiple sources to be specified * Require report directory to be specified if multiple input sources * Created Dockerfile * Add Docker build and release * Only use GHCR Signed-off-by: Caroline Russell <[email protected]> * Removed extraneous lines Signed-off-by: Caroline Russell <[email protected]> * Actionmods (#35) * Fixed find_exe and modified report dir * Fixed src_dir error --------- Signed-off-by: Caroline Russell <[email protected]> * Update dockerfile version Signed-off-by: Caroline Russell <[email protected]> * bump version Signed-off-by: Caroline Russell <[email protected]> --------- Signed-off-by: Caroline Russell <[email protected]>
1 parent 31282a8 commit ddd4062

File tree

5 files changed

+71
-19
lines changed

5 files changed

+71
-19
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@ jobs:
8787
tag_name: ${{ github.ref }}
8888
release_name: Release ${{ github.ref }}
8989
draft: false
90-
prerelease: false
90+
prerelease: false

Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM almalinux:9.2-minimal
2+
3+
LABEL maintainer="appthreat" \
4+
org.opencontainers.image.authors="Team AppThreat <[email protected]>" \
5+
org.opencontainers.image.source="https://github.com/AppThreat/blint" \
6+
org.opencontainers.image.url="https://github.com/AppThreat/blint" \
7+
org.opencontainers.image.version="1.0.31" \
8+
org.opencontainers.image.vendor="AppThreat" \
9+
org.opencontainers.image.licenses="Apache-2.0" \
10+
org.opencontainers.image.title="blint" \
11+
org.opencontainers.image.description="BLint is a Binary Linter to check the security properties, and capabilities in your executables. It is powered by lief." \
12+
org.opencontainers.docker.cmd="docker run --rm -it -v /tmp:/tmp -v $(pwd):/app:rw -w /app -t ghcr.io/appthreat/blint"
13+
14+
ARG TARGETPLATFORM
15+
ARG JAVA_VERSION=22.3.r19-grl
16+
ARG SBT_VERSION=1.9.0
17+
ARG MAVEN_VERSION=3.9.2
18+
ARG GRADLE_VERSION=8.1.1
19+
20+
ENV GOPATH=/opt/app-root/go \
21+
GO_VERSION=1.20.4 \
22+
JAVA_VERSION=$JAVA_VERSION \
23+
SBT_VERSION=$SBT_VERSION \
24+
MAVEN_VERSION=$MAVEN_VERSION \
25+
GRADLE_VERSION=$GRADLE_VERSION \
26+
GRADLE_OPTS="-Dorg.gradle.daemon=false" \
27+
JAVA_HOME="/opt/java/${JAVA_VERSION}" \
28+
MAVEN_HOME="/opt/maven/${MAVEN_VERSION}" \
29+
GRADLE_HOME="/opt/gradle/${GRADLE_VERSION}" \
30+
SBT_HOME="/opt/sbt/${SBT_VERSION}" \
31+
COMPOSER_ALLOW_SUPERUSER=1 \
32+
PYTHONUNBUFFERED=1 \
33+
PYTHONIOENCODING="utf-8"
34+
ENV PATH=${PATH}:${JAVA_HOME}/bin:${MAVEN_HOME}/bin:${GRADLE_HOME}/bin:${SBT_HOME}/bin:${GOPATH}/bin:/usr/local/go/bin:/usr/local/bin/:/root/.local/bin:
35+
36+
COPY . /opt/blint
37+
38+
RUN microdnf install -y python3.11 python3.11-pip \
39+
&& alternatives --install /usr/bin/python3 python /usr/bin/python3.11 1 \
40+
&& python3 --version \
41+
&& python3 -m pip install --upgrade pip \
42+
&& cd /opt/blint \
43+
&& python3 -m pip install -e . \
44+
&& chmod a-w -R /opt \
45+
&& microdnf clean all
46+
47+
WORKDIR /app
48+
49+
ENTRYPOINT [ "blint" ]

blint/analysis.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,12 @@ def run_prefuzz(f, metadata):
390390

391391

392392
def start(args, src, reports_dir):
393-
files = [src]
393+
files = src
394394
findings = []
395395
reviews = []
396396
fuzzables = []
397-
if os.path.isdir(src):
398-
files = find_exe_files(src)
397+
for i in src:
398+
files += find_exe_files(i)
399399
with Progress(
400400
transient=True,
401401
redirect_stderr=True,

blint/cli.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ def build_args():
2828
"-i",
2929
"--src",
3030
dest="src_dir_image",
31-
help="Source directory or container image or binary file. Defaults to current directory.",
31+
action="extend",
32+
nargs="+",
33+
help="Source directories, container images or binary files. Defaults to current directory.",
3234
)
3335
parser.add_argument(
3436
"-o",
@@ -72,19 +74,20 @@ def main():
7274
if not args.no_banner:
7375
print(blint_logo)
7476
src_dir = args.src_dir_image
75-
if not src_dir:
76-
src_dir = os.getcwd()
77-
reports_base_dir = src_dir
77+
if args.reports_dir:
78+
reports_dir = args.reports_dir
79+
elif not src_dir:
80+
reports_base_dir, src_dir= os.getcwd(), [os.getcwd()]
81+
reports_dir = os.path.join(reports_base_dir, "reports")
82+
elif len(src_dir) == 1:
83+
reports_dir = os.path.dirname(src_dir[0])
7884
else:
79-
reports_base_dir = os.path.dirname(src_dir)
80-
reports_dir = (
81-
args.reports_dir
82-
if args.reports_dir
83-
else os.path.join(reports_base_dir, "reports")
84-
)
85-
if not os.path.exists(src_dir):
86-
print(f"{src_dir} is an invalid file or directory!")
87-
return
85+
print("You must use the -o option to specify a reports output directory when scanning multiple sources.")
86+
exit()
87+
for dir in src_dir:
88+
if not os.path.exists(dir):
89+
print(f"{src_dir} is an invalid file or directory!")
90+
return
8891
# Create reports directory
8992
if reports_dir and not os.path.exists(reports_dir):
9093
os.makedirs(reports_dir)

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "blint"
3-
version = "1.0.30"
3+
version = "1.0.31"
44
description = "Linter for binary files powered by lief"
55
authors = ["Prabhu Subramanian <[email protected]>"]
66
license = "Apache-2.0"
@@ -45,4 +45,4 @@ pyinstaller = "^5.10.1"
4545

4646
[build-system]
4747
requires = ["poetry-core>=1.0.0"]
48-
build-backend = "poetry.core.masonry.api"
48+
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)