/
githubmirror
/
metasploit-framework
Обзор
Документация
Войти
/
githubmirror
/
metasploit-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
modules/encoders/php/minify.rb
42 строки
967 B
cgranleese-r7
Updates modules to remove non-printable chars
25 июн 2025, 16:19
25 июн 2025, 16:19
04a18fb
Код
Авторство
О чём код?
## # 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