Vic*_*huk 19 networking windows vpn windows-7 proxy
我尝试过 ForceBindIP,但它有一个明显的缺点——它不会影响我试图绑定的应用程序的子级,它只会影响应用程序本身。它也不能强制应用程序总是通过指定的接口运行,它必须forcebindip.exe每次都运行。它成为像英雄联盟这样的应用程序的问题,其中进程树看起来像这样:

启动器运行补丁程序,补丁程序运行客户端等等。我只能影响树中所有这些进程的父进程,所以实际游戏并没有绑定到我想要的界面,这使得整个冒险毫无意义。
对于 Windows 7,是否有更现代的 ForceBindIP 替代方案?这个网站上有很多与这个类似的问题,但它们大多是旧的。也许现在有更好的方法来解决这个问题?
我目前的想法是做以下事情:
设置绑定到所需接口的本地 3proxy 服务器。
通过 Proxifier 或配置为通过该本地代理运行的类似软件运行游戏。
我不确定这是否可行,但即使可行,这似乎也是一个次优解决方案。大家有什么更好的想法吗?
编辑:我的想法没有奏效:(
编辑 2:基本上,我想要实现的是在 VPN 运行时将一些应用程序绑定到常规界面。原因是我大部分时间都需要通过VPN连接,但是由于ping较高等问题,某些应用程序(例如游戏)无法通过这种方式正常工作。
bea*_*ker 12
###Update 我发现 ForceBindIp 实际上正在将参数传递给被调用的可执行文件。它只是省略了第一个参数。所以我修改了我的脚本以使用ForceBindIp.exe而不是自定义注入器,现在看起来所有injectory异常问题都消失了,一切正常。
这是修改后的步骤和BindIp.cmd脚本:
像往常一样安装 ForceBindIp
放在BindIp.cmd驱动器上的任何位置(例如C:\BindIp\BindIp.cmd)
BindIp.cmd 脚本:
setlocal
:: IP to bind to
set IP=192.168.128.85
:: Common variables
set RegIFEO=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\%~nx1
set Injector=ForceBindIp.exe
:: ForceBindIp swallows first parameter passed to target exe,
:: so we inject dummy parameter just before it
set AllParams=%*
set FirstParam=%1
call set TargetParams=%%AllParams:*%FirstParam%=%FirstParam% Dummy%%
:: Delete debugger for the target exe in registry,
:: or we'll end in an endless loop of the batch files
reg delete "%RegIFEO%%" /v Debugger /f
:: Start target exe via ForceBindIp
%Injector% %IP% %TargetParams%
:: Restore this script as debugger for the target exe in registry
reg add "%RegIFEO%" /v Debugger /t REG_SZ /d "%~dpnx0" /f
:: Debug, uncomment if needed
rem pause
endlocal
Run Code Online (Sandbox Code Playgroud)
然后按照下面的步骤 2-6 进行操作。
###Theory 要使用BindIp.dll而不ForceBindIp.exe需要找出它们如何通信(ForceBindIp.exe必须以某种方式将 IP 地址传递给 dll)。
我已经免费使用IDA并发现它ForceBindIp.exe创建了名称FORCEDIP为保存 IP 地址的环境变量,并BindIp.dll在注入并在目标进程中执行时从该变量中读取 IP 地址。
为了检测目标应用程序的启动,我们可以Debugger在注册表的 Image File Execution Options 中为此可执行文件添加一个键:
Kernel32!CreateProcess 在没有 DEBUG_PROCESS 或 DEBUG_ONLY_THIS_PROCESS 创建标志的情况下调用时,检查注册表以查看是否已在其启动的可执行文件上设置了 IFEO。如果是,那么它只是将调试器路径添加到可执行文件名称之前,有效地让可执行文件在调试器下启动。
在我们的例子中,“调试器”将是一个批处理脚本,它将设置FORCEDIP变量并启动注入dll 注入器。Injectory然后将启动进程,传递命令行参数并注入BindIp.dll。
###实践
C:\BindIp例如)并将这三个文件放入其中:BindIp.dllBindIp.cmdBindIp.cmd 脚本:
setlocal
:: IP to bind to. This env.var is used by BindIp.dll
set FORCEDIP=192.168.1.23
:: Common variables
set RegIFEO=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\%~nx1
set Injector=%~dp0injectory.x86.exe
set BindIpDll=%~dp0BindIp.dll
:: Extract target's parameters, if any
set AllParams=%*
set FirstParam=%1
call set TargetParams=%%AllParams:*%FirstParam% =%%
:: Delete debugger for the target exe in registry,
:: or we'll end in an endless loop of the batch files
reg delete "%RegIFEO%%" /v Debugger /f
:: Start target exe and inject BindIp.dll
if not [%2] == [] (
:: If there were parameters for target exe, pass them on
"%Injector%" --launch %1 --inject "%BindIpDll%" --args "%TargetParams%"
) else (
:: No parameters were specified
"%Injector%" --launch %1 --inject "%BindIpDll%"
)
:: Restore this script as debugger for the target exe in registry
reg add "%RegIFEO%" /v Debugger /t REG_SZ /d "%~dpnx0" /f
:: Debug, uncomment if needed
rem pause
endlocal
Run Code Online (Sandbox Code Playgroud)
LolClient.exe为目标可执行文件创建注册表项(例如)HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\DebuggerC:\BindIp\BindIp.cmd设置所需的IP地址 BindIp.cmd
你希望绑定(每个可执行重复步骤3和4 rad_user_kernel.exe,LolLauncher.exe,LolPatcher.exe,等)。
现在,每次当您启动具有相应注册表项的可执行文件时,BindIp.cmd脚本将改为启动并将此程序绑定到所需的 IP 地址。
###结论
我已经在运行 Windows 8.1 x64 的笔记本电脑上对此进行了测试,并且能够使用这种技术成功地将各种程序(AIMP 2、BersIRC、Opera 12.4)绑定到以太网或 WiFi 适配器。不幸的BindIp.dll是,它是 32 位的,因此它不适用于 64 位进程。
我找到了HideMyAss!VPN 客户端具有安全 IP 绑定功能,允许将应用程序绑定到 VPN 接口:
安全 IP 绑定使您能够强制计算机上的选定应用程序仅在连接到我们的 VPN 服务器后才能运行。这确保选定的应用程序只能在安全的加密连接后工作。如果您在未连接到我们的 VPN 的情况下打开选定的应用程序,它们将无法访问互联网。
我看过它,它基于自定义的分层服务提供程序 (LSP) dll 和 COM 接口来控制它。它可以(ab)使用而无需安装 HideMyAss 的 VPN 客户端。
bin解压安装程序中的文件夹将这三个文件复制到磁盘上的文件夹 ( C:\HMA_Bind)
把Install.cmd和Uninstall.cmd放到这个文件夹
安装命令
%~dp0InstallLSP.exe -i -a -n "HMA_LSP" -d %~dp0ForceInterfaceLSP.dll
regsvr32 /s %~dp0ForceInterfaceCOM.dll
Run Code Online (Sandbox Code Playgroud)
卸载.cmd
%~dp0InstallLSP.exe -f
regsvr32 /u /s %~dp0ForceInterfaceCOM.dll
Run Code Online (Sandbox Code Playgroud)
Install.cmd 以管理员身份运行。要验证安装是否成功,您可以使用Autoruns:Windows PowerShell ISE (x86)或Windows PowerShell (x86),因为 COM 组件是 32 位的。首先,您必须创建新的安全 IP 绑定对象:
# Create new Secure IP Bind COM object
$HmaFbi = New-Object -ComObject ForceInterfaceCOM.ForceInterface -ErrorAction Stop
Run Code Online (Sandbox Code Playgroud)
然后你可以调用它的方法:
# Add bound application
# Not sure what second boolean argument does
$HmaFbi.AddApplicationHandled('firefox.exe', $true)
# Delete bound application
$HmaFbi.RemoveApplicationHandled('firefox.exe')
# Save applications to registry (applies bindings)
# Setting are saved to: HKEY_CURRENT_USER\Software\ForceInterfaceCOM
$HmaFbi.SaveToRegistry()
# List all bound applications
0..($HmaFbi.GetApplicationHandledCount() - 1) | ForEach-Object {$HmaFbi.GetApplicationName($_)}
# Set IP to bind to
$HmaFbi.SetInterfaceIP('192.168.1.23')
# Get stored IP
$HmaFbi.GetInterfaceIP()
# Enable binding
$HmaFbi.SetEnabled($true)
# Disable binding
$HmaFbi.SetEnabled($false)
# Show binding status
$HmaFbi.GetEnabled()
Run Code Online (Sandbox Code Playgroud)
Uninstall.cmd 以管理员身份运行,使用 Autoruns 验证卸载是否成功。请注意,您必须在每个 PowerShell 会话中仅创建一次安全 IP 绑定 COM 对象。下面的示例假设您在新的 PowerShell 会话中执行它们,因此它们始终创建新的 COM 对象。
设置要绑定的IP,添加firefox到绑定的应用程序,启用绑定。
# Create new Secure IP Bind COM object
$HmaFbi = New-Object -ComObject ForceInterfaceCOM.ForceInterface -ErrorAction Stop
# Set IP to bind to
$HmaFbi.SetInterfaceIP('192.168.1.23')
# Add bound application
# Not sure what second boolean argument does
$HmaFbi.AddApplicationHandled('firefox.exe', $true)
# Save applications to registry (applies bindings)
# Setting are saved to: HKEY_CURRENT_USER\Software\ForceInterfaceCOM
$HmaFbi.SaveToRegistry()
# Enable binding
$HmaFbi.SetEnabled($true)
Run Code Online (Sandbox Code Playgroud)全局启用IP绑定:
# Create new Secure IP Bind COM object
$HmaFbi = New-Object -ComObject ForceInterfaceCOM.ForceInterface -ErrorAction Stop
# Enable binding
$HmaFbi.SetEnabled($true)
Run Code Online (Sandbox Code Playgroud)全局禁用IP绑定:
# Create new Secure IP Bind COM object
$HmaFbi = New-Object -ComObject ForceInterfaceCOM.ForceInterface -ErrorAction Stop
# Disable binding
$HmaFbi.SetEnabled($false)
Run Code Online (Sandbox Code Playgroud)从列表中删除应用程序(停止绑定此应用程序):
# Create new Secure IP Bind COM object
$HmaFbi = New-Object -ComObject ForceInterfaceCOM.ForceInterface -ErrorAction Stop
# Delete bound application
$HmaFbi.RemoveApplicationHandled('firefox.exe')
# Save applications to registry (applies bindings)
# Setting are saved to: HKEY_CURRENT_USER\Software\ForceInterfaceCOM
$HmaFbi.SaveToRegistry()
Run Code Online (Sandbox Code Playgroud)因为安全 IP 绑定是作为自定义分层服务提供程序 (LSP) dll 实现的,所以这些限制适用:
自 Windows Server 2012 起,LSP 已被弃用。包含 LSP 的系统将无法通过 Windows 徽标检查。使用网络的 Windows 8 样式“地铁”应用程序将自动绕过所有 LSP。
我已经用各种应用程序测试了这种方法,结果不一:32 位应用程序可以工作,但 64 位不能,即我能够绑定 64 位资源管理器(可能是因为它的选项卡进程默认为 32 位),但是不是 64 位Waterfox浏览器或其他 64 位应用程序。
| 归档时间: |
|
| 查看次数: |
32548 次 |
| 最近记录: |