Esempio n. 1
0
        // on proxy type combobox changed
        private void proxytool_SelectedIndexChanged(object sender, EventArgs e)
        {
            NetworkHelper.currentFakeIP = "";
            if (this.proxytool.Text != "Micro")
            {
                this.ipProxyHost.Text = NetworkHelper.getLocalIpAddress();
                Random random = new Random();
                this.numProxyPort.Value = random.Next(1000, 50000);
            }

            bool flag = this.proxytool.Text == "SSH";

            if (flag)
            {
                IEnumerable <string> enumerable = (from x in this.listssh
                                                   select x.country).Distinct <string>();
                this.comboProxyGeo.Items.Clear();
                foreach (string item in enumerable)
                {
                    this.comboProxyGeo.Items.Add(item);
                }
                bool flag2 = this.comboProxyGeo.Items.Count > 0;
                if (flag2)
                {
                    this.comboProxyGeo.Text = this.comboProxyGeo.Items[0].ToString();
                }
            }
            else
            {
                bool flag3 = this.proxytool.Text == "Vip72";
                if (flag3)
                {
                    this.comboProxyGeo.Items.Clear();
                    foreach (countrycode ctcode in RunData.getInstance().listCountryCode)
                    {
                        this.comboProxyGeo.Items.Add(ctcode.country);
                    }
                    this.comboProxyGeo.SelectedIndex = 0;
                }
                else
                {
                    if (this.proxytool.Text == "SSHServer")
                    {
                        if (this.tbSSHServer.Text == "")
                        {
                            MessageBox.Show("Chua config SSH server. Proxy -> SSH -> SSH server");
                            this.proxytool.Text = "Direct";
                            return;
                        }

                        HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(this.tbSSHServer.Text + "/getgeo.php");
                        httpWebRequest.UserAgent = "XXX";
                        try
                        {
                            System.IO.Stream responseStream = httpWebRequest.GetResponse().GetResponseStream();
                            StreamReader     streamReader   = new StreamReader(responseStream);
                            string           text           = streamReader.ReadToEnd();
                            if (text.EndsWith("|"))
                            {
                                text = text.Substring(0, text.Length - 1);
                            }
                            string[] items = text.Split(new string[]
                            {
                                "|"
                            }, StringSplitOptions.None);
                            this.comboProxyGeo.Items.Clear();
                            this.comboProxyGeo.Items.AddRange(items);
                            this.comboProxyGeo.SelectedIndex = 0;
                        }
                        catch (Exception ex)
                        {
                            this.proxytool.Text = "Direct";
                            MessageBox.Show("Error connect to SSH Server");
                        }
                    }
                    else
                    {
                        this.comboProxyGeo.Items.Clear();
                    }
                }
            }
            this.saveothersetting();
        }
Esempio n. 2
0
        public Form1(string param)
        {
            this.settingUpdateTimer = new System.Windows.Forms.Timer();

            this.changesssh   = 0;
            this.scriptstatus = "stop";

            this._sshssh        = false;
            this.documentfolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\";

            this.offerListItem = new List <offerItem>();

            this.deviceComm = new DeviceCommunicator();
            this.cmd        = new command(this.deviceComm);
            this.cmdResult  = new commandResult();

            this.DeviceInfo = new deviceInfo();
            this.AppList    = new List <appDetail>();

            this.listbackup = new List <BackupObj>();
            this.listvipacc = new List <vipaccount>();

            this.maxwait             = 120;           // thoi gian timeout cua wipe - backup
            this.bitproc             = new Process(); //bitvise process
            this.runningstt          = EnumRunningSTT.NOT_RUN;
            this.currentOfferProfile = "";

            this.components = null;


            Random random = new Random();

            this.InitializeComponent();

            //init port connect
            this.numProxyPort.Value = random.Next(1000, 50000);
            //init ip connect
            this.DeviceIpControl.Text = Settings.Default.ipaddress;

            RunData.getInstance().loadAllData();

            this.lvwColumnSorter = new ListViewColumnSorter();
            this.listViewRRS.ListViewItemSorter = this.lvwColumnSorter;
            this.listViewRRS.OwnerDraw          = true;

            this.ipProxyHost.Text = NetworkHelper.getLocalIpAddress();


            ImageList imageList = new ImageList();

            imageList.ImageSize = new Size(1, 50);
            this.listViewOffer.SmallImageList = imageList;
            this.proxytool.Text = "SSH";


            try
            {
                this.Text = this.DeviceIpControl.Text.Split(new string[]
                {
                    "."
                }, StringSplitOptions.None)[3] + "|disconnected";
            }
            catch (Exception)
            {
            }

            initAutoLeadTab();

            Dictionary <string, ThreadStart> initParams = new Dictionary <string, ThreadStart>();

            initParams.Add("AutoLeadThread", new ThreadStart(this.autoLeadThread));
            initParams.Add("RRSThread", new ThreadStart(this.autoRRS));
            initParams.Add("BackupThread", new ThreadStart(this.backupthread));
            initParams.Add("WipeThread", new ThreadStart(this.wipethread));
            initParams.Add("ChangeIpThread", new ThreadStart(this.threadchangeIP));
            initParams.Add("ReconnectThread", new ThreadStart(this.reconnect));
            initParams.Add("ExeScriptThread", new ThreadStart(this.excutescriptthread1));

            ThreadManager.getInstance().init(initParams);
        }