Skip to content

Commit

Permalink
Merge branch 'main' into 194-expand-shell-command-to-return-exit-code…
Browse files Browse the repository at this point in the history
…-and-stderr
  • Loading branch information
hulto authored Jun 15, 2023
2 parents c8fabb5 + 24b3700 commit 343b500
Show file tree
Hide file tree
Showing 9 changed files with 291 additions and 128 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
uses: codecov/codecov-action@v3
implants:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os:
Expand Down Expand Up @@ -63,4 +64,4 @@ jobs:
- name: 🔎 Run tests
run: cd ./implants/ && cargo llvm-cov nextest --lcov --output-path lcov.info
- name: 📶 Upload Coverage Results
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v3
2 changes: 2 additions & 0 deletions docs/_data/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
children:
- title: Standard Library
url: "user-guide/eldritch#standard-library"
- title: "Golem"
url: "user-guide/golem"
- title: Developer Guide
url: dev-guide
links:
Expand Down
252 changes: 178 additions & 74 deletions docs/_docs/user-guide/eldritch.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/_docs/user-guide/tavern.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ After installing the gcloud CLI, run `gcloud auth application-default login` to
terraform apply -var="gcp_project=new-realm-deployment" -var="oauth_client_id=12345.apps.googleusercontent.com" -var="oauth_client_secret=ABCDEFG" -var="oauth_domain=test-tavern.redteam.toys"
```

After terraform completes succesfully, head to the [DNS mappings for Cloud Run](https://console.cloud.google.com/run/domains) and wait for a certificate to successfully provision. This may take a while, so go enjoy a nice cup of coffee ☕
After terraform completes successfully, head to the [DNS mappings for Cloud Run](https://console.cloud.google.com/run/domains) and wait for a certificate to successfully provision. This may take a while, so go enjoy a nice cup of coffee ☕

After your certificate has successfully provisioned, it may still take a while (e.g. an hour or two) before you are able to visit Tavern using your custom OAuth Domain (if configured).

Expand Down
12 changes: 6 additions & 6 deletions implants/eldritch/src/pivot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,22 @@ fn methods(builder: &mut MethodsBuilder) {
smb_exec_impl::smb_exec(target, port, username, password, hash, command)
}
// May want these too: PSRemoting, WMI, WinRM
fn port_scan<'v>(this: PivotLibrary, starlark_heap: &'v Heap, target_cidrs: Vec<String>, ports: Vec<i32>, portocol: String, timeout: i32) -> anyhow::Result<Vec<Dict<'v>>> {
fn port_scan<'v>(this: PivotLibrary, starlark_heap: &'v Heap, target_cidrs: Vec<String>, ports: Vec<i32>, protocol: String, timeout: i32) -> anyhow::Result<Vec<Dict<'v>>> {
if false { println!("Ignore unused this var. _this isn't allowed by starlark. {:?}", this); }
port_scan_impl::port_scan(starlark_heap, target_cidrs, ports, portocol, timeout)
port_scan_impl::port_scan(starlark_heap, target_cidrs, ports, protocol, timeout)
}
fn arp_scan(this: PivotLibrary, target_cidrs: Vec<String>) -> anyhow::Result<Vec<String>> {
if false { println!("Ignore unused this var. _this isn't allowed by starlark. {:?}", this); }
arp_scan_impl::arp_scan(target_cidrs)
}
fn port_forward(this: PivotLibrary, listen_address: String, listen_port: i32, forward_address: String, forward_port: i32, portocol: String) -> anyhow::Result<NoneType> {
fn port_forward(this: PivotLibrary, listen_address: String, listen_port: i32, forward_address: String, forward_port: i32, protocol: String) -> anyhow::Result<NoneType> {
if false { println!("Ignore unused this var. _this isn't allowed by starlark. {:?}", this); }
port_forward_impl::port_forward(listen_address, listen_port, forward_address, forward_port, portocol)?;
port_forward_impl::port_forward(listen_address, listen_port, forward_address, forward_port, protocol)?;
Ok(NoneType{})
}
fn ncat(this: PivotLibrary, address: String, port: i32, data: String, portocol: String) -> anyhow::Result<String> {
fn ncat(this: PivotLibrary, address: String, port: i32, data: String, protocol: String) -> anyhow::Result<String> {
if false { println!("Ignore unused this var. _this isn't allowed by starlark. {:?}", this); }
ncat_impl::ncat(address, port, data, portocol)
ncat_impl::ncat(address, port, data, protocol)
}
// Seems to have the best protocol support - https://github.com/ajmwagar/merino
fn bind_proxy(this: PivotLibrary, listen_address: String, listen_port: i32, username: String, password: String) -> anyhow::Result<NoneType> {
Expand Down
2 changes: 1 addition & 1 deletion implants/eldritch/src/pivot/port_forward_impl.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;

pub fn port_forward(_listen_address: String, _listen_port: i32, _forward_address: String, _forward_port: i32, _portocol: String) -> Result<()> {
pub fn port_forward(_listen_address: String, _listen_port: i32, _forward_address: String, _forward_port: i32, _protocol: String) -> Result<()> {
unimplemented!("Method unimplemented")
}
6 changes: 3 additions & 3 deletions implants/eldritch/src/pivot/port_scan_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ async fn handle_port_scan(target_cidrs: Vec<String>, ports: Vec<i32>, protocol:
// ]

// Non-async wrapper for our async scan.
pub fn port_scan(starlark_heap: &Heap, target_cidrs: Vec<String>, ports: Vec<i32>, portocol: String, timeout: i32) -> Result<Vec<Dict>> {
if portocol != TCP && portocol != UDP {
pub fn port_scan(starlark_heap: &Heap, target_cidrs: Vec<String>, ports: Vec<i32>, protocol: String, timeout: i32) -> Result<Vec<Dict>> {
if protocol != TCP && protocol != UDP {
return Err(anyhow::anyhow!("Unsupported protocol. Use 'tcp' or 'udp'."))
}

Expand All @@ -347,7 +347,7 @@ pub fn port_scan(starlark_heap: &Heap, target_cidrs: Vec<String>, ports: Vec<i32
.unwrap();

let response = runtime.block_on(
handle_port_scan(target_cidrs, ports, portocol, timeout)
handle_port_scan(target_cidrs, ports, protocol, timeout)
);

match response {
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 @@ -72,7 +72,7 @@ fn main() -> anyhow::Result<()> {
tome_files_and_content.push( (tome_path, tome_contents) )
}

let runtime = tokio::runtime::Builder::new_current_thread()
let runtime = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.unwrap();
Expand Down
Loading

0 comments on commit 343b500

Please sign in to comment.