forked from syndbg/ssh-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
27 lines (20 loc) · 746 Bytes
/
main.py
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
import sys
from twisted.internet import reactor
from twisted.cred import portal
from twisted.python import log
from protocol import ChatProtocolFactory
from checkers import PublicKeyCreditentialsChecker, AllowAnnomyousKeysChecker
from realm import ChatRealm
from helpers import get_RSA_keys
if __name__ == '__main__':
log.startLogging(sys.stdout)
factory = ChatProtocolFactory()
realm = ChatRealm()
factory.portal = portal.Portal(realm)
checker = AllowAnnomyousKeysChecker()
factory.portal.registerChecker(checker)
public_key, private_key = get_RSA_keys()
factory.publicKeys = {'ssh-rsa': public_key}
factory.privateKeys = {'ssh-rsa': private_key}
reactor.listenTCP(2222, factory)
reactor.run()