File size: 2,154 Bytes
02591b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const axios = require('axios');

// Chat application URL (update with your actual URL)
const LOGIN_URL = 'https://heckergd.serv00.net/pchat/login.php'; // Adjust this based on your setup
const CHAT_APP_URL = 'https://heckergd.serv00.net/pchat/chat.php'; // Adjust this based on your setup

// User credentials (replace with actual credentials)
const username = 'user';
const password = 'test';

// Function to fetch the login page and get PHPSESSID
async function fetchSessionId() {
    try {
        const response = await axios.get(LOGIN_URL);
        const cookies = response.headers['set-cookie'];

        // Extract PHPSESSID from cookies
        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);
    }
}

// Function to send random messages to the chat application
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);
    }
}

// Main function to run the bot
async function runBot() {
    const sessionId = await fetchSessionId();
    if (sessionId) {
        console.log("Chat Bot is running! Sending random messages...");

        // Send a random message every 5 seconds
        setInterval(() => sendRandomMessage(sessionId), 5000);
    }
}

// Start the bot
runBot();