상속: Subject
예제 #1
0
    public static void Main(string[] args)
    {
        // configure the proxy
        client = new SecondLife("../data/keywords.txt", "../data/message_template.msg");
        protocolManager = client.Protocol;
        ProxyConfig proxyConfig = new ProxyConfig("Analyst", "*****@*****.**", protocolManager, args);
        proxy = new Proxy(proxyConfig);

        // build the table of /command delegates
        InitializeCommandDelegates();

        // add delegates for login
        proxy.SetLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest));
        proxy.SetLoginResponseDelegate(new XmlRpcResponseDelegate(LoginResponse));

        // add a delegate for outgoing chat
        proxy.AddDelegate("ChatFromViewer", Direction.Incoming, new PacketDelegate(ChatFromViewerIn));
        proxy.AddDelegate("ChatFromViewer", Direction.Outgoing, new PacketDelegate(ChatFromViewerOut));

        //  handle command line arguments
        foreach (string arg in args)
            if (arg == "--log-all")
                LogAll();
            else if (arg == "--log-login")
                logLogin = true;

        // start the proxy
        proxy.Start();
    }
 public ProxyThread(String urlTemplate, BlockingCollection<Int32> jobs, int jobInterval, Proxy proxy)
 {
     this.urlTemplate = urlTemplate;
     this.proxy = proxy;
     this.jobs = jobs;
     this.jobInterval = jobInterval;
 }
예제 #3
0
파일: AwesomeSauce.cs 프로젝트: zadark/par
        public AwesomeSauce(PubComb p)
        {
            plugin = p;
            currentRegion = UUID.Zero.GetULong();
            form = new AweseomeSauceForm1(this);
            this.frame = p.frame;
            this.proxy = frame.proxy;
            //this.proxy.AddDelegate(PacketType.ScriptDialogReply, Direction.Outgoing, new PacketDelegate(OutDialogFromViewer));
            //this.proxy.AddDelegate(PacketType.ChatFromViewer, Direction.Outgoing, new PacketDelegate(OutChatFromViewerHandler));
            //this.proxy.AddDelegate(PacketType.ImprovedInstantMessage, Direction.Outgoing, new PacketDelegate(SendingIM));
            this.proxy.AddDelegate(PacketType.AssetUploadRequest, Direction.Outgoing, new PacketDelegate(TryToSendAsset));
            this.proxy.AddDelegate(PacketType.ConfirmXferPacket, Direction.Incoming, new PacketDelegate(InConfirmXferPacketHandler));
            this.proxy.AddDelegate(PacketType.RequestXfer, Direction.Incoming, new PacketDelegate(ServerRequestsMyDataToStart));
            this.proxy.AddDelegate(PacketType.SendXferPacket, Direction.Outgoing, new PacketDelegate(ClientSentThisScript));
            this.proxy.AddDelegate(PacketType.TransferPacket, Direction.Incoming, new PacketDelegate(LoadingUpNewScript));
            this.proxy.AddDelegate(PacketType.TransferInfo, Direction.Incoming, new PacketDelegate(SimWantsToSendUs));
            //this.proxy.AddDelegate(PacketType.ReplyTaskInventory, Direction.Incoming, new PacketDelegate(ReplyTask));
            //this.proxy.AddDelegate(PacketType.TransferRequest, Direction.Outgoing, new PacketDelegate(TrasferReq));
            //this.proxy.AddCapsDelegate("UpdateScriptTask", new CapsDelegate(UploadStart));
            //this.proxy.AddCapsDelegate("UpdateScriptAgent", new CapsDelegate(UploadStart));

            //if (!Directory.Exists("(You can Delete me) Expired Scripts Cache"))
            //Directory.CreateDirectory("(You can Delete me) Expired Scripts Cache");

            if (!Directory.Exists("Scripts Cache"))
            {
                Directory.CreateDirectory("Scripts Cache");
            }

                       // File.Move("./" + f, "./Old Particle Scripts/" + DateTime.Now.Date.Month.ToString() + "-" + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Year.ToString() +
                       //     " - " + DateTime.Now.TimeOfDay.TotalSeconds.ToString() + "@" + f.Substring(17));
        }
예제 #4
0
        public void Log(Packet packet, Proxy proxy)
        {
            if (packet.PacketContext == PacketContext.ServerToClient && !settings.LogServer)
                return;
            if (packet.PacketContext == PacketContext.ClientToServer && !settings.LogClient)
                return;
            if (settings.FilterPackets != null)
            {
                if (!settings.FilterPackets.Contains(packet.PacketId))
                    return;
            }
            if (settings.UnloggedPackets != null)
            {
                if (settings.FilterPackets.Contains(packet.PacketId))
                    return;
            }

            StringBuilder sb = new StringBuilder();
            if (packet.PacketContext == PacketContext.ClientToServer)
                sb.Append("{" + DateTime.Now.ToLongTimeString() + "} [CLIENT " + proxy.RemoteSocket.LocalEndPoint + "->SERVER]: ");
            else
                sb.Append("{" + DateTime.Now.ToLongTimeString() + "} [SERVER->CLIENT " + proxy.LocalSocket.RemoteEndPoint + "]: ");

            sb.Append(Packet.AddSpaces(packet.GetType().Name.Replace("Packet", "")));
            sb.AppendFormat(" (0x{0})", packet.PacketId.ToString("X2"));
            sb.AppendLine();
            sb.Append(DataUtility.DumpArrayPretty(packet.Payload));
            sb.AppendLine(packet.ToString(proxy));

            stream.Write(sb + Environment.NewLine);
        }
예제 #5
0
 public unsafe void AddProxyResult(ushort proxyId, Proxy proxy, int maxCount, SortKeyFunc sortKey)
 {
     float num = sortKey(proxy.UserData);
     if (num >= 0f)
     {
         fixed (float* ptr = this._querySortKeys)
         {
             float* ptr2 = ptr;
             while (*ptr2 < num && ptr2 < ptr + this._queryResultCount)
             {
                 ptr2 += 4 / 4;
             }
             //int num2 = ((int)ptr2 - ((int)ptr) / 4) / 4;
             int num2 = (int)((ulong)ptr2 - (ulong)ptr) / 4; // STEVE
             if (maxCount != this._queryResultCount || num2 != this._queryResultCount)
             {
                 if (maxCount == this._queryResultCount)
                 {
                     this._queryResultCount--;
                 }
                 for (int i = this._queryResultCount + 1; i > num2; i--)
                 {
                     this._querySortKeys[i] = this._querySortKeys[i - 1];
                     this._queryResults[i] = this._queryResults[i - 1];
                 }
                 this._querySortKeys[num2] = num;
                 this._queryResults[num2] = proxyId;
                 this._queryResultCount++;
                 //ptr = null;
             }
         }
     }
 }
        public frmSecondGlance()
        {
            InitializeComponent();

            PacketType[] types = (PacketType[])Enum.GetValues(typeof(PacketType));

            // Fill up the "To Log" combo box with options
            foreach (PacketType type in types)
            {
                if (type != PacketType.Default) cboToLog.Items.Add(type);
            }

            // Set the default selection to the first entry
            cboToLog.SelectedIndex = 0;

            // Setup the proxy
            ProxyConfig proxyConfig = new ProxyConfig("Second Glance", "John Hurliman <*****@*****.**>",
                new string[0]);
            Proxy = new Proxy(proxyConfig);

            Proxy.Start();

            // Start the timer that moves packets from the queue and displays them
            DisplayTimer.Elapsed += new System.Timers.ElapsedEventHandler(DisplayTimer_Elapsed);
            DisplayTimer.Start();
        }
예제 #7
0
  public static void Main( string[] args )
  {
    // Create proxy and request a service
    Proxy p = new Proxy();
    p.Request();

  }
예제 #8
0
        /// <summary>
        /// Get user profile implementation method
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="channels"></param>
        /// <param name="fbAccessToken"></param>
        /// <returns></returns>
        public ResponseList<Profile> getUserProfile(string userId, string channels, string fbAccessToken)
        {
            ResponseList<Profile> response = new ResponseList<Profile>();

            if (string.IsNullOrEmpty(userId))
            {
                response.error="Missing Param userId";
                return response;
            }

            if(string.IsNullOrEmpty(channels))
            {
                response.error = "Missing Param channels";
                return response;
            }
            try
            {
                Proxy proxy = new Proxy();
                response.data = proxy.getUserProfile(userId, channels, fbAccessToken);
            }
            catch(Exception ex)
            {
                response.error = ex.Message;
                return response;
            }

            return response;
        }
예제 #9
0
        private static bool PostAction(Proxy p, Server server, Action action)
        {
            var instance = p.Instance;
            // if we can't issue any commands, bomb out
            if (instance.AdminUser.IsNullOrEmpty() || instance.AdminPassword.IsNullOrEmpty()) return false;

            var loginInfo = $"{instance.AdminUser}:{instance.AdminPassword}";
            var haproxyUri = new Uri(instance.Url);
            var requestBody = $"s={server.Name}&action={action.ToString().ToLower()}&b={p.Name}";
            var requestHeader = $"POST {haproxyUri.AbsolutePath} HTTP/1.1\r\nHost: {haproxyUri.Host}\r\nContent-Length: {Encoding.GetEncoding("ISO-8859-1").GetBytes(requestBody).Length}\r\nAuthorization: Basic {Convert.ToBase64String(Encoding.Default.GetBytes(loginInfo))}\r\n\r\n";

            try
            {
                var socket = new System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                socket.Connect(haproxyUri.Host, haproxyUri.Port);
                socket.Send(Encoding.UTF8.GetBytes(requestHeader + requestBody));

                var responseBytes = new byte[socket.ReceiveBufferSize];
                socket.Receive(responseBytes);

                var response = Encoding.UTF8.GetString(responseBytes);
                instance.PurgeCache();
                return response.StartsWith("HTTP/1.0 303") || response.StartsWith("HTTP/1.1 303");
            }
            catch (Exception e)
            {
                Current.LogException(e);
                return false;
            }
        }
예제 #10
0
파일: usefull.cs 프로젝트: zadark/par
        public useful(PubComb plug)
        {
            plugin = plug;
            shared = plugin.SharedInfo;
            this.frame = plug.frame;
            this.proxy = frame.proxy;
            form = new UsefulForm1(this);

            /*this.proxy.AddDelegate(PacketType.AgentMovementComplete, Direction.Incoming, delegate(Packet packet, IPEndPoint sim)
            {
                RegionHandle = ((AgentMovementCompletePacket)packet).Data.RegionHandle;
                return packet;
            });
            this.proxy.AddDelegate(PacketType.AgentUpdate, Direction.Outgoing, delegate(Packet packet, IPEndPoint sim)
            {
                CameraCenter = ((AgentUpdatePacket)packet).AgentData.CameraCenter;
                return packet;
            });
            */

            //this.proxy.AddDelegate(PacketType.ChatFromViewer, Direction.Outgoing, new PacketDelegate(OutChatFromViewerHandler));
            //this.proxy.AddDelegate(PacketType.AgentUpdate, Direction.Outgoing, new PacketDelegate(OutAgentUpdateHandler));
            this.proxy.AddDelegate(PacketType.ImprovedInstantMessage, Direction.Incoming, new PacketDelegate(InImprovedInstantMessageHandler));
            //this.proxy.AddDelegate(PacketType.ViewerEffect, Direction.Incoming, new PacketDelegate(InViewerEffectHandler));
            this.proxy.AddDelegate(PacketType.AlertMessage, Direction.Incoming, new PacketDelegate(InAlertMessageHandler));
            this.proxy.AddDelegate(PacketType.AvatarPropertiesRequest, Direction.Outgoing, new PacketDelegate(OutAvatarPropertiesRequestHandler));
            this.proxy.AddDelegate(PacketType.GroupProfileReply, Direction.Incoming, new PacketDelegate(GroupProp));
            this.proxy.AddDelegate(PacketType.UUIDNameReply, Direction.Incoming, new PacketDelegate(GotName));

            //this.proxy.AddDelegate(PacketType.AvatarSitResponse, Direction.Incoming, new PacketDelegate(InAvatarSitResponseHandler));
            //this.proxy.AddDelegate(PacketType.TerminateFriendship, Direction.Incoming, new PacketDelegate(InTerminateFriendshipHandler));
            //this.proxy.AddDelegate(PacketType.ObjectUpdate, Direction.Incoming, new PacketDelegate(InObjectUpdateHandler));
        }
예제 #11
0
    public static void Main(string[] args)
    {
        libslAssembly = Assembly.Load("libsecondlife");
        if (libslAssembly == null) throw new Exception("Assembly load exception");

        ProxyConfig proxyConfig = new ProxyConfig("Analyst V2", "Austin Jennings / Andrew Ortman", args);
        proxy = new Proxy(proxyConfig);

        // build the table of /command delegates
        InitializeCommandDelegates();

        // add delegates for login
        proxy.SetLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest));
        proxy.SetLoginResponseDelegate(new XmlRpcResponseDelegate(LoginResponse));

        // add a delegate for outgoing chat
        proxy.AddDelegate(PacketType.ChatFromViewer, Direction.Outgoing, new PacketDelegate(ChatFromViewerOut));

        //  handle command line arguments
        foreach (string arg in args)
            if (arg == "--log-all")
                LogAll();
            else if (arg == "--log-login")
                logLogin = true;

        // start the proxy
        proxy.Start();
    }
예제 #12
0
        static void Main(string[] args)
        {
            var proxy = new Proxy();

            Console.WriteLine(proxy.Add(1, 2));
            Console.WriteLine(proxy.Sub(5, 2));
        }
		public void ValidationPassedWhenProjectDiffersButNameIsSame()
		{
			Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(HostDesignerDomainModel));
			using (Transaction t = store.TransactionManager.BeginTransaction())
			{
				ClientApplication clientApp1 = new ClientApplication(store,
									new PropertyAssignment(ClientApplication.ImplementationProjectDomainPropertyId, "Project1"));
				ClientApplication clientApp2 = new ClientApplication(store,
					new PropertyAssignment(ClientApplication.ImplementationProjectDomainPropertyId, "AnotherProject"));

				HostDesignerModel model = new HostDesignerModel(store);

				model.ClientApplications.Add(clientApp1);
				model.ClientApplications.Add(clientApp2);

				Proxy proxy1 = new Proxy(store,
					new PropertyAssignment(Proxy.NameDomainPropertyId, "Proxy1"));
				Proxy proxy2 = new Proxy(store,
					new PropertyAssignment(Proxy.NameDomainPropertyId, "Proxy1"));


				clientApp1.Proxies.Add(proxy1);
				clientApp2.Proxies.Add(proxy2);

				TestableHostModelContainsUniqueProxyNamesAcrossClientsValidator validator = new TestableHostModelContainsUniqueProxyNamesAcrossClientsValidator();


				t.Rollback();
			}
		}
예제 #14
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="proxy"></param>
        /// <returns></returns>
        public static string GenProxyServerStringByProtocol(Proxy proxy)
        {
            string proxyServer = "";

            string http  = proxy.Http;
            string https = proxy.Https;
            string ftp   = proxy.Ftp;
            string socks = proxy.Socks;

            if (http != null && http.Length > 0)
            {
                proxyServer = AddProxyServers(proxyServer, "http", http);
            }
            if (https != null && https.Length > 0)
            {
                proxyServer = AddProxyServers(proxyServer, "https", https);
            }
            if (ftp != null && ftp.Length > 0)
            {
                proxyServer = AddProxyServers(proxyServer, "ftp", ftp);
            }
            if (socks != null && socks.Length > 0)
            {
                proxyServer = AddProxyServers(proxyServer, "socks", socks);
            }

            return proxyServer;
        }
예제 #15
0
파일: Program.cs 프로젝트: niuniuliu/CSharp
        static void Main(string[] args)
        {
            Proxy proxy = new Proxy();
            proxy.Request();

            Console.Read();
        }
예제 #16
0
파일: test.cs 프로젝트: mono/gert
	static void Main (string [] args)
	{
		Server http = new Server ();
		Proxy proxy = new Proxy ();

		new Thread (http.Run).Start ();
		new Thread (proxy.Run).Start ();

		IPAddress ip = GetIPv4Address (Dns.GetHostName ());

		HttpWebRequest request = (HttpWebRequest) WebRequest.Create ("http://" + ip.ToString () + ":8080/default.htm");
		request.Proxy = new WebProxy (ip.ToString (), 8081);

		try {
			HttpWebResponse response = (HttpWebResponse) request.GetResponse ();
			Assert.IsNull (response.CharacterSet, "#A1");
			Assert.AreEqual (HttpStatusCode.OK, response.StatusCode, "#A2");
			Assert.AreEqual (string.Empty, response.ContentEncoding, "#A3");
			Assert.AreEqual (string.Empty, response.ContentType, "#A4");

			using (StreamReader sr = new StreamReader (response.GetResponseStream ())) {
				string body = sr.ReadToEnd ();
				Assert.AreEqual ("<html><body>ok</body></html>", body, "#A5");
			}
		} catch (WebException ex) {
			if (ex.Response != null) {
				StreamReader sr = new StreamReader (ex.Response.GetResponseStream ());
				Console.WriteLine (sr.ReadToEnd ());
			}
			throw;
		} finally {
			http.Stop ();
			proxy.Stop ();
		}
	}
예제 #17
0
        private static void start()
        {
            isActicvated = true;
            List<Fiddler.Session> oAllSessions = new List<Fiddler.Session>();
            List<String> list = new List<string>();

            Fiddler.FiddlerApplication.BeforeResponse += delegate(Fiddler.Session oSession)
            {
                Messages.write(oSession.fullUrl);
            };

            Fiddler.CONFIG.IgnoreServerCertErrors = false;

            FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.abortifclientaborts", true);

            FiddlerCoreStartupFlags oFCSF = FiddlerCoreStartupFlags.Default;
            //Do no decrypt SSL traffic
            oFCSF = (oFCSF & ~FiddlerCoreStartupFlags.DecryptSSL);
            //Do not act like system proxy
            //oFCSF = (oFCSF & ~FiddlerCoreStartupFlags.RegisterAsSystemProxy);

            //Fiddler will auto select available port.
            Fiddler.FiddlerApplication.Startup(0, oFCSF);

            // We'll also create a HTTPS listener, useful for when FiddlerCore is masquerading as a HTTPS server
            // instead of acting as a normal CERN-style proxy server.
            oSecureEndpoint = FiddlerApplication.CreateProxyEndpoint(iSecureEndpointPort, true, sSecureEndpointHostname);
            if (null != oSecureEndpoint)
            {
                FiddlerApplication.Log.LogFormat("Created secure end point listening on port {0}, using a HTTPS certificate for '{1}'", iSecureEndpointPort, sSecureEndpointHostname);
            }

            while (isActicvated) ;
            DoQuit();
        }
예제 #18
0
        public static IWebProxy FormatProxyStringToProxyObject(string proxyPattern)
        {
            if(string.IsNullOrEmpty(proxyPattern))
                return null;

            WebProxy webProxy = new WebProxy();
            Proxy proxy = new Proxy();

            try
            {
                string[] proxyData = proxyPattern.Split(':');

                proxy.Protocol = proxyData[0];
                proxy.User = proxyData[1];
                proxy.Password = proxyData[2];
                proxy.Domain = proxyData[3];
                proxy.Port = Convert.ToInt32(proxyData[4]);

                Uri proxyUri = new Uri(proxy.Protocol + "://" + proxy.Domain + ":" + proxy.Port);

                webProxy.Address = proxyUri;
                webProxy.Credentials = new NetworkCredential(proxy.User, proxy.Password);
            }
            catch (Exception ex)
            {
                throw new Exception("An error occurred when I try to format proxy string. :(", ex);
            }

            return webProxy;
        }
예제 #19
0
        public void Start_on_execute_should_return_expected()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                var actualInputs = new List<ULTypeOfFeedback>();

                var proxy1 = new Proxy<OfPProxyULChatBot>();
                proxy1.Setup<ReplyInformationFunc>(_ => _.ReplyInformationULTypeOfFeedbackStringRefULActionsRefULTypeOfFeedbackRef()).Body =
                    (ULChatBot @this, ULTypeOfFeedback input, out string reply, ref ULActions action, out ULTypeOfFeedback recommendation) =>
                    {
                        actualInputs.Add(input);
                        reply = "1";
                        recommendation = ULTypeOfFeedback.Suggestion;
                        return true;
                    };

                var proxy2 = new Proxy<OfPProxyULChatBot>();
                proxy2.Setup<ReplyInformationFunc>(_ => _.ReplyInformationULTypeOfFeedbackStringRefULActionsRefULTypeOfFeedbackRef()).Body =
                    (ULChatBot @this, ULTypeOfFeedback input, out string reply, ref ULActions action, out ULTypeOfFeedback recommendation) =>
                    {
                        actualInputs.Add(input);
                        reply = "2";
                        recommendation = ULTypeOfFeedback.Incomprehensible;
                        return true;
                    };

                // Act
                new ChatRoom().Start(ULTypeOfFeedback.Praise, (ULChatBot)proxy1.Target, (ULChatBot)proxy2.Target);

                // Assert
                var expectedInputs = new[] { ULTypeOfFeedback.Praise, ULTypeOfFeedback.Suggestion };
                CollectionAssert.AreEqual(expectedInputs, actualInputs);
            }
        }
예제 #20
0
        static void Main(string[] args)
        {
            Subject subject = new Proxy();
            subject.Request();

            Console.ReadKey();
        }
 // initialize control
 private void InitializeControl(Proxy proxy)
 {
     _Model = new OrderManagementViewModel(proxy, this);
     _PreviousFile = _Model._DefaultFile;
     this.Loaded += MainWindow_Loaded;
     webBrowser1.Loaded += webBrowser1_Loaded;
 }
예제 #22
0
파일: ProfileFun.cs 프로젝트: zadark/par
 public ProfileFunPlugin(PubComb plug)
 {
     plugin = plug;
     form = new SimpleProfForm1(this);
     this.frame = plug.frame;
     shared = plugin.SharedInfo;
     this.proxy = plug.proxy;
     proxy.AddDelegate(PacketType.AvatarPropertiesReply, Direction.Incoming, new PacketDelegate(inAvatar));
     RefreshDownloadsTimer.Elapsed += new System.Timers.ElapsedEventHandler(RefreshDownloadsTimer_Elapsed);
     RefreshDownloadsTimer.Start();
     proxy.AddDelegate(PacketType.AgentMovementComplete, Direction.Incoming, delegate(Packet packet, IPEndPoint sim)
     {
         shared.RegionHandle = ((AgentMovementCompletePacket)packet).Data.RegionHandle;
         return packet;
     });
     proxy.AddDelegate(PacketType.AgentUpdate, Direction.Outgoing, delegate(Packet packet, IPEndPoint sim)
     {
         AgentUpdatePacket.AgentDataBlock p = ((AgentUpdatePacket)packet).AgentData;
         shared.CameraPosition = p.CameraCenter;
         shared.CameraAtAxis = p.CameraAtAxis;
         shared.CameraLeftAxis = p.CameraLeftAxis;
         shared.CameraUpAxis = p.CameraUpAxis;
         shared.Far = p.Far;
         shared.ip = sim.Address;
         shared.port = sim.Port;
         return packet;
     });
 }
예제 #23
0
 public void Run()
 {
     Subject subject = new Proxy("SubjectName");
     var subjectName = subject.Name;
     subject.Request();
     subject.Request();
 }
예제 #24
0
        // transfers the file to the server in blocks of bytes.
        public bool SendFile(string file, string path)
        {
            long blockSize = 512;
            Proxy proxy = new Proxy();

            try
            {
                string filename = Path.GetFileName(file);
                proxy.GetChannel().OpenFileForWrite(filename, path);
                FileStream fs = File.Open(file, FileMode.Open, FileAccess.Read);
                int bytesRead = 0;
                while (true)
                {
                    long remainder = (int)(fs.Length - fs.Position);
                    if (remainder == 0)
                        break;
                    long size = Math.Min(blockSize, remainder);
                    byte[] block = new byte[size];
                    bytesRead = fs.Read(block, 0, block.Length);
                    proxy.channel.WriteFileBlock(block);
                }
                fs.Close();
                proxy.GetChannel().CloseFile();
                return true;
            }
            catch (Exception ex)
            {
                Console.Write("\n  can't open {0} for writing - {1}", file, ex.Message);
                return false;
            }
        }
 /// <summary>
 /// Parametrized cofigurator constructor
 /// </summary>
 /// <param name="domainSetup">domain setups</param>
 public Client(AppDomainSetup domainSetup)
 {
     if (domainSetup == null)
         throw new ArgumentNullException();
     Configurate(domainSetup);
     Proxy = new Proxy(Services.Count, Services);
 }
 public bool CheckIdentity(Proxy proxy, Message message)
 {
     EndpointAddress to = proxy.To;
     bool access = this.identityVerifier.CheckAccess(to, message);
     this.TraceCheckIdentityResult(access, to, message);
     return access;
 }
예제 #27
0
 // construct the file
 internal ImportFile(BulkImportViewModel model, int fileId, string name, string title, string description)
 {
     _Model = model;
     _Proxy = _Model._Proxy;
     _MaxPreview = _Model.MaxPreview;
     _Description = string.IsNullOrWhiteSpace(description) ? string.Empty : description;
     if (!string.IsNullOrEmpty(_Description))
     {
         if (_Description.Contains("{70}"))
         {
             _PreviousStatus = JobStatus.AllDone;
             _Description = _Description.Replace("{70}", "");
         }
         if (_Description.Contains("{75}"))
         {
             _PreviousStatus = JobStatus.AllDoneError;
             _Description = _Description.Replace("{75}", "");
         }
     }
     _Name = name;
     Title = title;
     _TitleUpper = Title.ToUpperInvariant();
     _FileId = fileId;
     _ProgressPercent = 0;
     _IsShowAllEnabled = false;
     _ShowAll = false;
     _RepairOrders = new ObservableCollection<RepairOrder>();
     _LoadedAll = false;
     _JobStatus = JobStatus.Load;
     _IsImportEnabled = false;
     _Status = String.Empty + _JobStatus;
     _LongStatus = _Status;
     _Stopwatch = new Stopwatch();
     _ProgressTimer = new Stopwatch();
 }
예제 #28
0
        public void TestProxySendAndReceive()
        {
            using (var ctx = NetMQContext.Create())
            using (var front = ctx.CreateRouterSocket())
            using (var back = ctx.CreateDealerSocket())
            {
                front.Bind("inproc://frontend");
                back.Bind("inproc://backend");

                var proxy = new Proxy(front, back, null);
                Task.Factory.StartNew(proxy.Start);

                using (var client = ctx.CreateRequestSocket())
                using (var server = ctx.CreateResponseSocket())
                {
                    client.Connect("inproc://frontend");
                    server.Connect("inproc://backend");

                    client.Send("hello");
                    Assert.AreEqual("hello", server.ReceiveString());
                    server.Send("reply");
                    Assert.AreEqual("reply", client.ReceiveString());
                }
            }
        }
