Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DONE] Feature/210 monkey mia timeout #313

Merged
merged 26 commits into from May 28, 2019
Merged

Conversation

@ShayNehmad
Copy link
Contributor

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
鈥 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 requested a review from itaymmguardicore May 7, 2019
@ShayNehmad ShayNehmad requested a review from danielguardicore May 7, 2019
ShayNehmad added 6 commits May 7, 2019
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

This comment has been minimized.

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 left a comment

Indeed bugless oriented. However still need to fix minor stuff

monkey/monkey_island/cc/models/__init__.py Outdated Show resolved Hide resolved
monkey/monkey_island/cc/models/creds.py Show resolved Hide resolved
monkey/monkey_island/cc/models/errors.py Outdated Show resolved Hide resolved
monkey/monkey_island/cc/models/monkey.py Show resolved Hide resolved
monkey/monkey_island/cc/models/monkey_ttl.py Outdated Show resolved Hide resolved
monkey/monkey_island/cc/models/test_monkey.py Outdated Show resolved Hide resolved
ShayNehmad and others added 5 commits May 27, 2019
Fixed type

Co-Authored-By: Itay Mizeretz <30774653+itaymmguardicore@users.noreply.github.com>
Copy link
Contributor

itaymmguardicore left a comment

Approved pending this passes sanity after all latest changes

@ShayNehmad

This comment has been minimized.

Copy link
Contributor Author

ShayNehmad commented May 28, 2019

Sanity passed 鉁旓笍

@ShayNehmad

This comment has been minimized.

Copy link
Contributor Author

ShayNehmad commented May 28, 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)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can鈥檛 perform that action at this time.