HasanCanKarakahya Posted November 15, 2011 Share Posted November 15, 2011 [center]Programı kurarken interneti kesmek istiyorum ve kurulduğunda tekrar otomatikman aktifleşmesini istiyorum bana bir autoit kodu verirmisiniz ama win7 ve win xp de çalışacak şekilde yapmak istiyorum yada programın internet bağlantısını kesmek isterim ama kurulurken olsun. saygılar...[/center] Quote Link to comment Share on other sites More sharing options...
blue_life Posted November 15, 2011 Share Posted November 15, 2011 @HasanCanKarakahya Program kurulurken bağlandığı sitelerin isimlerini belirleyip, hosts dosyasından engelleyebilirsin! Tam olarak niçin böyle bir şey yapmak istiyorsun? Biraz daha detay verebilirsen seni daha iyi yönlendirebiliriz... Internete erişimi kesmek için internetin kullandığı birservisi durdurabilir, dns değiştirebiirsin. Yani duruma göre düşünüp araştırarak güzel yöntemler bulunabilir bu konuda! Quote Link to comment Share on other sites More sharing options...
HasanCanKarakahya Posted November 15, 2011 Author Share Posted November 15, 2011 Hocam hosts tan nası kesebiliriz onu anlatın. Quote Link to comment Share on other sites More sharing options...
blue_life Posted November 15, 2011 Share Posted November 15, 2011 (edited) Programı çalıştırmadan önce programın ulaşmaya çalıştığı sitenin ismini hosts dosyasına ekleyeceksin. Misal program www.google.com sitesine ulaşmaya çalışıyorsa, hosts dosaysına aşağıdaki satırları ekleyeceksin. [color="#8B0000"][b]127.0.0.1 www.google.com 127.0.0.1 google.com[/b][/color] [tnctr='http://www.tnctr.com/topic/181780-google-earth-icin-autoit-ile-hosts-dosyasy/']Autoit için bu konuda bir örnek paylaşmıştım...[/tnctr] Edited November 15, 2011 by blue_life Quote Link to comment Share on other sites More sharing options...
blue_life Posted November 15, 2011 Share Posted November 15, 2011 [codebox];Writeted by BlueLife #RequireAdmin #NoTrayIcon ;Rahat kullanabilmek için dosyanın konumu bir değişkene atıyoruz. Local $HostFile = @WindowsDir & "\System32\drivers\etc\hosts" ;Dosyayı okuyoruz. Local $BlueReadFile = _Blue_FileRead_To_Array($HostFile, False) ;Ilgili içerikte domainin olup olmadığına bakıyoruz, yoksa alt satıra ekliyoruz. _Blue_Host_Adline($BlueReadFile, "127.0.0.1", "tonec.com") _Blue_Host_Adline($BlueReadFile, "127.0.0.1", "www.tonec.com") _Blue_Host_Adline($BlueReadFile, "127.0.0.1", "registeridm.com") _Blue_Host_Adline($BlueReadFile, "127.0.0.1", "www.registeridm.com") _Blue_Host_Adline($BlueReadFile, "127.0.0.1", "secure.registeridm.com") _Blue_Host_Adline($BlueReadFile, "127.0.0.1", "internetdownloadmanager.com") _Blue_Host_Adline($BlueReadFile, "127.0.0.1", "www.internetdownloadmanager.com") _Blue_Host_Adline($BlueReadFile, "127.0.0.1", "secure.internetdownloadmanager.com") _Blue_Host_Adline($BlueReadFile, "127.0.0.1", "mirror.internetdownloadmanager.com") _Blue_Host_Adline($BlueReadFile, "127.0.0.1", "mirror2.internetdownloadmanager.com") _Blue_Host_Adline($BlueReadFile, "127.0.0.1", "mirror3.internetdownloadmanager.com") ; .... Bu şekilde devam edecek ; .... Bu şekilde devam edecek ;Değiştirdiğimiz içeriği yazıyoruz. _Blue_Host_Write($BlueReadFile, $HostFile) If @error = 0 Then ;Istersen mesajları silersin MsgBox(64, "", "Işlem başarılı!") Else ;Istersen mesajları silersin MsgBox(64, "", "Işlem hatalı!") EndIf Func _Blue_Host_Adline(ByRef $ArrayList, $IP, $Domain) Local $Find_Domain, $BLUE_LINE, $BL_Instr For $I = 1 To $ArrayList[0] $BLUE_LINE = StringStripWS($ArrayList[$I], 3) If StringIsDigit(StringLeft($BLUE_LINE, 1)) = 0 Then ContinueLoop $BL_Instr = StringInStr($BLUE_LINE, Chr(32)) If $BL_Instr = 0 Then $BL_Instr = StringInStr($BLUE_LINE, @TAB) If $BL_Instr = 0 Then ContinueLoop $Find_Domain = StringStripWS(StringTrimLeft($BLUE_LINE, $BL_Instr), 3) If $Find_Domain = $Domain Then $ArrayList[$I] = $IP & " " & $Domain Return 1 EndIf Next If UBound($ArrayList) >= $ArrayList[0] Then ReDim $ArrayList[$ArrayList[0] + 100] $ArrayList[0] += 1 $ArrayList[$ArrayList[0]] = $IP & " " & $Domain Return 1 EndFunc ;==>_Blue_Host_Adline Func _Blue_Host_Write(ByRef $ArrayList, $TARGET_FILE) Local $Return = True, $Blue_Write FileSetAttrib($TARGET_FILE, "-RSH") Local $File_hwnd = FileOpen($TARGET_FILE, 2) If $File_hwnd = -1 Then $Return = False Else For $I = 1 To $ArrayList[0] $Blue_Write &= $ArrayList[$I] & @CRLF Next If FileWrite($TARGET_FILE, $Blue_Write) = 0 Then $Return = False EndIf ;FileSetAttrib($TARGET_FILE, "+RSH") If $Return = False Then Return SetError(1, 0, 0) Return 1 EndFunc ;==>_Blue_Host_Write Func _Blue_FileRead_To_Array($TARGET_FILE, $SStripWS = True) ;Dosya|Fazla enterleri silmek Local $Return_Array[1] = [0] Local $FileGetSize = FileGetSize($TARGET_FILE) If $TARGET_FILE = "" Or FileExists($TARGET_FILE) = 0 Or $FileGetSize = 0 Then Return SetError(1, 0, $Return_Array) Local $File_hwnd = FileOpen($TARGET_FILE, 0) If $File_hwnd = -1 Then Return SetError(2, 0, $Return_Array) Local $File_Read = FileRead($File_hwnd, $FileGetSize) FileClose($File_hwnd) If StringLen($File_Read) < 1 Then Return SetError(3, 0, $Return_Array) If StringInStr($File_Read, @LF) Then $File_Read = StringStripCR($File_Read) ElseIf StringInStr($File_Read, @CR) Then $File_Read = StringReplace($File_Read, @CR, @LF) EndIf If $SStripWS = True Then Do $File_Read = StringReplace($File_Read, @LF & @LF, @LF) Until @extended = 0 $File_Read = StringStripWS($File_Read, 3) EndIf $Return_Array = StringSplit($File_Read, @LF) Return $Return_Array EndFunc ;==>_Blue_FileRead_To_Array[/codebox] Quote Link to comment Share on other sites More sharing options...
xarax Posted November 15, 2011 Share Posted November 15, 2011 (edited) IDM güncellemelerini host dosyasından engellemek için ben bunu kullanıyorum. [code]FileSetAttrib(@SystemDir & "\drivers\etc\hosts", "-RSH");hosts dosyasının sadece okunabilir, sistem dosyası ve gizli dosya özelliklerini kaldır. $Dosya = FileRead(@SystemDir & "\drivers\etc\hosts") ; hosts dosyasını oku ;Engellenecek Siteler $site1 = "www.tonec.com" $site2 = " tonec.com" $site3 = "www.registeridm.com" $site4 = " registeridm.com" $site5 = "secure.registeridm.com" $site6 = "www.internetdownloadmanager.com" $site7 = " internetdownloadmanager.com" $site8 = "secure.internetdownloadmanager.com" $site9 = "mirror.internetdownloadmanager.com" $site10 = "mirror2.internetdownloadmanager.com" ;Daha önce varmı kontrol et, yoksa engelle. if StringInStr($Dosya, $site1)=0 Then FileWrite(@SystemDir & "\drivers\etc\hosts", @CRLF & "127.0.0.1 " & $site1) EndIf If StringInStr($Dosya, $site2)=0 Then FileWrite(@SystemDir & "\drivers\etc\hosts", @CRLF & "127.0.0.1" & $site2) EndIf if StringInStr($Dosya, $site3)=0 Then FileWrite(@SystemDir & "\drivers\etc\hosts", @CRLF & "127.0.0.1 " & $site3) EndIf if StringInStr($Dosya, $site4)=0 Then FileWrite(@SystemDir & "\drivers\etc\hosts", @CRLF & "127.0.0.1" & $site4) EndIf If StringInStr($Dosya, $site5)=0 Then FileWrite(@SystemDir & "\drivers\etc\hosts", @CRLF & "127.0.0.1 " & $site5) EndIf if StringInStr($Dosya, $site6)=0 Then FileWrite(@SystemDir & "\drivers\etc\hosts", @CRLF & "127.0.0.1 " & $site6) EndIf if StringInStr($Dosya, $site7)=0 Then FileWrite(@SystemDir & "\drivers\etc\hosts", @CRLF & "127.0.0.1" & $site7) EndIf If StringInStr($Dosya, $site8)=0 Then FileWrite(@SystemDir & "\drivers\etc\hosts", @CRLF & "127.0.0.1 " & $site8) EndIf if StringInStr($Dosya, $site9)=0 Then FileWrite(@SystemDir & "\drivers\etc\hosts", @CRLF & "127.0.0.1 " & $site9) EndIf if StringInStr($Dosya, $site10)=0 Then FileWrite(@SystemDir & "\drivers\etc\hosts", @CRLF & "127.0.0.1 " & $site10) EndIf[/code] Edited November 15, 2011 by xarax Quote Link to comment Share on other sites More sharing options...
Mehmet Posted November 15, 2011 Share Posted November 15, 2011 @blue_life komple interneti kesmek isterse nasıl yapıcak.? ve program kurulumu bittikten sonra tekrardan açtıracak Quote Link to comment Share on other sites More sharing options...
blue_life Posted November 15, 2011 Share Posted November 15, 2011 @xarax Evet oda güzel ama ilgili sitelerden birisinin gerçek ipsi hosts dosyasında ekli olur ise senin kodlama sorun çıkartır! Yani 127.0.0.1 yerine sitenin gerçek ipsi olma ihtimali düşükte olsa var... Benim verdiğim örneği kendine göre düzenleyip kullanmanı tavsiye ederim... @MeHMeTBeN [tnctr='http://www.tnctr.com/topic/177522-ynterneti-kapatyp-acma/']Burda daha önce bir şeyler yazmıştık...[/tnctr] Quote Link to comment Share on other sites More sharing options...
Mehmet Posted November 16, 2011 Share Posted November 16, 2011 @blue_life orada SimpsoN_Bart arkadaşımızın verdiği devcon.exe ile çalışıyor senin verdiğinde ise form var bu kodlara göre uyarlayamazmıyız [codebox] Opt("TrayMenuMode", 1) TrayTip("TNCTR", "Program Yüklenirken lütfen bekleyiniz", 30, 4) Sleep(2000) ;program kurulmadan internet kapanacak FileInstall("program.exe",@TempDir & "\program.exe") ShellExecuteWait(@TempDir & "\program.exe","/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-","","",@SW_HIDE) FileDelete(@TempDir & "\program.exe") ;program bittikten sonra internet açılacak TrayTip("TNCTR", "Program Başarıyla Yüklendi", 10, 4) Sleep(2000) [/codebox] Quote Link to comment Share on other sites More sharing options...
blue_life Posted November 16, 2011 Share Posted November 16, 2011 [codebox]Opt("TrayMenuMode", 1) TrayTip("TNCTR", "Program Yüklenirken lütfen bekleyiniz", 30, 4) Sleep(2000) RunWait("ipconfig.exe /release *",@SystemDir,@SW_HIDE) ; switch off FileInstall("program.exe",@TempDir & "\program.exe") ShellExecuteWait(@TempDir & "\program.exe","/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-","","",@SW_HIDE) FileDelete(@TempDir & "\program.exe") RunWait("ipconfig.exe /renew *",@SystemDir,@SW_HIDE) ; switch on TrayTip("TNCTR", "Program Başarıyla Yüklendi", 10, 4) Sleep(2000)[/codebox] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.