Download Horizon :: Staff Members :: TheTechGame.com :: XboxMB YouTube


Old 02-05-2012   #1 (permalink)
Regular Member
 
Join Date: Feb 2012
Location: Kentucky
Posts: 27
Thanks: 11
Default Host File Editor v1

This is a basic program i made that edits your host file instead of going to system32 and opening it in notepad.

Pictures



Virus Scan



Download
__________________
Possibilities is offline Send a message via AIM to Possibilities Send a message via Skype™ to Possibilities
Reply With Quote
The following users thanked this post: j0shh0a, LegendKiller


Old 02-05-2012   #2 (permalink)

Kink's Avatar
Sailing the 7 seas.
Join Date: Sep 2010
Location: ****ing clouds.
Posts: 2,710
Thanks: 3,408
Default Re: Host File Editor v1

This could be done in like 2 lines of code but good work anyways.
__________________
[ Steam/Skype: iiKink | AIM: Jimmyclimo ]
Kink is offline Send a message via AIM to Kink Send a message via Skype™ to Kink
Reply With Quote
The following user thanked this post: hbg53195


Old 02-05-2012   #3 (permalink)
Cheater912's Avatar
:D
Join Date: Jul 2010
Location: New York
Posts: 5,683
Thanks: 12,225
Default Re: Host File Editor v1

At least make a list view or something that makes it easier to edit.
__________________
Cheater912 is offline Send a message via Skype™ to Cheater912
Reply With Quote
The following users thanked this post: Brad1571, sgt frankieboy


Old 02-05-2012   #4 (permalink)
RDCA's Avatar
Join Date: Jun 2011
Posts: 138
Thanks: 63
Default Re: Host File Editor v1

I made one of these by request a while back, here is my source:

Code:
'Written by RDCA. Done by request. Fully commented as well. 

'NOTE: This will NOT work in the debugger as it requires elevated permissions, to test comple the executable then run
'from the Debug folder.


Imports System.IO
Imports System.Threading



Public Class Form1
    'Declaring a variable that will hold the backup of the original host file.
    Public backup As String


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'Creating a stream reader
        Dim sr As StreamReader = New StreamReader("C:\Windows\System32\drivers\etc\hosts")

        'Setting textbox1's text to the text/value that is read from the StreamReader
        TextBox1.Text = sr.ReadToEnd

        'Closing the stream.
        sr.Close()

        'Setting the value of our backup.
        backup = TextBox1.Text
    End Sub





    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        'Clearing the textbox and setting its new text to the backup.
        TextBox1.Clear()
        TextBox1.Text = backup
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        'Clearing textbox1's text and setting the value to the defualt text. (Located in resources)
        TextBox1.Clear()
        TextBox1.Text = My.Resources.String1
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        'Deleting the file (Requires elevated permissions.
        File.Delete("C:\Windows\System32\drivers\etc\hosts")

        'Declaring our StreamWrriter
        Dim sw As StreamWriter

        'Setting the path of the StreamWriter
        sw = New StreamWriter("C:\Windows\System32\drivers\etc\hosts")

        'Writing our new host file and closing the stream.
        sw.Write(TextBox1.Text)
        sw.Close()
    End Sub

    Private Sub CheckBox1_Click(sender As Object, e As EventArgs) Handles CheckBox1.Click
        'Checking to see if checkbox1 is checked.
        If CheckBox1.Checked = True Then

            'Now we are checking to see if the background worker is already working.
            If Not BackgroundWorker1.IsBusy Then

                'If it's not then we are going to start the background worker.
                BackgroundWorker1.RunWorkerAsync()
            End If
        Else

            'If checkbox1 is not checked then we are going to cancel our background worker
            BackgroundWorker1.CancelAsync()
        End If
    End Sub

    Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork

        'Checking to make sure checkbox1 is checked.
        While CheckBox1.Checked = True
            'Deleting the hosts file.
            File.Delete("C:\Windows\System32\drivers\etc\hosts")

            'Declaring our Stremwriter.
            Dim sw As StreamWriter

            'Setting the path for the hostfile.
            sw = New StreamWriter("C:\Windows\System32\drivers\etc\hosts")

            'Writing the new hostfile, then closing the stream.
            sw.Write(TextBox1.Text)
            sw.Close()

            'Wating 10 seconds before restarting the check for checkbox1.
            Thread.Sleep(1000)
        End While

    End Sub
End Class
Had a couple cool features in mine. Here is a crappy picture I took back then:



& here is the source download for whatevz: Multiupload.com - upload your files to multiple file hosting sites!

Btw when you do something easy like this, you might as well post the source, as it really is 2 lines of code in the simplest form.
RDCA is offline
Reply With Quote


Old 02-05-2012   #5 (permalink)
Regular Member
 
Join Date: Feb 2012
Location: Kentucky
Posts: 27
Thanks: 11
Default Re: Host File Editor v1

Quote:
Originally Posted by RDCA View Post
I made one of these by request a while back, here is my source:

