!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/space/   drwxrwxrwx
Free 13.22 GB of 57.97 GB (22.8%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     app_or.js (6.61 KB)      -rwxrwxrwx
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
// Imports your configured client and any necessary S3 commands.
import { PutObjectCommand } from "@aws-sdk/client-s3";
import { s3Client } from "./client.js";
import express from 'express';

var app = express();
app.use(express.json());
import multer from 'multer';
import ShortUniqueId from 'short-unique-id';
//Instantiate
const uid = new ShortUniqueId({ length: 10 });


app.listen(3007, () => {
  console.log("Server running on port 3007");
 });

// const multer  = require('multer')
const storage = multer.memoryStorage()
const upload = multer({ storage: storage })

// app.put("/images",async(req,res) => {
//   console.log(req.body.vendor);
//   res.send("hello world");
// });
// app.get("/images",async(req,res)=>{
//   res.send("hello world");
// });

// Specifies a path within your Space and the file to upload.
let bucketParams;


// run();
// insert images
app.post("/images",upload.array('images'), async (req, res, next) => {
  // console.log(req.files);
  let no_of_files=req.files.length;
  var file_location=[];
  // var abc=req.body.vendor;
  // console.log(abc);
  for (let i = 0; i < no_of_files; i++) {
    var ud=uid()
      let file_name=req.body.vendor+"/images/"+ud+".jpg";
        bucketParams = {
          Bucket: "jiff",
          Key: file_name,
          Body: req.files[i].buffer,
          ContentType: "image/jpeg",
          ACL: "public-read",
          Preview:req.files[i].buffer,
        };
        await insert(bucketParams);
        file_location.push(ud);
      }
      res.send({"data":file_location}); 
});
// delete images
app.post("/delete_images", async (req, res, next) => {
  // var abc=req.body.vendor;
  var images=req.body.images;
  console.log(images);
  if (images!=='') {
    images=images.split(',');
  }else{
    images=[];
  }
  for (let i = 0; i < images.length; i++) {
    let file_name=req.body.vendor+"/images/"+images[i]+".jpg";
    bucketParams = {
      Bucket: "jiff",
      Key: file_name,
    };
    await delete_image(bucketParams);
  }
  res.send({"message":"deleted successfully"});
});
// change images
app.put("/images",upload.array('images'), async (req, res, next) => {
  let no_of_files=req.files.length;
  var files_name=req.body.files_name;
  console.log(files_name);
  if (files_name!=='') {
    files_name=files_name.split(',');
  }else{
    files_name=[];
  }
  for (let i = 0; i < no_of_files; i++) {
      let file_name=req.body.vendor+"/images/"+files_name[i]+".jpg";
    bucketParams = {
      Bucket: "jiff",
      Key: file_name,
      Body: req.files[i].buffer,
      ContentType: "image/jpeg",
      ACL: "public-read",
      Preview:req.files[i].buffer,
    };
    await insert(bucketParams);
  }
  res.send({"message":"Change Succesfully"});
 });
// all in one
app.put("/change_images",upload.array('images'), async (req, res, next) => {
  let no_of_files=req.files.length;
  var files_name=req.body.files_name;
  if (files_name!=='') {
    files_name=files_name.split(',');
  }else{
    files_name=[];
  }
  var file_location=[];
      // when  no of new file is equal  change or delete file name length

  if (no_of_files===files_name.length) {
    for (let i = 0; i < no_of_files; i++) {
      let file_name=req.body.vendor+"/images/"+files_name[i]+".jpg";
      bucketParams = {
        Bucket: "jiff",
        Key: file_name,
        Body: req.files[i].buffer,
        ContentType: "image/jpeg",
        ACL: "public-read",
        Preview:req.files[i].buffer,
      };
      await insert(bucketParams);
    }
    res.send({"message":"Chnage Successfull"});
    // when  no of new file is less than change or delete file name length
  }else if (no_of_files<files_name.length) {
    var c=0;
    for (let i = 0; i < no_of_files; i++) {
      let file_name=req.body.vendor+"/images/"+files_name[i]+".jpg";
      bucketParams = {
        Bucket: "jiff",
        Key: file_name,
        Body: req.files[i].buffer,
        ContentType: "image/jpeg",
        ACL: "public-read",
        Preview:req.files[i].buffer,
      };
      await insert(bucketParams);
      c=c+1;
    }
    if (c<files_name.length) {
      for (let j = c; j < files_name.length; j++) {
        let file_name=req.body.vendor+"/images/"+files_name[j]+".jpg";
        bucketParams = {
          Bucket: "jiff",
          Key: file_name,
        };
        await delete_image(bucketParams);
        file_location.push(files_name[j]);
      }
    }
    res.send({"data":file_location});
    // when  no of new file is greater than change or delete file name length
  }else if (no_of_files>files_name.length) {
    var c=0;
    
    for (let i = 0; i < no_of_files; i++) {
      c=c+1;
      if (c>files_name.length) {
        var ud=uid()
        let file_name=req.body.vendor+"/images/"+ud+".jpg";
        bucketParams = {
          Bucket: "jiff",
          Key: file_name,
          Body: req.files[i].buffer,
          ContentType: "image/jpeg",
          ACL: "public-read",
          Preview:req.files[i].buffer,
        };
        await insert(bucketParams);
        file_location.push(ud);
      }else{
        let file_name=req.body.vendor+"/images/"+files_name[i]+".jpg";
        bucketParams = {
          Bucket: "jiff",
          Key: file_name,
          Body: req.files[i].buffer,
          ContentType: "image/jpeg",
          ACL: "public-read",
          Preview:req.files[i].buffer,
        };
        await insert(bucketParams);
      }
     
    }
    res.send({"data":file_location});
  }else{
    res.send({"error":"something is wrong "});
  }

  // for (let i = 0; i < no_of_files; i++) {
  //     let file_name=req.body.vendor+"/images/"+files_name[i]+".jpg";
  //   bucketParams = {
  //     Bucket: "jiff",
  //     Key: file_name,
  //     Body: req.files[i].buffer,
  //     ContentType: "image/jpeg",
  //     ACL: "public-read",
  //     Preview:req.files[i].buffer,
  //   };
  //   await insert(bucketParams);
  // }
  // res.send("Change Succesfully");
 });
 // Uploads the specified file to the chosen path.
export const insert = async (bucketParams) => {
  try {
    const data = await s3Client.send(new PutObjectCommand(bucketParams));
    console.log(
      "Successfully uploaded object: " +
        bucketParams.Bucket +
        "/" +
        bucketParams.Key
    );
    return data;
  } catch (err) {
    console.log("Error", err);
  }
};
export const delete_image = async (bucketParams) => {
  try {
    const data = await s3Client.deleteObject(bucketParams);
    return data;
  } catch (err) {
    console.log("Error", err);
  }
};

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

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