Skip to content

Commit 6fa33f8

Browse files
committed
First release \o/
0 parents  commit 6fa33f8

File tree

167 files changed

+20078
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+20078
-0
lines changed

.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ELASTIC_PASSWORD=passwordSUPERPAssword
2+
ELASTIC_USERNAME=bsim
3+
CERTS_DIR=/cert
4+
BASE_URL=ghcr.io/quarkslab/sighthouse
5+
VERSION="1.0.0"

.github/workflows/ci.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
env:
12+
PACKAGE_VERSION: "1.0.0"
13+
REGISTRY: ghcr.io
14+
IMAGE_NAME: ${{ github.repository }}
15+
16+
jobs:
17+
test-sighthouse:
18+
name: Test (Sighthouse)
19+
runs-on: ubuntu-latest
20+
# Only run on PRs targeting the default branch
21+
if: github.event_name == 'pull_request'
22+
permissions:
23+
packages: read
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Login to GitHub Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Install dev dependencies
36+
run: make install-dev || true
37+
env:
38+
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/ghidraheadless-python3-ci:1.0.0
39+
40+
- name: Run tests
41+
run: |
42+
docker run --rm \
43+
-v ${{ github.workspace }}:/workspace \
44+
-w /workspace \
45+
-e GHIDRA_INSTALL_DIR=/ghidra \
46+
ghcr.io/${{ github.repository }}/ghidraheadless-python3-ci:1.0.0 \
47+
make test
48+
49+
build:
50+
name: Build & Type Check
51+
runs-on: ubuntu-latest
52+
container:
53+
image: python:latest
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v4
57+
58+
- name: Install dev dependencies
59+
run: make install-dev
60+
61+
- name: Type check
62+
run: make type-check
63+
64+
- name: Run tests
65+
run: mkdir -p /tmp && chmod -R +775 /tmp && make test
66+
67+
docker_generation:
68+
name: Build & Publish Docker Image
69+
runs-on: ubuntu-latest
70+
71+
steps:
72+
- name: Checkout repository
73+
uses: actions/checkout@v4
74+
75+
- name: Setup Docker certs
76+
run: |
77+
sudo mkdir -p /etc/docker/certs.d/${{ secrets.CI_REGISTRY }}
78+
echo "${{ secrets.REGISTRY_CA_CERT }}" | sudo tee /etc/docker/certs.d/${{ secrets.CI_REGISTRY }}/ca.crt
79+
80+
- name: Login to GitHub Container Registry
81+
uses: docker/login-action@v3
82+
with:
83+
registry: ghcr.io
84+
username: ${{ github.actor }}
85+
password: ${{ secrets.GITHUB_TOKEN }}
86+
87+
- name: Build Docker images
88+
run: |
89+
cd docker
90+
chmod +x build.sh
91+
./build.sh
92+
93+
- name: Publish Docker images
94+
run: |
95+
cd docker
96+
chmod +x publish.sh
97+
./publish.sh
98+
99+
- name: Logout from registry
100+
run: docker logout ghcr.io
101+
102+
pages:
103+
name: Deploy Docs (GitHub Pages)
104+
runs-on: ubuntu-latest
105+
106+
permissions:
107+
pages: write
108+
id-token: write
109+
110+
environment:
111+
name: github-pages
112+
url: ${{ steps.deployment.outputs.page_url }}
113+
114+
container:
115+
image: python:latest
116+
117+
steps:
118+
- uses: actions/checkout@v4
119+
120+
- name: Install doc dependencies
121+
working-directory: doc
122+
run: make install
123+
124+
- name: Deploy docs
125+
working-directory: doc
126+
run: make gh-deploy

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.pyc
2+
__pycache__
3+
build/
4+
*.egg-info/
5+
venv/
6+
generated/
7+
*.class
8+
*.lock
9+
.cache/

