- Bağlantıyı al
- X
- E-posta
- Diğer Uygulamalar
Merhaba arkadaşlar yine ufak bir program ile karşınızdayım.
Bu program "C:/Windows/System32/drivers/etc/" dizininde bulunan hosts dosyasını düzenlemek için yazıldı. biliyorsunuz bazı programların server ile iletişimini kesmek için bu hosts dosyası düzenlenir ve yönlendirilecek dns adresi ve yönlenecek adres ayarlanır.
Örneğin bilgisayarınızdan www.yandex.com.tr adresine girilmesini istemiyorsunuz bunun için hosts dosyasını açıp
satırını eklersiniz bilgisayar yandex.com.tr ye girmek yerine 127.0.0.1 (-> pcnizin localhost adresi) adresine sizi yönlendirecektir.
Yada bilgisayarınızda iis server kurulu attınız dosyalarınızı servera adres çubuğuna localhost yada 127.0.0.1 yazmak yerine direk istediğiniz adresi yazın serhadbahadirtekkol.com.tr
bu adres sizin localhostunuza yönlendirecektir.
lisanslı programları kullanırken sürekli karşımıza gelen yakalanma ekranından kurtulmanın bir yoluda budur.
buraya sistemin dns adreslerini girersiniz program server a veri gönderdiğini düşünür ancak sizin sisteminizdeki localhosta gönderir yada istediğiniz başka bir adrese.
Programın ekran görüntüsü aşağıdaki gibi
Programı Buradan indirebilirsiniz
Bu program "C:/Windows/System32/drivers/etc/" dizininde bulunan hosts dosyasını düzenlemek için yazıldı. biliyorsunuz bazı programların server ile iletişimini kesmek için bu hosts dosyası düzenlenir ve yönlendirilecek dns adresi ve yönlenecek adres ayarlanır.
Örneğin bilgisayarınızdan www.yandex.com.tr adresine girilmesini istemiyorsunuz bunun için hosts dosyasını açıp
127.0.0.1 www.yandex.com.tr
satırını eklersiniz bilgisayar yandex.com.tr ye girmek yerine 127.0.0.1 (-> pcnizin localhost adresi) adresine sizi yönlendirecektir.
Yada bilgisayarınızda iis server kurulu attınız dosyalarınızı servera adres çubuğuna localhost yada 127.0.0.1 yazmak yerine direk istediğiniz adresi yazın serhadbahadirtekkol.com.tr
127.0.0.1 serhadbahadirtekkol.com.tr
bu adres sizin localhostunuza yönlendirecektir.
lisanslı programları kullanırken sürekli karşımıza gelen yakalanma ekranından kurtulmanın bir yoluda budur.
buraya sistemin dns adreslerini girersiniz program server a veri gönderdiğini düşünür ancak sizin sisteminizdeki localhosta gönderir yada istediğiniz başka bir adrese.
Programın ekran görüntüsü aşağıdaki gibi
Programı Buradan indirebilirsiniz
programın kaynak kodları ise
- ////////////-SerhadBahadir-////////
- ////Coded By SerhadBahadirTEKKOL
- ////bahadir_tekkol@hotmail.com
- //// 03.02.2014
- //////////////////////////////////
- ////Hosts File Edit Tool
- ///.Net Framework 4.5
- ///VS2013_Ultimate
- ////////////////////////////////
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.IO;
- namespace HostDuzenlemeProgram
- {
- public partial class Form1 : Form
- {
- string dosyayolu= "C:/Windows/System32/drivers/etc/hosts";
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- toolTip1.SetToolTip(listBox1, " İşlemler İçin Right Click ");
- using (StreamReader stRead = new StreamReader(dosyayolu))
- while (!stRead.EndOfStream)
- {
- listBox1.Items.Add(stRead.ReadLine());
- }
- int satirbasi = listBox1.Items.Count;
- for (int i = 0; i <satirbasi; i++)
- {
- string cumle = listBox1.Items[i].ToString();
- if (cumle.StartsWith("#") || cumle.Length<1)
- {
- listBox1.Items.Remove(listBox1.Items[i]);
- i = i - 1;
- satirbasi = satirbasi - 1;
- }
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- string genellocal="";
- if (textBox1.Text!="")
- {
- if (textBox2.Text== "")
- {
- genellocal = "127.0.0.1 ";
- }
- else
- {
- genellocal=textBox2.Text+" ";
- }
- listBox1.Items[Convert.ToInt32(label3.Text)] =genellocal+ textBox1.Text; ;
- }
- else
- {
- MessageBox.Show("Yönlendirilecek Dns ve adresi tam giriniz");
- }
- }
- private string dosyaayristir(string adres)
- {
- string siralama = adres;
- string sonuc;
- string dnscozumlenen="";
- int sirasi = siralama.IndexOf(" ");
- if (sirasi!=-1)
- {
- dnscozumlenen = siralama.Substring(0, sirasi);
- sonuc = siralama.Remove(0, sirasi+1);
- label3.Text = listBox1.SelectedIndex.ToString();
- if (sonuc.StartsWith(" ") || sonuc.StartsWith("\t"))
- {
- label3.Text =listBox1.SelectedIndex.ToString();
- }
- }
- else
- {
- label3.Text = listBox1.SelectedIndex.ToString();
- sonuc = "";
- }
- textBox2.Text=dnscozumlenen;
- return sonuc;
- }
- private void linkLabel1_MouseClick(object sender, MouseEventArgs e)
- {
- textBox3.Text = listBox1.Items[Convert.ToInt32(label3.Text)].ToString();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < listBox1.Items.Count; i++)
- {
- string cumle = listBox1.Items[i].ToString();
- if (cumle.StartsWith("127.0.0.1"))
- {
- cumle = cumle.Remove(0, 9);
- cumle= cumle.Replace(" ", "");
- cumle = cumle.Replace("\t", "");
- cumle = "127.0.0.1 " + cumle;
- listBox1.Items[i] = cumle;
- }
- else
- {
- if (!cumle.StartsWith("::1"))
- {
- int ilkbos;
- string basdns;
- ilkbos = cumle.IndexOf(" ");
- basdns = cumle.Substring(0, ilkbos);
- cumle = cumle.Remove(0, ilkbos);
- cumle = cumle.Replace(" ", "");
- cumle = cumle.Replace("\t", "");
- cumle = basdns + " " + cumle;
- listBox1.Items[i] = cumle;
- }
- }
- }
- }
- private void tamamıToolStripMenuItem_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < listBox1.Items.Count; i++)
- {
- string cumle = listBox1.Items[i].ToString();
- if (cumle.StartsWith("127.0.0.1"))
- {
- cumle = cumle.Remove(0, 9);
- cumle = cumle.Replace(" ", "");
- cumle = cumle.Replace("\t", "");
- cumle = "127.0.0.1 " + cumle;
- listBox1.Items[i] = cumle;
- }
- else
- {
- try
- {
- int ilkbos;
- string basdns;
- ilkbos = cumle.IndexOf(" ");
- basdns = cumle.Substring(0, ilkbos);
- cumle = cumle.Remove(0, ilkbos);
- cumle = cumle.Replace(" ", "");
- cumle = cumle.Replace("\t", "");
- cumle = basdns + " " + cumle;
- listBox1.Items[listBox1.SelectedIndex] = cumle;
- }
- catch
- {
- }
- }
- }
- }
- private void seçileniToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (listBox1.SelectedIndex==-1)
- {
- MessageBox.Show("Öncelikle Seçim Yapınız");
- }
- else
- {
- string cumle = listBox1.Items[listBox1.SelectedIndex].ToString();
- if (cumle.StartsWith("127.0.0.1"))
- {
- cumle = cumle.Remove(0, 9);
- cumle = cumle.Replace(" ", "");
- cumle = cumle.Replace("\t", "");
- cumle = "127.0.0.1 " + cumle;
- listBox1.Items[listBox1.SelectedIndex] = cumle;
- }
- else
- {
- int ilkbos;
- string basdns;
- ilkbos = cumle.IndexOf(" ");
- basdns = cumle.Substring(0, ilkbos);
- cumle = cumle.Remove(0, ilkbos);
- cumle = cumle.Replace(" ", "");
- cumle = cumle.Replace("\t", "");
- cumle = basdns+" " + cumle;
- listBox1.Items[listBox1.SelectedIndex] = cumle;
- }
- }
- }
- private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- textBox1.Text = dosyaayristir(listBox1.SelectedItem.ToString());
- }
- private void duzenleToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (listBox1.SelectedIndex == -1)
- {
- MessageBox.Show("Öncelikle Seçim Yapınız");
- }
- else
- {
- textBox1.Text = dosyaayristir(listBox1.SelectedItem.ToString());
- }
- }
- private void button3_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < header.Items.Count; i++)
- {
- listBox1.Items.Insert(i, header.Items[i]) ;
- }
- StreamWriter yazmaStream = new StreamWriter(dosyayolu);
- foreach (var item in listBox1.Items)
- {
- yazmaStream.WriteLine(item.ToString());
- }
- yazmaStream.Close();
- for (int i = 0; i < 19; i++)
- {
- listBox1.Items.RemoveAt(0);
- }
- }
- private void button4_Click(object sender, EventArgs e)
- {
- if (textBox1.Text!="")
- {
- string genellocal = "";
- if (textBox2.Text == "")
- {
- genellocal = "127.0.0.1 ";
- }
- else
- {
- genellocal = textBox2.Text + " ";
- }
- listBox1.Items.Add(genellocal + " " + textBox1.Text);
- }
- }
- private void silToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (listBox1.SelectedIndex != -1)
- {
- listBox1.Items.RemoveAt(listBox1.SelectedIndex);
- }
- else
- {
- MessageBox.Show("silmek için lütfen listeden seçim yapınız");
- }
- }
- }
- }
Yorumlar
Yorum Gönder