Skip to content

Commit

Permalink
mostly updates to final challenge solution
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-rreeder committed Oct 19, 2023
1 parent e979ad7 commit 1a6b39d
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 48 deletions.
108 changes: 60 additions & 48 deletions docs/cubespace-instructor/6-ins-final.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,67 @@
# Final Challenge Solution
# Final Challenge Solution

[DISTRIBUTION STATEMENT A] This material has been approved for public release and unlimited distribution.

## Overview

To complete the final goal, players must discover the address of the final location. They accomplish this by compiling an executable from a combination of the main program's source code while referencing the three DLLs obtained by submitting Alien codex files. Then, run the resulting executable against the six data-sets to decode the final answer. The final answer is a set of coordinates given as two (2) sets of three (3) case insensitive alphanumeric characters (e.g., 123/abc, a2n/3ib).
To complete the final goal, players must discover the address of the final location. Do this by compiling an executable from a combination of the main program's source code while referencing the three DLLs obtained by submitting alien codex files. Then, run the resulting executable against the six data-sets to decode the final answer. The final answer is a set of coordinates given as two (2) sets of three (3) case-insensitive alphanumeric characters (e.g., `123/abc`, `a2n/3ib`).

In order to ensure that players can finish the game by solving any three challenges, the files are split up as follows:
To ensure that players can finish the game by solving any three challenges, the files are split up as follows:

- Archive A: All six data files, no source code.
- Archive B: Library File #2, Library File #3, Main Source File, Data File 4, Data File 5, Data File 6.
- Archive C: Library File #1, Library File #3, Main Source file, Data File 2, Data File 3, Data File 6.
- Archive D: Library File #1, Library File #2, Main source file, Data File 1, Data file 3, Data File 5.
- Archive E: Library File 1, Library File 2, Library File 3, Data File 1, Data File 2, Data File 4.
- **Archive A:** All six data files, no source code.
- **Archive B:** Library File #2, Library File #3, Main Source File, Data File 4, Data File 5, Data File 6.
- **Archive C:** Library File #1, Library File #3, Main Source file, Data File 2, Data File 3, Data File 6.
- **Archive D:** Library File #1, Library File #2, Main source file, Data File 1, Data file 3, Data File 5.
- **Archive E:** Library File 1, Library File 2, Library File 3, Data File 1, Data File 2, Data File 4.

The final solution can be built using Visual Studio Code or from the C# command-line tools on any of the five Kali Linux operator terminals.

### Answer Quick Reference

The correct answer is provided here for your convenience.

Provide the coordinates of the final artifact to save Mars.

`20x/y4R`
The correct answer is provided here for your convenience. Provide the coordinates of the final artifact to save Mars: `20x/y4R`

## Question 1

*Provide the coordinates of the final artifact to save Mars.*

1. Start by moving all of the collected archives to the operator terminal and extracting them.
Start by moving all of the collected archives to the operator terminal and extracting them.

![image 85](img/image85.png)

2. Open Visual Studio Code.
3. From the terminal, enter the following command: `dotnet new console --name extractor`
Open Visual Studio Code.

From the terminal, enter the following command:

```
dotnet new console --name extractor
```

![image 86](img/image86.png)

![image 87](img/image87.png)

![image 88](img/image88.png)

4. Copy the DataExtractor1.dll, DataExtractor2.dll and DataExtractor3.dll files into the root of the new extractor directory.
5. Copy the DataFile1.txt, DataFile2.txt, DataFile3.txt, DataFile4.txt, DataFile5.txt, and DataFile6.txt files into the root of the new extractor directory.
6. Replace the Program.cs text in the extractor directory with code similar to that below.
Copy the **DataExtractor1.dll**, **DataExtractor2.dll**, and **DataExtractor3.dll** files into the root of the new extractor directory.

Copy the **DataFile1.txt**, **DataFile2.txt**, **DataFile3.txt**, **DataFile4.txt**, **DataFile5.txt**, and **DataFile6.txt** files into the root of the new extractor directory.

Replace the **Program.cs** text in the extractor directory with code similar to that below.

![image 89](img/image89.png)

```
```cs
using System;
using System.IO;

namespace FinalProgram
{
internal class Program
{
private static DataExtractor1.Class1 dataExtractor1 = new DataExtractor1.Class1();
private static DataExtractor2.Class1 dataExtractor2 = new DataExtractor2.Class1();
private static DataExtractor3.Class1 dataExtractor3 = new DataExtractor3.Class1();

static void Main(string[] args)
{
string finalCoordinates = ProcessFile1();
Expand All @@ -68,85 +71,85 @@ namespace FinalProgram
finalCoordinates = finalCoordinates + ProcessFile4();
finalCoordinates = finalCoordinates + ProcessFile5();
finalCoordinates = finalCoordinates + ProcessFile6();

Console.WriteLine("Final Coordinates: " + finalCoordinates);
}

private static string ProcessFile1()
{
var text = string.Empty;

using (var sr = new StreamReader("DataFile1.txt"))
{
text = sr.ReadToEnd();
}

string result = dataExtractor1.Method1(text).ToString();
return result[733].ToString();
}

private static string ProcessFile2()
{
var text = string.Empty;

using (var sr = new StreamReader("DataFile2.txt"))
{
text = sr.ReadToEnd();
}

string result = dataExtractor2.Method4(text).ToString();
result = dataExtractor2.Method4(result).ToString();
return result[116].ToString();
}

private static string ProcessFile3()
{
var text = string.Empty;

using (var sr = new StreamReader("DataFile3.txt"))
{
text = sr.ReadToEnd();
}

string result = dataExtractor2.Method1(text).ToString();
return result[393].ToString();
}

private static string ProcessFile4()
{
var text = string.Empty;

using (var sr = new StreamReader("DataFile4.txt"))
{
text = sr.ReadToEnd();
}

string result = dataExtractor3.Method1(text).ToString();
return result[840].ToString();
}

private static string ProcessFile5()
{
var text = string.Empty;

using (var sr = new StreamReader("DataFile5.txt"))
{
text = sr.ReadToEnd();
}

string result = dataExtractor1.Method3(text).ToString();
return result[257].ToString();
}

private static string ProcessFile6()
{
var text = string.Empty;

using (var sr = new StreamReader("DataFile6.txt"))
{
text = sr.ReadToEnd();
}

string result = dataExtractor2.Method3(text).ToString();
return result[905].ToString();
}
Expand All @@ -158,7 +161,7 @@ Edit the extractor.csproj file, adding the following values inside the element.

![image 90](img/image90.png)

```
```cs
<ItemGroup>
<Reference Include="DataExtractor1.Class1">
<HintPath>DataExtractor1.dll</HintPath>
Expand All @@ -170,7 +173,7 @@ Edit the extractor.csproj file, adding the following values inside the element.
<HintPath>DataExtractor3.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<None Update="DataFile1.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down Expand Up @@ -202,17 +205,26 @@ Edit the extractor.csproj file, adding the following values inside the element.
</ItemGroup>
```

8. Save and close the extractor.csproj file.
9. Make sure you are in the correct directory (where the .csproj file is located). Run the following command in the VS Code terminal window: `dotnet build`
Save and close the extractor.csproj file.

Make sure you are in the correct directory (where the .csproj file is located). Run the following command in the VS Code terminal window:

```
dotnet build
```

![image 91](img/image91.png)

10. If there are any build errors, correct them and run the build command again.
If there are any build errors, correct them and run the build command again.

![image 92](img/image92.png)

11. Run the program from the VS Code terminal window with the following command: `dotnet run`
Run the program from the VS Code terminal window with the following command:

```
dotnet run
```
![image 93](img/image93.png)
![image 93](img/image93.png)
The final output should be printed out. Final Coordinates: `20x/y4R`
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ theme:
- search.suggest
- search.highlight
- content.code.copy

palette:
- scheme: default
primary: blue grey
Expand Down

0 comments on commit 1a6b39d

Please sign in to comment.