From 4a3e5223e83398df79fa506e0ace6435b8f717da Mon Sep 17 00:00:00 2001 From: Giovani Rodriguez Date: Tue, 15 Jul 2025 04:28:17 +0000 Subject: [PATCH] feat: decode base64 encoded url --- Base64Decode.cs | 0 README.md | 8 +++++++- base64Decode.csx | 23 +++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) delete mode 100644 Base64Decode.cs create mode 100644 base64Decode.csx diff --git a/Base64Decode.cs b/Base64Decode.cs deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md index a160bba..502b4a9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Part One -``` Please decode the text below. Upon decoding, you will be taken to a URL with further instructions on completing the challenge. aHR0cHM6Ly90bnM0bHBnbXppaXlwbnh4emVsNXNzNW55dTBuZnRvbC5sYW1iZGEtdXJsLnVzLWVhc3QtMS5vbi5hd3MvcmFtcC1jaGFsbGVuZ2UtaW5zdHJ1Y3Rpb25zLw== + +```bash +dotnet script base64Decode.csx aHR0cHM6Ly90bnM0bHBnbXppaXlwbnh4emVsNXNzNW55dTBuZnRvbC5sYW1iZGEtdXJsLnVzLWVhc3QtMS5vbi5hd3MvcmFtcC1jaGFsbGVuZ2UtaW5zdHJ1Y3Rpb25zLw== ``` + +Running the above yielded: [https://tns4lpgmziiypnxxzel5ss5nyu0nftol.lambda-url.us-east-1.on.aws/ramp-challenge-instructions/](https://tns4lpgmziiypnxxzel5ss5nyu0nftol.lambda-url.us-east-1.on.aws/ramp-challenge-instructions/) + + diff --git a/base64Decode.csx b/base64Decode.csx new file mode 100644 index 0000000..9dec956 --- /dev/null +++ b/base64Decode.csx @@ -0,0 +1,23 @@ +#r "System" +#r "System.Text.Encoding" + +using System.Text; + +if (Args.Count == 0) +{ + Console.WriteLine("Usage: dotnet script base64Decode.csx "); + return; +} + +try +{ + string base64Encoded = Args[0]; + var base64Bytes = Convert.FromBase64String(base64Encoded); + var decodedString = Encoding.UTF8.GetString(base64Bytes); + + Console.WriteLine("Decoded String: " + decodedString); +} +catch (FormatException) +{ + Console.WriteLine("Invalid Base64 string!"); +} \ No newline at end of file