This repository was archived by the owner on Jul 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathmain.py
More file actions
45 lines (37 loc) · 1.25 KB
/
main.py
File metadata and controls
45 lines (37 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
import logging
from securitybot.bot import SecurityBot
from securitybot.chat.slack import Slack
from securitybot.tasker.sql_tasker import SQLTasker
from securitybot.auth.duo import DuoAuth
from securitybot.sql import init_sql
import duo_client
CONFIG = {}
SLACK_KEY = 'slack_api_token'
DUO_INTEGRATION = 'duo_integration_key'
DUO_SECRET = 'duo_secret_key'
DUO_ENDPOINT = 'duo_endpoint'
REPORTING_CHANNEL = 'some_slack_channel_id'
ICON_URL = 'https://dl.dropboxusercontent.com/s/t01pwfrqzbz3gzu/securitybot.png'
def init():
# Setup logging
logging.basicConfig(level=logging.DEBUG,
format='[%(asctime)s %(levelname)s] %(message)s')
logging.getLogger('requests').setLevel(logging.WARNING)
logging.getLogger('usllib3').setLevel(logging.WARNING)
def main():
init()
init_sql()
# Create components needed for Securitybot
duo_api = duo_client.Auth(
ikey=DUO_INTEGRATION,
skey=DUO_SECRET,
host=DUO_ENDPOINT
)
duo_builder = lambda name: DuoAuth(duo_api, name)
chat = Slack('securitybot', SLACK_KEY, ICON_URL)
tasker = SQLTasker()
sb = SecurityBot(chat, tasker, duo_builder, REPORTING_CHANNEL, 'config/bot.yaml')
sb.run()
if __name__ == '__main__':
main()