gmailnator
Advanced tools
Comparing version 1.0.5 to 1.1.0
150
index.js
@@ -1,2 +0,2 @@ | ||
const needle = require('needle'); | ||
const got = require("got"); | ||
const cheerio = require('cheerio'); | ||
@@ -6,11 +6,44 @@ const url = require('url'); | ||
exports.generateEmail = (cb) =>{ | ||
var data = "action=GenerateEmail&data=[]=2&data[]=1&data[]=3"; | ||
needle.post("https://gmailnator.com/index/indexquery",data,function(err,resp,body){ | ||
if (!err) { | ||
var err = null; | ||
cb(err,body); | ||
} else { | ||
var body = null; | ||
cb(err,body) | ||
got("https://gmailnator.com/", { | ||
headers: { | ||
"Host": "gmailnator.com", | ||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0", | ||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", | ||
"Accept-Language": "en-US,en;q=0.5", | ||
"Accept-Encoding": "gzip, deflate, br", | ||
"DNT": "1", | ||
"Connection": "keep-alive", | ||
"Upgrade-Insecure-Requests": "1" | ||
} | ||
}).then(function(response) { | ||
var $ = cheerio.load(response.body); | ||
var csrf = $("#csrf-token")[0].attribs.content; | ||
var bodyD = "csrf_gmailnator_token=" + csrf + "&action=GenerateEmail&data%5B%5D=2&data%5B%5D=3"; | ||
var l1 = encodeURIComponent(bodyD).match(/%[89ABab]/g); | ||
var l = bodyD.length + (l1 ? l1.length : 0) | ||
got.post("https://gmailnator.com/index/indexquery", { | ||
body: bodyD, | ||
headers: { | ||
"Host": "gmailnator.com", | ||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0", | ||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", | ||
"Accept-Language": "en-US,en;q=0.5", | ||
"Accept-Encoding": "gzip, deflate, br", | ||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", | ||
"X-Requested-With": "XMLHttpRequest", | ||
"Content-Length": l, | ||
"Origin": "https://gmailnator.com/", | ||
"DNT": "1", | ||
"Connection": "keep-alive", | ||
"Referer": "https://gmailnator.com", | ||
"Cookie": "csrf_gmailnator_cookie=" + csrf, | ||
"TE": "Trailers" | ||
} | ||
}).then(function(response) { | ||
cb(null, response.body) | ||
}).catch(function(e) { | ||
cb(e, null) | ||
}) | ||
}).catch(function(e) { | ||
cb(e, null) | ||
}) | ||
@@ -29,7 +62,40 @@ } | ||
} | ||
var data = "action=LoadMailList&Email_address=" + encodeURIComponent(email); | ||
needle.post("https://gmailnator.com/mailbox/mailboxquery",data,function(err,resp,body) { | ||
if (!err) { | ||
var err = null; | ||
var d = JSON.parse(body); | ||
var iburl = "https://gmailnator.com/inbox/#" + email | ||
got(iburl, { | ||
headers: { | ||
"Host": "gmailnator.com", | ||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0", | ||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", | ||
"Accept-Language": "en-US,en;q=0.5", | ||
"Accept-Encoding": "gzip, deflate, br", | ||
"DNT": "1", | ||
"Connection": "keep-alive", | ||
"Upgrade-Insecure-Requests": "1" | ||
} | ||
}).then(function(response) { | ||
var $ = cheerio.load(response.body); | ||
var csrf = $("#csrf-token")[0].attribs.content; | ||
var data = "csrf_gmailnator_token=" + csrf + "&action=LoadMailList&Email_address=" + encodeURIComponent(email); | ||
var l1 = encodeURIComponent(data).match(/%[89ABab]/g); | ||
var l = data.length + (l1 ? l1.length : 0) | ||
got.post("https://gmailnator.com/mailbox/mailboxquery", { | ||
body: data, | ||
headers: { | ||
"Host": "gmailnator.com", | ||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0", | ||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", | ||
"Accept-Language": "en-US,en;q=0.5", | ||
"Accept-Encoding": "gzip, deflate, br", | ||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", | ||
"X-Requested-With": "XMLHttpRequest", | ||
"Content-Length": l, | ||
"Origin": "https://gmailnator.com/", | ||
"DNT": "1", | ||
"Connection": "keep-alive", | ||
"Referer": "https://gmailnator.com/inbox/", | ||
"Cookie": "csrf_gmailnator_cookie=" + csrf, | ||
"TE": "Trailers" | ||
} | ||
}).then(function(response){ | ||
var d = JSON.parse(response.body); | ||
var b = []; | ||
@@ -50,14 +116,18 @@ for (var c in d) { | ||
} | ||
var body = JSON.parse(JSON.stringify(b)); | ||
cb(err,body); | ||
} else { | ||
var body = null; | ||
cb(err,body) | ||
} | ||
var body = JSON.parse(JSON.stringify({ | ||
"emails": b, | ||
"csrf": csrf | ||
})); | ||
cb(null,body); | ||
}).catch(function(e) { | ||
cb(e, null) | ||
}) | ||
}).catch(function(e) { | ||
cb(e, null) | ||
}) | ||
} | ||
exports.getMessage = (str, cb) => { | ||
if (!str) { | ||
console.error("Needs email param"); | ||
exports.getMessage = (str, csrf, cb) => { | ||
if (!str | !csrf) { | ||
cb("Needs email or csrf_token param", null); | ||
return false; | ||
@@ -68,13 +138,29 @@ } | ||
var id = s.hash.substring(1, s.hash.length); | ||
var data = "action=get_message&message_id=" + id + "&email=" + email; | ||
needle.post("https://gmailnator.com/mailbox/get_single_message/", data, function(err,resp,body) { | ||
if (err) { | ||
var body = null; | ||
cb(err, body); | ||
} else { | ||
var body = body.split("<hr />")[1]; | ||
var err = null; | ||
cb(err, body); | ||
var data = "csrf_gmailnator_token=" + csrf +"&action=get_message&message_id=" + id + "&email=" + email; | ||
var l1 = encodeURIComponent(data).match(/%[89ABab]/g); | ||
var l = data.length + (l1 ? l1.length : 0) | ||
got.post("https://gmailnator.com/mailbox/get_single_message/", { | ||
body: data, | ||
headers: { | ||
"Host": "gmailnator.com", | ||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0", | ||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", | ||
"Accept-Language": "en-US,en;q=0.5", | ||
"Accept-Encoding": "gzip, deflate, br", | ||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", | ||
"X-Requested-With": "XMLHttpRequest", | ||
"Content-Length": l, | ||
"Origin": "https://gmailnator.com/", | ||
"DNT": "1", | ||
"Connection": "keep-alive", | ||
"Referer": "https://gmailnator.com/inbox/", | ||
"Cookie": "csrf_gmailnator_cookie=" + csrf, | ||
"TE": "Trailers" | ||
} | ||
}).then(function(response) { | ||
var body = response.body.split("<hr />")[1]; | ||
cb(null, body) | ||
}).catch(function(e) { | ||
cb(e, null) | ||
}) | ||
} |
{ | ||
"name": "gmailnator", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "access gmailnator.com programically", | ||
@@ -19,3 +19,3 @@ "main": "index.js", | ||
"author": "n0rmancodes", | ||
"license": "ISC", | ||
"license": "UNLICENSED", | ||
"bugs": { | ||
@@ -27,3 +27,3 @@ "url": "https://github.com/n0rmancodes/gmailnator-api/issues" | ||
"cheerio": "^1.0.0-rc.3", | ||
"needle": "^2.5.0" | ||
"got": "^11.7.0" | ||
}, | ||
@@ -30,0 +30,0 @@ "devDependencies": {}, |
const gmailnator = require("../../index.js"); | ||
gmailnator.checkEmails("jcnetmp+iw1dp@gmail.com", function(err,body) { | ||
console.log(body) | ||
gmailnator.getMessage(body[0].link, function(err,body) { | ||
console.log(body); | ||
}) | ||
console.log(body.emails.length + " mail"); | ||
if (body.emails[0]) { | ||
console.log("- getting most recent email..."); | ||
gmailnator.getMessage(body.emails[0].link, body.csrf, function (err, body) { | ||
if (err) { | ||
console.log(err); | ||
} else { | ||
console.log(body) | ||
} | ||
}) | ||
} else { | ||
console.log("- there is no mail to retrieve!") | ||
} | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8067
188
1
+ Addedgot@^11.7.0
+ Added@sindresorhus/is@4.6.0(transitive)
+ Added@szmarczak/http-timer@4.0.6(transitive)
+ Added@types/cacheable-request@6.0.3(transitive)
+ Added@types/http-cache-semantics@4.0.4(transitive)
+ Added@types/keyv@3.1.4(transitive)
+ Added@types/node@22.10.0(transitive)
+ Added@types/responselike@1.0.3(transitive)
+ Addedcacheable-lookup@5.0.4(transitive)
+ Addedcacheable-request@7.0.4(transitive)
+ Addedclone-response@1.0.3(transitive)
+ Addeddecompress-response@6.0.0(transitive)
+ Addeddefer-to-connect@2.0.1(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedget-stream@5.2.0(transitive)
+ Addedgot@11.8.6(transitive)
+ Addedhttp-cache-semantics@4.1.1(transitive)
+ Addedhttp2-wrapper@1.0.3(transitive)
+ Addedjson-buffer@3.0.1(transitive)
+ Addedkeyv@4.5.4(transitive)
+ Addedlowercase-keys@2.0.0(transitive)
+ Addedmimic-response@1.0.13.1.0(transitive)
+ Addednormalize-url@6.1.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedp-cancelable@2.1.1(transitive)
+ Addedpump@3.0.2(transitive)
+ Addedquick-lru@5.1.1(transitive)
+ Addedresolve-alpn@1.2.1(transitive)
+ Addedresponselike@2.0.1(transitive)
+ Addedundici-types@6.20.0(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedneedle@^2.5.0
- Removeddebug@3.2.7(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedms@2.1.3(transitive)
- Removedneedle@2.9.1(transitive)
- Removedsax@1.4.1(transitive)