Giter Site home page Giter Site logo

projectdiscovery / notify Goto Github PK

View Code? Open in Web Editor NEW
1.3K 23.0 128.0 1006 KB

Notify is a Go-based assistance package that enables you to stream the output of several tools (or read from a file) and publish it to a variety of supported platforms.

Home Page: https://projectdiscovery.io

License: MIT License

Go 95.50% Dockerfile 0.66% Shell 3.06% Makefile 0.79%
slack telegram discord

notify's Issues

Blank text in discord

This needs further investigation, manage to reproduce it, root cause is still unknown.

Discussed in #88

Originally posted by gauravnarwani97 August 27, 2021
HI Im using discord webhook integration but observing blank texts while using notify.

config:

discord:
  - id: "asd"
    discord_channel: "#general"
    discord_username: "Alerts"
    discord_format: "{{data}}"
    discord_webhook_url: "https://discord.com/api/webhooks/XXXXXX"
Screenshot 2021-08-27 at 2 21 32 AM

Getting blank texts

compilation terminated. error when installed intercept

ali@ali:~$ GO111MODULE=on go get -v -u github.com/projectdiscovery/notify/cmd/intercept

output:
go: github.com/projectdiscovery/notify/cmd/intercept upgrade => v0.0.0-20210217203733-c03d0cfcf351
go: github.com/logrusorgru/aurora upgrade => v2.0.3+incompatible
go: github.com/projectdiscovery/gologger upgrade => v1.1.4
go: github.com/projectdiscovery/collaborator upgrade => v0.0.2
go: golang.org/x/sys upgrade => v0.0.0-20210228012217-479acdf4ea46
go: downloading github.com/projectdiscovery/gologger v1.1.4
go: downloading github.com/projectdiscovery/collaborator v0.0.2
go: downloading golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46
go: github.com/modern-go/reflect2 upgrade => v1.0.1
go: github.com/modern-go/concurrent upgrade => v0.0.0-20180306012644-bacd9c7ef1dd
github.com/projectdiscovery/gologger/levels
github.com/modern-go/concurrent
github.com/projectdiscovery/gologger/writer
github.com/google/gopacket/pcap

github.com/google/gopacket/pcap

go/pkg/mod/github.com/google/[email protected]/pcap/pcap_unix.go:34:18: fatal error: pcap.h: No such file or directory
#include <pcap.h>
^
compilation terminated.
github.com/modern-go/reflect2
github.com/json-iterator/go
github.com/projectdiscovery/gologger/formatter
github.com/projectdiscovery/gologger

"discord" vs. "discordapp" in discord.go

It appears that discord.go expects DiscordWebHookURL to use "discord.com" as the domain for webhook URLs: https://github.com/projectdiscovery/notify/blob/master/pkg/providers/discord/discord.go#L43

Copying a webhook's URL from Discord's settings currently yields an URL with "discordapp.com." Pasting webhook URLs copied from Discord into provider-config.yaml results in the following error when running notify:

[ERR] failed to send discord notification for id: alert : token missing from config URL

Changing "discordapp.com" in the webhook's URL to the expected "discord.com" results in a valid configuration.

I am not sure if, at one point in time, Discord used "discord.com" instead of "discordapp.com" for webhook URLs or if this was a typo.

Trimming both "https://discord.com/api/webhooks/" and "https://discordapp.com/api/webhooks/" from the discordTokens variable seems like an easy solution that would not break existing configurations and also allow pasting webhook URLs copied directly from Discord.

Multi-time support for exsiting webhooks

Currently, notify doesn't support reusing the same webhook multiple time with different keys/tokens.

For example, if we have the following entry in the config file:-

discord_webhook_url: https://discord.com/api/webhooks/7730624177430/XXXX
discord_username: A
discord: true

discord_webhook_url: https://discord.com/api/webhooks/77306241774308/YYYY
discord_username: B
discord: true

Notify will only post to 2nd discord_webhook_url and the same goes for any other webhook, slack, telegram.

With this support -

For the cases when we want to post the same results on multiple servers/channels, we can simply define the webhook multiple times in config with different values to achieve this.

Threading support for slack webook

This is a feature request.
A way to reply in a slack thread by providing a timestamp, a channel ID, and the Slack API Key in the command line.

Notify providers configuration

Similar to cloudlist, it would be better if we can separate providers config details from the default goflag based config for flags.

Providers are a list of services/platforms we support with notify to push notifications.

  • Slack
  • Discord
  • Telegram
  • Pushover
  • Email
  • Custom

This addition will also separate provider-related flags from default CLI as it is moved under the config file and will be directly configured under that file.

