You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/encoders/php/base64.rb
+20-1Lines changed: 20 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,11 @@ def initialize
17
17
'Author'=>'egypt',
18
18
'License'=>BSD_LICENSE,
19
19
'Arch'=>ARCH_PHP)
20
+
register_options(
21
+
[
22
+
OptBool.new('Compress',[true,'Compress the payload with zlib',false])# Disabled by default as it relies on having php compiled with zlib, which might not be available on come exotic setups.
23
+
],
24
+
self.class)
20
25
end
21
26
22
27
defencode_block(state,buf)
@@ -26,6 +31,12 @@ def encode_block(state, buf)
26
31
raiseBadcharErrorifstate.badchars.include?(c)
27
32
end
28
33
34
+
ifdatastore['Compress']
35
+
%w[gzuncompress].uniq.eachdo |c|
36
+
raiseBadcharErrorifstate.badchars.include?(c)
37
+
end
38
+
end
39
+
29
40
# Modern versions of PHP choke on unquoted literal strings.
30
41
quote="'"
31
42
ifstate.badchars.include?("'")
@@ -34,6 +45,10 @@ def encode_block(state, buf)
34
45
quote='"'
35
46
end
36
47
48
+
ifdatastore['Compress']
49
+
buf=Zlib::Deflate.deflate(buf)
50
+
end
51
+
37
52
# PHP escapes quotes by default with magic_quotes_gpc, so we use some
0 commit comments