hanc00l / nemo_go

Nemo是用来进行自动化信息收集的一个简单平台,通过集成常用的信息收集工具和技术,实现对内网及互联网资产信息的自动收集,提高隐患排查和渗透测试的工作效率。
Apache License 2.0
1.63k stars 245 forks source link

任务消息通知,能否增加tg机器人通知 #153

Closed pythonSB closed 6 months ago

pythonSB commented 6 months ago

任务消息通知,能否增加tg机器人通知

hanc00l commented 6 months ago

可以的。有好用的telegram的go代码或库可以推荐一下,下一次加到nemo里。

pythonSB commented 6 months ago

https://github.com/go-telegram-bot-api/telegram-bot-api

package main

import ( "log"

tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"

)

func main() { bot, err := tgbotapi.NewBotAPI("YOUR_BOT_TOKEN") if err != nil { log.Panic(err) }

bot.Debug = true

log.Printf("Authorized on account %s", bot.Self.UserName)

u := tgbotapi.NewUpdate(0)
u.Timeout = 60

updates, err := bot.GetUpdatesChan(u)

for update := range updates {
    if update.Message == nil { // ignore any non-Message Updates
        continue
    }

    log.Printf("[%s] %s", update.Message.From.UserName, update.Message.Text)

    msg := tgbotapi.NewMessage(update.Message.Chat.ID, update.Message.Text)
    msg.ReplyToMessageID = update.Message.MessageID

    bot.Send(msg)
}

} 提供参考。希望注重一下,资产的管理和关联,将杂乱的ip资产和域名资产进行关联

hanc00l commented 2 months ago

任务消息通知,能否增加tg机器人通知

考虑到目前tg在国内的应用受到一些限制,本人以前的tg因多年没用也无法使用和测试了,暂不考虑增加tg了。如果确实有需求建议自行fork代码后增加相应的功能。

实在抱歉。