コード例 #1
0
ファイル: BruteCore.cs プロジェクト: Pilipets/Login-via-code
 public void DeleteCurrentPage()
 {
     pages.Remove(page);
     ChangeUI(this, new LoginEventArgs(EventType.Progress,
                                       "Page: " + page.Name + " has been succesfully deleted"));
     page = pages.Count > 0 ? pages[0] : null;
 }
コード例 #2
0
ファイル: BruteCore.cs プロジェクト: Pilipets/Login-via-code
        public async Task ReadPagesFromFile(string path)
        {
            ChangeUI(this, new LoginEventArgs(EventType.Progress,
                                              "Started reading default pages from file" + path));
            FileStream file   = new FileStream(path, FileMode.Open, FileAccess.Read);
            var        reader = new StreamReader(file);

            do
            {
                string _filePath = await reader.ReadLineAsync();

                try
                {
                    _filePath = string.Format("{0}\\Files\\{1}", path.Substring(0, path.LastIndexOf('\\')), _filePath);
                }
                catch (Exception)
                {
                    throw new Exception("Path for login page file was incorrect");
                }
                LoginCore newPage = new LoginCore(ChangeUI);
                await newPage.InitializeFromFile(_filePath);

                pages.Add(newPage);
            } while (reader.Peek() >= 0);
            reader.Dispose();
            file.Dispose();
            page = pages[0];
            ChangeUI(this, new LoginEventArgs(EventType.Progress,
                                              "Finished reading default pages from file" + path));
            ChangeUI(this, new LoginEventArgs(EventType.Progress,
                                              page.Name + " has been set as default brute page"));
        }
コード例 #3
0
 public void SetPage(LoginCore page)
 {
     editingPage             = page;
     txtPageName.Text        = page.Name;
     txtPostString.Text      = page.postPattern;
     txtIndicateString.Text  = page.indicateString;
     txtNavigateUrl.Text     = page.navigateUrl;
     txtNavigateReferer.Text = page.navigateReferer;
     txtFormAction.Text      = page.ActionType;
 }
コード例 #4
0
ファイル: BruteCore.cs プロジェクト: Pilipets/Login-via-code
 public void AddPage(LoginCore siteInfo, int index = -1)
 {
     if (index > -1)
     {
         pages.Insert(index, siteInfo);
         ChangeUI(this, new LoginEventArgs(EventType.Progress,
                                           "Editted Page " + siteInfo.Name));
     }
     else
     {
         pages.Add(siteInfo);
         ChangeUI(this, new LoginEventArgs(EventType.Progress,
                                           "Added new Page " + siteInfo.Name));
     }
 }
コード例 #5
0
ファイル: Form1.cs プロジェクト: Pilipets/Login-via-code
        public void AddPage(LoginCore editingPage, string pageName, string postString,
                            string indicateString, string navigateUrl, string navigateReferer, string formAction)
        {
            LoginCore page = new LoginCore(ChangeUI, pageName, postString, indicateString,
                                           navigateUrl, navigateReferer, formAction);

            if (editingPage != null)
            {
                int index = core.pages.IndexOf(editingPage);
                core.pages.RemoveAt(index);
                core.AddPage(page, index);
            }
            else
            {
                core.AddPage(page);
            }
        }
コード例 #6
0
ファイル: BruteCore.cs プロジェクト: Pilipets/Login-via-code
 public void SetCurrentPage(LoginCore loginCore)
 {
     page = loginCore;
     ChangeUI(this, new LoginEventArgs(EventType.Progress,
                                       "Set current Login Page as " + loginCore.Name));
 }