As default, providers.yaml will be used for providers configuration file and a custom config file can be used with -provider-config flag.

Custom config file input support

As of now, the default config is used to read inputs, with the support of the config flag one can provide custom config as well.

[Idea] Telegram support

Congratz team for sharing this tool with community and help us =)
May are u planning on future to add telegram support on conf file?

Notify taking time to send output in Slack

Hi Team,

I have a one query, I configured all the settings in the config file for slack. I received the response in the slack but it will take some time..

if i need subdomain for particular domain, so i used the command - subfinder -d bugpoc.com | notify - it send one subdomain in 5 sec then another subdomain sending in 10 sec. If i send directly subfinder -d bugpoc.com then it will take around 2 sec to fetch all subdomains and even i used slackcat subfinder -d bugpoc.com | slackcat for this it will send all subdomain in one shot within 2 sec but in notify it will take too much time. Can you please help?

PFB Screenshot
image

Notify doesn't work with telegram+collaborator

This works perfect since I can see a "x" message in my telegram bot.

echo x | notify -telegram -telegram-api-key XXXX -telegram-chat-id XXXX

This also works fine since I see the burp collaborator interactions.

notify -biid 'XXXXXXXXXXXXXXXXXXXXXXXXXX'

But this doesn't work since I don't see any burp collaborator interaction in my telegram bot.

notify -biid 'XXXXXXXXXXXXXXXXXXXXXXXXXX' -telegram -telegram-api-key XXXX -telegram-chat-id XXXX

Optional support to push bulk data using file instead of per line

  • Hey there, Is there an option on notify to not return results line by line over there on the discord webhooks? I'm using notify on my discord bot to make things faster over there, but it's really not good when notify keep sending a lot of messages based on the command lines that keeps spamming the server users with a lot of notifications. if there's no option it will be really great if you gonna do something about it.

Adding support for posting data to custom webhook URL

Suggested by Roni (on discord)

Example config:-

custom:
  - id: webhook
    custom_webook_url: http://0.0.0.0/api/webhook
    custom_method: GET
    custom_format: '{{data}}'
    custom_headers:
      Content-Type: application/json
      X-Api-Key: XXXXX

File read support

Notify used for redirecting output data from multiple tools to multiple platforms, and most of the time STDOUT data is used as input to pass the data to notify, but for the cases, where you have an output file that you want to read and post it somewhere else, we need to use cat or anything similar.

It can still be done with cat but currently, there is no support to notify to directly read the file.

Proposed solution:-

Introduce data flag that accepts a file as input to post further on configured platforms.

notify -data subdomains.txt

Example use case:- https://github.com/projectdiscovery/pd-actions/blob/ec3c86125256dbcbfaf1b2d7a8e681e283f5a86f/.github/workflows/pd-actions.yaml#L78

Rate Limit treatment

It would be nice for notify to automatically detect when it is being blocked and implement a exponential backoff system where it keeps retrying to send messages in exponentially greater delays.
Example:

notify -> 429
sleep 2 seconds
notify -> 429
sleep 4 seconds
notify -> 429
sleep 8 seconds
notify -> 429
sleep 16 seconds
notify -> 200
leave program

Error while running notify after installing.

I am root user but still I am getting this
[FTL] Could not create runner: could not open provider config file: open /home/user/.config/notify/provider-config.yaml: no such file or directory.

Notify version: latest i.e. 1.0.1

Steps To Reproduce:

Example: steps to reproduce the behavior:

  1. Run 'notify ..'
  2. See error...

Issue with CLI input precedence

The expected behavior is that notify will read the config file if defined, otherwise takes input from CLI flag.

Issue:-

When the config file is configured and CLI flag is also provided, CLI flag should take precedence which is not happening currently, as a result, CLI flags can't be used if the same provided is defined in the config file.

Expected behavior:-

  • Read the config file as default
  • CLI flag takes precedence over config if specified.

[ERR] bulk flag is not supported with stdin

