|
const axios = require('axios'); |
|
|
|
|
|
const LOGIN_URL = 'https://heckergd.serv00.net/pchat/login.php'; |
|
const CHAT_APP_URL = 'https://heckergd.serv00.net/pchat/chat.php'; |
|
|
|
|
|
const username = 'user'; |
|
const password = 'test'; |
|
|
|
|
|
async function fetchSessionId() { |
|
try { |
|
const response = await axios.get(LOGIN_URL); |
|
const cookies = response.headers['set-cookie']; |
|
|
|
|
|
const sessionId = cookies.find(cookie => cookie.startsWith('PHPSESSID')).split(';')[0]; |
|
console.log(`Fetched PHPSESSID: ${sessionId}`); |
|
return sessionId; |
|
} catch (error) { |
|
console.error('Error fetching session ID:', error); |
|
} |
|
} |
|
|
|
|
|
async function sendRandomMessage(sessionId) { |
|
const messages = [ |
|
"Hello everyone!", |
|
"How's it going?", |
|
"Just checking in!", |
|
"What's up?", |
|
"Need any help?", |
|
"Hope you're having a great day!", |
|
"Did you see the latest news?", |
|
"Random thoughts...", |
|
"Let's chat!", |
|
"How can I assist you today?" |
|
]; |
|
|
|
const randomMessage = messages[Math.floor(Math.random() * messages.length)]; |
|
|
|
try { |
|
await axios.post(CHAT_APP_URL, { |
|
message: randomMessage |
|
}, { |
|
headers: { |
|
'Cookie': sessionId, |
|
'Content-Type': 'application/json' |
|
} |
|
}); |
|
|
|
console.log(`Sent: ${randomMessage}`); |
|
} catch (error) { |
|
console.error('Error sending message:', error); |
|
} |
|
} |
|
|
|
|
|
async function runBot() { |
|
const sessionId = await fetchSessionId(); |
|
if (sessionId) { |
|
console.log("Chat Bot is running! Sending random messages..."); |
|
|
|
|
|
setInterval(() => sendRandomMessage(sessionId), 5000); |
|
} |
|
} |
|
|
|
|
|
runBot(); |