forked from thinkst/canarytokens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitchboard.tac
95 lines (79 loc) · 3.94 KB
/
switchboard.tac
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import sys, os
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
from twisted.names import dns, server
from caa_monkeypatch import monkey_patch_caa_support
monkey_patch_caa_support()
from twisted.application import service, internet
from loghandlers import webhookLogObserver
from twisted.logger import ILogObserver, textFileLogObserver, globalLogPublisher
from twisted.python import logfile
from twisted.logger import Logger
log = Logger()
import settings
from channel_dns import DNSServerFactory, ChannelDNS
from channel_http import ChannelHTTP
from channel_input_imgur import ChannelImgur
from channel_input_linkedin import ChannelLinkedIn
from channel_input_bitcoin import ChannelBitcoin
from channel_input_smtp import ChannelSMTP
from channel_input_mtls import ChannelKubeConfig
from channel_input_mysql import ChannelMySQL
from channel_input_wireguard import ChannelWireGuard
from channel_output_email import EmailOutputChannel
from channel_output_twilio import TwilioOutputChannel
from channel_output_webhook import WebhookOutputChannel
from switchboard import Switchboard
from queries import update_tor_exit_nodes_loop
application = service.Application("Canarydrops Switchboard")
f = logfile.LogFile.fromFullPath(settings.LOG_FILE, rotateLength=settings.SWITCHBOARD_LOG_SIZE,
maxRotatedFiles=settings.SWITCHBOARD_LOG_COUNT)
globalLogPublisher.addObserver(textFileLogObserver(f))
if getattr(settings, 'ERROR_LOG_WEBHOOK', None):
# Only create this log observer if the config is setup for it.
globalLogPublisher.addObserver(webhookLogObserver())
switchboard = Switchboard()
# email_output_channel = EmailOutputChannel(switchboard=switchboard)
# twilio_output_channel = TwilioOutputChannel(switchboard=switchboard)
# webhook_output_channel = WebhookOutputChannel(switchboard=switchboard)
# dns_service = service.MultiService()
#
# factory = DNSServerFactory(
# clients=[ChannelDNS(listen_domain=settings.LISTEN_DOMAIN,
# switchboard=switchboard)]
# )
# udp_factory = dns.DNSDatagramProtocol(factory)
# internet.TCPServer(settings.CHANNEL_DNS_PORT, factory)\
# .setServiceParent(dns_service)
# internet.UDPServer(settings.CHANNEL_DNS_PORT, udp_factory)\
# .setServiceParent(dns_service)
# dns_service.setServiceParent(application)
canarytokens_httpd = ChannelHTTP(port=settings.CHANNEL_HTTP_PORT,
switchboard=switchboard)
canarytokens_httpd.service.setServiceParent(application)
# canarytokens_imgur = ChannelImgur(min_delay=settings.CHANNEL_IMGUR_MIN_DELAY,
# switchboard=switchboard)
# canarytokens_imgur.service.setServiceParent(application)
#
# canarytokens_linkedin = ChannelLinkedIn(min_delay=settings.CHANNEL_LINKEDIN_MIN_DELAY,
# switchboard=switchboard)
# canarytokens_linkedin.service.setServiceParent(application)
#
# canarytokens_bitcoin = ChannelBitcoin(min_delay=settings.CHANNEL_BITCOIN_MIN_DELAY,
# switchboard=switchboard)
# canarytokens_bitcoin.service.setServiceParent(application)
#
# canarytokens_smtp = ChannelSMTP(port=settings.CHANNEL_SMTP_PORT,
# switchboard=switchboard)
# canarytokens_smtp.service.setServiceParent(application)
# canarytokens_kubeconfig=ChannelKubeConfig(port=settings.CHANNEL_MTLS_KUBECONFIG_PORT, ip=settings.PUBLIC_IP,
# switchboard=switchboard)
# canarytokens_kubeconfig.service.setServiceParent(application)
# canarytokens_mysql = ChannelMySQL(port=settings.CHANNEL_MYSQL_PORT,
# switchboard=switchboard)
# canarytokens_mysql.service.setServiceParent(application)
#
# canarytokens_wireguard = ChannelWireGuard(switchboard=switchboard)
# canarytokens_wireguard.service.setServiceParent(application)
#loop to update tor exit nodes every 30 min
loop_http = internet.task.LoopingCall(update_tor_exit_nodes_loop)
loop_http.start(1800)