Sign in to follow this  
Followers 0
Glyco

Block some websites

9 posts in this topic

i want to block access to some websites.

first i was thinking to hide or close the window, but now i think blocking full access is better.

website should not be opened at all.

this is for a basic website blocking program.

Share this post


Link to post
Share on other sites



i want to block access to some websites.

first i was thinking to hide or close the window, but now i think blocking full access is better.

website should not be opened at all.

this is for a basic website blocking program.

you could use the hosts file to redirect traffic to those sites to google

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

how to use that?

i know about the file but don't know what to do with that

an example?

Share this post


Link to post
Share on other sites

how to use that?

i know about the file but don't know what to do with that

an example?

the hosts file actually has examples contained within it. basically you give it the host address, then where you want that to go to. you have to open as administrator i believe to change

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

i think hosts file needs a lot of editing just for blocking one single website.

am i right?

because it seems i will have to put all the sub domains to block the website completely!

then how 'll i get all the sub domains info of a website?

Share this post


Link to post
Share on other sites

i think hosts file needs a lot of editing just for blocking one single website.

am i right?

because it seems i will have to put all the sub domains to block the website completely!

then how 'll i get all the sub domains info of a website?

hadn't though of sub domains, sorry... probably not the best or most elegant solution, but you could have a script check the url being displayed in the browser against a list of bad domains, then a bad domain is part of the url, parse out the subdomain, add it to hosts file and refresh the page.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

i think it would be better if you use window titles, i use this method:

Opt("WinTitleMatchMode", 2) ; Read more about its use
While 1
    If WinExists("Title") Then
        WinSetState("Title", "", @SW_HIDE) ; or use WinClose()
        MsgBox(64, "Access Denied", "Website Blocked.", 10)
    EndIf
    Sleep(250) ; for low cpu usage
WEnd

Or

Func _Close($title)
    If WinExists($title) Then
        WinSetState($title, "", @SW_HIDE) ; or use WinClose()
        MsgBox(64, "Access Denied", "Website "& $title & "Blocked.", 10)
    EndIf
    Sleep(250)
EndFunc
_Close("Some Website Title")

i have one more idea, we can create a script to block titles only on browsers.

by this way other program windows 'll not be effected by this censorship.

Here (This is for IE Only):

; Modify the script to work with all browsers.
Func _ProcessGetName($i_PID)
    If Not ProcessExists($i_PID) Then Return SetError(1, 0, '')
    If Not @error Then
        Local $a_Processes = ProcessList()
        For $i = 1 To $a_Processes[0][0]
            If $a_Processes[$i][1] = $i_PID Then Return $a_Processes[$i][0]
        Next
    EndIf
    Return SetError(1, 0, '')
EndFunc
Func _RunDOS($sCommand)
    Local $nResult = RunWait(@ComSpec & " /C " & $sCommand, "", @SW_HIDE)
    Return SetError(@error, @extended, $nResult)
EndFunc
Func _Close($Title)
    Opt("WinTitleMatchMode", 4)
    $Title = WinGetTitle("[REGEXPTITLE:(?i)"&$Title&"]", "")
    $P_pid = WinGetProcess($Title)
    $Process = _ProcessGetName($P_pid)
    If $Process = "IExplore.exe"
        WinClose($Title)
        MsgBox(64, "Access Denied", "Website "& $title & "Blocked.", 10)
    EndIf
EndFunc
_Close("A Website Title"); Just use it it a loop

These are just examples i created to make easy for you to understand it.

you can modify any of them to as you want them to work. just read more about the functions i used.

i have not tested any of the above but i think there 'll be no errors.

You can also use FileWrite() & it's related functions to edit the hosts file, just search the google and you 'll get all the details.

i think wikipedia also have information about it. i did not check but i think i had read in past.

Enjoy!

Share this post


Link to post
Share on other sites

These are just examples i created to make easy for you to understand it.

you can modify any of them to as you want them to work. just read more about the functions i used.

i have not tested any of the above but i think there 'll be no errors.

You can also use FileWrite() & it's related functions to edit the hosts file, just search the google and you 'll get all the details.

i think wikipedia also have information about it. i did not check but i think i had read in past.

Enjoy!

one issue that you'll run into though; if you have an output like the message box in the examples, a user can just leave that message box up and that would disable the window watching.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0