Hướng dẫn how to decrypt php file - cách giải mã tập tin php

UNPHP là một dịch vụ miễn phí để phân tích mã PHP bị xáo trộn và độc hại.

Để bắt đầu sao chép mã của bạn bên dưới hoặc chọn một tệp để tải lên sau đó nhấp vào 'Giải mã PHP này'. Chỉ cần kiểm tra điều này? Tải dữ liệu mẫu.

Eval + gzinflate + base64

UNPHP dễ dàng xử lý các phương thức obfuscation đơn giản mà các chức năng chuỗi như eval [], gzinflate [], str_rot13 [], str_replace [] và base64_decode []

Xem đầu ra

Khả năng khử trùng đệ quy

Các vòng lặp UNPHP đệ quy thông qua mã PHP để giải mã nhiều cấp độ obfuscation. Ví dụ dưới đây sử dụng 81 vòng của eval [] + base64_decode []

Xem đầu ra

Chức năng tùy chỉnh và hỗ trợ regex

UNPHP xử lý các chức năng giải mã tùy chỉnh và biểu thức chính quy. Ví dụ dưới đây sử dụng hàm d1 [] và preg_replace [] với bộ cờ thực thi.

Xem đầu ra

Kiểm tra 'Nội dung mã hóa để bảo mật dữ liệu'. ....

Nhấp vào Áp dụng trên các thuộc tính ..

Làm cách nào để giải mã một tệp được bảo vệ?

Để giải mã một tệp hoặc thư mục:.

const CUSTOM_CHUNK_SIZE = 8192;

/**
 * @ref //stackoverflow.com/q/11716047
 */
function encryptFile[string $inputFilename, string $outputFilename, string $key]: bool
{
    $iFP = fopen[$inputFilename, 'rb'];
    $oFP = fopen[$outputFilename, 'wb'];

    [$state, $header] = sodium_crypto_secretstream_xchacha20poly1305_init_push[$key];

    fwrite[$oFP, $header, 24]; // Write the header first:
    $size = fstat[$iFP]['size'];
    for [$pos = 0; $pos < $size; $pos += CUSTOM_CHUNK_SIZE] {
        $chunk = fread[$iFP, CUSTOM_CHUNK_SIZE];
        $encrypted = sodium_crypto_secretstream_xchacha20poly1305_push[$state, $chunk];
        fwrite[$oFP, $encrypted, CUSTOM_CHUNK_SIZE + 17];
        sodium_memzero[$chunk];
    }

    fclose[$iFP];
    fclose[$oFP];
    return true;
}

Từ menu bắt đầu, chọn chương trình hoặc tất cả các chương trình, sau đó là các phụ kiện, sau đó Windows Explorer ..

/**
 * @ref //stackoverflow.com/q/11716047
 */
function decryptFile[string $inputFilename, string $outputFilename, string $key]: bool
{
    $iFP = fopen[$inputFilename, 'rb'];
    $oFP = fopen[$outputFilename, 'wb'];

    $header = fread[$iFP, 24];
    $state = sodium_crypto_secretstream_xchacha20poly1305_init_pull[$header, $key];
    $size = fstat[$iFP]['size'];
    $readChunkSize = CUSTOM_CHUNK_SIZE + 17;
    for [$pos = 24; $pos < $size; $pos += $readChunkSize] {
        $chunk = fread[$iFP, $readChunkSize];
        [$plain, $tag] = sodium_crypto_secretstream_xchacha20poly1305_pull[$state, $chunk];
        fwrite[$oFP, $plain, CUSTOM_CHUNK_SIZE];
        sodium_memzero[$plain];
    }
    fclose[$iFP];
    fclose[$oFP];
    return true;
}

Nhấp chuột phải vào tệp hoặc thư mục bạn muốn giải mã, sau đó nhấp vào Thuộc tính ..

$key = random_bytes[32];
encryptFile['input.txt', 'cipher.txt', $key];
decryptFile['cipher.txt', 'decrypt.txt', $key];

Trong PHP, có thể sử dụng một chuỗi mã hóa và giải mã một chuỗi bằng cách sử dụng một trong các tiện ích mở rộng mật mã được gọi là hàm openSSL để mã hóa và giải mã.

