spellshift / realm

Realm is a cross platform Red Team engagement platform with a focus on automation and reliability.
https://docs.realm.pub/
GNU General Public License v3.0
418 stars 31 forks source link

Get Agent IP every callback #711

Closed Cictrone closed 8 months ago

Cictrone commented 8 months ago

What type of PR is this?

/kind bug

What this PR does / why we need it:

As documented in #704, we were seeing that Imix would sometimes check in faster than the networking stack would complete DHCP on some boxes. To solve this we will just refresh our primary_ip with each callback.

Which issue(s) this PR fixes:

Fixes #704

Cictrone commented 8 months ago

Some output for what it looks like while Imix waits for the box to have an IP:

 2024-03-14T22:07:25.030Z ERROR imix::config > failed to get primary ip: Local IP address not found
 2024-03-14T22:07:25.038Z INFO  imix::agent  > claimed 0 tasks
 2024-03-14T22:07:25.038Z INFO  imix::agent  > completed callback in 0s, sleeping for 5s
 2024-03-14T22:07:30.043Z ERROR imix::config > failed to get primary ip: Local IP address not found
 2024-03-14T22:07:30.050Z INFO  imix::agent  > claimed 0 tasks
 2024-03-14T22:07:30.051Z INFO  imix::agent  > completed callback in 0s, sleeping for 5s
 2024-03-14T22:07:35.053Z ERROR imix::config > failed to get primary ip: Local IP address not found
 2024-03-14T22:07:35.064Z INFO  imix::agent  > claimed 0 tasks
 2024-03-14T22:07:35.064Z INFO  imix::agent  > completed callback in 0s, sleeping for 5s
 2024-03-14T22:07:40.069Z ERROR imix::config > failed to get primary ip: Local IP address not found
 2024-03-14T22:07:40.076Z INFO  imix::agent  > claimed 0 tasks
 2024-03-14T22:07:40.077Z INFO  imix::agent  > completed callback in 0s, sleeping for 5s
 2024-03-14T22:07:45.082Z ERROR imix::config > failed to get primary ip: Local IP address not found
 2024-03-14T22:07:45.088Z INFO  imix::agent  > claimed 0 tasks
 2024-03-14T22:07:45.089Z INFO  imix::agent  > completed callback in 0s, sleeping for 5s
 2024-03-14T22:07:50.115Z INFO  imix::agent  > claimed 0 tasks
 2024-03-14T22:07:50.115Z INFO  imix::agent  > completed callback in 0s, sleeping for 5s
 2024-03-14T22:07:55.137Z INFO  imix::agent  > claimed 0 tasks
 2024-03-14T22:07:55.137Z INFO  imix::agent  > completed callback in 0s, sleeping for 5s
 2024-03-14T22:08:00.162Z INFO  imix::agent  > claimed 0 tasks
 2024-03-14T22:08:00.162Z INFO  imix::agent  > completed callback in 0s, sleeping for 5s
 2024-03-14T22:08:05.187Z INFO  imix::agent  > claimed 0 tasks
 2024-03-14T22:08:05.187Z INFO  imix::agent  > completed callback in 0s, sleeping for 5s
 2024-03-14T22:08:10.208Z INFO  imix::agent  > claimed 0 tasks
 2024-03-14T22:08:10.209Z INFO  imix::agent  > completed callback in 0s, sleeping for 5s
codecov[bot] commented 8 months ago

Codecov Report

Attention: Patch coverage is 0% with 19 lines in your changes are missing coverage. Please review.

Project coverage is 71.95%. Comparing base (b2aa17e) to head (e004008).

Files Patch % Lines
implants/imix/src/config.rs 0.00% 14 Missing :warning:
implants/imix/src/agent.rs 0.00% 5 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #711 +/- ## ========================================== - Coverage 72.06% 71.95% -0.12% ========================================== Files 175 175 Lines 12232 12251 +19 ========================================== Hits 8815 8815 - Misses 3202 3221 +19 Partials 215 215 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.