Skip to content

Commit

Permalink
Updated Readme with additional information.
Browse files Browse the repository at this point in the history
Log error if response code is equal or above 400.
  • Loading branch information
dubsec committed Jan 25, 2021
1 parent fa2276a commit b0c09c1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Options:
Examples:
emissary -telegram --message "Hello telegram"
cat domins.txt | emissary --slack --stdin
emissary --channel Discord -m "It works!!!"
```

**Create ~/.config/emissary.ini with the following:**
Expand All @@ -58,11 +59,32 @@ server=smtp.gmail.com
port=587
subject="New domains found!"
```

*When using gmail, you need to activate less secure apps on your account: [https://myaccount.google.com/lesssecureapps](https://myaccount.google.com/lesssecureapps)*

Now you can start using emissary :)


**Custom Webhooks**

It's possible to add your own channels as well, adding Discord as a custom channel looks like this:

```
[Discord]
webhook=https://discord.com/api/webhooks/xxxxxxxxxxxxxxxxxxxxxxxxxx
textField=content
```

And can be executed with `emissary --channel Discord -m "It works!!!"`.

The following fields can be used for a given channel:

| field | description |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| webhook | The actual webhook to send data to |
| textField | Some API's have a specific json key where the message goes, here you can define that. Default key is `text`, e.g. `{"text": "Your message"}`. |
| data | If you want to send additional data, you can specify that here as a json formatted string, e.g. `data={"someKey": "someValue", "otherKey": "otherValue"}`. |


**Pipe data via stdin:**
```
$ cat domains.txt | emissary --telegram --stdin
Expand All @@ -88,17 +110,7 @@ $ cat domains.txt | emissary -t -si --rows 10
$ cat domains.txt | emissary -t -si -r 0
```

Right now the Emissary will only deliver 20 rows, to protect against accidentally sending a gazillion domains :)

## Todo
Some stuff that I plan to implement:
- [X] Slack
- [X] Telegram
- [X] Microsoft Teams
- [ ] Discord
- [X] Email
- [X] Let user decide max rows to be sent
- [X] Place config file in ~/.config/emissary.ini
Emissary will only send 20 rows by default, this is to protect against accidentally sending a gazillion domains :) It can be overwritten with `--rows 0` which means unlimited rows.

## Contributing
Any feedback or ideas are welcome! Want to improve something? Create a pull request!
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

func checkResponse(httpResponse *http.Response, err error) {
if httpResponse != nil {
if httpResponse.StatusCode > 201 {
if httpResponse.StatusCode >= 400 {
body, respErr := ioutil.ReadAll(httpResponse.Body)
if respErr != nil {
log.Println("Error reading response body:", respErr)
Expand Down

0 comments on commit b0c09c1

Please sign in to comment.