!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/instagram/src/handlers/   drwxr-xr-x
Free 7.96 GB of 57.97 GB (13.74%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     postComment.js (9.95 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
const axios = require('axios').default;
const crypto = require("crypto");
const fs = require("fs");
const {sendMessage} = require("../services/instagramSend.service");
const product_info = require('../dcore/products.js');
const private_message=require('../dcore/private_message.js');
const { Product } = require("../models/Products");
const account_info = require('../dcore/account_info.js');
const {INSTAGRAM_URI} =process.env;
const comment_keyword=["pp","product code","inbox","price","prize","⁠প্রাইস","⁠প্রাইজ","buy","info","⁠কিনতে","kinte","daam","dam","⁠দাম","koto","⁠কত","⁠কতো","⁠ইনফো","⁠বাই","⁠ইনবক্স","Order"];
const invalid_words=["fuck","damn", "cunt","faggot", "Shit","Nigga", "Slut"];
function decryptText (encryptedText) {
    return crypto.privateDecrypt(
    {
        key: fs.readFileSync('fb_private_key.pem', 'utf8'),
        // In order to decrypt the data, we need to specify the
        // same hashing function and padding scheme that we used to
        // encrypt the data in the previous step
        // padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,
        oaepHash: 'sha256'
    },
    encryptedText
    )
}
async function getLastInteractionTimestamp(senderId,ACCESS_TOKEN) {
    try {
        var ACCESS_TOKEN= await decryptText (Buffer.from(ACCESS_TOKEN, "base64"));
        var response=  await axios.get(`${INSTAGRAM_URI}/me/conversations?limit=10&fields=messages{from,created_time}&user_id=${senderId}&access_token=${ACCESS_TOKEN.toString()}`);
        if (response.status=== 200) {
            var conversationsData = response.data;            
            var lastInteraction=null;
            if ( conversationsData && conversationsData.data[0].messages.data.length>0) {
                for (const message of conversationsData.data[0].messages.data) {
                    // console.log(message.from.id);
                    if (message.from.id == senderId) {  // Check if the message is from the user
                        lastInteraction = message.created_time;
                        break;  // Stop at the most recent message from the user
                    }
                }
                if (lastInteraction) {
                    const now = new Date();
                    if ((now - new Date(lastInteraction)) <= 24 * 60 * 60 * 1000) {
                        // console.log("within 24");
                        return 1;
                    } else {
                        return 2;
                    }
                }else{
                    return 2;
                }
            } else {
                return 2;
            }
        }else{
            return 2;
        }
    } catch (error) {
        console.log("error ==" + error);
        return 2;
    }
}
async function commentReply(ACCESS_TOKEN,comment_id,message) {
    var ACCESS_TOKEN= await decryptText (Buffer.from(ACCESS_TOKEN, "base64"));            
    var response=  await axios.post(`${INSTAGRAM_URI}/${comment_id}/replies`,{ 
            "message": message
        },
        {
            params: { access_token: ACCESS_TOKEN }
        }).then((res) => {
        // console.log(res.data);
    }).catch((error) => {        
        console.log(error);
    });
    return "done";
} 

// Handles messages events
const postComment = async function (user_id, comment_id, senderId, post_id, message) {
    try {
        var text_m = message.toLowerCase();
        var texted_comment = comment_keyword.find(substring => text_m.includes(substring));
        
        var vulgar = invalid_words.find(substring => text_m.includes(substring.toLowerCase()));
        // const bangla_comment = comment_keyword.find(substring => text_m.includes(substring));
        // var comparisonResult1 = longString.includes(banglaString1) ? 0 : longString.localeCompare(banglaString1, 'bn', { sensitivity: 'base' });
        // banglaString1.localeCompare(banglaString2, 'bn', { sensitivity: 'base' });
        data=await account_info.get_accessToken(user_id);
        if (data) {
            var product=await account_info.post_info(user_id.toString(),post_id,data.vendor_id);
            
            var ACCESS_TOKEN=data.token;
            var vendor_id=data.vendor_id;
            var shop_id=data.shop_id;
            // console.log(product);
            if (vulgar) {
                return "done";
                // var ACCESS_TOKEN= await decryptText (Buffer.from(ACCESS_TOKEN, "base64"));                    
                // var response=  await axios.delete(`${process.env.FACEBOOK_URI}/${comment_id}?access_token=${ACCESS_TOKEN.toString()}`);
            }else{
                
                if (product=="empty") {
                    var message="Thank you for contacting us. Our team will get back to you soon. However, you can always send us a message on messenger to get replies faster.";
                    await commentReply(ACCESS_TOKEN,comment_id,message);
                    return "done";
                }else{
                    if (product.startsWith("88") && product.length>=13) {
                        var pr_code=product.split("_").pop();                            
                        if (texted_comment || text_m.includes(pr_code)) {

                            // var pr_code=product.product_code.split("_").pop();
                            var message_type =await getLastInteractionTimestamp(senderId,ACCESS_TOKEN);
                            
                            if (message_type==1) {
                                var res = await  product_info.get_product(user_id,pr_code,vendor_id,ACCESS_TOKEN,senderId,shop_id);
                                var message="Thank you for contacting us. We have replied you back to you on messenger. Please check your messenger.";
                                await commentReply(ACCESS_TOKEN,comment_id,message); 
                                return res;  
                            }else if(message_type==2){
                                var pr=await Product.findOne({$and:[{product_code: product},{vendor_id:vendor_id},{visibility: 1}]},'title');                                    
                                
                                if (pr) {
                                    var response={
                                        "attachment":{
                                        "type":"template",
                                        "payload":{
                                            "template_type":"button",
                                            "text":`Are you interested on product ${ pr.title} ( ${pr_code}) ? Click the Yes button below to know more details.`,
                                            "buttons":[
                                            {
                                                "type":"postback",
                                                "title":"Yes",
                                                "payload":`product_${pr_code}`
                                            }
                                            ]
                                        }
                                        }
                                    }
                                    
                                    var res=await private_message.callSendAPI (ACCESS_TOKEN,comment_id, response);
                                    var message="Thank you for contacting us. We have replied you back to you on messenger. Please check your messenger.";
                                    await commentReply(ACCESS_TOKEN,comment_id,message);   
                                    return res;
                                }else{    
                                    var message="Thank you for contacting us. This product is currently unavailable. Please send us a message on messenger to know about our products.";
                                    await commentReply(ACCESS_TOKEN,comment_id,message);      
                                }
                            }else{
                                return "error";
                            }
                        }else{
                            var message="Thank you for contacting us. Our team will get back to you soon. However, you can always send us a message on messenger to get replies faster.";
                            await commentReply(ACCESS_TOKEN,comment_id,message);
                        }
                        return "done";
                    }else{
                        if (texted_comment || text_m.includes(product)) {
                            var message="Thank you for contacting us. This product is currently unavailable. Please send us a message on messenger to know about our products.";
                            await commentReply(ACCESS_TOKEN,comment_id,message);
                        }else{
                            var message="Thank you for contacting us. Our team will get back to you soon. However, you can always send us a message on messenger to get replies faster.";
                            await commentReply(ACCESS_TOKEN,comment_id,message);
                        }
                        // var ACCESS_TOKEN= await decryptText (Buffer.from(ACCESS_TOKEN, "base64"));                    
                        // var response=  await axios.post(`https://graph.facebook.com/v20.0/${comment_id}/comments?`,{
                        //     'message': "Thank you for contacting us. This product is currently unavailable. Please send us a message on messenger to know about our products.",
                        //     'access_token': ACCESS_TOKEN.toString()
                        // });    
                    }
                }
            }
            return "done";
        }else{
            return "done";
        }   
    } catch (error) {
        console.log(error);
        
        return "error";
    }
}
module.exports={ postComment };

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.005 ]--