Skip to content

Instantly share code, notes, and snippets.

@fdciabdul
Created October 3, 2020 13:41
Show Gist options
  • Save fdciabdul/54f92fb3e2eea821e7d59beee9b82c35 to your computer and use it in GitHub Desktop.
Save fdciabdul/54f92fb3e2eea821e7d59beee9b82c35 to your computer and use it in GitHub Desktop.
wkkwkwkw iseng aja
var express = require("express");
var app = express();
const cheerio = require('cheerio');
var axios = require("axios");
const request = require("request")
app.get("/", (req, res, next) => {
request.get("https://pastebin.com/xxxx/raw", function(error, response, data) {
var b = JSON.parse(data);
var random = b[Math.floor(Math.random() * b.length)];
request.post({
headers: {
'user-agent' : 'Mozilla/5.0 (Linux; Android 8.1.0; vivo 1820) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Mobile Safari/537.36',
'Content-Type':'application/x-www-form-urlencoded'
},
url : "https://kampusgw.ac.id/index.php?kanal=login",
body : random
},function(error, response, body){
//var b = JSON.parse(body);
var cookie=response.headers['set-cookie'].toString();
const config = {
headers: {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"accept-language": "en-US,en;q=0.9,id;q=0.8,la;q=0.7,af;q=0.6,mt;q=0.5,ms;q=0.4,fr;q=0.3,de;q=0.2,pt;q=0.1",
"cache-control": "max-age=0",
"pragma": "akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no, akamai-x-get-request-id,akamai-x-get-nonces,akamai-x-get-client-ip,akamai-x-feo-trace",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "same-origin",
"cookie": cookie,
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1",
"referrer": "https://kampusgw.ac.id/index.php?kanal=dashboard",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors"
}
}
function autoAbsen(){
axios.get('https://kampusgw.ac.id/index.php?kanal=perkuliahan-kehadiran&menu=2',config)
.then((result) => {
let $ = cheerio.load(result.data);
//console.log(result.data)
absen = [];
$('div[class="social-like"] > a').each(function (i, e) {
absen[i] = $(this).attr("href");
});
var gud = ""
$('#table-custom > thead > tr').each(() => {
gud += $('td').text().replace(/2019/gi, '2019 \n\n').replace(/Nama/gi, "\n Nama").replace(/Program/gi , "\n Tahun")
});
var ya = absen.toString();
console.log(`
Data Mahasiswa
=====================
${gud.replace(/Pembimbing Akademik:/gi, "")}
=====================
`);
if(ya.indexOf("index.php") !== -1){
res.send(`
SEDANG ABSEN..
`);
axios.get('https://kampusgw.ac.id/'+ ya, config)
.then((result) => {
//console.log(result)
console.log(`
====== SUKSES =========
Berhasil Absen
======================
`);
})
}else{
console.log(`
======= GAGAL ===========
Belum Ada Matkul / Kamu sudah Absen
=========================
`);
}
})
}
res.send(autoAbsen())
})
})
})
const PORT = process.env.PORT || 3000;
app.listen(PORT, err => {
if(err) throw err;
console.log("%c Server running")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment