Jumat, 08 November 2013

Memblokir situs dengan Timer atau waktu

Memblokir situs dengan Timer atau waktu

1. Tujuan
Dapat memblokir situs dengan waktu.
Dapat mengatur penjadwalan Blokir.

2.  Dasar Teori
Cara untuk memblok suatu alamat situs dengan cara memberi batas waktu situs yang diblok dengan jangka waktu tertentu misalnya pada waktu jam praktikum disekolah situs-situs tertentu tidak dapat diakses, dan setelah jam belajar selesai situs tersebut dapat diakses kembali.


3.  Langkah Kerja
Berikut langkah-langkahnya:

buka ”C:\WINDOWS\system32\drivers\etc“ melalui RUN pada start menu.
C:\WINDOWS\system32\drivers\etc.

Gambar 1.1
Maka akan didapat 6 file yang terdapat didalam folder etc.

Gambar 1.2
Buat satu folder dengan nama “backup” setelah itu copy file hosts yang ada pada folder etc ke folder backup.

Gambar 1.3
Setelah file hosts berada dalam folder backup copy lagi file hosts tersebut didalam folder backup dan ubah namanya menjadi host.unblok

Gambar 1.4
Buka file hosts dan host.unblok pada folder backup menggunakan notepad untuk:
  • file hosts file (file asli/default) hasil copy dari folder etc
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample
HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of
IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding
host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
127.0.0.1       localhost

Gambar 1.5
Tambahkan alamat situs yang akan diblokir tepat dibawah 127.0.0.1 localhost misalnya http://www.facebook.com, youtube.com, dan yang lainnya seperti gambar dibawah ini kemudian save.  Sampai disini alamat yang akan anda blokir telah terblok dengan sendirinya..

Gambar 1.6
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
127.0.0.1       localhost
0.0.0.0
http://www.facebook.com
0.0.0.0 facebook.com
0.0.0.0 m.facebook.com
0.0.0.0 touch.facebook.com
0.0.0.0 wwww.youtube.com
0.0.0.0 youtube.com
0.0.0.0 m.youtube.com

  • file host.unblok: file yang akan membuka alamat situs yang diblokir file ini isinya sama dengan file hosts yang asli (default)  
Membuat file dengan ekstensi bat (.bat) yaitu file blok.bat dan unblok.bat, buka notepad kembali untuk menulisan perintah kedua file tersebut.
  • file blok.bat
@ECHO OFF
DEL “C:\WINDOWS\system32\drivers\etc\hosts
COPY “C:\WINDOWS\system32\drivers\etc\backup\hosts”
Gambar 1.7
Setelah dibuka menggunakan notepad dan menuliskan perintah diatas selanjutnya di save as dengan tipe save All Files dan memberikan ekstensi dot bat dibelakang nama file menjadi blok.bat dan save kedalam folder etc.
  • file unblok.bat
@ECHO OFF
DEL “C:\WINDOWS\system32\drivers\etc\hosts
COPY “C:\WINDOWS\system32\drivers\etc\backup\hosts.unblok” “C:\WINDOWS\system32\drivers\etc\hosts”
REN “C:\WINDOWS\system32\drivers\etc\hosts.unblok hosts”

Gambar 1.8
setelah dibuka menggunakan notepad dan menuliskan perintah diatas selanjutnya di save as dengan tipe save All Files dan memberikan ekstensi dot bat dibelakang nama file menjadi unblok.bat dan save kedalam folder etc.
Membuat Scheduled untuk mengatur waktu alamat situs nantinya diblokir. Disini file blok.bat yang dibuat tadi sebagai  menjalankan waktu pemblokiran dan file unblok.bat sebagai yang memberhentikan pemblokiran alamat situs dalam scheduled.
Untuk selanjutnya buka Scheduled Tasks yang terdapat pada Control Panel > Performance and Maintenance > Scheduled Tasks
  • Add Scheduled Task untuk file blok.bat cari file (browse) dimana tempat menyimpan file blok.bat
C:\WINDOWS\system32\drivers\etc\blok.bat

Gambar 1.9
Pilih Daily untuk harian dan melanjutkan ke tahapan berikutnya mengatur waktu scheduled. Atur waktu untuk menjalankan file blok.bat dengan memilih Perform this task: every day tahap selanjutnya terdapat form untuk mengisikan password untuk ini abaikan saja (next), selanjutnya centang pada pilihan Open advanced properties for this task when i click Finish lalu finish.

Gambar 1.10
Untuk pilihan Run only if logged on beri tanda centang dan pada tab Settings hilangkan tanda centang pada pilihan Stop the task if it run for:
  • Add Scheduled Task untuk file unblok.bat
Prosesnya sama dengan menjalankan scheduled file blok.bat hanya yang membendakan waktu dari yang akan dijalankan file ini. Yaitu waktu untuk memberhantikan pemblokiran suatu situs.

Gambar 1.11 waktu blok.bat

Gambar 1.12 waktu unblok.bat

0 komentar:

Posting Komentar