notify

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 10 Imported by: 0

README

notify

License Go Report Card contributions welcome GitHub Release Follow on Twitter Chat on Discord

Notify is an helper utility written in Go that allows you to pull results from burp collaborator instances and post to CLI, also sends the notification via webhooks to Slack and Discord.

Resources

Features

notify

  • 💥 Automatic Burp Collaborator BIID interception.
  • 💥 Burp Collaborator Slack / Discord notification support.
  • 💥 Redirect output of any tool to Slack / Discord / Telegram.

Usage

▶ notify -h

This will display help for the tool. Here are all the switches it supports.

Flag Description Example
-biid burp private key notify -biid 123456789
-slack-webhook-url Slack Webhook URL notify -slack-webhook-url hxxp://a.b.c
-slack-username Slack Username notify -slack-username test
-slack-channel Slack Channel notify -slack-channel test
-slack Enable Slack notify -slack
-discord-webhook-url Discord Webhook URL notify -discord-webhook-url hxxp://a.b.c
-discord-username Discord Username notify -discord-username test
-discord-avatar Discord Avatar Url notify -discord-avatar hxxp://a.b.c
-discord Enable Discord notify -discord
-silent Silent mode notify -silent
-version Show version of notify notify -version
-interval Polling interval in seconds notify -interval 5
-intercept-biid Attempt to intercept biid (needs sudo) notify -intercept-biid
-intercept-biid-timeout Timeout for biid interception in seconds notify -intercept-biid-timeout 120
-http-message HTTP Message notify -http-message test
-dns-message DNS Message notify -dns-message test

Installation Instructions

From Binary

The installation is easy. You can download the pre-built binaries for your platform from the releases page. Extract them using tar, move it to your $PATHand you're ready to go.

Download latest binary from https://github.com/projectdiscovery/notify/releases

▶ tar -xvf notify-linux-amd64.tar
▶ mv notify-linux-amd64 /usr/local/bin/notify
▶ notify -version
From Source

Notify requires go1.14+ to install successfully. Run the following command to get the repo -

Installing Notify -

▶ GO111MODULE=on go get -u -v github.com/projectdiscovery/notify/cmd/notify

Installing Intercept -

▶ GO111MODULE=on go get -u -v github.com/projectdiscovery/notify/cmd/intercept
From Github

Installing Notify -

▶ git clone https://github.com/projectdiscovery/notify.git; cd notify/cmd/notify; go build; mv notify /usr/local/bin/; notify -version

Installing Intercept -

▶ git clone https://github.com/projectdiscovery/notify.git; cd notify/cmd/intercept; go build; mv intercept /usr/local/bin/;

Intercept BIID

  • Run intercept as root sudo intercept
  • Open Burp Suite => Project Options => Misc
  • Tick Pull Over HTTP
  • Generate new collaborator, click on Poll now.
  • Intercept will capture biid that can be used with notify
sudo ./intercept
Attempting to intercept BIID
BIID found: o%2JREfoFxWfdk4i1VOvPQiX96MfpZ7qlZ6kXiGeHbjvJ%3d

Running notify

CLI

You can use notify to receive burp collaborator interaction on your CLI, following command accepts biid as input and post all incoming interaction over CLI.

notify -biid 132456789                                  

Slack notification

The tool accept parameters from a config file located at $HOME/.config/notify/notify.conf or either via CLI.

To run the tool just use the following command.

▶ notify -biid 132456789 -slack -slack-webhook-url https://a.b.c -slack-username test -slack-channel test-channel

If you already configured the config file, you can simply run following command and notify will start receiving burp collaborator interaction on CLI and sends notification to slack / discord.

▶ notify

Discord notification

Similarly to slack, in order to use discord

▶ notify -biid 132456789 -discord -discord-webhook-url https://a.b.c -discord-username notify-bot

Telegram notification

Similarly to slack, in order to use discord

▶ notify -biid 132456789 -telegram -telegram-api-key 119489xxxx-:AAF4OV9 -telegram-chat-id 1231434

Using notify with other tools

Notify also supports piping output of any tool and send it over discord/slack channel as notification.

Following command will enumerate subdomains using SubFinder and probe for alive URLs and sends the notifications of alive URLs using httpx to configured discord / slack channel.

subfinder -d hackerone.com | httpx | notify

notify-httpx

Following command will enumerate subdomains using SubFinder and probe alive URLs using httpx, runs Nuclei templates and send the nuclei results as a notifications to configured discord / slack channel.

subfinder -d intigriti.com | httpx | nuclei -t files | notify

In similar manner, output (stdout) of any tool can be piped to notify for posting data into slack/discord.

Config File

The default config file should be located in $HOME/.config/notify/notify.conf and has the following contents:

burp_biid: 132465789
# Slack
slack: true
slack_webhook_url: https://a.b.c
slack_username: test
slack_channel: test

# Discord
discord: true
discord_webhook_url: https://a.b.c
discord_username: test
discord_avatar: https://a.b.c/avatar

# Telegram
telegram: true
telegram_apikey: 119489xxxx-:AAF4OV9cdCEzq3tQ3aMtVyzHaRV3a1M7Ow4
telegram_chat_id: 36808xxxx

# General Settings
interval: 2 # seconds

http_message: |
    The collaborator server received an {{protocol}} request from {{from}} at {{time}}:

    ```http
    {{request}}

    {{response}}
    ```

dns_message: |
    The collaborator server received a DNS lookup of type {{type}} for the domain name {{domain}} from {{from}} at {{time}}:

    ```
    {{request}}
    ```

📋 Notes

  • You can obtain the biid with wireshark on any platform and configure it within the config file.
  • Burp collaborator server allow to fetch results only for once, so if you are using this, you will not see results in burp collaborator window.
  • Config file has priority over CLI arguments.
  • Telegram notifcation does not support burp collaborator.

