public SourcererInterceptor(object target, ISourcerer sourcerer, ProxyExtension.MakeCommandDelegate makeCommand, string fragment = null, SourcererInterceptor parent = null)
 {
     _target = target;
     _sourcerer = sourcerer;
     _makeCommand = makeCommand;
     _fragment = fragment;
     _parent = parent;
     _target.SetInnerType(sourcerer.ReadModel.GetType());
 }
Example #2
0
        public void SetProxy(string ipAddress, string port, string username, string password)
        {
            //Proxy is not set for local loopback addresses
            if (String.IsNullOrEmpty(ipAddress) || ipAddress == "127.0.0.1" || ipAddress == "::1")
            {
                return;
            }

            OpenQA.Selenium.Proxy sProxy = new OpenQA.Selenium.Proxy();
            sProxy.Kind          = ProxyKind.Manual;
            sProxy.IsAutoDetect  = false;
            sProxy.HttpProxy     = ipAddress + ":" + port;
            sProxy.SslProxy      = ipAddress + ":" + port;
            sProxy.SocksUserName = username;
            sProxy.SocksPassword = username;
            _options.Proxy       = sProxy;

            //Workaround - submit login credentials dialog by loading custom extension. Does not work in icognito.
            ProxyExtension proxyExtension = new ProxyExtension();

            proxyExtension.SetConnectionDetails(ipAddress, port, username, password);
            AddExtension(proxyExtension);
        }
 public SourcererEnumeratorInterceptor(IEnumerator<object> enumerator, ISourcerer sourcerer, ProxyExtension.MakeCommandDelegate makeCommand, string fragment, SourcererInterceptor parent)
     : base(enumerator, sourcerer, makeCommand, fragment, parent)
 {
     _enumerator = enumerator;
 }
Example #4
0
        // Token: 0x060000BE RID: 190 RVA: 0x0000E870 File Offset: 0x0000CA70
        public static void Execute(ModuleDef md)
        {
            for (int i = 0; i < Ref_Proxy.Intensity; i++)
            {
                foreach (TypeDef typeDef in md.Types)
                {
                    bool isGlobalModuleType = typeDef.IsGlobalModuleType;
                    if (!isGlobalModuleType)
                    {
                        foreach (MethodDef methodDef in typeDef.Methods.ToArray <MethodDef>())
                        {
                            bool flag = !methodDef.HasBody;
                            if (!flag)
                            {
                                int k = 0;
                                while (k < methodDef.Body.Instructions.Count)
                                {
                                    bool flag2 = methodDef.Body.Instructions[k].OpCode == OpCodes.Call;
                                    if (flag2)
                                    {
                                        try
                                        {
                                            MethodDef methodDef2 = methodDef.Body.Instructions[k].Operand as MethodDef;
                                            bool      flag3      = !methodDef2.FullName.Contains(md.Assembly.Name);
                                            if (!flag3)
                                            {
                                                bool flag4 = methodDef2.Parameters.Count == 0 || methodDef2.Parameters.Count > 4;
                                                if (!flag4)
                                                {
                                                    MethodDef methodDef3 = methodDef2.CopyMethod(md);
                                                    methodDef2.Module.GlobalType.Methods.Add(methodDef3);
                                                    ProxyExtension.CloneSignature(methodDef2, methodDef3);
                                                    CilBody cilBody = new CilBody();
                                                    cilBody.Instructions.Add(OpCodes.Nop.ToInstruction());
                                                    for (int l = 0; l < methodDef2.Parameters.Count; l++)
                                                    {
                                                        switch (l)
                                                        {
                                                        case 0:
                                                            cilBody.Instructions.Add(OpCodes.Ldarg_0.ToInstruction());
                                                            break;

                                                        case 1:
                                                            cilBody.Instructions.Add(OpCodes.Ldarg_1.ToInstruction());
                                                            break;

                                                        case 2:
                                                            cilBody.Instructions.Add(OpCodes.Ldarg_2.ToInstruction());
                                                            break;

                                                        case 3:
                                                            cilBody.Instructions.Add(OpCodes.Ldarg_3.ToInstruction());
                                                            break;
                                                        }
                                                    }
                                                    cilBody.Instructions.Add(OpCodes.Call.ToInstruction(methodDef3));
                                                    cilBody.Instructions.Add(OpCodes.Ret.ToInstruction());
                                                    methodDef2.Body = cilBody;
                                                    Ref_Proxy.Amount++;
                                                }
                                            }
                                        }
                                        catch
                                        {
                                        }
                                    }
IL_255:
                                    k++;
                                    continue;
                                    goto IL_255;
                                }
                            }
                        }
                    }
                }
            }
        }