.hooks/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
# This pre commit hook unsure that the code formatter is run before commit new code
3+
#
4+
make lint && git add -u

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Benoit Forgette, Sami Babigeon, Quarkslab
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
2+
default: help
3+
4+
help: # Show help for each of the Makefile recipes.
5+
@grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "\033[1;32m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done
6+
7+
lint: # Format with black and lint with ruff.
8+
@echo "[+] Linting"
9+
@if [ ! -d "./venv" ]; then echo "No venv detected. Please use 'make install-dev' first."; exit 1; fi
10+
@. ./venv/bin/activate && black .
11+
12+
type-check: # Run mypy.
13+
@echo "[+] Type checking"
14+
@if [ ! -d "./venv" ]; then echo "No venv detected. Please use 'make install-dev' first."; exit 1; fi
15+
@# Only run mypy for now, maybe add pylint/ruff
16+
@. ./venv/bin/activate && python -m mypy --exclude build --exclude tests \
17+
--check-untyped-defs \
18+
--follow-untyped-imports \
19+
--config-file sighthouse-core/pyproject.toml \
20+
sighthouse-core
21+
@# Exclude core modules as well for now
22+
@. ./venv/bin/activate && python -m mypy --exclude build --exclude tests --exclude core_modules \
23+
--check-untyped-defs \
24+
--follow-untyped-imports \
25+
--config-file sighthouse-core/pyproject.toml \
26+
sighthouse-pipeline
27+
@. ./venv/bin/activate && python -m mypy --exclude build --exclude tests \
28+
--check-untyped-defs \
29+
--follow-untyped-imports \
30+
--config-file sighthouse-frontend/pyproject.toml \
31+
sighthouse-frontend
32+
33+
test: # Run pytest.
34+
@echo "[+] Run tests"
35+
@if [ ! -d "./venv" ]; then echo "No venv detected. Please use 'make install-dev' first."; exit 1; fi
36+
@# Create tmp directory if it does not exists (it's the case for github CI)
37+
@mkdir -p /tmp/
38+
@. ./venv/bin/activate && python -m pytest --cov="sighthouse" --cov-report=html \
39+
src sighthouse-core sighthouse-pipeline \
40+
sighthouse-client sighthouse-frontend
41+
42+
install-hooks: # Install git hooks
43+
@echo "Copy git hooks"
44+
@if [ -d ".git" ]; then mkdir -p .git/hooks/ && cp ./.hooks/* .git/hooks/; fi
45+
46+
install: # Install sighthouse in a new virtual env.
47+
@if [ ! -d "./venv" ]; then python3 -m venv venv; fi
48+
@. ./venv/bin/activate && cd sighthouse-cli && pip install .
49+
@. ./venv/bin/activate && cd sighthouse-core && pip install .
50+
@. ./venv/bin/activate && cd sighthouse-client && pip install .
51+
@. ./venv/bin/activate && cd sighthouse-frontend && pip install .
52+
@. ./venv/bin/activate && cd sighthouse-pipeline && pip install .
53+
@. ./venv/bin/activate && pip install .[all]
54+
55+
install-dev: # Install sighthouse in a new virtual env in debug mode.
56+
install-dev: install-hooks
57+
@if [ ! -d "./venv" ]; then python3 -m venv venv; fi
58+
@. ./venv/bin/activate && cd sighthouse-cli && pip install .
59+
@. ./venv/bin/activate && cd sighthouse-core && pip install .
60+
@. ./venv/bin/activate && cd sighthouse-client && pip install .
61+
@. ./venv/bin/activate && cd sighthouse-frontend && pip install .
62+
@. ./venv/bin/activate && cd sighthouse-pipeline && pip install .
63+
@. ./venv/bin/activate && pip install .[all]
64+
@. ./venv/bin/activate && pip install pytest mypy black pytest-cov
65+
66+
clean: # Clean build artefacts
67+
@echo "[+] Clean"
68+
@find . -name '__pycache__' -type d -exec rm -rf {} +
69+
@find . -name '*.class' -type f -delete
70+
@find . -name '*.egg-info' -type d -exec rm -rf {} +
71+
@$(RM) -rf dist build sighthouse-pipeline/build sighthouse-frontend/build sighthouse-core/build \
72+
sighthouse-client/build htmlcov .coverage
73+

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# SightHouse
2+
3+
<img align="right" src="./doc/docs/assets/images/logo.png" width="270">
4+
5+
SightHouse is a tool designed to assist reverse engineers by retrieving information and
6+
metadata from programs and identifying similar functions.
7+
8+
## Installation
9+
10+
SightHouse is available on Pypi.
11+
12+
```bash
13+
# Install SRE clients only
14+
pip install sighthouse-client
15+
# Install frontend only
16+
pip install sighthouse-frontend
17+
# Install pipeline only
18+
pip install sighthouse-pipeline
19+
# Or install everything
20+
pip install sighthouse[all]
21+
```
22+
23+
### From sources
24+
25+
You can also install it from the `git` repository:
26+
```bash
27+
# Download the repo
28+
git clone https://github.com/quarkslab/sighthouse && cd sighthouse
29+
# Make install will create a new virtual env and install sighthouse in it
30+
make install
31+
```
32+
33+
## Build Documentation
34+
35+
The documentation can be build by first installing SightHouse and then serve the documentation
36+
on a local server.
37+
38+
```bash
39+
# Skip this step if you already have a local repo
40+
git clone https://github.com/quarkslab/sighthouse && cd sighthouse/doc
41+
# Install dependencies
42+
make install
43+
# Serve the documentation
44+
make serve
45+
```
46+
47+
An online documentation is available [here](https://quarkslab.github.io/sighthouse/).
48+
49+
## Running unit tests
50+
51+
You can run unit tests locally for the default python version using:
52+
```bash
53+
# Skip this step if you already have a local repo
54+
git clone https://github.com/quarkslab/sighthouse && cd sighthouse
55+
make test
56+
```
57+
58+
## Authors
59+
60+
- MadSquirrels (Forgette Benoit)
61+
- Fenrisfulsur (Babigeon Sami)
62+

doc/Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
SHELL := /bin/bash
3+
4+
default: help
5+
6+
help: # Show help for each of the Makefile recipes.
7+
@grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "\033[1;32m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done
8+
9+
install: # Install requirements for building the doc
10+
@echo "Install mkdocs-material"
11+
@if [ ! -d "./venv" ]; then python3 -m venv venv; fi
12+
@. venv/bin/activate && pip install mkdocs-material mkdocs-plugin-inline-svg mkdocs-to-pdf 'mkdocstrings[python]' griffe-inherited-docstrings
13+
@# We need to install sighthouse to generate API reference because mkdocstrings does not handle namespace package correctly
14+
@. ./venv/bin/activate && cd ../sighthouse-core && pip install .
15+
@. ./venv/bin/activate && cd ../sighthouse-client && pip install .
16+
@. ./venv/bin/activate && cd ../sighthouse-frontend && pip install .
17+
@. ./venv/bin/activate && cd ../sighthouse-pipeline && pip install .
18+
19+
check-env:
20+
@if [ ! -d "./venv" ]; then \
21+
echo -e "\nNo venv found, please use 'make install' first\n"; \
22+
exit 1; \
23+
fi
24+
25+
build: # Build the documentation
26+
build: check-env
27+
@echo "Building documentation"
28+
@. venv/bin/activate && mkdocs build --site-dir public
29+
30+
gh-deploy: # Deploy to Github pages
31+
@echo "Deploy to Github pages"
32+
@. venv/bin/activate && mkdocs gh-deploy --force
33+
34+
serve: # Serve the documentation using local server
35+
serve: check-env
36+
@echo "Serving documentation"
37+
@. venv/bin/activate && mkdocs serve -a '0.0.0.0:8000'
38+
39+
clean: # Clean build artefacts
40+
@echo "Cleaning"
41+
@rm -rf public .cache venv

doc/docs/api-reference/client.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Client API Reference
2+
3+
::: sighthouse.client.SightHouseAnalysis
4+
5+
::: sighthouse.client.Section
6+
7+
::: sighthouse.client.Function
8+
9+
::: sighthouse.client.Match
10+
11+
::: sighthouse.client.Signature
12+
13+
::: sighthouse.client.LoggingSighthouse

doc/docs/api-reference/core.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Core API Reference
2+
3+
::: sighthouse.core.utils
4+
5+
::: sighthouse.core.utils.api
6+
7+
::: sighthouse.core.utils.repo
8+
9+
::: sighthouse.core.utils.database
10+
11+
::: sighthouse.core.utils.analyzer

0 commit comments

Comments
 (0)