use notify with github action

      - name: Notify Reports
        run: |
          for file in output/vul-${{ steps.date.outputs.date }}/nuclei/* ; do notify -provider-config config/provider-config.yaml -bulk -id dd -data $file; done
        shell: bash



Run for file in output/vul-20210908-0530/nuclei/* ; do notify -provider-config config/provider-config.yaml -bulk -id dd -data $file; done

             __  _ ___    
  ___  ___  / /_(_) _/_ __
 / _ \/ _ \/ __/ / _/ // /
/_//_/\___/\__/_/_/ \_, / v1.0.0
                   /___/  

		projectdiscovery.io

Use with caution. You are responsible for your actions
Developers assume no liability and are not responsible for any misuse or damage.
[ERR] bulk flag is not supported with stdin
Error: Process completed with exit code 1.

i've been tested on terminal , everything is fine

image

but github action got [ERR] bulk flag is not supported with stdin

Updating profiles with ids

We added profile field support in the config file and profile flag to use any specific profile instead of all providers at once.

Example:-

notify -profile recon_subfinder
discord:
  - profile: recon_subfinder
    discord_webhook_url: https://discord.com/api/webhooks/XX/XX
    discord_username: test
    discord_channel: notify-test

We can update the profile with id to improve the UX and simple to use.

After change:-

notify -id recon,hack
discord:
  - id: recon
    discord_webhook_url: https://discord.com/api/webhooks/XX/XX
    discord_username: test
    discord_channel: notify-test
    
  - id: hack
    discord_webhook_url: https://discord.com/api/webhooks/XX/XX
    discord_username: hack
    discord_channel: hack-test

not able to install intercept

sddddd@hacker:~$ go get -u -v github.com/projectdiscovery/notify/cmd/intercept
github.com/projectdiscovery/notify (download)
github.com/projectdiscovery/collaborator (download)
github.com/google/gopacket (download)
github.com/projectdiscovery/gologger (download)
github.com/logrusorgru/aurora (download)
github.com/google/gopacket/pcap

github.com/google/gopacket/pcap

go/src/github.com/google/gopacket/pcap/pcap_unix.go:34:10: fatal error: pcap.h: No such file or directory
34 | #include <pcap.h>
| ^~~~~~~~
compilation terminated.

telegram notification drops message containing the word "Hourly"

A bit weird issue here on version 0.0.2

echo Hourly | notify -telegram -telegram-api-key <API>-telegram-chat-id <ID>

Would work as expected sending the message to telegram, but

echo something Hourly | notify -telegram -telegram-api-key <API>-telegram-chat-id <ID>

Does not send anything to telegram. Not sure if this a telegram issue or notify itself.

notify conf isnt loading

hi team ,
i had been running as a root and i cameup with this error

Running as root, skipping config file write to avoid permissions issues: /root/.config/notify/notify.conf
Could not read configuration file /root/.config/notify/notify.conf - ignoring error: open /root/.config/notify/notify.conf: no such file or directory

Bug in sending notification to multiple instances of same provider

Using the following config with two unique discord_webhook_url

discord:
  - id: test1
    discord_webhook_url: https://discord.com/api/webhooks/XXX
    discord_username: test
    discord_channel: notify-test
    discord_format: '{{data}}'
  - id: test2
    discord_webhook_url: https://discord.com/api/webhooks/YYY
    discord_username: test2
    discord_channel: notify-test2
    discord_format: '{{data}}'

Used cmd:-

notify -bulk -data test.txt
notify -bulk -data test.txt -id test1,test2

In both cases, it is expected that notification will be sent to both webhooks which is not happening, same with other providers as well.

This is related to #43

Allow setting the Subject for SMTP provider

Is it currently possible to set the subject of e-mail being sent by the SMTP provider?
If no, can this be implemented? It would allow notification to be easily distinguishable, instead of having to open them up to see what they are about.

Blank text in discord

HI Im using discord webhook integration but observing blank texts while using notify.

config:

discord:
  - id: "asd"
    discord_channel: "#general"
    discord_username: "Alerts"
    discord_format: "{{data}}"
    discord_webhook_url: "https://discord.com/api/webhooks/XXXXXX"

Screenshot 2021-08-27 at 2 21 32 AM

Getting blank texts

Data format customization with CLI and Config file

Description:-

Notify supports, multiple providers to push data and all have different UX/UI based on the format of the msg, so it's always a good idea to have control over the format around data to make it easily viewable in markdown or any format that a specific provider supports.

As default, notify doesn't add or should not add any formatting to the data and push it as it is, additionally we can have support for custom formatting via flag and config file.

CLI flag: msg-format

CLI example:-

notify -msg-format '`{{data}}`'

Config support:-

$provider_format: '{{data}}'

Config example:-

discord:
  - profile: test1
    discord_webhook_url: https://discord.com/api/webhooks/XX/XX
    discord_username: test
    discord_channel: notify-test
    discord_format: '{{data}}' # default format
    
discord:
  - profile: test2
    slack_webhook_url: https://xxxx/xxx
    slack_username: test
    slack_channel: notify-test
    slack_format: '`{{data}}`' # custom format
    
telegram:
  - profile: test
    telegram_apikey: xxxx
    telegram_chat_id: xxxx
    telegram_format: | # custom format
    		```
    		{{data}}
    		```

This support is optional, as data formatting is disabled as default, if enabled using CLI, CLI flag format will be applied to all providers regardless of the format defined in the config, otherwise, each provider can be formatted differently if specified and used with the config file.

Issue with Burp notification on Telegram.

Hi team,
It's amazing to see the notification on Telegram/Discord when a tool finds a bug. I appreciate your work.
When I run the command on Linux ' echo "Working" | notify' it sends the notification to both Telegram/Discord, but when I run 'notify' it sends the notification to Discord only. I am not getting Burp Collabrator interaction on my Telegram whereas I get above on Discord.

Is this the functionality of notify or am I missing something? Please suggest on above.

Best Regards

smtp send messages fail

failed to send smtp notification for id: email : error authenticating: unencrypted connection

Notify config file isn't loading

Hello guys,

I am using a fully updated kali Linux on a VPS.
Notify Version: 0.0.2

As i installed notify and runt it as root, i got this message:

Running as root, skipping config file write to avoid permissions issues: /root/.config/notify/notify.conf
Could not read configuration file /root/.config/notify/notify.conf - ignoring error: open /root/.config/notify/noti
fy.conf: no such file or directory

Then proceeded to run it as a normal user
and i got this message:

Found existing config file: /home/user/.config/notify/notify.conf
Could not read configuration file /home/user/.config/notify/notify.conf - ignoring error: EOF

I edited the .config file with my webhook and also removed the comment from discord: true
Then i copied the notify.conf from the /home/user/.config/notify directory to the root directory: /root/.config/notify/ (because it was missing from the root directory)

And run it again.
The message i got is this one:

Found existing config file: /root/.config/notify/notify.conf
Could not read configuration file /root/.config/notify/notify.conf - ignoring error: yaml: line 8: did not find expected key

After that i tried again with the normal user and it WORKED.
But running it as root causes the error i mentioned above.

what is the problem and it cannot read the configuration file when running it as root?

Notify doesn't post to discord with webhook.

`

Slack

slack: false
slack_webhook_url: https://a.b.c
slack_username: test
slack_channel: test

Discord

discord: true
discord_webhook_url: https://discordapp.com/api/webhooks/774399247235022920/QiMD_xhcM5YPDvk2ZI0pien8GpZy8tPnTXAZWwxl8BnAv1GBP2yYc-3SMIZM6FYSKm6C
discord_username: tides
discord_avatar: https://a.b.c/avatar

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}}
`

Located in ~/.config/notify/notify.conf not too sure what im doing wrong!

WINDOWS ERROR

[←[1;31mFTL←[0m] The program is not running as root and unable to access raw sockets

Running nuclei with sudo gives command not found

Hi,

I am running notify's latest version (just fetched today), if I run notify simply using notify it works well but if I type sudo notify it says command is not found!

I have other project discovery tools installed as well e.g nuclei, httpx etc and they dont behave this way they works well both with and without sudo.

[FTL] Could not create runner

Hey There,
I cant find provider-config.yaml file in .config/notify/config.yaml

             __  _ ___
  ___  ___  / /_(_) _/_ __
 / _ \/ _ \/ __/ / _/ // /
/_//_/\___/\__/_/_/ \_, / v1.0.1
                   /___/

                projectdiscovery.io
Use with caution. You are responsible for your actions
Developers assume no liability and are not responsible for any misuse or damage.
Using default provider config: /home/littleboy_pugazh/.config/notify/provider-config.yaml
[FTL] Could not create runner: could not open provider config file: open /home/littleboy_pugazh/.config/notify/provider-config.yaml: no such file or directory

Any Solution?

Cronjob not running the latest version of notify

Hi,

I was using notify version 0.0.2 on my ubuntu machine, when I realized that this version does not have -bulk flag support so I again ran the go install command that is given on readme file to install the latest version.

Now the issue is, when I run notify using my terminal myself it shows that the version is 1.0.0 and the bulk command is working fine but when I run the same command through cronjob it throws the error.

I checked the version ran by the cronjob by running notify -version through cron and it returned version 0.0.2.

Somehow, cron isnt able to fetch the latest notify version.

Why is it so and whats the solution?

--discord-webhook-url argument doesn't seem to be working.

I dunno if i'm wrong or not. but i want to use notify for multi tasks on my discord server. so i guessed --discord-webhook-url argument could be used to set two different webhooks on every command. but when i add the webhook URL as an argument value. the result keep getting sent into the webhook on notify config itself.

I deleted the config and tried again, and nothing happens all that happens there is that notify keeps telling me that the config file doesn't exists.

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.