-
Notifications
You must be signed in to change notification settings - Fork 1
/
StubForm.cs
323 lines (271 loc) · 10.7 KB
/
StubForm.cs
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
namespace NetStub
{
using System;
using System.Drawing;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Windows.Forms;
using RTCV.Common;
using RTCV.NetCore;
using RTCV.UI;
using RTCV.Vanguard;
public enum StubMode
{
PS4,
MacOSX_PPC,
Linux_AMD64,
WindowsXP,
}
public partial class StubForm : Form
{
public static volatile System.Timers.Timer AutoCorruptTimer;
public string localIP;
public int localPort;
public StubForm()
{
InitializeComponent();
SyncObjectSingleton.SyncObject = this;
cbMode.Items.Clear();
foreach (var mode in Enum.GetNames(typeof(StubMode)))
{
cbMode.Items.Add(mode);
}
if (Params.IsParamSet("LAST_IP"))
{
tbClientAddr.Text = Params.ReadParam("LAST_IP");
}
if (Params.IsParamSet("NETSTUB_MODE"))
{
string stubModeString = Params.ReadParam("NETSTUB_MODE");
cbMode.SelectedIndex = (int)(StubMode)System.Enum.Parse(typeof(StubMode), stubModeString);
VanguardImplementation.stubMode = (StubMode)System.Enum.Parse(typeof(StubMode), stubModeString);
}
if (Params.IsParamSet("PROCESS_NAME"))
{
VanguardImplementation.ProcessName = Params.ReadParam("PROCESS_NAME");
tbProcName.Text = VanguardImplementation.ProcessName;
}
if (!Params.IsParamSet("DISCLAIMERREAD"))
{
var disclaimer = $@"Welcome.
Disclaimer:
This program comes with absolutely ZERO warranty.
You may use it at your own risk.
Be EXTREMELY careful with what you choose to corrupt.
Be aware there is always the chance of damage.
This program inserts random data in hooked processes. There is no way to accurately predict what can happen out of this.
The developers of this software will not be held responsible for any damage caused
as the result of use of this software.
By clicking 'Yes' you agree that you have read this warning in full and are aware of any potential consequences of use of the program. If you do not agree, click 'No' to exit this software.";
if (MessageBox.Show(disclaimer, "Net Stub", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
Environment.Exit(0);
Params.SetParam("DISCLAIMERREAD");
}
Colors.SetRTCColor(Color.LightSteelBlue, this);
}
private void StubForm_Load(object sender, EventArgs e)
{
Focus();
}
private void BtnRefreshDomains_Click(object sender, EventArgs e)
{
if (VanguardCore.vanguardConnected)
{
switch (VanguardImplementation.stubMode)
{
case StubMode.PS4:
StubEndpoints.PS4.ProcessWatch.UpdateDomains();
break;
case StubMode.MacOSX_PPC:
StubEndpoints.MacOSX_PPC.ProcessWatch.UpdateDomains();
break;
case StubMode.Linux_AMD64:
StubEndpoints.X86_64_Linux.ProcessWatch.UpdateDomains();
break;
case StubMode.WindowsXP:
StubEndpoints.WindowsXP.ProcessWatch.UpdateDomains();
break;
default:
break;
}
}
}
private void connect_Click(object sender, EventArgs e)
{
}
private void tbClientAddr_TextChanged(object sender, EventArgs e)
{
}
private void tbClientPort_TextChanged(object sender, EventArgs e)
{
}
private void btnConnect_Click(object sender, EventArgs e)
{
if (VanguardImplementation.stubMode == StubMode.PS4)
{
//Connector.InitializeConnector();
btnStartClient.Visible = true;
VanguardImplementation.ps4 = new libdebug.PS4DBG(tbClientAddr.Text);
VanguardImplementation.ps4.Connect();
VanguardImplementation.ps4.Notify(222, $"Now connected to NetStub");
VanguardImplementation.pl = VanguardImplementation.ps4.GetProcessList();
StubEndpoints.PS4.ProcessWatch.ExceptionHandlerApplied = false;
foreach (var proc in VanguardImplementation.pl.processes)
{
if (proc.name == VanguardImplementation.ProcessName)
{
lbPID.Text = $"(PID: {proc.pid})";
VanguardImplementation.ps4.Notify(222, lbPID.Text);
break;
}
}
}
else if (VanguardImplementation.stubMode == StubMode.MacOSX_PPC)
{
btnStartClient.Visible = true;
VanguardImplementation.mac = new StubEndpoints.MacOSX_PPC.RPC.PowerMacRPC(tbClientAddr.Text);
VanguardImplementation.mac.Connect();
}
else if (VanguardImplementation.stubMode == StubMode.Linux_AMD64)
{
btnStartClient.Visible = true;
VanguardImplementation.linux = new StubEndpoints.X86_64_Linux.LinuxRPC(tbClientAddr.Text);
VanguardImplementation.linux.Connect();
}
else if (VanguardImplementation.stubMode == StubMode.WindowsXP)
{
btnStartClient.Visible = true;
VanguardImplementation.winxp = new StubEndpoints.WindowsXP.RPC(tbClientAddr.Text);
VanguardImplementation.winxp.Connect();
}
Params.SetParam("LAST_IP", tbClientAddr.Text);
}
private void btnStart_Click(object sender, EventArgs e)
{
//Hook.Start();
VanguardCore.Start();
if (VanguardImplementation.stubMode == StubMode.PS4)
{
VanguardImplementation.ps4.Notify(222, $"Now connected to RTCV");
}
btnRefreshDomains.Visible = true;
}
private void btnStartClient_Click(object sender, EventArgs e)
{
//Hook.Start();
VanguardCore.Start();
RTCV.Common.Logging.StartLogging(VanguardCore.logPath);
btnRefreshDomains.Visible = true;
if (VanguardImplementation.stubMode == StubMode.PS4)
{
if (VanguardImplementation.ProcessName == "")
{
VanguardImplementation.ProcessName = "eboot.bin";
}
StubEndpoints.PS4.ProcessWatch.Start();
VanguardImplementation.ps4.Notify(222, $"Now connected to RTCV");
return;
}
if (VanguardImplementation.ProcessName == "")
{
return;
}
if (VanguardImplementation.stubMode == StubMode.MacOSX_PPC)
{
StubEndpoints.MacOSX_PPC.ProcessWatch.Start();
}
else if (VanguardImplementation.stubMode == StubMode.Linux_AMD64)
{
StubEndpoints.X86_64_Linux.ProcessWatch.Start();
}
else if (VanguardImplementation.stubMode == StubMode.WindowsXP)
{
StubEndpoints.WindowsXP.ProcessWatch.Start();
}
}
private void SendPayload(string IP, string path, bool isElf)
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(new IPEndPoint(IPAddress.Parse(IP), 9090));
socket.SendFile(path);
socket.Close();
}
private void btnPayload_Click(object sender, EventArgs e)
{
btnConnect.Visible = true;
SendPayload(tbClientAddr.Text, System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "payload.bin"), false);
}
private void label7_Click(object sender, EventArgs e)
{
}
private void label4_Click(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
private void StubForm_Load_1(object sender, EventArgs e)
{
}
private void cbProcessList_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void tbProcName_TextChanged(object sender, EventArgs e)
{
VanguardImplementation.ProcessName = tbProcName.Text;
Params.SetParam("PROCESS_NAME", VanguardImplementation.ProcessName);
}
private void cbMode_SelectedIndexChanged(object sender, EventArgs e)
{
btnPayload.Visible = false;
if (cbMode.SelectedIndex == (int)StubMode.PS4)
{
btnPayload.Visible = true;
}
VanguardImplementation.stubMode = (StubMode)Enum.Parse(typeof(StubMode), (string)cbMode.SelectedItem);
Params.SetParam("NETSTUB_MODE", VanguardImplementation.stubMode.ToString());
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
switch (VanguardImplementation.stubMode)
{
default: break;
case StubMode.PS4:
{
StubEndpoints.PS4.ProcessWatch.OverrideExceptionHandlers = cbOverrideHandlers.Checked;
break;
}
}
}
private void btnFindCaves_Click(object sender, EventArgs e)
{
switch (VanguardImplementation.stubMode)
{
default: break;
case StubMode.Linux_AMD64:
{
StubEndpoints.X86_64_Linux.ProcessWatch.CaveList = StubEndpoints.X86_64_Linux.ProcessWatch.FindCodeCaves(16);
break;
}
case StubMode.WindowsXP:
{
StubEndpoints.WindowsXP.ProcessWatch.CaveList = StubEndpoints.WindowsXP.ProcessWatch.FindCodeCaves(16);
break;
}
}
}
//private void tbAutoAttach_TextChanged(object sender, EventArgs e)
//{
//}
//private void label3_Click(object sender, EventArgs e)
//{
//}
//private void btnTargetSettings_Click(object sender, EventArgs e)
//{
//}
//private void label4_Click(object sender, EventArgs e)
//{
//}
}
}