Skip to content

Conversation

ShayNehmad
Copy link
Contributor

@ShayNehmad ShayNehmad commented May 5, 2019

Feature / Fixes

#210

  • Have you added an explanation of what your changes do and why you'd like to include them?

  • Have you successfully tested your changes locally?

  • Example screenshot/log transcript of the feature working

  1. Run monkey on a victim machine, looks alive on map:
    image

  2. TTL is created in DB:
    image

  3. Kill monkey (sorry little guy, it's for the cause 😢)
    image

  4. Wait a bit, TTL is deleted automatically by mongodb TTL index:
    image

  5. looks dead on map:
    image

Changes

  • Added models directory, started using mongoengine
  • Added MonkeyTTL collection with TTL index which automatically deletes
  • Added is_dead function which takes the TTL into consideration, allows us to distinguish between Alive, Dead, and MIA.

@ShayNehmad ShayNehmad changed the title Feature/210 monkey mia timeout [WIP] Feature/210 monkey mia timeout May 5, 2019
ShayNehmad added 7 commits May 7, 2019 11:51
… for Monkey.is_dead

The init of models checks the env and sets up the DB connection.
Useful in many cases in the code.
Also added unittest for this method which passed.
Overshadows local
@ShayNehmad ShayNehmad changed the title [WIP] Feature/210 monkey mia timeout [CR] Feature/210 monkey mia timeout May 7, 2019
@ShayNehmad ShayNehmad added Feature Issue that describes a new feature to be implemented. island labels May 7, 2019
ShayNehmad added 6 commits May 7, 2019 17:21
Even though all monkeys have finished, the report page still used the dead=False check instead of is_dead. So even though all monkeys were dead or MIA the report page said that some monkeys are still runnning.
@VakarisZ
Copy link
Contributor

VakarisZ commented May 23, 2019

It would be perfect if we could update monkey's TTL each time it communicates to the server. For that you could write a custom decorator, that gets guid field from request and updates TTL. Then you would add this decorator to the POST method in telemetry, I'd use it for ATT&CK telems once they are done. What do you think? (I know it's a bit too much for beginner feature, but you also know a bit too much to be a beginner :D)

Copy link
Contributor

@itaymmguardicore itaymmguardicore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed bugless oriented. However still need to fix minor stuff

Copy link
Contributor

@itaymmguardicore itaymmguardicore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending this passes sanity after all latest changes

@ShayNehmad
Copy link
Contributor Author

Sanity passed ✔️

@ShayNehmad
Copy link
Contributor Author

It would be perfect if we could update monkey's TTL each time it communicates to the server. For that you could write a custom decorator, that gets guid field from request and updates TTL. Then you would add this decorator to the POST method in telemetry, I'd use it for ATT&CK telems once they are done. What do you think? (I know it's a bit too much for beginner feature, but you also know a bit too much to be a beginner :D)

You're correct, that would be a great improvement. However I believe it's not a blocker. Adding to tasklist for future, hopefully I'll get to it soon ⏲

@ShayNehmad ShayNehmad changed the title [CR] Feature/210 monkey mia timeout [DONE] Feature/210 monkey mia timeout May 28, 2019
@ShayNehmad ShayNehmad merged commit 1073eb7 into develop May 28, 2019
@ShayNehmad ShayNehmad deleted the feature/210-monkey-mia-timeout branch May 28, 2019 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Issue that describes a new feature to be implemented.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants