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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension: AdminUI: Fixed offline zombie not deleting #2165

Merged
merged 1 commit into from
Sep 12, 2021
Merged

Extension: AdminUI: Fixed offline zombie not deleting #2165

merged 1 commit into from
Sep 12, 2021

Conversation

wheatley
Copy link
Contributor

Category

Extension: Admin UI

Currently there is a defect if an offline zombie exists and you try to delete it in the tree list view, it will not delete.
This was due to the existing code not referencing the correct variable for online/offline hooked browser

Screen Shot 2021-09-12 at 8 59 09 am

  var hb_id = this.contextNode.id.split('zombie-online-')[1];
  var hb_id_off = this.contextNode.id.split('zombie-offline-')[1];

The code used to delete the zombie referenced the hb_id

  var token = beefwui.get_rest_token();
  if (!confirm('Are you sure you want to delete zombie [id: ' + hb_id + '] ?\nWarning: this will remove all zombie related data, including logs and command results!')) {
     //commands_statusbar.update_fail('Cancelled');
    return;
  }
     
  //commands_statusbar.update_sending('Removing zombie [id: ' + hb_id + '] ...');
  var url = "/api/hooks/" + escape(hb_id) + "/delete?token=" + token;
  Ext.Ajax.request({
    url: url,
    method: 'GET'
  });

Do make sure the delete for both online/offline will work the following code could be used.
Splits the id by - and references the last substring which contains the ID.

  var hb_id = this.contextNode.id.split('-')[2];

Test Cases

Currently testing will ned to be carried out manually, but will be add when automatic tests are created.

  1. Start beef
  2. Hook Browser
  3. Close Hooked Browser
  4. Right click zombie on panel

Screen Shot 2021-09-12 at 8 58 59 am

  1. Check id value is set in confirmation

Screen Shot 2021-09-12 at 9 01 05 am

  1. Confirm deletion
  2. Wait for hooked browser to disappear

Screen Shot 2021-09-12 at 9 01 17 am

Improvements

Most likely should add in a guard clause incase there isn't a ID
Automatic testing to verify that this works

@wheatley wheatley self-assigned this Sep 11, 2021
@wheatley wheatley linked an issue Sep 11, 2021 that may be closed by this pull request
@wheatley wheatley added this to the 0.5.2.0 milestone Sep 11, 2021
@wheatley wheatley changed the base branch from master to release-0.5.2.0 September 11, 2021 23:07
Copy link
Contributor

@DeezyE DeezyE left a comment

Choose a reason for hiding this comment

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

Nice find

@DeezyE DeezyE merged commit 00d2b20 into beefproject:release-0.5.2.0 Sep 12, 2021
@wheatley wheatley deleted the 2044_zombies_not_deleting branch September 12, 2021 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zombies not deleting.
2 participants