References:-

Notify is made with 🖤 by the projectdiscovery team.

Documentation

Overview

Package notify notifies out of band interactions via webhook

Index

Constants

View Source
const (
	DefaultTelegraTimeout = 5 * time.Second
	Endpoint              = "https://api.telegram.org/bot{{apikey}}/sendMessage?chat_id={{chatid}}&text={{message}}"
)

DefaultTelegraTimeout to conclude operations

View Source
const DefaultDiscordTimeout = 5 * time.Second

DefaultDiscordTimeout to conclude operations

View Source
const DefaultSlackTimeout = 5 * time.Second

DefaultSlackTimeout to conclude operations

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Color         string `json:"color,omitempty"`
	Fallback      string `json:"fallback,omitempty"`
	CallbackID    string `json:"callback_id,omitempty"`
	ID            int    `json:"id,omitempty"`
	AuthorID      string `json:"author_id,omitempty"`
	AuthorName    string `json:"author_name,omitempty"`
	AuthorSubname string `json:"author_subname,omitempty"`
	AuthorLink    string `json:"author_link,omitempty"`
	AuthorIcon    string `json:"author_icon,omitempty"`
	Title         string `json:"title,omitempty"`
	TitleLink     string `json:"title_link,omitempty"`
	Pretext       string `json:"pretext,omitempty"`
	Text          string `json:"text,omitempty"`
	ImageURL      string `json:"image_url,omitempty"`
	ThumbURL      string `json:"thumb_url,omitempty"`
	// Fields and actions are not defined.
	MarkdownIn []string    `json:"mrkdwn_in,omitempty"`
	TS         json.Number `json:"ts,omitempty"`
}

Attachment of slack message

type DiscordClient

type DiscordClient struct {
	WebHookURL string
	UserName   string
	Avatar     string
	TimeOut    time.Duration
	// contains filtered or unexported fields
}

DiscordClient handling webhooks

func (*DiscordClient) SendDiscordNotification

func (dc *DiscordClient) SendDiscordNotification(discordMessage *DiscordMessage) error

SendDiscordNotification with json structure

func (*DiscordClient) SendInfo

func (dc *DiscordClient) SendInfo(message string) (err error)

SendInfo to discord

type DiscordMessage

type DiscordMessage struct {
	Username  string `json:"username,omitempty"`
	AvatarURL string `json:"avatar_url,omitempty"`
	Content   string `json:"content,omitempty"`
}

DiscordMessage json structure

type Notify

type Notify struct {
	// contains filtered or unexported fields
}

Notify handles the notification engine

func New

func New() (*Notify, error)

New notify instance

func NewWithOptions

func NewWithOptions(options *Options) (*Notify, error)

NewWithOptions create a new instance of notify with options

func (*Notify) SendNotification

func (n *Notify) SendNotification(message string) error

SendNotification to registered webhooks

type Options

type Options struct {
	// Slack
	SlackWebHookURL string
	SlackUsername   string
	SlackChannel    string
	Slack           bool

	// Discord
	DiscordWebHookURL       string
	DiscordWebHookUsername  string
	DiscordWebHookAvatarURL string
	Discord                 bool

	// Telegram
	TelegramAPIKey string
	TelegramChatID string
	Telegram       bool
}

Options of internal webhooks

type SimpleSlackRequest

type SimpleSlackRequest struct {
	Text      string
	IconEmoji string
}

SimpleSlackRequest basic request

type SlackClient

type SlackClient struct {
	WebHookURL string
	UserName   string
	Channel    string
	TimeOut    time.Duration
	// contains filtered or unexported fields
}

SlackClient holding the slack communication logic

func (*SlackClient) SendError

func (sc *SlackClient) SendError(message string, options ...string) (err error)

SendError message

func (*SlackClient) SendInfo

func (sc *SlackClient) SendInfo(message string, options ...string) (err error)

SendInfo message

func (*SlackClient) SendJobNotification

func (sc *SlackClient) SendJobNotification(job SlackJobNotification) error

SendJobNotification will post a job notification to slack

func (*SlackClient) SendSlackNotification

func (sc *SlackClient) SendSlackNotification(sr SimpleSlackRequest) error

SendSlackNotification will post to an 'Incoming Webook' url setup in Slack Apps. It accepts some text and the slack channel is saved within Slack.

func (*SlackClient) SendWarning

func (sc *SlackClient) SendWarning(message string, options ...string) (err error)

SendWarning message

type SlackJobNotification

type SlackJobNotification struct {
	Color     string
	IconEmoji string
	Details   string
	Text      string
}

SlackJobNotification structure

type SlackMessage

type SlackMessage struct {
	Username    string       `json:"username,omitempty"`
	IconEmoji   string       `json:"icon_emoji,omitempty"`
	Channel     string       `json:"channel,omitempty"`
	Text        string       `json:"text,omitempty"`
	Attachments []Attachment `json:"attachments,omitempty"`
}

SlackMessage structure

type TelegramClient added in v0.0.2

type TelegramClient struct {
	TimeOut time.Duration
	// contains filtered or unexported fields
}

TelegramClient handling webhooks

func (*TelegramClient) SendInfo added in v0.0.2

func (dc *TelegramClient) SendInfo(message string) (err error)

SendInfo to telegram

type TelegramResponse added in v0.0.2

type TelegramResponse struct {
	Ok          bool   `json:"ok"`
	ErrorCode   int    `json:"error_code,omitempty"`
	Description string `json:"description,omitempty"`
}

TelegramResponse structure

Directories

Path Synopsis
cmd
notify command
intercept module
internal
runner
Package runner contains the internal logic
Package runner contains the internal logic

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL