Skip to content

Instantly share code, notes, and snippets.

@dcatanzaro
Last active January 26, 2024 22:36
Show Gist options
  • Star 99 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save dcatanzaro/5fc1bbd4753403305be7543d28b2eddf to your computer and use it in GitHub Desktop.
Save dcatanzaro/5fc1bbd4753403305be7543d28b2eddf to your computer and use it in GitHub Desktop.
Botcito para el Galicia
const axios = require("axios");
let lastIndexMovement = 0;
const TELEGRAM_BOTID = "";
const TELEGRAM_CHATID = "";
class Telegram {
sendTelegramMessage(message) {
const botId = TELEGRAM_BOTID;
const chatId = TELEGRAM_CHATID;
if (!botId || !chatId) {
return;
}
try {
const telegramMsg = encodeURIComponent(message);
const url = `https://api.telegram.org/${botId}/sendMessage?chat_id=${chatId}&text=${telegramMsg}&parse_mode=HTML`;
axios.get(url);
} catch (e) {
console.log(e);
}
}
}
const telegram = new Telegram();
const getMovimientosGalicia = async () => {
const url =
"https://cuentas.bancogalicia.com.ar/Cuentas/GetMovimientosCuenta";
const cookies =
"";
const headers = {
accept: "application/json, text/javascript, */*; q=0.01",
"accept-language": "en-US,en;q=0.9,es;q=0.8",
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-requested-with": "XMLHttpRequest",
cookie: cookies,
Referer: "https://cuentas.bancogalicia.com.ar/cuentas/mis-cuentas",
"Referrer-Policy": "strict-origin-when-cross-origin",
};
const body = "";
const result = await axios.post(url, body, { headers });
return result.data.Model.Movimientos;
};
const init = async () => {
let movementsGalicia = await getMovimientosGalicia();
movementsGalicia = movementsGalicia.reverse();
movementsGalicia.forEach((movement) => {
if (movement.IndiceMovimiento > lastIndexMovement) {
lastIndexMovement = movement.IndiceMovimiento;
if (movement.ImporteCredito !== "0,00") {
telegram.sendTelegramMessage(
`<strong>🏦 Banco</strong>: Galicia\n<strong>❗️ Nuevo movimiento:</strong> ${movement.DescripcionAMostrar}\n<strong>💰 Ingreso:</strong> ${movement.ImporteCreditoLabel}`
);
} else {
telegram.sendTelegramMessage(
`<strong>🏦 Banco</strong>: Galicia\n<strong>❗️ Nuevo movimiento:</strong> ${movement.DescripcionAMostrar}\n<strong>💰 Gasto:</strong> ${movement.ImporteDebitoLabel}`
);
}
}
});
};
setInterval(init, 10000);
@rromero96
Copy link

buenas buenass, cual seria el nombre de la cookie del galicia que deberia capturar su valor? porque tengo varios je
Captura de Pantalla 2022-10-19 a la(s) 16 41 13

@amiotti
Copy link

amiotti commented Oct 19, 2022

buenas buenass, cual seria el nombre de la cookie del galicia que deberia capturar su valor? porque tengo varios je Captura de Pantalla 2022-10-19 a la(s) 16 41 13

document.cookie en la consola te trae todas... en string

@alejoamiras
Copy link

Hace unos meses empecé a hacer esto mismo y me distraje. Protip (?): si le pegás a cierto endpoint keepalive, el homebanking no cierra la sesión nunca, y podés seguir pidiendo este dato sin volver a loguearte.

Bue, me siento tan seguro en este momento 👀

@rromero96
Copy link

rromero96 commented Oct 20, 2022

si pongo lo que trae document.cookie la repsonse es = >

  data: {
    IsError: true,
    Model: {
      Codigo: 'NULLJSONEXCP',
      Descripcion: "Error en 'ErrorAjaxJSon', exception es null",
      CerrarSesion: false
    }
  }

a alguien le paso? como se soluciona?

@amiotti
Copy link

amiotti commented Oct 21, 2022

alguien lo hizo para el BBVA?

@yagopajarino
Copy link

alguien lo hizo para el BBVA?

https://github.com/yagopajarino/bot-bbva

🚀

@amiotti
Copy link

amiotti commented Oct 22, 2022

alguien lo hizo para el BBVA?

https://github.com/yagopajarino/bot-bbva

🚀

Muchas gracias!! Te puedo hacer una consulta?
En cookies mandas toda la cookie quw se genera cuando haces login o solo algunos valores??

@yagopajarino
Copy link

alguien lo hizo para el BBVA?

https://github.com/yagopajarino/bot-bbva
🚀

Muchas gracias!! Te puedo hacer una consulta? En cookies mandas toda la cookie quw se genera cuando haces login o solo algunos valores??

Hola! Se la paso entera ;)

@amiotti
Copy link

amiotti commented Oct 24, 2022

alguien lo hizo para el BBVA?

https://github.com/yagopajarino/bot-bbva
🚀

Muchas gracias!! Te puedo hacer una consulta? En cookies mandas toda la cookie quw se genera cuando haces login o solo algunos valores??

Hola! Se la paso entera ;)

tenes idea por que me puede tirar este error? le estoy pasando el 'x-xsrf-token' de la sesion..

data: 'Error 403: Expected CSRF token not found. Has your session expired?\n'

@yagopajarino
Copy link

Mandame un dm o un mail y lo vemos

alguien lo hizo para el BBVA?

https://github.com/yagopajarino/bot-bbva
🚀

Muchas gracias!! Te puedo hacer una consulta? En cookies mandas toda la cookie quw se genera cuando haces login o solo algunos valores??

Hola! Se la paso entera ;)

tenes idea por que me puede tirar este error? le estoy pasando el 'x-xsrf-token' de la sesion..

data: 'Error 403: Expected CSRF token not found. Has your session expired?\n'

Mandame un dm por twitter o un mail y lo vemos

@estebanlis
Copy link

Muy bueno Damian! Alguien tiene idea si se puede hacer para Santander?
@tstambulsky

Recién de curioso estuve chequeando, hay que adaptar algunas cositas pero se puede seguir la misma lógica tranquilamente

intente hacerlo para el santander y no me funcionó.. si alguno lo hizo y lo quiere compartir, bienvenido será..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment