Skip to content

Commit 21f0170

Browse files
committed
update
0 parents  commit 21f0170

13 files changed

+798
-0
lines changed

ForceBindIP - Download.au3

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#RequireAdmin
2+
3+
#include <WindowsConstants.au3>
4+
#include <Constants.au3>
5+
#include <FileConstants.au3>
6+
#include <MsgBoxConstants.au3>
7+
#include <WinAPIFiles.au3>
8+
9+
$system32 = "C:\Windows\System32"
10+
$sysWOW64 = "C:\windows\sysWOW64"
11+
$sZipFile = @ScriptDir & "\ForceBindIP.zip"
12+
$sDestFolder = @ScriptDir & "\ForceBindIP"
13+
14+
DownloadConfig()
15+
16+
17+
Func DownloadConfig()
18+
If FileExists ( "C:\Windows\System32\BindIP.dll" ) Or FileExists("C:\Windows\sysWOW64\BindIP64.dll") Then
19+
MsgBox(0,"File Exist","You Do Not Need To Use This Bottom " & @CRLF & @CRLF & "Everything Looks Great")
20+
21+
ElseIf FileExists("C:\Windows\sysWOW64") Then; System64
22+
; Download
23+
InetGet ( "https://r1ch.net/assets/forcebindip/ForceBindIP-1.32.zip", "ForceBindIP.zip" )
24+
25+
; Unzip
26+
UnZip($sZipFile, $sDestFolder)
27+
If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error unzipping file : " & @error)
28+
29+
; Copy
30+
FileCopy ( @ScriptDir & "\ForceBindIP\BindIP.dll", $system32)
31+
FileCopy ( @ScriptDir & "\ForceBindIP\BindIP64.dll", $system32)
32+
FileCopy ( @ScriptDir & "\ForceBindIP\ForceBindIP.exe", $system32)
33+
FileCopy ( @ScriptDir & "\ForceBindIP\ForceBindIP64.exe", $system32)
34+
FileCopy ( @ScriptDir & "\ForceBindIP\BindIP.dll", $sysWOW64)
35+
FileCopy ( @ScriptDir & "\ForceBindIP\BindIP64.dll", $sysWOW64)
36+
FileCopy ( @ScriptDir & "\ForceBindIP\ForceBindIP.exe", $sysWOW64)
37+
FileCopy ( @ScriptDir & "\ForceBindIP\ForceBindIP64.exe", $sysWOW64)
38+
MsgBox(0,"Done","Configuration done now u can use the app")
39+
40+
Else ; System32
41+
; Download
42+
InetGet ( "https://r1ch.net/assets/forcebindip/ForceBindIP-1.32.zip", "ForceBindIP.zip" )
43+
44+
; Unzip
45+
UnZip($sZipFile, $sDestFolder)
46+
If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error unzipping file : " & @error)
47+
48+
; Copy
49+
FileCopy ( @ScriptDir & "\ForceBindIP\BindIP.dll", $system32)
50+
FileCopy ( @ScriptDir & "\ForceBindIP\BindIP64.dll", $system32)
51+
FileCopy ( @ScriptDir & "\ForceBindIP\ForceBindIP.exe", $system32)
52+
FileCopy ( @ScriptDir & "\ForceBindIP\ForceBindIP64.exe", $system32)
53+
MsgBox(0,"Done","Configuration done now u can use the app")
54+
55+
EndIf
56+
EndFunc
57+
58+
Func UnZip($sZipFile, $sDestFolder)
59+
If Not FileExists($sZipFile) Then Return SetError (1) ; source file does not exists
60+
If Not FileExists($sDestFolder) Then
61+
If Not DirCreate($sDestFolder) Then Return SetError (2) ; unable to create destination
62+
Else
63+
If Not StringInStr(FileGetAttrib($sDestFolder), "D") Then Return SetError (3) ; destination not folder
64+
EndIf
65+
Local $oShell = ObjCreate("shell.application")
66+
Local $oZip = $oShell.NameSpace($sZipFile)
67+
Local $iZipFileCount = $oZip.items.Count
68+
If Not $iZipFileCount Then Return SetError (4) ; zip file empty
69+
For $oFile In $oZip.items
70+
$oShell.NameSpace($sDestFolder).copyhere($ofile)
71+
Next
72+
EndFunc ;==>UnZip

ForceBindIP - Gui.au3

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
Opt("TrayMenuMode",1)
2+
3+
#include <ButtonConstants.au3>
4+
#include <ComboConstants.au3>
5+
#include <EditConstants.au3>
6+
#include <GUIConstantsEx.au3>
7+
#include <StaticConstants.au3>
8+
#include <WindowsConstants.au3>
9+
10+
#include <Constants.au3>
11+
12+
#include <FileConstants.au3>
13+
#include <MsgBoxConstants.au3>
14+
#include <WinAPIFiles.au3>
15+
16+
#Region ### START Koda GUI section ### Form=C:\Program Files (x86)\AutoIt3\koda_1.7.3.0\Extras\Import\ForceBindIP.kxf
17+
$ForceBindIP = GUICreate("ForceBindIP - By IX JB", 627, 429, -1, -1)
18+
$Group_appAddress = GUICtrlCreateGroup("Application Address", 16, 16, 593, 153)
19+
$Button_runApp = GUICtrlCreateButton("Run Application", 240, 120, 123, 25)
20+
$Input_appAddress = GUICtrlCreateInput("Application Address", 32, 72, 553, 21)
21+
$Combo_internetSelect = GUICtrlCreateCombo("Select Internet Connection", 32, 40, 553, 25)
22+
$Radio_x86 = GUICtrlCreateRadio("x86", 440, 112, 113, 17)
23+
$Radio_x64 = GUICtrlCreateRadio("x64", 440, 136, 113, 17)
24+
GUICtrlCreateGroup("", -99, -99, 1, 1)
25+
$Group_Quick = GUICtrlCreateGroup("Quick Access", 16, 176, 593, 209)
26+
$Button1 = GUICtrlCreateButton("", 40, 200, 91, 25)
27+
$Button2 = GUICtrlCreateButton("", 192, 200, 91, 25)
28+
$Button3 = GUICtrlCreateButton("", 352, 200, 91, 25)
29+
$Button4 = GUICtrlCreateButton("", 496, 200, 91, 25)
30+
$Button5 = GUICtrlCreateButton("", 40, 240, 91, 25)
31+
$Button6 = GUICtrlCreateButton("", 192, 240, 91, 25)
32+
$Button7 = GUICtrlCreateButton("", 352, 240, 91, 25)
33+
$Button8 = GUICtrlCreateButton("", 496, 240, 91, 25)
34+
$Button9 = GUICtrlCreateButton("", 40, 280, 91, 25)
35+
$Button10 = GUICtrlCreateButton("", 192, 280, 91, 25)
36+
$Button11 = GUICtrlCreateButton("", 352, 280, 91, 25)
37+
$Button12 = GUICtrlCreateButton("", 496, 280, 91, 25)
38+
$Button_downloadConfig = GUICtrlCreateButton("Download and Config ForceBindIP", 40, 344, 203, 25)
39+
$Button_Config = GUICtrlCreateButton("Config", 432, 344, 155, 25)
40+
GUICtrlCreateGroup("", -99, -99, 1, 1)
41+
$Label_copyRight = GUICtrlCreateLabel("IX JB", 520, 400, 84, 17)
42+
$Label_Internet = GUICtrlCreateLabel("Select Internet Connection", 16, 400, 474, 17)
43+
GUISetState(@SW_SHOW)
44+
#EndRegion ### END Koda GUI section ###
45+
46+
47+
; Vars
48+
Global $cFilePath = @ScriptDir & "\ForceBindIP-config.ini"
49+
50+
If FileExists($cFilePath) = False Then
51+
createIniFile() ; Create config.ini
52+
EndIf
53+
54+
GetInternet()
55+
setIniName()
56+
57+
While 1
58+
$nMsg = GUIGetMsg()
59+
60+
Switch $nMsg
61+
62+
Case $GUI_EVENT_CLOSE
63+
Exit
64+
65+
Case $Button_runApp
66+
If GUICtrlRead($Input_appAddress) <> "" Then
67+
runCMD(GUICtrlRead($Input_appAddress))
68+
Else
69+
MsgBox(0,"Input Can Not Be Empty","Please Enter Valid Data...")
70+
EndIf
71+
72+
Case $Button1
73+
$iniX = getIniX("Button1")
74+
runQuickCMD(getIniAddress("Button1"))
75+
76+
Case $Button2
77+
$iniX = getIniX("Button2")
78+
runQuickCMD(getIniAddress("Button2"))
79+
80+
Case $Button3
81+
$iniX = getIniX("Button3")
82+
runQuickCMD(getIniAddress("Button3"))
83+
84+
Case $Button4
85+
$iniX = getIniX("Button4")
86+
runQuickCMD(getIniAddress("Button4"))
87+
88+
Case $Button5
89+
$iniX = getIniX("Button5")
90+
runQuickCMD(getIniAddress("Button5"))
91+
92+
Case $Button6
93+
$iniX = getIniX("Button6")
94+
runQuickCMD(getIniAddress("Button6"))
95+
96+
Case $Button7
97+
$iniX = getIniX("Button7")
98+
runQuickCMD(getIniAddress("Button7"))
99+
100+
Case $Button8
101+
$iniX = getIniX("Button8")
102+
runQuickCMD(getIniAddress("Button8"))
103+
104+
Case $Button9
105+
$iniX = getIniX("Button9")
106+
runQuickCMD(getIniAddress("Button9"))
107+
108+
Case $Button10
109+
$iniX = getIniX("Button10")
110+
runQuickCMD(getIniAddress("Button10"))
111+
112+
Case $Button11
113+
$iniX = getIniX("Button11")
114+
runQuickCMD(getIniAddress("Button11"))
115+
116+
Case $Button12
117+
$iniX = getIniX("Button12")
118+
runQuickCMD(getIniAddress("Button12"))
119+
120+
Case $Button_Config
121+
ShellExecute($cFilePath)
122+
123+
Case $Button_downloadConfig
124+
GetFileDownload()
125+
ShellExecute("ForceBindIP - Download.exe")
126+
127+
Case $Combo_internetSelect
128+
$ComboString = GUICtrlRead($Combo_internetSelect)
129+
$iPosition = StringInStr($ComboString, "{")
130+
$iPosition = $iPosition - 1
131+
$sString = StringTrimLeft($ComboString,$iPosition)
132+
GUICtrlSetData($Label_Internet,$sString)
133+
134+
EndSwitch
135+
WEnd
136+
137+
138+
139+
140+
Func getIniName($section,$param)
141+
142+
; Ini Array
143+
Local $iArray = IniReadSection($cFilePath, $section)
144+
$name = $iArray[1][1] ; Name
145+
GUICtrlSetData($param,$name)
146+
147+
EndFunc
148+
149+
150+
Func getIniAddress($section)
151+
152+
; Ini Array
153+
Local $iArray = IniReadSection($cFilePath, $section)
154+
$address = $iArray[2][1] ; Address
155+
Return $address
156+
157+
EndFunc
158+
159+
160+
Func getIniX($section)
161+
162+
; Ini Array
163+
Local $iArray = IniReadSection($cFilePath, $section)
164+
$x = $iArray[3][1] ; X
165+
Return $x
166+
167+
EndFunc
168+
169+
170+
Func setIniName()
171+
172+
getIniName("Button1",$Button1)
173+
getIniName("Button2",$Button2)
174+
getIniName("Button3",$Button3)
175+
getIniName("Button4",$Button4)
176+
getIniName("Button5",$Button5)
177+
getIniName("Button6",$Button6)
178+
getIniName("Button7",$Button7)
179+
getIniName("Button8",$Button8)
180+
getIniName("Button9",$Button9)
181+
getIniName("Button10",$Button10)
182+
getIniName("Button11",$Button11)
183+
getIniName("Button12",$Button12)
184+
185+
EndFunc
186+
187+
188+
Func createIniFile()
189+
190+
For $i = 1 To 12 Step 1
191+
IniWrite ($cFilePath , "Button" & $i , "Name", "Button" & $i)
192+
IniWrite ($cFilePath , "Button" & $i , "Address", "" & @CRLF)
193+
;~ IniWrite ($cFilePath , "Button" & $i , "X", "" & @CRLF)
194+
Next
195+
196+
EndFunc
197+
198+
199+
Func GetInternet ()
200+
201+
; Get WMI
202+
$wbemFlagReturnImmediately = 0x10
203+
$wbemFlagForwardOnly = 0x20
204+
$colItems = ""
205+
$strComputer = "localhost"
206+
$Output=""
207+
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
208+
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionID != NULL", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
209+
210+
If IsObj($colItems) then
211+
For $objItem In $colItems
212+
If $objItem.NetEnabled = True Then
213+
GUICtrlSetData($Combo_internetSelect , "(" & $objItem.NetConnectionID & ") " & $objItem.Name & " --- " & $objItem.GUID)
214+
EndIf
215+
Next
216+
Else
217+
Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_NetworkAdapter" )
218+
Endif
219+
220+
EndFunc
221+
222+
223+
Func runCMD($address)
224+
225+
If (GUICtrlRead($Radio_x86) = 1) Then
226+
Run("cmd /c ForceBindIP -i " & GUICtrlRead($Label_Internet) & ' ' & $address,"" , @SW_HIDE)
227+
ElseIf (GUICtrlRead($Radio_x64) = 1) Then
228+
Run("cmd /c ForceBindIP64 -i " & GUICtrlRead($Label_Internet) & ' ' & $address,"" , @SW_HIDE)
229+
Else
230+
MsgBox(1,"Select One Option", "Please Select One Option")
231+
EndIf
232+
233+
EndFunc
234+
235+
236+
Func runQuickCMD($address)
237+
238+
If ($iniX = "86") Then
239+
Run("cmd /c ForceBindIP -i " & GUICtrlRead($Label_Internet) & ' ' & $address,"" , @SW_HIDE)
240+
ElseIf ($iniX = "64") Then
241+
Run("cmd /c ForceBindIP64 -i " & GUICtrlRead($Label_Internet) & ' ' & $address,"" , @SW_HIDE)
242+
Else
243+
MsgBox(1,"x64 / x86 Not Set", "Please Set 86 or 64 In X Section From Config File")
244+
EndIf
245+
246+
EndFunc
247+
248+
249+
Func GetFileDownload()
250+
251+
If FileExists(@ScriptDir & "\ForceBindIP - Download.exe") Then; System64
252+
Return Null
253+
Else
254+
InetGet ( "https://raw.githubusercontent.com/ixjb94/ForceBindIP-Gui/master/dist/ForceBindIP%20-%20Download.exe", "ForceBindIP - Download.exe" ) ; Download
255+
EndIf
256+
257+
EndFunc

0 commit comments

Comments
 (0)