Skip to content

Commit

Permalink
shhgit: Dockerfile fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MaKyOtOx committed Jul 30, 2021
1 parent f9c052c commit 9ba9a05
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ engines/droopescan/tmp/*
engines/apivoid/apivoid.json
engines/wpscan/wpscan.json
engines/cybelangel/cybelangel.json
engines/shhgit/shhgit.json
engines/shhgit/libs/sast_git_leaks
env
env3
venv
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.33 // PatrowlEngines
1.4.34 // PatrowlEngines
2 changes: 0 additions & 2 deletions engines/shhgit/.gitignore

This file was deleted.

31 changes: 20 additions & 11 deletions engines/shhgit/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
FROM alpine:latest
MAINTAINER Patrowl.io "[email protected]"
LABEL Name="SHHGit\ \(Patrowl engine\)" Version="1.4.28"
LABEL Name="SHHGit\ \(Patrowl engine\)" Version="1.4.30"

# Create the target repo
RUN mkdir -p /opt/patrowl-engines/shhgit
RUN mkdir -p /opt/patrowl-engines/shhgit/results
RUN mkdir -p /opt/patrowl-engines/shhgit/data
RUN mkdir -p /opt/patrowl-engines/shhgit/libs

# Set the working directory
WORKDIR /opt/patrowl-engines/shhgit
# Install any needed packages specified in requirements.txt
RUN apk add --update --no-cache \
python3 python3-dev py3-pip \
gcc libc-dev libffi-dev make git \
&& rm -rf /var/cache/apk/*

# Clone sast-git-leaks
WORKDIR /opt/patrowl-engines/shhgit/libs
RUN git clone https://github.com/leboncoin/sast-git-leaks/
RUN ls -al
RUN ls -al sast-git-leaks
RUN sed -e 's/sast_git_leaks.tools/libs.sast_git_leaks.sast_git_leaks.tools/g' sast-git-leaks/config/variables.py > sast-git-leaks/config/variables.py.bak && mv sast-git-leaks/config/variables.py.bak sast-git-leaks/config/variables.py

# Copy the current directory contents into the container at /
WORKDIR /opt/patrowl-engines/shhgit
COPY __init__.py .
COPY engine-shhgit.py .
COPY libs .
COPY libs/github.py libs/github.py
COPY libs/git_leaks.py libs/git_leaks.py
COPY shhgit.json.sample shhgit.json
COPY requirements.txt .
COPY README.md .
COPY VERSION .

# Install any needed packages specified in requirements.txt
RUN mkdir -p results
RUN mkdir -p data
RUN apk add --update --no-cache \
python3 python3-dev py3-pip \
gcc libc-dev libffi-dev make \
&& rm -rf /var/cache/apk/*
# Install python requirements
RUN pip3 install --upgrade pip
RUN pip3 install --trusted-host pypi.python.org -r requirements.txt
RUN pip3 install --trusted-host pypi.python.org -r libs/sast_git_leaks/requirements.txt

# TCP port exposed by the container (NAT)
EXPOSE 5025
Expand Down
2 changes: 1 addition & 1 deletion engines/shhgit/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.29
1.4.30
1 change: 1 addition & 0 deletions engines/shhgit/engine-shhgit.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def getreport(scan_id):


def _loadconfig():
"""Load configuration file."""
conf_file = APP_BASE_DIR / 'shhgit.json'
global LOGGER
try:
Expand Down
4 changes: 2 additions & 2 deletions engines/shhgit/libs/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
Licensed under the Apache License
Written by Fabien Martinez <[email protected]>
'''
import logging

from github import Github


def get_repositories(logger, github_account, organization):
"""Retrieve repositories from a Github organization."""
try:
repositories = github_account.get_organization(organization).get_repos()
except Exception as e:
Expand All @@ -20,6 +19,7 @@ def get_repositories(logger, github_account, organization):


def get_github_repositories(logger, github_account):
"""Retrieve repositories."""
github = Github(github_account['github_key'])
if github_account['is_internal']:
github = Github(
Expand Down

0 comments on commit 9ba9a05

Please sign in to comment.