Answer the question
In order to leave comments, you need to log in
How to send the result of the script to the slack chat?
There is a script that scans and displays open ports:
import nmap
import requests
import json
nmScan = nmap.PortScanner()
nmScan.scan('127.0.0.1', '21-2000')
for host in nmScan.all_hosts():
print('Host : %s (%s)' % (host, nmScan[host].hostname()))
print('State : %s' % nmScan[host].state())
for proto in nmScan[host].all_protocols():
print('----------')
print('Protocol : %s' % proto)
lport = nmScan[host][proto].keys()
sorted(lport)
for port in lport:
print ('port : %s\tstate : %s' % (port, nmScan[host][proto][port]['state']))
Answer the question
In order to leave comments, you need to log in
Create a new application in Slack: https://api.slack.com/apps/new
Link it to your workspace
Select Incoming Webhooks
https://api.slack.com/apps/%APPID%/incoming-webhooks
Add New Webhook to Workspace
, bind the webhook to the desired channel Send import requests
data = {'text': 'TARGET: target.com\nports: 8080, 443'}
requests.post(WEBHOOK_URL, json=data)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question