Block IP address using .htaccess for Apache or using url.access-deny for Lighttpd

By technese - Last updated: Saturday, December 3, 2011

For Apache Web Server, edit the .htaccess per directory:

Allow access from a certain IP address:

In this case, stands for a specific IP address. For example:

order deny,allow
deny from all
allow from 192.168.1.2

Deny access from a specific IP address:

order allow, deny
allow from all
deny from 192.168.1.2

For multiple IP addresses:

order deny,allow
deny from all
allow from 192.168.1.2 192.168.1.3
allow from 192.168.1.4

For Lighttpd web server:

Edit lighttpd.conf

$HTTP[“remoteip”] == “192.168.1.2″ {
url.access-deny = ( “” )
}

Do not allow IP address 192.168.1.2, 192.168.1.3 to access our site:

$HTTP[“remoteip”] =~ “192.168.1.2|192.168.1.3″ {
url.access-deny = ( “” )
}

or

$HTTP[“remoteip”] == “192.168.1.2|192.168.1.3″ {
url.access-deny = ( “” )
}

 

Allow ONLY IP addresses, 192.168.1.2, 192.168.1.3 to access,
note the != which means ‘string does not match’ operator basically – IF remoteip is not
192.168.1.2 or 192.168.1.3, THEN deny:

$HTTP[“remoteip”] != “192.168.1.2|192.168.1.3″ {
url.access-deny = ( “” )
}

Reference:

http://www.htpasswdgenerator.com/apache/htaccess.html
http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html
http://redmine.lighttpd.net/wiki/1/Docs:Configuration
http://perishablepress.com/press/2006/01/10/stupid-htaccess-tricks

Filed in General

Windows 8 Beta ISO Download

By technese - Last updated: Sunday, November 27, 2011

Windows Developer Preview with developer tools English, 64-bit
(x64)

DOWNLOAD (4.8 GB)
Sha 1 hash – 6FE9352FB59F6D0789AF35D1001BD4E4E81E42AF

All of the following come on a disk image file (.iso). See below for
installation instructions.

Windows Developer Preview English, 64-bit (x64)
DOWNLOAD (3.6 GB)
Sha 1 hash – 79DBF235FD49F5C1C8F8C04E24BDE6E1D04DA1E9
Includes a disk image file (.iso) to install the Windows Developer
Preview and Metro style apps on a 64-bit PC.

Windows Developer Preview English, 32-bit (x86)
DOWNLOAD (2.8 GB)
Sha 1 hash – 4E0698BBABE01ED27582C9FC16AD21C4422913CC
Includes a disk image file (.iso) to install the Windows Developer
Preview and Metro style apps on a 32-bit PC.

System Requirements
Windows Developer Preview works great on the same hardware that
powers Windows Vista and Windows 7:

Notes about installing the Windows Developer Preview

Filed in Windows

LinuxCommand.org: Learn the Linux command line. Write shell scripts.

By technese - Last updated: Sunday, November 27, 2011

http://linuxcommand.org/index.php

Filed in General

Okean Sino-Korea and DShield Top 20 Blocklist for Rocky Arno’s IPtables blockhosts file

By technese - Last updated: Saturday, November 26, 2011
#!/bin/sh
# script created from technese.com
# Download Okean Sino-Korea Block IP list
rm -f /tmp/cnkr_htaccess.txt
rm -f /tmp/top10-2.txt
wget http://www.okean.com/antispam/cnkr_htaccess.txt -P /tmp
file=/tmp/cnkr_htaccess.txt
file2=/tmp/top10-2.txt
tempfile=/etc/arno-iptables-firewall/blocked-hosts
# Remove first and last lines, and "deny from " text
echo '#Okean Sino-Korea Block IP list:' `date`'' > $tempfile
sed -e '1d' -e 's/deny from //' -e '$d' < $file >> $tempfile
# Append DShield Top 20 IPs
echo '#DShield Top 20 IP Block :' `date`'' >> $tempfile
wget http://feeds.dshield.org/top10-2.txt -P /tmp
# print first column and add /24 to DShield IPs
awk '{ print $1 }' < $file2 | sed 's/$/\/24/' >> $tempfile

Download and rename with .sh file type:

blockIPlist.txt

Reference:

http://www.okean.com
http://dshield.org

Filed in General, Network, Security

Bash script to create a .m3u from a directory

By technese - Last updated: Friday, November 25, 2011
#!/bin/bash
dir=`echo ${PWD##*/}`
echo "Create a .m3u playlist for $dir ..."
ls *.mp3 -1 >> "$dir.m3u"
ls *.mp4 -1 >> "$dir.m3u"
ls *.m4v -1 >> "$dir.m3u"
echo "Found these media files:"
cat "$dir.m3u"
Filed in General, Linux

iPhone, iPod, iPad and Firmware Download Links

By technese - Last updated: Friday, November 25, 2011

http://www.felixbruns.de/iPod/firmware

http://www.iclarified.com/entry/index.php?enid=750

Filed in General

Basename or extract of current working directory – Linux command output

By technese - Last updated: Thursday, November 24, 2011

Four examples:

$ basename `pwd` 
$ pwd | awk -F/ '{print $NF}' 
$ pwd | sed 's#.*/##' 
$ echo "${PWD##*/}" 

Reference:

http://stackoverflow.com/questions/1744595/extract-the-last-directory-of-a-pwd-output

http://tldp.org/LDP/abs/html/parameter-substitution.html

Filed in General

html index page of tree view of directory

By technese - Last updated: Sunday, November 20, 2011

-H : turn on html
baseHREF : gives the base ftp location when using HTML output.
-o : output filename

$ tree -H baseHREF -o index.htm

create index.htm of current directory and output filename as index.htm

$ tree -H . -o index.htm 
Filed in General

wget download specific filetype from URL

By technese - Last updated: Sunday, November 20, 2011

-U , user-agent
-r , recursive
-l1 -one level
-A , filetype

$ wget -U Firefox -r -l1 -nd -e robots=off -A filetype http://domain.index.html

e.g.

$ wget -U Firefox -r -l1 -nd -e robots=off -A .txt http://technese.com/index.html 

multiple filetypes

$ wget -U Firefox -r -l1 -nd -e robots=off -A filetype1,filetype2 http://domain.index.html]

e.g.

$ wget -U Firefox -r -l1 -nd -e robots=off -A .txt,doc http://technese.com/index.html 

Filed in General

SQL Coding Guidelines

By technese - Last updated: Sunday, November 20, 2011

http://www.unifiedasp.net/index.php/sql-coding-guidelines

Filed in Database