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

Novo branch para a nova votação #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions run-server.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SET /P email= Digite seu email da grobo:
SET /P senha= Digite sua senha da grobo:
SET /P voto= Digite sua opcao de voto [0 | 1 | 2]:
SET /P email= Digite seu email da grobo:
SET /P senha= Digite sua senha da grobo:

SET /P voto= Digite sua senha da grobo [prior | manu | mari]:
node src/index.js %voto% %email% %senha%
node src/index.js %voto% %email% %senha%
18 changes: 4 additions & 14 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,11 @@
require('dotenv/config');

const getVictim = name => {
name = name.toLowerCase();
switch (name) {
case 'prior':
return 0;
case 'manu':
return 1;
case 'mari':
return 2;
}

throw new Error('candidato invalido, use prior | manu | mari');
throw new Error('candidato invalido, use 0 | 1 | 2');
};

module.exports = () => {
const victim = process.argv[2] || 'manu';
const victim = process.argv[2] || 'gabi';
const email = process.argv[3] || process.env.EMAIL;
const password = process.argv[4] || process.env.PASSWORD;

Expand All @@ -29,8 +19,8 @@ module.exports = () => {

console.log(
`[❌] Erro: Comando invalido
Utilize: node src/index.js [prior | manu | mari] [email protected] sua_senha
Exemplo: node src/index.js prior [email protected] minhasenha123`
Utilize: node src/index.js [0 | 1 | 2] [email protected] sua_senha
Exemplo: node src/index.js 1 [email protected] minhasenha123`
.split('\n')
.map(str => str.trim())
.join('\n')
Expand Down
42 changes: 21 additions & 21 deletions src/config/contents.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
const logoAscii = `
\`-+syhhys+:\` ./syhhhs:
/hmmmmmmmmmd+ \`:ymmmmmmy-
smmmmmdhhddo. \`/hmmmmmds- \`:.
/mmmmms. .. \`+hmmmmmdo. \`:ymy
+mmmmm/ .+dmmmmmdo. \`/hmmmh
.dmmmmdo-.odmmmmmh+. .+s-.+hmmmmm/
-ymmmmmddmmmmmh/\` .odmmmdmmmmmd/
\`:ymmmmmmmmh/\` .smmmmmmmmh+.
\`:ymmmmy:\` .smmmmmmh/\`
-sy:\` -sdmmmmmh/\`
-ymmmmmmy:\`
-ymmmmmmy-
\`+dmmms-
\`+s.
\`-+syhhys+:\` ./syhhhs:
/hmmmmmmmmmd+ \`:ymmmmmmy-
smmmmmdhhddo. \`/hmmmmmds- \`:.
/mmmmms. .. \`+hmmmmmdo. \`:ymy
+mmmmm/ .+dmmmmmdo. \`/hmmmh
.dmmmmdo-.odmmmmmh+. .+s-.+hmmmmm/
-ymmmmmddmmmmmh/\` .odmmmdmmmmmd/
\`:ymmmmmmmmh/\` .smmmmmmmmh+.
\`:ymmmmy:\` .smmmmmmh/\`
-sy:\` -sdmmmmmh/\`
-ymmmmmmy:\`
-ymmmmmmy-
\`+dmmms-
\`+s.
HE4RT DEVELOPERS
DISCORD.IO/HE4RT
DISCORD.IO/HE4RT
`;

const links = {
loginUrl: 'https://minhaconta.globo.com',
voteUrl:
'https://gshow.globo.com/realities/bbb/bbb20/votacao/paredao-bbb20-quem-voce-quer-eliminar-felipe-manu-ou-mari-a9f49f90-84e2-4c12-a9af-b262e2dd5be4.ghtml',
'https://gshow.globo.com/realities/bbb/bbb20/votacao/paredao-bbb20-quem-voce-quer-eliminar-babu-gabi-ou-thelma-305135b8-b442-4cc8-888f-2a01ed79cc2d.ghtml',
challengeUrl: 'https://captcha.globo.com/api/challenge/generate',
challengeAcceptedUrl:
'https://royale.globo.com/polls/8e81660d-89b5-4777-a324-6f2da878c5c7',
Expand All @@ -34,7 +34,7 @@ const XPathContents = {
'/html/body/div[1]/main/div[2]/div/div/div/div[2]/div[1]/form/div[3]/div[1]/input',
loginBtn:
'/html/body/div[1]/main/div[2]/div/div/div/div[2]/div[1]/form/div[6]/button',
revoteBtn: '/html/body/div[2]/div[4]/div/div[3]/div/div/div[1]/div[2]/button',
revoteBtn: '/html/body/div[1]/div[4]/div/div[3]/div/div/div[1]/div[2]/button',
captchaImage:
'/html/body/div[2]/div[4]/div/div[1]/div[4]/div[2]/div[2]/div/div/div[2]/div/div[2]/img'
};
Expand All @@ -45,10 +45,10 @@ const users = [
'/html/body/div[2]/div[4]/div/div[1]/div[4]/div[3]/div'
];

/*
PRIOR = 0
MANU = 1
MARI = 2
/*
BABU = 0
GABI = 1
THELMA = 2
*/

module.exports = {
Expand Down
26 changes: 14 additions & 12 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ let availableImages = [];
const fsExtra = require('fs-extra');

const timeout = ms => new Promise(resolve => setTimeout(resolve, ms));

const runLogin = auth => async page => {
await page.goto(links.loginUrl);

Expand All @@ -24,7 +25,7 @@ const runLogin = auth => async page => {

await page.waitForNavigation();
await page.goto(links.voteUrl);
// removeCss(page);
removeCss(page);
};

const configs = async () => {
Expand All @@ -51,14 +52,14 @@ const removeCss = async page => {
display: none !important;
}
`;
await page.$eval('#banner_votacao1', e => {
/*await page.$eval('#banner_votacao1', e => {
var me = $('#banner_votacao1');
var newMe = $(
'<img style="width: 100%;" src="https://i.imgur.com/4XShvht.gif">'
);
newMe.html(me.html());
me.replaceWith(newMe);
});
});*/
await page.addStyleTag({ content: css });
};

Expand Down Expand Up @@ -96,10 +97,11 @@ const vote = victim => async page => {

const revote = victim => async page => {
await new Promise(resolve => setTimeout(resolve, 400));
const retryBtn = await page.waitForXPath(XPathContents.revoteBtn);
//const retryBtn = await page.waitForSelector('_3VpV6myQ0E-1rsgh9PoeaN _2RlpFUvPRVdsXs_oOyQ_pN');

await retryBtn.click();
//await retryBtn.click();

await page.goto(links.voteUrl);
await new Promise(resolve => setTimeout(resolve, 400));
vote(victim)(page);
};
Expand Down Expand Up @@ -191,8 +193,8 @@ const challengePage = async (page, response, setToSave) => {
if (mainSymbol.length === 0) {
return false;
}
}
*/
}*/


if (mainSymbol.length === 1 && mainSymbol[1] === 'no existe') {
return resetCaptcha(page);
Expand Down Expand Up @@ -244,7 +246,7 @@ const challengeAcceptedPage = victim => async (

if (parseInt(status) === 200) {
revote(victim)(_page);
if (toSave) {
//if (toSave) {
try {
const res = await instance.post('/vote', {
success: true,
Expand All @@ -253,7 +255,7 @@ const challengeAcceptedPage = victim => async (
});
const { localVotes, totalVotes } = res.data;
console.clear();
console.log('\x1b[35m', logoAscii);
//console.log('\x1b[35m', logoAscii);
console.log(
'\x1b[32m',
`
Expand All @@ -264,10 +266,10 @@ const challengeAcceptedPage = victim => async (
} catch (e) {
console.log(e.response.data);
}
}
//}
} else {
console.clear();
console.log('\x1b[35m', logoAscii);
//console.log('\x1b[35m', logoAscii);
console.log(
'\x1b[31m',
`
Expand Down Expand Up @@ -321,4 +323,4 @@ module.exports = ({ victim, login }) => ({
listenEvents: listenEvents(victim),
configs,
fetchSymbolData
});
});