Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/reflective_loader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ edition = "2021"
crate-type = ["cdylib"]

[profile.dev]
opt-level = "z" # This reduces the numebr of symbols not found.
opt-level = "z" # This reduces the number of symbols not found.
lto = true
codegen-units = 1
panic = "abort"
Expand Down
6 changes: 3 additions & 3 deletions bin/reflective_loader/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ struct PeFileHeaders64 {
section_headers: [IMAGE_SECTION_HEADER; MAX_PE_SECTIONS],
}

// Pares the PE file from a series of bytes
// Parses the PE file from a series of bytes
#[cfg(target_arch = "x86_64")]
impl PeFileHeaders64 {
fn new(dll_bytes_ptr: *mut c_void) -> Self {
Expand Down Expand Up @@ -390,7 +390,7 @@ fn process_import_address_tables(
function_ordinal_ptr,
) as _;
} else {
// Calculate a refernce to the function name by adding the dll_base and name's RVA.
// Calculate a reference to the function name by adding the dll_base and name's RVA.
let image_import_ptr: *mut IMAGE_IMPORT_BY_NAME = (new_dll_base as usize
+ unsafe { library_thunk.u1.AddressOfData } as usize)
as *mut IMAGE_IMPORT_BY_NAME;
Expand Down Expand Up @@ -819,7 +819,7 @@ mod tests {
assert_eq!(base_reloc_entry.reloc_type, 0xa);
}

// PE Headers change everytime create file dll is built
// PE Headers change every time create file dll is built
// #[test]
// fn test_reflective_loader_parse_pe_headers() -> () {

Expand Down
2 changes: 1 addition & 1 deletion implants/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ rand_chacha = { version = "0.3.1", default-features = false, features = ["std"]}
regex = { version = "1.5.5", default-features = false}
reqwest = { version = "0.12.15", default-features = false }
russh = "0.37.1"
russh-sftp = "=2.0.8" # `thiserror` dependcy in older versions causes downstream issues in other libraries.
russh-sftp = "=2.0.8" # `thiserror` dependency in older versions causes downstream issues in other libraries.
russh-keys = "0.37.1"
rustls = "0.23"
quinn = { version = "0.11", default-features = false, features = ["ring", "runtime-tokio"] }
Expand Down
2 changes: 1 addition & 1 deletion implants/golem/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn main() -> anyhow::Result<()> {
});
}
}
// If we havent specified tomes in INPUT, we need to look through the asset locker for tomes to run
// If we haven't specified tomes in INPUT, we need to look through the asset locker for tomes to run
if parsed_tomes.is_empty() {
match locker.list() {
Ok(assets) => {
Expand Down
2 changes: 1 addition & 1 deletion implants/golem/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn test_golem_main_loaded_files() -> anyhow::Result<()> {

// Test running `./golem -a ../../bin/golem_cli_test/ -e`
// NOTE: Depending on how this test is run, the commands may not actually be run
// therefor we only test the output of eldritch and not the stdlib
// therefore we only test the output of eldritch and not the stdlib
#[test]
fn test_golem_main_loaded_and_embdedded_files() -> anyhow::Result<()> {
let mut cmd = Command::new(cargo_bin!("golem"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub fn find_best_match(target: &str, candidates: &[String]) -> Option<String> {
// Threshold logic:
// Allow a distance of up to 4, or half the string length + 1.
// This allows "config" (6) -> "get_config" (10) (dist 4, threshold 4)
// "apend" (5) -> "append" (6) (dist 1, threshold 3)
// "append" (5) -> "append" (6) (dist 1, threshold 3)
let threshold = (target.len() / 2 + 1).clamp(1, 4);

for candidate in candidates {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async fn handle_ncat(address: String, port: i32, data: String, protocol: String)
// Connect to remote host
let mut connection = TcpStream::connect(&address_and_port).await?;

// Write our meessage
// Write our message
connection.write_all(data.as_bytes()).await?;

// Read server response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ async fn handle_port_scan(

let mut result: Vec<(String, i32, String, String)> = vec![];
// Await results of each job.
// We are not acting on scan results indepently so it's okay to loop through each and only return when all have finished.
// We are not acting on scan results independently so it's okay to loop through each and only return when all have finished.
for task in all_scan_futures {
match task.await? {
Ok(res) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ mod tests {
offset: u64,
data: Vec<u8>,
) -> Result<Status, Self::Error> {
//Warning this will only write one chunk - subsequesnt chunks will overwirte the old ones.
//Warning this will only write one chunk - subsequesnt chunks will overwrite the old ones.
// Tests over the size of the chunk will fail
let tmp_data = String::from_utf8(data).unwrap();
fs::write(handle, tmp_data.trim_end_matches(char::from(0))).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion implants/lib/transport/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ http = { workspace = true }
tower = { workspace = true }
# Use hyper 1.x for grpc
hyper = { workspace = true, features = ["client"] }
# These crates are kinda funky gonna keep them in just transprot for now.
# These crates are kinda funky gonna keep them in just transport for now.
hyper_legacy = { package = "hyper", version = "0.14", features = ["client", "http1", "http2", "stream"] }
hyper-util = { version = "0.1", features = ["client", "client-legacy", "http1", "http2"] }
hyper-rustls = { version = "0.27", default-features = false, features = ["webpki-tokio", "http2"] }
Expand Down
2 changes: 1 addition & 1 deletion tavern/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ import (
tavernmcp "realm.pub/tavern/internal/mcp"
"realm.pub/tavern/internal/portals"
"realm.pub/tavern/internal/portals/mux"
"realm.pub/tavern/internal/portals/ssh"
"realm.pub/tavern/internal/portals/pty"
"realm.pub/tavern/internal/portals/ssh"
"realm.pub/tavern/internal/redirectors"
"realm.pub/tavern/internal/scheduler"
"realm.pub/tavern/internal/secrets"
Expand Down
2 changes: 1 addition & 1 deletion tavern/internal/auth/token_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ParamTokenRedirToken = "access_token"
// HeaderAPIAccessToken is the name of the header clients should set to authenticate with personal access tokens.
const HeaderAPIAccessToken = "X-Tavern-Access-Token"

// NewTokenRedirectHandler returns a new http endpoint that redirects the requestor to http://127.0.0.1 at the port specified
// NewTokenRedirectHandler returns a new http endpoint that redirects the requester to http://127.0.0.1 at the port specified
// in the query parameters. This method requires an authenticated session, and will set the user's personal access token in the redirected
// URL query parameters intended for use by CLI applications authenticating to Tavern.
func NewTokenRedirectHandler() http.HandlerFunc {
Expand Down
1 change: 0 additions & 1 deletion tavern/internal/c2/api_claim_tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,4 +494,3 @@ func (srv *Server) ClaimTasks(ctx context.Context, req *c2pb.ClaimTasksRequest)
// Return claimed tasks
return &resp, nil
}

4 changes: 2 additions & 2 deletions tavern/internal/cdn/download_screenshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ func TestDownloadScreenshot(t *testing.T) {
wantBody: []byte(fmt.Sprintf("%s\n", cdn.ErrInvalidFileID.Error())),
},
{
name: "Cached",
reqURL: fmt.Sprintf("/download/%d", existingScreenshot.ID),
name: "Cached",
reqURL: fmt.Sprintf("/download/%d", existingScreenshot.ID),
wantStatus: cdn.ErrFileNotModified.StatusCode,
wantBody: []byte(fmt.Sprintf("%s\n", cdn.ErrFileNotModified.Error())),
},
Expand Down
2 changes: 1 addition & 1 deletion tavern/internal/ent/enttest/testdb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions tavern/internal/graphql/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (

type testCase struct {
State string `yaml:"state"`
Requestor struct {
Requester struct {
SessionToken string `yaml:"session_token"`
} `yaml:"requestor"`
} `yaml:"requester"`
Query string `yaml:"query"`
Variables map[string]any `yaml:"variables"`
Expected map[string]any `yaml:"expected"`
Expand Down Expand Up @@ -96,11 +96,11 @@ func runTestCase(t *testing.T, path string) {
opts = append(opts, client.Var(key, val))
}

// Requestor
if tc.Requestor.SessionToken != "" {
// Requester
if tc.Requester.SessionToken != "" {
opts = append(opts, client.AddCookie(&http.Cookie{
Name: auth.SessionCookieName,
Value: tc.Requestor.SessionToken,
Value: tc.Requester.SessionToken,
Expires: time.Now().Add(24 * time.Hour),
}))
}
Expand Down
2 changes: 1 addition & 1 deletion tavern/internal/graphql/testdata/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ state: |
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true);

# Authenticate as that user (via session_token)
requestor:
requester:
session_token: secretToken

# Query all existing users
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ state: |
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true);
INSERT INTO `hosts` (id, name, identifier, platform, created_at, last_modified_at)
VALUES (1010,"db1","EXISTING-HOST", "PLATFORM_UNSPECIFIED", "2023-03-04 14:51:13", "2023-03-04 14:51:13");
requestor:
requester:
session_token: secretToken
query: |
mutation CreateQuestWithNoBeacons($input: CreateHostCredentialInput!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ state: |
VALUES(1011, "2023-03-04 14:51:13", "2023-03-04 14:51:13", "Test Quest", 2000);
INSERT INTO `tasks` (id, created_at, last_modified_at, output_size, quest_tasks, task_beacon)
VALUES(1012, "2023-03-04 14:51:13", "2023-03-04 14:51:13", 100, 1011, 1337);
requestor:
requester:
session_token: secretToken
query: |
mutation CreateQuestWithNoBeacons($input: CreateHostCredentialInput!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ state: |
INSERT INTO `assets` (id, name, content, hash, size, created_at, last_modified_at)
VALUES (1001, "TestAsset", "test content", "abcdefg123", 12, "2024-01-22 14:51:13", "2024-01-22 14:51:13");

requestor:
requester:
session_token: secretToken
query: |
mutation CreateLink($input: CreateLinkInput!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ state: |
VALUES (1010,"db1","EXISTING-HOST", "PLATFORM_UNSPECIFIED", "2023-03-04 14:51:13", "2023-03-04 14:51:13");
INSERT INTO `tomes` (id, name, description, author, eldritch, hash, created_at, last_modified_at)
VALUES (2000,"Test Tome","Used in a unit test :D", "kcarretto", "print('Hello World!')", "abcdefg", "2023-03-04 14:51:13", "2023-03-04 14:51:13");
requestor:
requester:
session_token: secretToken
query: |
mutation CreateQuestWithNoBeacons($beaconIDs: [ID!]!, $input: CreateQuestInput!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ state: |
VALUES (1337,"delightful-lich","ABCDEFG-123456",1010, "TRANSPORT_UNSPECIFIED", "2024-01-22 14:51:13", "2024-01-22 14:51:13");
INSERT INTO `tomes` (id, name, description, author, eldritch, hash, created_at, last_modified_at)
VALUES (2000,"Test Tome","Used in a unit test :D", "kcarretto", "print('Hello World!')", "abcdefg", "2023-03-04 14:51:13", "2023-03-04 14:51:13");
requestor:
requester:
session_token: secretToken
query: |
mutation CreateQuestWithNoFiles($beaconIDs: [ID!]!, $input: CreateQuestInput!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ state: |
VALUES (2000, 3000);
INSERT INTO `tome_assets` (tome_id, asset_id)
VALUES (2000, 3001);
requestor:
requester:
session_token: secretToken
query: |
mutation CreateQuestWithFiles($beaconIDs: [ID!]!, $input: CreateQuestInput!) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true);
requestor:
requester:
session_token: secretToken
query: |
mutation CreateRepository($input: CreateRepositoryInput!) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true);
requestor:
requester:
session_token: secretToken
query: |
mutation CreateRepository($input: CreateRepositoryInput!) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true);
requestor:
requester:
session_token: secretToken
query: |
mutation CreateRepository($input: CreateRepositoryInput!) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true);
requestor:
requester:
session_token: secretToken
query: |
mutation CreateRepository($input: CreateRepositoryInput!) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true);
requestor:
requester:
session_token: secretToken
query: |
mutation CreateRepository($input: CreateRepositoryInput!) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true);
requestor:
requester:
session_token: secretToken
query: |
mutation CreateRepository($input: CreateRepositoryInput!) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true);
requestor:
requester:
session_token: secretToken
query: |
mutation CreateRepository($input: CreateRepositoryInput!) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true);
requestor:
requester:
session_token: secretToken
query: |
mutation CreateRepository($input: CreateRepositoryInput!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ state: |
VALUES (1010,"db1","EXISTING-HOST","PLATFORM_UNSPECIFIED","2024-01-22 14:51:13", "2024-01-22 14:51:13");
INSERT INTO `beacons` (id, name, identifier, beacon_host, transport, created_at, last_modified_at)
VALUES (1337,"delightful-lich","ABCDEFG-123456", 1010, "TRANSPORT_UNSPECIFIED", "2024-01-22 14:51:13", "2024-01-22 14:51:13");
requestor:
requester:
session_token: secretToken
query: |
mutation CreateGroupTag($input: CreateTagInput!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ state: |
VALUES (420,"lovely-emu","ZYXWVUT-987654",1010, "TRANSPORT_UNSPECIFIED", "2024-01-22 14:51:13", "2024-01-22 14:51:13");
INSERT INTO `beacons` (id, name, identifier, beacon_host, transport, created_at, last_modified_at)
VALUES (421,"ballin-emu","ZYXWVUT-1234",1011, "TRANSPORT_UNSPECIFIED", "2024-01-22 14:51:13", "2024-01-22 14:51:13");
requestor:
requester:
session_token: secretToken
query: |
mutation CreateGroupTag($input: CreateTagInput!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ state: |
VALUES (1010,"db1","EXISTING-HOST", "PLATFORM_UNSPECIFIED", "2024-01-22 14:51:13", "2024-01-22 14:51:13");
INSERT INTO `beacons` (id, name, identifier, beacon_host, transport, created_at, last_modified_at)
VALUES (1337,"delightful-lich","ABCDEFG-123456",1010, "TRANSPORT_UNSPECIFIED", "2024-01-22 14:51:13", "2024-01-22 14:51:13");
requestor:
requester:
session_token: secretToken
query: |
mutation CreateServiceTag($input: CreateTagInput!) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,access_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,true);
requestor:
requester:
session_token: secretToken
query: |
mutation CreateTomeWithNoFiles($input: CreateTomeInput!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ state: |
VALUES (3000,"TestFile1", "hello world", "abcdefg", "2023-03-04 14:51:13", "2023-03-04 14:51:13");
INSERT INTO `assets` (id, name, content, hash, created_at, last_modified_at)
VALUES (3001,"TestFile2", "some test", "abcdefg", "2023-03-04 14:51:13", "2023-03-04 14:51:13");
requestor:
requester:
session_token: secretToken
query: |
mutation CreateTomeWithFiles($input: CreateTomeInput!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ state: |
VALUES (200, "Low", false, false, 5, 100, "2024-01-22 14:51:13", "2024-01-22 14:51:13");
INSERT INTO `notifications` (id, priority, `read`, archived, notification_user, notification_event, created_at, last_modified_at)
VALUES (201, "High", true, false, 5, 101, "2024-01-22 14:51:13", "2024-01-22 14:51:13");
requestor:
requester:
session_token: secretToken
query: |
mutation DeleteAllNotifications {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ state: |
VALUES (100, 1700000000, "BEACON_LOST", "2024-01-22 14:51:13", "2024-01-22 14:51:13");
INSERT INTO `notifications` (id, priority, `read`, archived, notification_user, notification_event, created_at, last_modified_at)
VALUES (200, "Low", false, false, 5, 100, "2024-01-22 14:51:13", "2024-01-22 14:51:13");
requestor:
requester:
session_token: secretToken
query: |
mutation DeleteAllNotifications {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ state: |
VALUES (3000, "TestFile1", "hello world", "a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447", "2023-03-04 14:51:13", "2023-03-04 14:51:13");
INSERT INTO `tome_assets` (tome_id, asset_id)
VALUES (2000, 3000);
requestor:
requester:
session_token: secretToken
query: |
mutation DeleteAsset($assetID: ID!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ state: |
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken","accessToken",true,false);
INSERT INTO `assets` (id, name, content, hash, created_at, last_modified_at)
VALUES (3000, "TestFile1", "hello world", "a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447", "2023-03-04 14:51:13", "2023-03-04 14:51:13");
requestor:
requester:
session_token: secretToken
query: |
mutation DeleteAsset($assetID: ID!) {
Expand Down
Loading
Loading