DEV Community

Shaiju T
Shaiju T

Posted on

SecureCLI - A custom CLI using .NET Core and MongoDB Atlas

The Problem

If you work in a company , they are many reason to access different websites. But sometimes maybe you need permissions from security teams to access these websites, or maybe sometimes you have to wait for 2 days to get this approved.

Solution : Reduce the wait time and support tickets

As a developer you like CLI tools because its quick. SecureCLItool helps you to check if the website is secure or not by just typing simple command like below:

secure https://cloud.mongodb.com/

Secure CLI Demo in GIF :)

Image description

Submission Category:

Automation Innovation :

Here we have automatedthe security teams job, instead of taking time to approving multiple support tickets , create a DB of approved links in Mongo DB :)

The Mongo Collection

Image description

The API Behind the CLI

Image description

Link to Code

This repo is related to a CLI App created for MongoDb and Dev.to Hackathon :)

Prerequisites

  • Install .NET Core 5.0 SDK : https://dotnet.microsoft.com/en-us/download/dotnet/5.0

  • Create you own Mongo DB Atlas FREE account, and create required DB and Collection : https://cloud.mongodb.com/

  • Add below sample documents inside your collection:

    {
        "_id": {
            "$oid": "auto_generated_id"
        },
        "link": "https://cloud.mongodb.com/",
        "isSecure": true
    }
    
    
    {
        "_id": {
                 "$oid": "auto_generated_id"
        },
        "link": "https://dev.to/",
        "isSecure": true
    }
    
    
    {
        "_id": {
                "$oid": "auto_generated_id"
        },
        "link": "https://www.exampleunsecuresite.com/",
        "isSecure": false
    }
    
  • Open the SearchSecureAPIController.cs file under Secure Cli API project and add all related config for Mongo DB Atlas like: Connection string, DB Name, Collection Name.

Steps to Run the Secure Cli API

1. Open the command prompt into folder SecureCliAPI

2. Type dotnet restore

3. Type dotnet build

4. Type dotnet run

5. Let this API be in running mode

Steps to Run the Secure Cli App

1. Open the command…

Additional Resources / Info

Was busy but still I did this project in less time, So feel free open issues in github if you face any problem running the projects.

Future Plans:

  • Create a back end with UIfor security teams add or remove links
  • Make the CLIrespond like a chat bot
  • Add options to check mail domains
  • Do the above as time permits :)

I enjoyed building a custom CLI. Thanks Mondodb and devto .

Enjoy the CLI :)

Top comments (0)