hàm openSSL_encrypt []: hàm openSSL_encrypt [] được sử dụng để mã hóa dữ liệu. The openssl_encrypt[] function is used to encrypt the data.

Syntax:

string openssl_encrypt[ string $data, string $method, string $key,
                        $options = 0, string $iv, string $tag= NULL,
                        string $aad, int $tag_length = 16  ]

Parameters:

  • $ Dữ liệu: Nó giữ chuỗi hoặc dữ liệu cần được mã hóa. It holds the string or data which need to be encrypted.
  • $ Phương thức: Phương thức mật mã được áp dụng bằng hàm openSSL_GET_CIPHER_METHODS []. The cipher method is adopted using openssl_get_cipher_methods[] function.
  • $ Key: Nó giữ khóa mã hóa. It holds the encryption key.
  • Tùy chọn $: Nó giữ sự phân tách bitwise của các cờ OpenSSL_RAW_DATA và OPENSSL_ZERO_PADDING. It holds the bitwise disjunction of the flags OPENSSL_RAW_DATA and OPENSSL_ZERO_PADDING.
  • $ IV: Nó giữ vectơ khởi tạo không phải là null. It holds the initialization vector which is not NULL.
  • $ TAG: Nó giữ thẻ xác thực được truyền bằng tham chiếu khi sử dụng chế độ mật mã AEAD [GCM hoặc CCM]. It holds the authentication tag which is passed by reference when using AEAD cipher mode [GCM or CCM].
  • $ AAD: Nó giữ dữ liệu xác thực bổ sung. It holds the additional authentication data.
  • $ tag_length: Nó giữ độ dài của thẻ xác thực. Độ dài của thẻ xác thực nằm trong khoảng từ 4 đến 16 cho chế độ GCM. It holds the length of the authentication tag. The length of authentication tag lies between 4 to 16 for GCM mode.

Giá trị trả về: Nó trả về chuỗi được mã hóa thành công hoặc sai khi thất bại. It returns the encrypted string on success or FALSE on failure.

hàm openSSL_decrypt [] Hàm openSSL_decrypt [] được sử dụng để giải mã dữ liệu. The openssl_decrypt[] function is used to decrypt the data.

Syntax:

string openssl_decrypt[ string $data, string $method, string $key,
             int $options = 0, string $iv, string $tag, string $aad]

Parameters:

  • $ Dữ liệu: Nó giữ chuỗi hoặc dữ liệu cần được mã hóa. It holds the string or data which need to be encrypted.
  • $ Phương thức: Phương thức mật mã được áp dụng bằng hàm openSSL_GET_CIPHER_METHODS []. The cipher method is adopted using openssl_get_cipher_methods[] function.
  • $ Key: Nó giữ khóa mã hóa. It holds the encryption key.
  • Tùy chọn $: Nó giữ sự phân tách bitwise của các cờ OpenSSL_RAW_DATA và OPENSSL_ZERO_PADDING. It holds the bitwise disjunction of the flags OPENSSL_RAW_DATA and OPENSSL_ZERO_PADDING.
  • $ IV: Nó giữ vectơ khởi tạo không phải là null. It holds the initialization vector which is not NULL.
  • $ TAG: Nó giữ thẻ xác thực được truyền bằng tham chiếu khi sử dụng chế độ mật mã AEAD [GCM hoặc CCM]. It holds the authentication tag using AEAD cipher mode [GCM or CCM]. When authentication fails openssl_decrypt[] returns FALSE.
  • $ AAD: Nó giữ dữ liệu xác thực bổ sung. It holds the additional authentication data.

$ tag_length: Nó giữ độ dài của thẻ xác thực. Độ dài của thẻ xác thực nằm trong khoảng từ 4 đến 16 cho chế độ GCM. It returns the decrypted string on success or FALSE on failure.

Giá trị trả về: Nó trả về chuỗi được mã hóa thành công hoặc sai khi thất bại. First declare a string and store it into variable and use openssl_encrypt[] function to encrypt the given string and use openssl_decrypt[] function to descrypt the given string.

hàm openSSL_decrypt [] Hàm openSSL_decrypt [] được sử dụng để giải mã dữ liệu. This example illustrates the encryption and decryption of string.

Bài Viết Liên Quan

Chủ Đề