Giter Club home page Giter Club logo

pingcastle-notify's Introduction

PingCastle Notify

PingCastle Notify is a tool that will monitor your PingCastle reports ! You will be notified every time a change between a scan and a previous scan is made.

How it works ? PingCastle-Notify is a PS1 script that will run a PingCastle scan, compare the difference between a previous scan, highlight the diff and send the result into a Slack / Teams channel or a log file !

The slack/teams/log message will notify you regarding the different states: correction, recession etc

image

⚠️ If you don't want to use Slack or Teams set the variable $teams and $slack to 0 inside the ps1 script. Skip the step "Create a BOT" and check the log file inside the Reports folder.


▶️ First scan
Slack Teams
image image
▶️ No new vulnerability but some rules have been updated

image

▶️ New vulnerabilty
Slack Teams
image image
▶️ Some vulnerability have been removed
Slack Teams
image image
▶️ No new vulnerability

No result in slack since reports are the same


🔰 Adding the result of the current scan

Set the variable $print_current_result to 1 in the script, the rules flagged on the current scan will be added as a thread into Slack or after the rule diff on Teams.

Slack Teams
image Teams_8N2r3YiVh4

How to install ?

Structure of the project

SECU-TOOL-SCAN/
    - PingCastle-Notify.ps1
    - PingCastle/
        - Reports/
            - domain.local.xml
            - domain.local.html
            - scan.logs <-- contains the logs of the scan (diff scan)
        - Pingcastle.exe
        - ...

PingCastle & PingCastle-Notify.ps1

  1. Download PingCastle
  2. Unzip the archive
  3. Create a "Reports" folder inside the PingCastle folder
  4. Download and add the file PingCastle-Notify.ps1 on the parent directory

Create a BOT

▶️ Slack BOT
  1. In Slack create an application https://api.slack.com/apps
  2. Add the following rights
    • Click on "Add features and functionality" -> Bots (configure the name)
    • Click on "Add features and functionality" -> Permissions (add the following permissions)
    • Generate a "Bot User OAuth Token" on the Permissions tab

image

  1. Get your token add it to the PingCastle-Notify.ps1 script
  2. Create a slack channel and add your bot user to the channel
  3. You can test your bot using https://api.slack.com/methods/chat.postMessage/test
  4. Add the channel to the script
  5. Run the script to test using this command: powershell.exe -exec bypass C:\YOUR_PATH\SECU-TOOL-SCAN\PingCastle-Notify.ps1
▶️ Teams BOT
  1. Create a channel pingcastle-scan
  2. Click on the "..." dots and select "Connectors"
  3. Search for Webhook
  4. Add the webhook
  5. Re-click on the connectors button and on the webhook click "configure"
  6. Add a title and a logo and click Create, copy the wehbook URL
  7. Add the url on the variable $teamsUri
  8. Set the variable $teams to 1 and $slack to 0

Deploy a Scheduled Task

On your Windows Server go to

  1. Create a service account that will run the PS1 script every night (no need to set the service account as domain admin)
  2. Give privileges to the service account on the folder "Reports"

image

  1. Run taskschd.msc to open the Scheduler Task
  2. Create a Task and use the service account you just created
  3. In Actions tab set "Start a program" -> "Script": C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -> "Arguments" -> -exec bypass -f C:\PINGCASTLE\Pingcastle-Notify.ps1
  4. Give the permission "Log on as Batch Job" to service account https://danblee.com/log-on-as-batch-job-rights-for-task-scheduler/
  5. Run the scheduled task to test the result
  6. Enjoy :)

Acknowledgement

License

MIT License

pingcastle-notify's People

Contributors

luffynextgen avatar mpgn avatar tassilopitrasch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pingcastle-notify's Issues

Feature Request - Offline diff

I have 2 pingcastle reports.
Report A = New
Report B = 1 month old

I would like to run an offline diff of the 2 reports and report the findings to a microsoft teams instance.
Does PingCastle-Notify support that?

Reporting functionality question

Hello,

This looks REALLY cool. Is there any - or do you have any plans to - export to any other reporting format? It would be awesome even to get a txt or json dump just so I could quickly scan it and tell a customer what has changed between scan 1 and 2.

Thanks for all your awesome work/tools!

Brian

A flag to run "full" report again?

Hi,

I'm baaaaaack :-)

My understanding of the tool workflow is as follows:

  1. Run the script, get the "full" Ping Castle results in a (very good looking) list.
  2. Fix some things.
  3. Run script again and see what vulns are new/changed/removed
  4. Repeat steps 2 and 3.

However, is there a way to run the script and get a new "full" report just to see what things look like at a high level? The only way I've found to do this is by nuking everything in the reports folder, but I don't want to do that either since I want my historical report to show I'm being a good sysadmin!

Thanks,
Brian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.