Lucene search
K

PHP Minify Encoder

🗓️ 05 Sep 2024 18:53:24Reported by Julien VoisinType 
metasploit
 metasploit
🔗 www.rapid7.com👁 205 Views

This encoder minifies a PHP payload by removing leasing spaces, trailing new lines, comments,

Code
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Encoder
  Rank = GreatRanking

  def initialize
    super(
      'Name' => 'PHP Minify Encoder',
      'Description' => %q{
        This encoder minifies a PHP payload by removing leasing spaces, trailing
        new lines, comments, ...
      },
      'Author' => 'Julien Voisin',
      'License' => BSD_LICENSE,
      'Arch' => ARCH_PHP)
  end

  def encode_block(_, buf)
    # Remove comments
    buf.gsub!(/^\s*#.*$/, '')

    # Remove spaces after keywords
    buf.gsub!(/^\s*(if|else|elsif|while|for|foreach)\s*\(/, '\1(')

    # Remove spaces before block opening
    buf.gsub!(/\s*{$/, '{')

    # Remove empty lines
    buf.squeeze!("\n")

    # Remove leading/trailing spaces
    buf.gsub!(/^[ \t]+/, '')

    # Remove new lines
    buf.gsub!(/([;{}])\n/, '\1')

    return buf
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

12 Jun 2026 19:02Current
7.1High risk
Vulners AI Score7.1
205