Exemplo n.º 1
0
        private static void HostSubscribeService()
        {
            subscribeServiceHost = new ServiceHost(typeof(SubscriberService));

            subscribeServiceHost.AddServiceEndpoint(typeof(ISubscriber), NetTcpBindingCreator.Create(), "net.tcp://localhost:7020/SubscribeService");
            subscribeServiceHost.Open();
        }
Exemplo n.º 2
0
        private void InitializeHosts()
        {
            hosts = new List <ServiceHost>();

            // service for handlling client requests
            ServiceHost invokerhost = new ServiceHost(typeof(Invoker));

            invokerhost.Description.Name = "SCADAInvokerservice";
            invokerhost.AddServiceEndpoint(typeof(ISCADAContract),
                                           NetTcpBindingCreator.Create(),
                                           new Uri("net.tcp://localhost:4000/SCADAService"));
            hosts.Add(invokerhost);

            // 2PC transaction service
            ServiceHost transactionServiceHost = new ServiceHost(typeof(SCADATransactionService));

            transactionServiceHost.Description.Name = "SCADATransactionService";
            transactionServiceHost.AddServiceEndpoint(typeof(ITransactionSCADA),
                                                      NetTcpBindingCreator.Create(),
                                                      new Uri("net.tcp://localhost:4001/SCADATransactionService"));

            transactionServiceHost.Description.Behaviors.Remove(typeof(ServiceDebugBehavior));
            transactionServiceHost.Description.Behaviors.Add(new ServiceDebugBehavior()
            {
                IncludeExceptionDetailInFaults = true
            });

            hosts.Add(transactionServiceHost);
        }
        public MainShellViewModel()
        {
            TopMenu = new ObservableCollection <UserControl>();
            TopMenu.Add(new TopMenu());

            subscriber       = new Subscriber();
            mITMServiceProxy = new MITMServiceProxy(NetTcpBindingCreator.Create());

            try
            {
                subscriber.Subscribe();
            }
            catch (Exception e) { }

            subscriber.publishConnectionInfoEvent    += ConnectionInfoChanged;
            subscriber.publishAnalogInputChangeEvent += AnalogInputChanged;

            ConnectionInfoChanged(mITMServiceProxy.GetConnectionInfo());

            ARPSpoofParticipantsInfo aRPSpoofParticipantsInfo = mITMServiceProxy.GetARPSpoofParticipants(out bool isAttack);

            if (isAttack)
            {
                lock (Database.lockObject)
                {
                    Database.ARPSpoofParticipantsInfo = aRPSpoofParticipantsInfo;
                    Database.IsAttack = true;
                }
            }
        }
Exemplo n.º 4
0
        private static void HostPublishService()
        {
            publishServiceHost = new ServiceHost(typeof(PublishService));

            publishServiceHost.AddServiceEndpoint(typeof(IPublisher), NetTcpBindingCreator.Create(), "net.tcp://localhost:7021/PublishService");
            publishServiceHost.Open();
        }
Exemplo n.º 5
0
        public void Start()
        {
            svc = new ServiceHost(typeof(MITM_Service));

            svc.AddServiceEndpoint(typeof(IMITM_Contract), NetTcpBindingCreator.Create(), new Uri("net.tcp://localhost:7023/MITM_Service"));

            svc.Open();
            Console.WriteLine("MITM Service ready and waiting for requests.");
        }
        public DNP3ExtensionViewModel()
        {
            Position          = ShellPosition.CENTER;
            AnalogInputPoints = new ObservableCollection <AnalogInputPoint>();
            mITMServiceProxy  = new MITMServiceProxy(NetTcpBindingCreator.Create());

            foreach (AnalogInputPoint analog in Database.AnalogInputPoints.Values)
            {
                AnalogInputPoints.Add(analog);
            }
        }
Exemplo n.º 7
0
        public ARPSpoofViewModel()
        {
            mITMServiceProxy = new MITMServiceProxy(NetTcpBindingCreator.Create());

            hostsList   = new ObservableCollection <Host>();
            hosts       = new Dictionary <string, Host>();
            hostsIPends = new List <byte>();

            target1 = string.Empty;
            target2 = string.Empty;

            CheckIfAttack();
        }
