Last active
June 15, 2023 09:12
-
-
Save tqk2811/90bd180e574f82ed7c47990825e294b0 to your computer and use it in GitHub Desktop.
AutoLoginGoogleExt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome.runtime.onMessage.addListener(function (message, sender, callback) { | |
if (message && message == "close_tab_call") { | |
chrome.tabs.remove(sender.tab.id, function () {}); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var g_acc = { | |
email: "{email}", | |
pass: "{pass}", | |
recovery: "{recovery}" | |
}; | |
var step = 0; | |
var timeout = Number("{timeout}"); | |
var intervalTime = Number("{intervalTime}"); | |
window.addEventListener('load', function () { | |
window.setInterval(RunLogin, intervalTime); | |
window.setTimeout(closeChrome, timeout); | |
if (window.location.href.includes("myaccount.google.com")) closeChrome(); | |
if (!window.location.href.includes("accounts.google.com")) closeChrome(); | |
}); | |
function RunLogin() { | |
switch (step) { | |
case 0: { | |
if (document.body.innerHTML.includes(g_acc.email)) { | |
step = -1; | |
closeChrome(); | |
} | |
let email = document.querySelector("input[id='identifierId']"); | |
let btn_emailnext = document.querySelector("[id='identifierNext'] button"); | |
if (email && btn_emailnext && !isHidden(email)) { | |
email.value = g_acc.email; | |
btn_emailnext.click(); | |
step++; | |
} | |
break; | |
} | |
case 1: { | |
let pass = document.querySelector("input[name='password']"); | |
let btn_passnext = document.querySelector("[id='passwordNext'] button"); | |
if (pass && btn_passnext && !isHidden(pass)) { | |
pass.value = g_acc.pass; | |
btn_passnext.click(); | |
step++; | |
} | |
break; | |
} | |
case 2: { | |
let recs = document.querySelectorAll("div[jsname='EBHGs']:not([id])"); | |
if (recs.length != 0) { | |
recs[recs.length - 1].click(); | |
step++; | |
} | |
else { | |
let rec_mail = document.querySelector("input[id='knowledge-preregistered-email-response']"); | |
if(rec_mail && !isHidden(rec_mail)){ | |
step++; | |
} | |
} | |
break; | |
} | |
case 3: { | |
let rec_mail = document.querySelector("input[id='knowledge-preregistered-email-response']"); | |
let rec_mail_next = document.querySelector("button[jsname='LgbsSe']"); | |
if (rec_mail && rec_mail_next && !isHidden(rec_mail)) { | |
rec_mail.value = g_acc.recovery; | |
rec_mail_next.click(); | |
step++; | |
} | |
break; | |
} | |
} | |
} | |
function closeChrome() { | |
chrome.runtime.sendMessage("close_tab_call"); | |
} | |
function isHidden(el) { | |
return (el.offsetParent === null) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Auto Login Google", | |
"description": "Auto Login Google.", | |
"version": "0.0.1", | |
"permissions": [ | |
"<all_urls>", | |
"activeTab", | |
"tabs" | |
], | |
"background": { | |
"scripts": [ | |
"/background.js" | |
], | |
"persistent": true | |
}, | |
"manifest_version": 2, | |
"content_scripts": [ | |
{ | |
"run_at": "document_idle", | |
"matches": [ | |
"https://*.google.com/*" | |
], | |
"js": [ | |
"/inject.js" | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Có hướng dẫn chi tiết không bạn? Tôi không phải dân IT