using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Timers; namespace BruteForceApplication { class BruteForceApplication { static void Main(string[] args) { Console.Write("Password: "); String password = Console.ReadLine(); String attempt = ""; int first = 0; int second = 0; int third = 0; int fourth = 0; int fifth = 0; int sixt = 0; int seventh = 0; int eight = 0; int cracks = 0; double timer = 0; string[] array = new string[63]; array[0] = ""; array[1] = "a"; array[2] = "b"; array[3] = "c"; array[4] = "d"; array[5] = "e"; array[6] = "f"; array[7] = "g"; array[8] = "h"; array[9] = "i"; array[10] = "j"; array[11] = "k"; array[12] = "l"; array[13] = "m"; array[14] = "n"; array[15] = "o"; array[16] = "p"; array[17] = "q"; array[18] = "r"; array[19] = "s"; array[20] = "t"; array[21] = "u"; array[22] = "v"; array[23] = "w"; array[24] = "x"; array[25] = "y"; array[26] = "z"; array[27] = "A"; array[28] = "B"; array[29] = "C"; array[30] = "D"; array[31] = "E"; array[32] = "F"; array[33] = "G"; array[34] = "H"; array[35] = "I"; array[36] = "J"; array[37] = "K"; array[38] = "L"; array[39] = "M"; array[40] = "N"; array[41] = "O"; array[42] = "P"; array[43] = "Q"; array[44] = "R"; array[45] = "S"; array[46] = "T"; array[47] = "U"; array[48] = "V"; array[49] = "W"; array[50] = "X"; array[51] = "Y"; array[52] = "Z"; array[53] = "0"; array[54] = "1"; array[55] = "2"; array[56] = "3"; array[57] = "4"; array[58] = "5"; array[59] = "6"; array[60] = "7"; array[61] = "8"; array[62] = "9"; while (!attempt.Equals(password)) { if (first == array.Length) { second++; first = 0; } if (second == array.Length) { third++; second = 0; } if (third == array.Length) { fourth++; third = 0; } if (fourth == array.Length) { fifth++; fourth = 0; } if (fifth == array.Length) { sixt++; fifth = 0; } if (sixt == array.Length) { seventh++; sixt = 0; } if (seventh == array.Length) { eight++; seventh = 0; } if (eight == array.Length) { break; } attempt = array[eight] + array[seventh] + array[sixt] + array[fifth] + array[fourth] + array[third] + array[second] + array[first]; if(attempt.Equals(password)) { Console.WriteLine(attempt); } first++; cracks++; timer = timer + 0.0001; } Console.WriteLine("> Attempts to crack: " + cracks); Console.ReadLine(); } } }
using System.IO; using System; class Program { static void Main() { Console.WriteLine("Hello, World!"); interfacename = "hello"; action = "enable"; string s1 = string.Format(" i am a good \"\" person"); Console.WriteLine(s1); } }
using System.IO; using System; class Program { /* Part 2 - C# Tutorial - Reading and writing to a console * 1. Reading from the console 2. Writing to the console 3. Two ways to write to console a) Concatenation b) Place holder syntax – Most preferred * Please note that C# is case sensitive language. */ static void Main() { // Prompt the user for his name Console.WriteLine("Please enter your name"); // Read the name from console string UserName = Console.ReadLine(); // Concatenate name with hello word and print Console.WriteLine("Hello " + UserName); //Placeholder syntax to print name with hello word Console.WriteLine("Hello {0}", UserName); } }
using System; using static System.Console; class MilitaryDiscountInteractive { static void Main() { const int SERVICE_AGE = 18; string input; int number; WriteLine("Enter Customer's age for discount eligibility:"); input = ReadLine(); number = Convert.ToInt32(input); if(number >= SERVICE_AGE) WriteLine("Thank you for your service. You are eligible for a 10% discount."); if(number < SERVICE_AGE) WriteLine("Military discount not valid"); } }
using System; class Program { static void Main() { string data = "YX22 2- Pineapple Rush, 249, 0.750, 3.10, 0.05, 0.79, Ludl 6th Feb - 01:45 2m5f Hcap Hrd"; // Split string on spaces (this will separate all the words). string[] words = data.Split(','); foreach (string word in words) { Console.WriteLine("WORD: " + word); } } }
using System.IO; using System; class Program { static void Main() { int numOne; int numTwo; int numThree; /*The IDE will not accept user input so i modified the code while leaving the original code in a block comment*/ Console.WriteLine("Please enter THREE numbers: "); numOne = 0; numTwo = 0; numThree = 0; /*numOne = Convert.ToInt32(Console.ReadLine()); numTwo = Convert.ToInt32(Console.ReadLine()); numThree = Convert.ToInt32(Console.ReadLine());*/ if (numOne < numTwo && numOne < numThree){ Console.WriteLine("The smallest number is {0}", numOne); } if (numTwo < numOne && numTwo < numThree) { Console.WriteLine("The smallest number is {0}", numTwo); } if (numThree < numOne && numThree < numTwo){ Console.WriteLine("The smallest number is {0}", numThree); } else if (numOne == numTwo && numTwo == numThree && numThree == numOne){ Console.WriteLine("The numbers are equal."); } } }
using System; namespace RectangleApplication { class Rectangle { // member variables double length; double width; public void Acceptdetails() { length = 4.5; width = 3.5; } public double GetArea() { return length * width; } public void Display() { Console.WriteLine("Length: {0}", length); Console.WriteLine("Width: {0}", width); Console.WriteLine("Area: {0}", GetArea()); } } class ExecuteRectangle { static void Main(string[] args) { Rectangle r = new Rectangle(); r.Acceptdetails(); r.Display(); Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Yahtzee { static void Main() { Console.WriteLine("Hello, World!"); } public class YahtzeeScorecard { //Upper section public int Ones { get; set; } public int Twos { get; set; } public int Threes { get; set; } public int Fours { get; set; } public int Fives { get; set; } //Lower section public int ThreeOfAKind { get; set; } public int FourOfAKind { get; set; } public int FullHouse { get; set; } public int SmallStraight { get; set; } public int LargeStraight {get; set; } public int Chance { get; set; } public int Yahtzee { get; set; } private YahtzeeDice dice; public YahtzeeScorecard(YahtzeeDice dice) { this.dice = dice; } } }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more