Exemplo n.º 8
0
        public void Start()
        {
            svc = new ServiceHost(typeof(ClientNMSService));
            svc.AddServiceEndpoint(typeof(IClientNMS), NetTcpBindingCreator.Create(), new Uri("net.tcp://localhost:7002/ClientNMSService"));

            svc.Description.Behaviors.Remove(typeof(ServiceDebugBehavior));
            svc.Description.Behaviors.Add(new ServiceDebugBehavior()
            {
                IncludeExceptionDetailInFaults = true
            });

            svc.Open();
            Console.WriteLine("ClientNMSService ready and waiting for requests.");
        }
Exemplo n.º 9
0
        public void Start()
        {
            //Database.SetInitializer<IncidentContext>(new DropCreateDatabaseIfModelChanges<IncidentContext>());

            LoadCrews();

            svc = new ServiceHost(typeof(IMSService));
            svc.AddServiceEndpoint(typeof(IIMSContract),
                                   NetTcpBindingCreator.Create(),
                                   new Uri("net.tcp://localhost:6000/IMSService"));

            svc.Open();
            Console.WriteLine("IMSService ready and waiting for requests.");
        }
Exemplo n.º 10
0
        private void CreateProxy()
        {
            string address = "";

            try
            {
                address = "net.tcp://localhost:7021/PublishService";
                EndpointAddress endpointAddress = new EndpointAddress(address);
                proxy = ChannelFactory <IPublisher> .CreateChannel(NetTcpBindingCreator.Create(), endpointAddress);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 11
0
        private void CreateProxy()
        {
            string address = "";

            try
            {
                address = "net.tcp://localhost:3001/Pub";
                EndpointAddress endpointAddress = new EndpointAddress(address);
                proxy = ChannelFactory <IPublishing> .CreateChannel(NetTcpBindingCreator.Create(), endpointAddress);
            }
            catch (Exception e)
            {
                throw e;
                //TODO log error;
            }
        }
Exemplo n.º 12
0
 public ClientNMSProxy() : base(NetTcpBindingCreator.Create(), new EndpointAddress("net.tcp://localhost:7002/ClientNMSService"))
 {
 }
Exemplo n.º 13
0
 public DMSProxy() : base(NetTcpBindingCreator.Create(), new EndpointAddress("net.tcp://localhost:5000/DMSService"))
 {
 }
Exemplo n.º 14
0
 private void CreateProxy()
 {
     try
     {
         EndpointAddress endpointAddress = new EndpointAddress("net.tcp://localhost:3002/Sub");
         InstanceContext callback        = new InstanceContext(this);
         DuplexChannelFactory <ISubscription> channelFactory = new DuplexChannelFactory <ISubscription>(callback, NetTcpBindingCreator.Create(), endpointAddress);
         subscriptionProxy = channelFactory.CreateChannel();
     }
     catch (Exception e)
     {
         throw e;
         //TODO  Log error : PubSub not started
     }
 }
        private void CreateChannel()
        {
            ChannelFactory <IOMSClient> factoryToOMS = new ChannelFactory <IOMSClient>(NetTcpBindingCreator.Create(),
                                                                                       new EndpointAddress("net.tcp://localhost:6080/TransactionManagerService"));

            ProxyToOMS = factoryToOMS.CreateChannel();
        }
Exemplo n.º 16
0
 public SCADAProxy() : base(NetTcpBindingCreator.Create(), new EndpointAddress("net.tcp://localhost:4000/SCADAService"))
 {
 }
Exemplo n.º 17
0
 private void CreateProxy()
 {
     try
     {
         EndpointAddress endpointAddress = new EndpointAddress("net.tcp://localhost:7020/SubscribeService");
         InstanceContext callback        = new InstanceContext(this);
         DuplexChannelFactory <ISubscriber> channelFactory = new DuplexChannelFactory <ISubscriber>(callback, NetTcpBindingCreator.Create(), endpointAddress);
         proxy = channelFactory.CreateChannel();
     }
     catch (Exception e)
     {
         throw e;
     }
 }