-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from mttaggart/dev
v1.1.0
- Loading branch information
Showing
33 changed files
with
997 additions
and
511 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,47 @@ | ||
FROM rust:latest | ||
FROM rust:latest AS rustbuilder | ||
|
||
RUN apt update -y && apt install mingw-w64 -y | ||
# Do the Rust setup, but do it just the once and separate the ON stuff | ||
|
||
RUN mkdir /opt/OffensiveNotion | ||
WORKDIR /opt/OffensiveNotion | ||
COPY agent/ . | ||
RUN echo "Installing dependencies" | ||
RUN apt update | ||
RUN apt install -y \ | ||
mingw-w64 \ | ||
gcc-multilib \ | ||
python3-pip \ | ||
cmake \ | ||
clang \ | ||
gcc \ | ||
g++ \ | ||
zlib1g-dev \ | ||
libmpc-dev \ | ||
libmpfr-dev \ | ||
libgmp-dev | ||
|
||
RUN rustup target add x86_64-pc-windows-gnu && rustup toolchain install stable-x86_64-pc-windows-gnu | ||
RUN rustup toolchain install nightly | ||
RUN rustup default nightly | ||
RUN rustup target add x86_64-pc-windows-gnu | ||
RUN rustup target add x86_64-apple-darwin | ||
|
||
# This Dockerfile gets edited dynamically by main.py. If using main.py, don't touch it. If building the Docker container from source, edit this with your target build and OS | ||
RUN cargo build {OS} {RELEASE} | ||
|
||
# Now we get to work | ||
# FROM ubuntu:latest as onbuilder | ||
|
||
RUN mkdir /OffensiveNotion | ||
RUN mkdir /OffensiveNotion/agent | ||
RUN mkdir /OffensiveNotion/agent/src | ||
RUN mkdir /OffensiveNotion/agent/target | ||
RUN mkdir /out | ||
# We're going to be more explicit about this copy over to save space in the image | ||
# Also, a fun hack to get the config.json if it exists, but copy the rest regardless | ||
COPY ./main.py ./requirements.txt config.jso[n] /OffensiveNotion/ | ||
COPY ./utils /OffensiveNotion/utils | ||
COPY ./agent/Cargo.toml ./agent/build.rs ./agent/offensive_notion.rc ./agent/notion.ico /OffensiveNotion/agent/ | ||
COPY ./agent/src/ /OffensiveNotion/agent/src/ | ||
|
||
WORKDIR /OffensiveNotion | ||
|
||
# MacOS install. If not building a macOS agent, feel free to comment this RUN command out. | ||
RUN git clone https://github.com/tpoechtrager/osxcross && cd osxcross && wget -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz && mv MacOSX10.10.sdk.tar.xz tarballs/ && echo "[*] Building osxcross. This may take a while..." &&UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh > /dev/null 2>&1 && echo "[+] Done!" | ||
|
||
RUN pip3 install -r requirements.txt | ||
ENTRYPOINT ["/usr/bin/python3", "main.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
use std::error::Error; | ||
use std::path::Path; | ||
use std::env::set_current_dir; | ||
use crate::cmd::{CommandArgs, notion_out}; | ||
|
||
/// Changes the directory using system tools | ||
/// Rather than the shell | ||
pub fn handle(s: &String) -> Result<String, Box<dyn Error>> { | ||
let new_path = Path::new(s.trim()); | ||
pub fn handle(cmd_args: &mut CommandArgs) -> Result<String, Box<dyn Error>> { | ||
let path_arg = cmd_args.nth(0).unwrap_or_else(|| ".".to_string()); | ||
let new_path = Path::new(&path_arg); | ||
match set_current_dir(new_path) { | ||
Ok(_) => Ok(format!("Changed to {s}").to_string()), | ||
Err(e) => Ok(e.to_string()) | ||
Ok(_) => notion_out!("Changed to {path_arg}"), | ||
Err(e) => Ok(format!("{e}")) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.