feat: decode base64 encoded url
This commit is contained in:
@@ -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/)
|
||||
|
||||
|
||||
|
||||
23
base64Decode.csx
Normal file
23
base64Decode.csx
Normal file
@@ -0,0 +1,23 @@
|
||||
#r "System"
|
||||
#r "System.Text.Encoding"
|
||||
|
||||
using System.Text;
|
||||
|
||||
if (Args.Count == 0)
|
||||
{
|
||||
Console.WriteLine("Usage: dotnet script base64Decode.csx <base64string>");
|
||||
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!");
|
||||
}
|
||||
Reference in New Issue
Block a user