예제 #29
0
파일: Server.cs 프로젝트: Domer79/CIAPI.CS
        public void Start()
        {

            var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
            path = path.Replace("file:\\", "");
            if (!path.EndsWith(@"\")) path += @"\";
            path += "FiddlerRoot.cer";

 
            FiddlerApplication.oDefaultClientCertificate = new X509Certificate(path);
            FiddlerApplication.BeforeRequest += ProcessBeginRequest;

            FiddlerApplication.AfterSessionComplete += ProcessEndResponse;
            CONFIG.IgnoreServerCertErrors = true;
            FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.ForgetStreamedData", false);
            FiddlerApplication.Prefs.SetBoolPref("fiddler.network.streaming.abortifclientaborts", true);



            _oSecureEndpoint = FiddlerApplication.CreateProxyEndpoint(_sslPort, true, _hostName);
            if (null == _oSecureEndpoint)
            {

                throw new Exception("could not start up secure endpoint");
            }
            FiddlerApplication.Startup(_port, false, true, true);
        }
예제 #30
0
        /// <summary>
        /// Converts the packet to a human-readable format.
        /// </summary>
        public string ToString(Proxy proxy)
        {
            Type type = GetType();
            string value = "";
            FieldInfo[] fields = type.GetFields();
            foreach (FieldInfo field in fields)
            {
                var nameAttribute = Attribute.GetCustomAttribute(field, typeof(FriendlyNameAttribute)) as FriendlyNameAttribute;
                var name = field.Name;

                if (nameAttribute != null)
                    name = nameAttribute.FriendlyName;
                else
                    name = AddSpaces(name);

                value += "    " + name + " (" + field.FieldType.Name + ")";

                var fValue = field.GetValue(this);
                string fieldValue = fValue.ToString();
                if (fValue is byte[])
                    fieldValue = DataUtility.DumpArray(fValue as byte[]);
                value += ": " + fieldValue + "\n";
            }
            if (value.Length == 0)
                return value;
            return value.Remove(value.Length - 1);
        }
 public Task <SuccessResponse> DeleteCiscoAsa1000vResourceAsync(DeleteCiscoAsa1000vResourceRequest request) => Proxy.RequestAsync <SuccessResponse>(request);
예제 #32
0
        public Signature Sign(Keccak message, Address address)
        {
            var rs = Proxy.SignCompact(message.Bytes, _keys[address].KeyBytes, out int v);

            return(new Signature(rs, v));
        }
예제 #33
0
        static public void Main()
        {
            Proxy proxy = new Proxy();

            proxy.DoSth();
        }
예제 #34
0
 /// <inheritdoc />
 public int SetId(int id) => Proxy.SetId(id);
예제 #35
0
 /// <inheritdoc />
 public int GetId() => Proxy.GetId();
 public Task <DeleteVolumeOnFilerCmdResponse> DestroyVolumeOnFilerAsync(DestroyVolumeOnFilerRequest request) => Proxy.RequestAsync <DeleteVolumeOnFilerCmdResponse>(request);
 public DeleteVolumeOnFilerCmdResponse DestroyVolumeOnFiler(DestroyVolumeOnFilerRequest request) => Proxy.Request <DeleteVolumeOnFilerCmdResponse>(request);
예제 #38
0
 public void Initialize(Proxy proxy)
 {
     throw new NotImplementedException();
 }
예제 #39
0
 public AsyncJobResponse DedicateZone(DedicateZoneRequest request) => Proxy.Request <AsyncJobResponse>(request);
 public SuccessResponse DeleteCiscoAsa1000vResource(DeleteCiscoAsa1000vResourceRequest request) => Proxy.Request <SuccessResponse>(request);
예제 #41
0
 public override bool IsCompatibleConnection(IDbConnection connection)
 {
     return(typeof(OdbcConnection).IsSameOrParentOf(Proxy.GetUnderlyingObject((DbConnection)connection).GetType()));
 }
예제 #42
0
 public Task <AsyncJobResponse> DedicateZoneAsync(DedicateZoneRequest request) => Proxy.RequestAsync <AsyncJobResponse>(request);
 public AsyncJobResponse MarkDefaultZoneForAccount(MarkDefaultZoneForAccountRequest request) => Proxy.Request <AsyncJobResponse>(request);
예제 #44
0
 void Awake()
 {
     m_Proxy = GetComponent <Proxy>();
 }
예제 #45
0
 public AsyncJobResponse DeleteNuageVspDevice(DeleteNuageVspDeviceRequest request) => Proxy.Request <AsyncJobResponse>(request);
 public Task <AsyncJobResponse> MarkDefaultZoneForAccountAsync(MarkDefaultZoneForAccountRequest request) => Proxy.RequestAsync <AsyncJobResponse>(request);
예제 #47
0
        private async void btnScrape_Click(object sender, EventArgs e)
        {
            btnScrape.Enabled = false;
            var hosts = new List <string>();

            if (rbCustom.Checked)
            {
                if (CustomSources.Count == 0)
                {
                    MessageBox.Show("You have selected custom source list. Please load some before scraping.", "Form Validation Failed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                hosts.Clear();
                hosts.AddRange(CustomSources.ToArray());
            }
            // hosts.Add("https://orca.tech/?action=real-time-proxy-list");
            //hosts.Add("http://free-proxy-list.net/anonymous-proxy.html");
            // hosts.Add("http://www.us-proxy.org/");
            // hosts.Add("www.sslproxies.org");
            //hosts.Add("http://irc-proxies24.blogspot.com/2016/08/26-08-16-irc-proxy-servers-900_26.html");
            //  hosts.Add("http://www.samair.ru/proxy/");
            //hosts.Add("https://www.hide-my-ip.com/proxylist.shtml");
            //hosts.Add("http://fineproxy.org/eng/?p=6");
            //hosts.Add("http://www.blackhatworld.com/seo/new-fresh-big-proxy-lists-worldwide-usa-and-elite-proxies-updated-daily.753956/page-21");
            //hosts.Add("https://us-proxy-server.blogspot.com/");
            //  hosts.Add("http://txt.proxyspy.net/proxy.txt");
            //hosts.Add("http://txt.proxyspy.net/proxy.txt");
            // hosts.Add("http://proxyrox.com");
            //hosts.Add("https://nordvpn.com/wp-admin/admin-ajax.php?searchParameters[0][name]=proxy-country&searchParameters[0][value]=&searchParameters[1][name]=proxy-ports&searchParameters[1][value]=&offset=25&limit=10000&action=getProxies");
            lvProxies.BeginUpdate();
            // BLOGSPOT
            //hosts.Add("http://proxyserverlist-24.blogspot.com/");
            //hosts.Add("http://sslproxies24.blogspot.ro");
            // hosts.Add("http://sslproxies24.blogspot.ro");

            bool checkLimit = cbLimit.Checked;
            var  numLimit   = (int)this.numLimit.Value;
            var  options    = new ParallelOptions()
            {
                MaxDegreeOfParallelism = 10
            };
            var _Scraper = new Scraper.Scraper();

            Hashtable hash = new Hashtable();


            Stopwatch s = new Stopwatch();

            s.Start();
            await Task.Run(() =>
            {
                Parallel.ForEach(hosts, options, (item) =>
                {
                    try
                    {
                        if (checkLimit && hash.Count >= numLimit)
                        {
                            return;
                        }
                        if (!item.StartsWith("http://") && !item.StartsWith("https://"))
                        {
                            item = "http://" + item;
                        }
                        string html = HTTP.DoWebRequest(item);
                        if (string.IsNullOrEmpty(html))
                        {
                            return;
                        }
                        List <Proxy> proxies = _Scraper.Scrape(item, html);
                        if (proxies == null)
                        {
                            return;
                        }
                        Parallel.ForEach(proxies, options, (proxy) =>
                        {
                            if (proxy == null)
                            {
                                return;
                            }

                            if (checkLimit && hash.Count >= numLimit)
                            {
                                return;
                            }
                            lock (hash)
                            {
                                if (!hash.Contains(proxy.Proxy_))
                                {
                                    hash.Add(proxy.Proxy_, proxy);
                                }
                            }
                        });
                    }
                    catch { }
                });
            });

            foreach (DictionaryEntry element in hash)
            {
                if (checkLimit && lvProxies.Items.Count >= numLimit)
                {
                    break;
                }
                Proxy proxy = (Proxy)(element.Value);

                Invoke(new MethodInvoker(() =>
                {
                    ListViewItem i  = new ListViewItem((lvProxies.Items.Count + 1).ToString());
                    var countryCode = CountryInfo.GetCode(proxy.Country);
                    if (!imageList.Images.Keys.Contains(countryCode))
                    {
                        imageList.Images.Add(countryCode, Image.FromFile(@"Flags\" + countryCode + ".png"));
                    }
                    i.ImageKey = countryCode;


                    // i.UseItemStyleForSubItems = false;
                    i.SubItems.Add(proxy.Proxy_);
                    i.SubItems.Add(proxy.Anonymity);
                    i.SubItems.Add(proxy.Country);
                    i.SubItems.Add("");
                    i.SubItems.Add("");
                    i.SubItems.Add("");
                    lvProxies.Items.Add(i);
                }));
            }

            s.Stop();
            lvProxies.EndUpdate();
            MessageBox.Show("Done!\r\nTime Elapsed: " + s.Elapsed);
            btnScrape.Enabled = true;
        }
예제 #48
0
 public Task <AsyncJobResponse> DeleteNuageVspDeviceAsync(DeleteNuageVspDeviceRequest request) => Proxy.RequestAsync <AsyncJobResponse>(request);
예제 #49
0
 private IEnumerable <string> GetPushRefSpecs()
 {
     return(Proxy.git_remote_get_push_refspecs(remoteHandle));
 }
예제 #50
0
        private static EncryptionKeyRequestPacket CreateEncryptionRequest(RemoteClient client, Proxy proxy)
        {
            var verifyToken = new byte[4];
            var csp         = new RNGCryptoServiceProvider();

            csp.GetBytes(verifyToken);
            client.VerificationToken = verifyToken;

            var encodedKey = AsnKeyBuilder.PublicKeyToX509(proxy.ServerKey);
            var request    = new EncryptionKeyRequestPacket(client.AuthenticationHash, encodedKey.GetBytes(), verifyToken);

            return(request);
        }
예제 #51
0
 public byte[] Current()
 {
     byte[] result = Proxy.EcdhSerialized(ephemeral.Bytes, privateKey.KeyBytes);
     return(result);
 }
예제 #52
0
 private void SetPushRefSpecs(IEnumerable <string> value)
 {
     Proxy.git_remote_set_push_refspecs(remoteHandle, value);
     Proxy.git_remote_save(remoteHandle);
 }
 public NetworkDeviceResponse AddNetworkDevice(AddNetworkDeviceRequest request) => Proxy.Request <NetworkDeviceResponse>(request);
예제 #54
0
 /// <summary>
 /// Returns an enumerator that iterates through the collection.
 /// </summary>
 /// <returns>An <see cref="IEnumerator{T}"/> object that can be used to iterate through the collection.</returns>
 public virtual IEnumerator <Branch> GetEnumerator()
 {
     return(Proxy.git_branch_foreach(repo.Handle, GitBranchType.GIT_BRANCH_LOCAL | GitBranchType.GIT_BRANCH_REMOTE, branchToCanoncialName)
            .Select(n => this[n])
            .GetEnumerator());
 }
 public ListResponse <Site2SiteVpnConnectionResponse> ListVpnConnections(ListVpnConnectionsRequest request) => Proxy.Request <ListResponse <Site2SiteVpnConnectionResponse> >(request);
 public Task <NetworkDeviceResponse> AddNetworkDeviceAsync(AddNetworkDeviceRequest request) => Proxy.RequestAsync <NetworkDeviceResponse>(request);
예제 #57
0
 public Task <AssociateLunCmdResponse> AssociateLunAsync(AssociateLunRequest request) => Proxy.RequestAsync <AssociateLunCmdResponse>(request);
 public Task <ListResponse <Site2SiteVpnConnectionResponse> > ListVpnConnectionsAsync(ListVpnConnectionsRequest request) => Proxy.RequestAsync <ListResponse <Site2SiteVpnConnectionResponse> >(request);
예제 #59
0
 private string RemoteNameFromRemoteTrackingBranch()
 {
     return(Proxy.git_branch_remote_name(repo.Handle, CanonicalName));
 }
 public ListResponse <Site2SiteVpnConnectionResponse> ListVpnConnectionsAllPages(ListVpnConnectionsRequest request) => Proxy.RequestAllPages <Site2SiteVpnConnectionResponse>(request);