Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
llogen committed Oct 29, 2024
0 parents commit 593eb85
Show file tree
Hide file tree
Showing 389 changed files with 44,926 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
coverage:
status:
patch:
default:
target: 30%
project:
default:
target: auto
threshold: 20%
62 changes: 62 additions & 0 deletions .github/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# syntax=docker/dockerfile:1.0.0-experimental
FROM ubuntu:22.04 AS builder

ARG TARGETARCH=amd64

# Install dependencies
RUN apt-get update
RUN apt-get -y upgrade

ENV DEBIAN_FRONTEND=noninteractive

# Install packages
RUN apt-get install -y git curl tzdata\
bison build-essential curl flex git gnat\
libncurses5-dev m4 zlib1g-dev bc libelf-dev

RUN dpkg-reconfigure --frontend noninteractive tzdata

# Install Go
RUN curl -L https://golang.org/dl/go1.19.5.linux-${TARGETARCH}.tar.gz | tar xzf -
ENV PATH=$PATH:/go/bin

RUN ln -s /lib/x86_64-linux-gnu/libc.so.6 /lib/libc.so.6

# SSH Magic
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
RUN touch /root/.ssh/config
RUN echo "StrictHostKeyChecking no" > /root/.ssh/config
RUN git config --global url."[email protected]:".insteadOf "https://github.com/"

# Build contest server
WORKDIR /root/contest
COPY . .
RUN --mount=type=ssh go build ./cmds/contest

#fwhunt dependencies
RUN --mount=type=ssh git clone https://github.com/binarly-io/fwhunt-scan.git /root/fwhunt-scan
RUN --mount=type=ssh git clone https://github.com/binarly-io/FwHunt.git /root/fwhunt-scan/FwHunt-rules

FROM ubuntu:22.04

COPY --from=builder /root/contest/contest /usr/local/bin/contest
COPY --from=builder /root/fwhunt-scan /fwhunt-scan

RUN apt-get update
RUN apt-get install -y qemu-system pip curl

# install fwhunt
WORKDIR /fwhunt-scan
RUN echo 'deb http://download.opensuse.org/repositories/home:/RizinOrg/xUbuntu_22.04/ /' | tee /etc/apt/sources.list.d/home:RizinOrg.list
RUN curl -fsSL https://download.opensuse.org/repositories/home:RizinOrg/xUbuntu_22.04/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/home_RizinOrg.gpg > /dev/null
RUN apt-get update --allow-insecure-repositories
RUN apt install rizin -y --allow-unauthenticated
RUN pip install -r requirements.txt

# Add SSH Keys for the DUTs
ADD .github/assets/ssh-keys/fwci /root/.ssh/fwci
ADD .github/assets/ssh-keys/fwci.pub /root/.ssh/fwci.pub

# Start everything
WORKDIR /
CMD contest -dbURI=""
33 changes: 33 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI
on:
push:
branches:
- main
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: .github/dockerfiles/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/contestgrpcserver:v0.4
ssh: default=${{ env.SSH_AUTH_SOCK }}
41 changes: 41 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tests

on: [push]

jobs:
linters:
name: linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19

- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: Setup gitconfig and ssh
run: |
git config --global url."[email protected]:".insteadOf "https://github.com/"
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2

- name: Check if dependencies are up-to-date
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
go mod tidy
go mod verify
git status
if [[ -n "$(git status --porcelain)" ]]; then
echo 'go.mod/sum is out-of-date: run `go mod tidy` and then check in the changes'
echo 'If `go mod tidy` results in no changes, make sure you are using the latest 1.19 release of Go'
exit 1
fi
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmds/contest/contest
cmds/clients/contestcli/contestcli
cmds/contest-generator/contest-generator
.*.swp
profile.out
.DS_Store
13 changes: 13 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
run:
timeout: 10m
linters:
enable:
- staticcheck
- unused

disable:
- typecheck

linters-settings:
lll:
line-length: 180
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Andrea Barberio <[email protected]>
Marco Guerri <[email protected]>
3 changes: 3 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# See https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax

* @linuxboot/team-contest
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <[email protected]>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
24 changes: 24 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Contributing to ConTest
We want to make contributing to this project as easy and transparent as
possible.

## Pull Requests
We actively welcome your pull requests.

1. Fork the repo and create your branch from `master`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. We request a DCO, so be sure to git commit -s

## Issues
We use GitHub issues to track public bugs. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue.

## Coding Style
We strive to follow the official Go coding style, see https://github.com/golang/go/wiki/CodeReviewComments .

## License
By contributing to ConTest, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Facebook, Inc. and its affiliates.

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:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

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
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.
Loading

0 comments on commit 593eb85

Please sign in to comment.