コード例 #1
0
 public Parser()
 {
     _adress          = new Adresses();
     _client          = new WebClient();
     _client.Encoding = Encoding.UTF8;
     _sumList         = new List <Summary>();
     _xpath           = new xPaths();
     _errorList       = new List <string>();
 }
コード例 #2
0
 private void buttonHit_Click(object sender, EventArgs e)
 {
     Console.Clear();
     if (string.IsNullOrWhiteSpace(textBoxUrl.Text))
     {
         Console.WriteLine("Introduceti un url valid.");
     }
     else
     {
         _url = textBoxUrl.Text;
         Console.WriteLine("Checking the url..");
         Check request = new Check(_url);
         if (request.isStatus)
         {
             Console.WriteLine("Url is valid, moving forward..");
             (sender as Button).Enabled = false;
             if (string.IsNullOrWhiteSpace(textBoxUser.Text) || string.IsNullOrWhiteSpace(textBoxPass.Text) || string.IsNullOrWhiteSpace(textBoxButton.Text))
             {
                 Console.WriteLine("Crawler called..");
                 xPaths xPathList = new xPaths(_url);
                 _username = xPathList.UsernameXPath;
                 _password = xPathList.PasswordXPath;
                 _login    = xPathList.ButtonXPath;
                 Console.WriteLine("Crawler ended succesfuly!");
             }
             else
             {
                 _username = textBoxUser.Text;
                 _password = textBoxPass.Text;
                 _login    = textBoxButton.Text;
             }
             Console.WriteLine("Dictionary attack has started..");
             Attack dictionaryAttack = new Attack(_url, _username, _password, _login, checkBoxBackground.Checked);
             dictionaryAttack.Start();
             foreach (string user in dictionaryAttack.ValidUser)
             {
                 labelUsernames.Text += user + " ";
             }
             foreach (string pass in dictionaryAttack.ValidPass)
             {
                 labelPasswords.Text += pass + " ";
             }
             (sender as Button).Enabled = true;
         }
         else
         {
             Console.WriteLine("URL invalid!");
         }
     }
 }
コード例 #3
0
        public void GetButtonXPath()//verify if the button xpath is valid
        {
            xPaths xPathList = new xPaths("http://192.168.1.105/login.php");

            Assert.IsTrue((xPathList.ButtonXPath).Contains("bmit") || (xPathList.ButtonXPath).Contains("ogin"));
        }
コード例 #4
0
        public void GetPassXPath()//verify if the password xpath is valid
        {
            xPaths xPathList = new xPaths("http://192.168.1.105/login.php");

            Assert.IsTrue((xPathList.PasswordXPath).Contains("pass"));
        }
コード例 #5
0
        public void GetUserXPath()//verify if the username xpath is valid
        {
            xPaths xPathList = new xPaths("http://192.168.1.105/login.php");

            Assert.IsTrue((xPathList.UsernameXPath).Contains("user"));
        }
コード例 #6
0
        public void FindXPaths()//find all the xpaths
        {
            xPaths xPathList = new xPaths("http://192.168.1.105/login.php");

            Assert.IsTrue(xPathList.UsernameXPath != null && xPathList.PasswordXPath != null && xPathList.ButtonXPath != null);
        }