File size: 2,491 Bytes
f8cd885
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
const axios = require('axios');
const fs = require('fs').promises;
const path = require('path');

async function loginAndSave() {
    const config = require('./config.json');
    const loginData = {
        email: config.web_email,
        password: config.web_password
    };

    const headers = {
        'host': 'x.mnitnetwork.com',
        'sec-ch-ua-platform': '"Android"',
        'user-agent': 'Mozilla/5.0 (Linux; Android 14; CPH2641 Build/UP1A.231005.007) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.7499.34 Mobile Safari/537.36',
        'accept': 'application/json, text/plain, */*',
        'sec-ch-ua': '"Android WebView";v="143", "Chromium";v="143", "Not A(Brand";v="24"',
        'content-type': 'application/json',
        'sec-ch-ua-mobile': '?1',
        'origin': 'https://x.mnitnetwork.com',
        'x-requested-with': 'mark.via.gp',
        'sec-fetch-site': 'same-origin',
        'sec-fetch-mode': 'cors',
        'sec-fetch-dest': 'empty',
        'referer': 'https://x.mnitnetwork.com/mauth/login',
        'accept-language': 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7',
        'priority': 'u=1, i'
    };

    try {
        console.log('🔐 Logging in...');
        const response = await axios.post(
            'https://x.mnitnetwork.com/mapi/v1/mauth/login',
            loginData,
            { headers, decompress: true }
        );

        if (response.data.meta.code === 200) {
            const token = response.data.data.token;
            const sessionData = {
                email: response.data.data.user.email,
                username: response.data.data.user.username,
                uid: response.data.data.user.uid,
                balance: response.data.data.user.balance,
                token: token,
                expiry: new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString(),
                cookie: `mauthtoken=${token}`,
                lastLogin: new Date().toISOString()
            };
            
            await fs.mkdir('./data', { recursive: true });
            await fs.writeFile('./data/session.json', JSON.stringify(sessionData, null, 2));
            console.log('✅ Session saved to data/session.json');
            console.log('👤 User:', sessionData.username);
            console.log('💰 Balance:', sessionData.balance);
            console.log('⏰ Expires:', sessionData.expiry);
        }
    } catch (error) {
        console.log('❌ Login error:', error.message);
    }
}

loginAndSave();