Code:
'Written by RDCA. Done by request. Fully commented as well. 

'NOTE: This will NOT work in the debugger as it requires elevated permissions, to test comple the executable then run
'from the Debug folder.


Imports System.IO
Imports System.Threading



Public Class Form1
    'Declaring a variable that will hold the backup of the original host file.
    Public backup As String


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'Creating a stream reader
        Dim sr As StreamReader = New StreamReader("C:\Windows\System32\drivers\etc\hosts")

        'Setting textbox1's text to the text/value that is read from the StreamReader
        TextBox1.Text = sr.ReadToEnd

        'Closing the stream.
        sr.Close()

        'Setting the value of our backup.
        backup = TextBox1.Text
    End Sub





    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        'Clearing the textbox and setting its new text to the backup.
        TextBox1.Clear()
        TextBox1.Text = backup
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        'Clearing textbox1's text and setting the value to the defualt text. (Located in resources)
        TextBox1.Clear()
        TextBox1.Text = My.Resources.String1
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        'Deleting the file (Requires elevated permissions.
        File.Delete("C:\Windows\System32\drivers\etc\hosts")

        'Declaring our StreamWrriter
        Dim sw As StreamWriter

        'Setting the path of the StreamWriter
        sw = New StreamWriter("C:\Windows\System32\drivers\etc\hosts")

        'Writing our new host file and closing the stream.
        sw.Write(TextBox1.Text)
        sw.Close()
    End Sub

    Private Sub CheckBox1_Click(sender As Object, e As EventArgs) Handles CheckBox1.Click
        'Checking to see if checkbox1 is checked.
        If CheckBox1.Checked = True Then

            'Now we are checking to see if the background worker is already working.
            If Not BackgroundWorker1.IsBusy Then

                'If it's not then we are going to start the background worker.
                BackgroundWorker1.RunWorkerAsync()
            End If
        Else

            'If checkbox1 is not checked then we are going to cancel our background worker
            BackgroundWorker1.CancelAsync()
        End If
    End Sub

    Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork

        'Checking to make sure checkbox1 is checked.
        While CheckBox1.Checked = True
            'Deleting the hosts file.
            File.Delete("C:\Windows\System32\drivers\etc\hosts")

            'Declaring our Stremwriter.
            Dim sw As StreamWriter

            'Setting the path for the hostfile.
            sw = New StreamWriter("C:\Windows\System32\drivers\etc\hosts")

            'Writing the new hostfile, then closing the stream.
            sw.Write(TextBox1.Text)
            sw.Close()

            'Wating 10 seconds before restarting the check for checkbox1.
            Thread.Sleep(1000)
        End While

    End Sub
End Class
Had a couple cool features in mine. Here is a crappy picture I took back then:



& here is the source download for whatevz: Multiupload.com - upload your files to multiple file hosting sites!

Btw when you do something easy like this, you might as well post the source, as it really is 2 lines of code in the simplest form.
o yea i remember you made yours on ttg
__________________
Possibilities is offline Send a message via AIM to Possibilities Send a message via Skype™ to Possibilities
Reply With Quote




Old 02-05-2012   #6 (permalink)
RDCA's Avatar
Join Date: Jun 2011
Posts: 138
Thanks: 63
Default Re: Host File Editor v1

Yea, I don't think I even bothered to post it here, as I didn't think it would help anyone.
RDCA is offline
Reply With Quote


Old 02-05-2012   #7 (permalink)
Regular Member
 
Join Date: Feb 2012
Location: Kentucky
Posts: 27
Thanks: 11
Default Re: Host File Editor v1

Quote:
Originally Posted by RDCA View Post
Yea, I don't think I even bothered to post it here, as I didn't think it would help anyone.
i was just bored so i posted mine
__________________
Possibilities is offline Send a message via AIM to Possibilities Send a message via Skype™ to Possibilities
Reply With Quote


Old 02-06-2012   #8 (permalink)
Regular Member
j0shh0a's Avatar
Join Date: Feb 2012
Location: http://www.youtube.com/j0shh0a
Posts: 11
Thanks: 8
Default Re: Host File Editor v1

good job!
it's great seeing programmers post there tool's on xboxmb. I'v just started learning so I don't know much but this tool could be of use to me.
j0shh0a is offline
Reply With Quote


Old 02-06-2012   #9 (permalink)
Regular Member
 
Join Date: Feb 2012
Location: Kentucky
Posts: 27
Thanks: 11
Default Re: Host File Editor v1

Quote:
Originally Posted by j0shh0a View Post
good job!
it's great seeing programmers post there tool's on xboxmb. I'v just started learning so I don't know much but this tool could be of use to me.
no problem be sure to check out my xbox 360 stalker if you have an xbox
__________________
Possibilities is offline Send a message via AIM to Possibilities Send a message via Skype™ to Possibilities
Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:31 AM.


 

Powered by vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
COPYRIGHT (c) 2010 - 2012 - XboxMB - DESIGN BY:
EDENWEBS.COM