Merge pull request #12 from MaxXor/master

Merge with recent base
This commit is contained in:
Justin Yanke 2015-05-24 23:38:53 -04:00
commit 12611dcb21
8 changed files with 287 additions and 49 deletions

View File

@ -55,9 +55,9 @@
</Choose>
<ItemGroup>
<Compile Include="Core\Compression\JpgCompression.Tests.cs" />
<Compile Include="Core\Compression\SafeQuickLZ.Tests.cs" />
<Compile Include="Core\Encryption\AES.Tests.cs" />
<Compile Include="Core\Encryption\SHA256.Tests.cs" />
<Compile Include="Core\Information\GeoIP.Tests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,126 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using xClient.Core.Compression;
namespace xClient.Tests.Core.Compression
{
[TestClass]
public class SafeQuickLZTests
{
/*
* Purpose: To validate a small amount of data after compression/decompression
* using SafeQuickLZ with level 1 compression.
*/
[TestMethod]
[TestCategory("Compression")]
public void SmallDataCompressionTestLevel1()
{
SafeQuickLZ safeQuickLZtest = new SafeQuickLZ();
byte[] smallData = new byte[100];
// Fill the small data array with random data.
new Random().NextBytes(smallData);
// Store the compressed data.
byte[] smallDataCompressed = safeQuickLZtest.Compress(smallData, 0, smallData.Length, 1);
// The original should not equal the compressed data.
Assert.AreNotEqual(smallData, smallDataCompressed, "Original data is equal to the compressed data!");
// Store the decompressed data.
byte[] smallDataDecompressed = safeQuickLZtest.Decompress(smallDataCompressed, 0, smallDataCompressed.Length);
// The compressed data should not equal the decompressed data.
Assert.AreNotEqual(smallDataCompressed, smallDataDecompressed, "Compressed data is equal to the decompressed data!");
// The original data must equal the decompressed data; must be able to make a round-trip.
CollectionAssert.AreEqual(smallData, smallDataDecompressed, "Original data does not match the decompressed data!");
}
/*
* Purpose: To validate a small amount of data after compression/decompression
* using SafeQuickLZ with level 3 compression.
*/
[TestMethod]
[TestCategory("Compression")]
public void SmallDataCompressionTestLevel3()
{
SafeQuickLZ safeQuickLZtest = new SafeQuickLZ();
byte[] smallData = new byte[100];
// Fill the small data array with random data.
new Random().NextBytes(smallData);
// Store the compressed data.
byte[] smallDataCompressed = safeQuickLZtest.Compress(smallData, 0, smallData.Length, 3);
// The original should not equal the compressed data.
Assert.AreNotEqual(smallData, smallDataCompressed, "Original data is equal to the compressed data!");
// Store the decompressed data.
byte[] smallDataDecompressed = safeQuickLZtest.Decompress(smallDataCompressed, 0, smallDataCompressed.Length);
// The compressed data should not equal the decompressed data.
Assert.AreNotEqual(smallDataCompressed, smallDataDecompressed, "Compressed data is equal to the decompressed data!");
// The original data must equal the decompressed data; must be able to make a round-trip.
CollectionAssert.AreEqual(smallData, smallDataDecompressed, "Original data does not match the decompressed data!");
}
/*
* Purpose: To validate a large amount of data after compression/decompression
* using SafeQuickLZ with level 1 compression.
*/
[TestMethod]
[TestCategory("Compression")]
public void BigDataCompressionTestLevel1()
{
SafeQuickLZ safeQuickLZtest = new SafeQuickLZ();
byte[] bigData = new byte[100000];
// Fill the big data array with random data.
new Random().NextBytes(bigData);
// Store the compressed data.
byte[] bigDataCompressed = safeQuickLZtest.Compress(bigData, 0, bigData.Length, 1);
// The original should not equal the compressed data.
Assert.AreNotEqual(bigData, bigDataCompressed, "Original data is equal to the compressed data!");
// Store the decompressed data.
byte[] bigDataDecompressed = safeQuickLZtest.Decompress(bigDataCompressed, 0, bigDataCompressed.Length);
// The compressed data should not equal the decompressed data.
Assert.AreNotEqual(bigDataCompressed, bigDataDecompressed, "Compressed data is equal to the decompressed data!");
// The original data must equal the decompressed data; must be able to make a round-trip.
CollectionAssert.AreEqual(bigData, bigDataDecompressed, "Original data does not match the decompressed data!");
}
/*
* Purpose: To validate a large amount of data after compression/decompression
* using SafeQuickLZ with level 3 compression.
*/
[TestMethod]
[TestCategory("Compression")]
public void BigDataCompressionTestLevel3()
{
SafeQuickLZ safeQuickLZtest = new SafeQuickLZ();
byte[] bigData = new byte[100000];
// Fill the big data array with random data.
new Random().NextBytes(bigData);
// Store the compressed data.
byte[] bigDataCompressed = safeQuickLZtest.Compress(bigData, 0, bigData.Length, 3);
// The original should not equal the compressed data.
Assert.AreNotEqual(bigData, bigDataCompressed, "Original data is equal to the compressed data!");
// Store the decompressed data.
byte[] bigDataDecompressed = safeQuickLZtest.Decompress(bigDataCompressed, 0, bigDataCompressed.Length);
// The compressed data should not equal the decompressed data.
Assert.AreNotEqual(bigDataCompressed, bigDataDecompressed, "Compressed data is equal to the decompressed data!");
// The original data must equal the decompressed data; must be able to make a round-trip.
CollectionAssert.AreEqual(bigData, bigDataDecompressed, "Original data does not match the decompressed data!");
}
}
}

View File

@ -1,21 +0,0 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using xClient.Core.Information;
namespace xClient.Tests.Core.Information
{
[TestClass]
public class GeoIPTests
{
[TestMethod]
public void GetGeoIPTest()
{
var ipInformation = new GeoIP();
Assert.IsNotNull(ipInformation.City);
Assert.IsNotNull(ipInformation.Country);
Assert.IsNotNull(ipInformation.CountryCode);
Assert.IsNotNull(ipInformation.Region);
Assert.IsNotNull(ipInformation.WanIp);
}
}
}

View File

@ -0,0 +1,126 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using xServer.Core.Compression;
namespace xServer.Tests.Core.Compression
{
[TestClass]
public class SafeQuickLZTests
{
/*
* Purpose: To validate a small amount of data after compression/decompression
* using SafeQuickLZ with level 1 compression.
*/
[TestMethod]
[TestCategory("Compression")]
public void SmallDataCompressionTestLevel1()
{
SafeQuickLZ safeQuickLZtest = new SafeQuickLZ();
byte[] smallData = new byte[100];
// Fill the small data array with random data.
new Random().NextBytes(smallData);
// Store the compressed data.
byte[] smallDataCompressed = safeQuickLZtest.Compress(smallData, 0, smallData.Length, 1);
// The original should not equal the compressed data.
Assert.AreNotEqual(smallData, smallDataCompressed, "Original data is equal to the compressed data!");
// Store the decompressed data.
byte[] smallDataDecompressed = safeQuickLZtest.Decompress(smallDataCompressed, 0, smallDataCompressed.Length);
// The compressed data should not equal the decompressed data.
Assert.AreNotEqual(smallDataCompressed, smallDataDecompressed, "Compressed data is equal to the decompressed data!");
// The original data must equal the decompressed data; must be able to make a round-trip.
CollectionAssert.AreEqual(smallData, smallDataDecompressed, "Original data does not match the decompressed data!");
}
/*
* Purpose: To validate a small amount of data after compression/decompression
* using SafeQuickLZ with level 3 compression.
*/
[TestMethod]
[TestCategory("Compression")]
public void SmallDataCompressionTestLevel3()
{
SafeQuickLZ safeQuickLZtest = new SafeQuickLZ();
byte[] smallData = new byte[100];
// Fill the small data array with random data.
new Random().NextBytes(smallData);
// Store the compressed data.
byte[] smallDataCompressed = safeQuickLZtest.Compress(smallData, 0, smallData.Length, 3);
// The original should not equal the compressed data.
Assert.AreNotEqual(smallData, smallDataCompressed, "Original data is equal to the compressed data!");
// Store the decompressed data.
byte[] smallDataDecompressed = safeQuickLZtest.Decompress(smallDataCompressed, 0, smallDataCompressed.Length);
// The compressed data should not equal the decompressed data.
Assert.AreNotEqual(smallDataCompressed, smallDataDecompressed, "Compressed data is equal to the decompressed data!");
// The original data must equal the decompressed data; must be able to make a round-trip.
CollectionAssert.AreEqual(smallData, smallDataDecompressed, "Original data does not match the decompressed data!");
}
/*
* Purpose: To validate a large amount of data after compression/decompression
* using SafeQuickLZ with level 1 compression.
*/
[TestMethod]
[TestCategory("Compression")]
public void BigDataCompressionTestLevel1()
{
SafeQuickLZ safeQuickLZtest = new SafeQuickLZ();
byte[] bigData = new byte[100000];
// Fill the big data array with random data.
new Random().NextBytes(bigData);
// Store the compressed data.
byte[] bigDataCompressed = safeQuickLZtest.Compress(bigData, 0, bigData.Length, 1);
// The original should not equal the compressed data.
Assert.AreNotEqual(bigData, bigDataCompressed, "Original data is equal to the compressed data!");
// Store the decompressed data.
byte[] bigDataDecompressed = safeQuickLZtest.Decompress(bigDataCompressed, 0, bigDataCompressed.Length);
// The compressed data should not equal the decompressed data.
Assert.AreNotEqual(bigDataCompressed, bigDataDecompressed, "Compressed data is equal to the decompressed data!");
// The original data must equal the decompressed data; must be able to make a round-trip.
CollectionAssert.AreEqual(bigData, bigDataDecompressed, "Original data does not match the decompressed data!");
}
/*
* Purpose: To validate a large amount of data after compression/decompression
* using SafeQuickLZ with level 3 compression.
*/
[TestMethod]
[TestCategory("Compression")]
public void BigDataCompressionTestLevel3()
{
SafeQuickLZ safeQuickLZtest = new SafeQuickLZ();
byte[] bigData = new byte[100000];
// Fill the big data array with random data.
new Random().NextBytes(bigData);
// Store the compressed data.
byte[] bigDataCompressed = safeQuickLZtest.Compress(bigData, 0, bigData.Length, 3);
// The original should not equal the compressed data.
Assert.AreNotEqual(bigData, bigDataCompressed, "Original data is equal to the compressed data!");
// Store the decompressed data.
byte[] bigDataDecompressed = safeQuickLZtest.Decompress(bigDataCompressed, 0, bigDataCompressed.Length);
// The compressed data should not equal the decompressed data.
Assert.AreNotEqual(bigDataCompressed, bigDataDecompressed, "Compressed data is equal to the decompressed data!");
// The original data must equal the decompressed data; must be able to make a round-trip.
CollectionAssert.AreEqual(bigData, bigDataDecompressed, "Original data does not match the decompressed data!");
}
}
}

View File

@ -53,6 +53,7 @@
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="Core\Compression\SafeQuickLZ.Tests.cs" />
<Compile Include="Core\Encryption\AES.Tests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>

View File

@ -42,8 +42,6 @@
this.txtHost = new System.Windows.Forms.TextBox();
this.lblHost = new System.Windows.Forms.Label();
this.groupInstall = new System.Windows.Forms.GroupBox();
this.chkIconChange = new System.Windows.Forms.CheckBox();
this.chkElevation = new System.Windows.Forms.CheckBox();
this.picUAC2 = new System.Windows.Forms.PictureBox();
this.picUAC1 = new System.Windows.Forms.PictureBox();
this.rbSystem = new System.Windows.Forms.RadioButton();
@ -65,6 +63,8 @@
this.txtInstallname = new System.Windows.Forms.TextBox();
this.lblInstallname = new System.Windows.Forms.Label();
this.chkInstall = new System.Windows.Forms.CheckBox();
this.chkIconChange = new System.Windows.Forms.CheckBox();
this.chkElevation = new System.Windows.Forms.CheckBox();
this.btnBuild = new System.Windows.Forms.Button();
this.tooltip = new System.Windows.Forms.ToolTip(this.components);
this.groupAsmInfo = new System.Windows.Forms.GroupBox();
@ -131,6 +131,7 @@
this.txtDelay.Size = new System.Drawing.Size(66, 22);
this.txtDelay.TabIndex = 8;
this.txtDelay.Text = "5000";
this.txtDelay.TextChanged += new System.EventHandler(this.txtDelay_TextChanged);
this.txtDelay.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtDelay_KeyPress);
//
// lblDelay
@ -237,30 +238,6 @@
this.groupInstall.TabStop = false;
this.groupInstall.Text = "Install";
//
// chkIconChange
//
this.chkIconChange.AutoSize = true;
this.chkIconChange.Location = new System.Drawing.Point(6, 44);
this.chkIconChange.Name = "chkIconChange";
this.chkIconChange.Size = new System.Drawing.Size(91, 17);
this.chkIconChange.TabIndex = 1;
this.chkIconChange.Text = "Change Icon";
this.tooltip.SetToolTip(this.chkIconChange, "Custom social engineering tactic to elevate Admin privileges.");
this.chkIconChange.UseVisualStyleBackColor = true;
this.chkIconChange.CheckedChanged += new System.EventHandler(this.chkIconChange_CheckedChanged);
//
// chkElevation
//
this.chkElevation.AutoSize = true;
this.chkElevation.Location = new System.Drawing.Point(6, 21);
this.chkElevation.Name = "chkElevation";
this.chkElevation.Size = new System.Drawing.Size(147, 17);
this.chkElevation.TabIndex = 0;
this.chkElevation.Text = "Enable Admin Elevation";
this.tooltip.SetToolTip(this.chkElevation, "Custom social engineering tactic to elevate Admin privileges.");
this.chkElevation.UseVisualStyleBackColor = true;
this.chkElevation.CheckedChanged += new System.EventHandler(this.chkElevation_CheckedChanged);
//
// picUAC2
//
this.picUAC2.Image = global::xServer.Properties.Resources.uac_shield;
@ -472,6 +449,30 @@
this.chkInstall.UseVisualStyleBackColor = true;
this.chkInstall.CheckedChanged += new System.EventHandler(this.chkInstall_CheckedChanged);
//
// chkIconChange
//
this.chkIconChange.AutoSize = true;
this.chkIconChange.Location = new System.Drawing.Point(6, 44);
this.chkIconChange.Name = "chkIconChange";
this.chkIconChange.Size = new System.Drawing.Size(91, 17);
this.chkIconChange.TabIndex = 1;
this.chkIconChange.Text = "Change Icon";
this.tooltip.SetToolTip(this.chkIconChange, "Custom social engineering tactic to elevate Admin privileges.");
this.chkIconChange.UseVisualStyleBackColor = true;
this.chkIconChange.CheckedChanged += new System.EventHandler(this.chkIconChange_CheckedChanged);
//
// chkElevation
//
this.chkElevation.AutoSize = true;
this.chkElevation.Location = new System.Drawing.Point(6, 21);
this.chkElevation.Name = "chkElevation";
this.chkElevation.Size = new System.Drawing.Size(147, 17);
this.chkElevation.TabIndex = 0;
this.chkElevation.Text = "Enable Admin Elevation";
this.tooltip.SetToolTip(this.chkElevation, "Custom social engineering tactic to elevate Admin privileges.");
this.chkElevation.UseVisualStyleBackColor = true;
this.chkElevation.CheckedChanged += new System.EventHandler(this.chkElevation_CheckedChanged);
//
// btnBuild
//
this.btnBuild.Location = new System.Drawing.Point(540, 458);

View File

@ -386,6 +386,11 @@ namespace xServer.Forms
HasChanged();
}
private void txtDelay_TextChanged(object sender, EventArgs e)
{
HasChanged();
}
private void txtMutex_TextChanged(object sender, EventArgs e)
{
HasChanged();

View File

@ -40,7 +40,7 @@ namespace xServer.Forms
foreach (FileInfo file in iFiles)
{
lstLogs.Items.Add(new ListViewItem().Text = file.Name);
lstLogs.Items.Add(new ListViewItem() { Text = file.Name });
}
}
}