示例#1
0
        public void SolvePart1()
        {
            var range = System.IO.File.ReadAllText("../../../input/day_04.txt")
                        .Split('-')
                        .Select(x => int.Parse(x))
                        .ToArray();

            int numPasswords = PasswordCracker.FindAllPasswordsInRange(range[0], range[1]).Count();

            Assert.Equal(1640, numPasswords);
        }
    public static void Main()
    {
        // The line below proves having more characters to choose from increases our search space.
        // Since we consider all characters between and inclusive of the "SPACE" and "~" characters,
        // we have O(M ^ N) runtime, where M (i.e. 95 characters in our chase) is the total number of
        // characters we are considering and N is the maximum length of password we specied. Our space
        // complexity is O(N) since our recursion only grows that much.
        //
        // var cracker = new PasswordCracker(new DummyAuthenticator(), new CompleteCharacters());

        // A typical password cracking software will employ the use of a dictionary attack or
        // reduce the search space by combining this with one or more of the strategies below
        //
        var cracker = new PasswordCracker(new DummyAuthenticator(), new CombinedCharacters(
                                              new LowercaseCharacters(), new UppercaseCharacters(), new NumericCharacters(), new SpecialCharacters()
                                              ));

        var result = cracker.Execute("Alex", 4);

        Console.WriteLine(result.Length > 0 ? result : "Unable to crack password!");
    }
示例#3
0
    public static void Main(string[] args)
    {
        Lockbox box = new Lockbox(numCompartments: 6,
                                  spellId: 2019,
                                  minPasswordLength: 3,
                                  maxPasswordLength: 5);

        PasswordCracker cracker = new PasswordCracker();

        string[] result = cracker.Crack(box);

        for (int i = 0; i < result.Length; ++i)
        {
            Console.WriteLine("Password for compartment #{0}: {1}",
                              i, result[i]);
        }

        // TODO: descifra el mensaje de Doctor Strange, usando como password
        //       la concatenacion, en algun orden desconocido, de las claves
        //       anteriores.  Una vez descifrado, muestra el mensaje en un
        //       comment.  Tambien debes proveer codigo del algoritmo que
        //       usaste para descifrarlo.
        // Valor: 3 puntos extras
    }
示例#4
0
    // Use this for initialization
    void Start()
    {
        System       = GameObject.Find("System");
        Applications = GameObject.Find("Applications");
        Hacking      = GameObject.Find("Hacking");
        Other        = GameObject.Find("Other");
        Computer     = GameObject.Find("Computer");
        Prompts      = GameObject.Find("Prompts");
        WindowHandel = GameObject.Find("WindowHandel");
        QA           = GameObject.Find("QA");

        winman = WindowHandel.GetComponent <WindowManager>();

        history      = Computer.GetComponent <SiteList>();
        websecviewer = Computer.GetComponent <WebSecViewer>();

        qa = QA.GetComponent <BugReport>();

        //DESKTOP ENVIROMENT
        customtheme = Computer.GetComponent <CustomTheme>();
        startmenu   = System.GetComponent <AppMenu>();
        rezprompt   = Prompts.GetComponent <RezPrompt>();
        desktop     = System.GetComponent <Desktop>();
        vc          = System.GetComponent <VolumeController>();

        //HACKING SOFTWARE
        pro             = Hacking.GetComponent <Progtive>();
        trace           = Hacking.GetComponent <Tracer>();
        dirsearch       = Hacking.GetComponent <DirSearch>();
        dicCrk          = Hacking.GetComponent <DicCrk>();
        passwordcracker = Hacking.GetComponent <PasswordCracker>();
        dirsearch       = Hacking.GetComponent <DirSearch>();

        //STOCK SYSTEMS
//		port = Applications.GetComponent<Portfolio>();
//		shareprompt = Prompts.GetComponent<SharePrompt>();

        //OTHER PROMPTS
        purchaseprompt = Prompts.GetComponent <PurchasePrompt>();

        //SYSTEM PROMPTS
        errorprompt    = Prompts.GetComponent <ErrorProm>();
        shutdownprompt = Prompts.GetComponent <ShutdownProm>();
        installprompt  = Prompts.GetComponent <InstallPrompt>();

        //SYSTEM SOFTWARE
        sysclock      = System.GetComponent <Clock>();
        cli           = System.GetComponent <CLI>();
        cliv2         = System.GetComponent <CLIV2>();
        os            = System.GetComponent <OS>();
        systempanel   = System.GetComponent <SystemPanel>();
        tasks         = System.GetComponent <TaskViewer>();
        com           = System.GetComponent <Computer>();
        diskman       = System.GetComponent <DiskMan>();
        vv            = System.GetComponent <VersionViewer>();
        fp            = System.GetComponent <FileExplorer>();
        SRM           = System.GetComponent <SystemResourceManager>();
        boot          = System.GetComponent <Boot>();
        deviceman     = System.GetComponent <DeviceManager>();
        executor      = System.GetComponent <Executor>();
        gatewayviewer = System.GetComponent <GatewayViewer>();

        //LEGAL APPLICATIONS
        email          = Applications.GetComponent <EmailClient>();
        caluclator     = Applications.GetComponent <Calculator>();
        notepad        = Applications.GetComponent <Notepad>();
        notepadv2      = Applications.GetComponent <Notepadv2>();
        accountlogs    = Applications.GetComponent <AccLog>();
        mp             = Applications.GetComponent <MusicPlayer>();
        treeview       = Applications.GetComponent <TreeView>();
        nv             = Applications.GetComponent <NotificationViewer>();
        pv             = Applications.GetComponent <PlanViewer>();
        calendar       = Applications.GetComponent <Calendar>();
        calendarv2     = Applications.GetComponent <CalendarV2>();
        eventview      = Applications.GetComponent <EventViewer>();
        exchangeviewer = Applications.GetComponent <ExchangeViewer>();

        //INTERNET BROWSERS
        internetbrowser = Applications.GetComponent <InternetBrowser>();
        edgebrowser     = Applications.GetComponent <NetViewer>();
        firefoxbrowser  = Applications.GetComponent <Firefox>();

        //APPLICATIONS
        systemMap  = Applications.GetComponent <SystemMap>();
        textreader = Applications.GetComponent <TextReader>();

        //BROWSER STUFF
        history = Computer.GetComponent <SiteList>();

        //OTHER CONNECTION DEVICE
        rv  = Applications.GetComponent <RemoteView>();
        vmd = Other.GetComponent <VMDesigner>();
    }
示例#5
0
 public Day5SecurityDoor(PasswordCracker cracker)
 {
     Cracker = cracker;
 }
示例#6
0
        public void CrackerFindsPassword()
        {
            var cracker = new PasswordCracker();

            Assert.Equal("18f47a30", cracker.Crack("abc"));
        }
示例#7
0
    void ProgramSetup()
    {
        AppSoftware     = GameObject.Find("Applications");
        QA              = GameObject.Find("QA");
        HackingSoftware = GameObject.Find("Hacking");
        SysSoftware     = GameObject.Find("System");
        Computer        = GameObject.Find("Computer");
        Other           = GameObject.Find("Other");
        Missions        = GameObject.Find("Missions");

        qa = QA.GetComponent <BugReport>();

        //mb = GetComponent<MissionBrow>();
        sl  = Computer.GetComponent <SiteList>();
        wsv = Computer.GetComponent <WebSecViewer>();

        //Hacking Software
        pro     = HackingSoftware.GetComponent <Progtive>();
        trace   = HackingSoftware.GetComponent <Tracer>();
        ds      = HackingSoftware.GetComponent <DirSearch>();
        dc      = HackingSoftware.GetComponent <DicCrk>();
        passcrk = HackingSoftware.GetComponent <PasswordCracker>();

        //System Sofware
        dsk   = SysSoftware.GetComponent <Desktop>();
        com   = SysSoftware.GetComponent <Computer>();
        ss    = SysSoftware.GetComponent <ScreenSaver>();
        sp    = SysSoftware.GetComponent <SystemPanel>();
        am    = SysSoftware.GetComponent <AppMenu>();
        tasks = SysSoftware.GetComponent <TaskViewer>();
        clk   = SysSoftware.GetComponent <Clock>();
        cmd   = SysSoftware.GetComponent <CLI>();
        cmd2  = SysSoftware.GetComponent <CLIV2>();
        os    = SysSoftware.GetComponent <OS>();
        dm    = SysSoftware.GetComponent <DiskMan>();
        mouse = SysSoftware.GetComponent <Mouse>();
        fp    = SysSoftware.GetComponent <FileExplorer>();
        dem   = SysSoftware.GetComponent <DeviceManager>();
        vc    = SysSoftware.GetComponent <VolumeController>();

        //Application Softwate
        //        port = AppSoftware.GetComponent<Portfolio>();
        tr     = AppSoftware.GetComponent <TextReader>();
        sm     = AppSoftware.GetComponent <SystemMap>();
        al     = AppSoftware.GetComponent <AccLog>();
        note   = AppSoftware.GetComponent <Notepad>();
        notev2 = AppSoftware.GetComponent <Notepadv2>();
        cc     = AppSoftware.GetComponent <EmailClient>();
        tv     = AppSoftware.GetComponent <TreeView>();
        nv     = AppSoftware.GetComponent <NotificationViewer>();
        pv     = AppSoftware.GetComponent <PlanViewer>();
        //calendar = AppSoftware.GetComponent<Calendar>();
        calendarv2   = AppSoftware.GetComponent <CalendarV2>();
        eventview    = AppSoftware.GetComponent <EventViewer>();
        exchangeview = AppSoftware.GetComponent <ExchangeViewer>();

        // Application Browsers
        ib  = AppSoftware.GetComponent <InternetBrowser>();
        eib = AppSoftware.GetComponent <NetViewer>();
        fib = AppSoftware.GetComponent <Firefox>();
        rv  = AppSoftware.GetComponent <RemoteView>();
        cal = AppSoftware.GetComponent <Calculator>();
        mp  = AppSoftware.GetComponent <MusicPlayer>();



        // Prompts
        ip  = Prompts.GetComponent <InstallPrompt>();
        pp  = Prompts.GetComponent <PurchasePrompt>();
        ep  = Prompts.GetComponent <ErrorProm>();
        sdp = Prompts.GetComponent <ShutdownProm>();
        rp  = Prompts.GetComponent <RezPrompt>();
//		shareprompt = Prompts.GetComponent<SharePrompt>();
        notiprompt = Prompts.GetComponent <NotfiPrompt>();

        //OTHER
        vmd = Other.GetComponent <VMDesigner>();

        // Computer
        ct = Computer.GetComponent <CustomTheme>();

        //Missions
        misgen = Missions.GetComponent <MissionGen>();
    }
示例#8
0
 public void Part2(string input, bool expected)
 {
     Assert.Equal(expected, PasswordCracker.MeetsRequirements(input, strict: true));
 }