Archivo

Entradas Etiquetadas ‘script’

VirtualBox Port Forward Bash Script

viernes, 17 de julio de 2009 Albertux Sin comentarios

VirtualBox Port Forward Bash Script

#!/bin/bash
# Albertux (Alberto Isaac Ayala Esquivias)
# Email: <albertux@AyalaSoft.com>
# Web: http://www.AyalaSoft.com
# Script: VirtualBox Port Forward Script Tool
 
YELLOW="\033[1;33m"
NORMAL="\033[0m"
 
function vbox-portfwd-help {
	echo -e "\n${YELLOW}vbox-portfwd${NORMAL} [OPTIONS]\n"
	echo -e "  -s \"set parameters to a VirtualBox Machine\""
	echo -e "  -u \"unset parameters to a VirtualBox Machine\""
	echo -e "  -m \"Machine Name\""
	echo -e "  -n \"Guest Port\""
	echo -e "  -l \"Host Port\""
	echo -e "  -p \"Protocol [TCP|UDP]\"\n\n${YELLOW}Examples:${NORMAL}"
	echo -e "  Usage: vbox-portfwd -s -d \"Proxy\" -m \"WinXP\" -n 8080 -l 3128 -p TCP"
	echo -e "  Usage: vbox-portfwd -u -d \"Proxy\" -m \"WinXP\""
	echo -e "\nNotes:\n  Protocol TCP is default option, if not given -p flag"
	echo -e "  Use this script when VirtualBox Machine status [Power Off]\n"
}
 
while getopts  "usd:m:n:g:l:p:" flag
do
	if [ "$flag" = "s" ]
	then
		OP=set
	elif [ "$flag" = "u" ]
	then
		OP=unset
	else
		eval $flag=$OPTARG
	fi
done
 
if [ -z $OP ]
then
	vbox-portfwd-help
	exit
fi
 
if [ -z $p ]
then
	p=TCP
fi
 
if [ "$OP" = "set" ]
then
	PROTOCOL=$p
	GUEST=$m
	GUEST_PORT=$n
	HOST_PORT=$l
	DESCRIPTIVE_NAME=$d
	if [ -z "$GUEST" -o -z "$DESCRIPTIVE_NAME" -o -z "$GUEST_PORT" -o -z "$HOST_PORT" ]
	then
		vbox-portfwd-help
		exit
	fi
fi
 
if [ "$OP" = "unset" ]
then
	GUEST=$m
	DESCRIPTIVE_NAME=$d
	if [ -z "$GUEST" -o -z "$DESCRIPTIVE_NAME" ]
	then
		vbox-portfwd-help
		exit
	fi
fi
 
case $OP in
	set)
		vboxmanage setextradata $GUEST "VBoxInternal/Devices/pcnet/0/LUN#0/Config/$DESCRIPTIVE_NAME/HostPort" $HOST_PORT
		vboxmanage setextradata $GUEST "VBoxInternal/Devices/pcnet/0/LUN#0/Config/$DESCRIPTIVE_NAME/GuestPort" $GUEST_PORT
		vboxmanage setextradata $GUEST "VBoxInternal/Devices/pcnet/0/LUN#0/Config/$DESCRIPTIVE_NAME/Protocol" $PROTOCOL
		;;
	unset)
		vboxmanage setextradata $GUEST "VBoxInternal/Devices/pcnet/0/LUN#0/Config/$DESCRIPTIVE_NAME/HostPort"
		vboxmanage setextradata $GUEST "VBoxInternal/Devices/pcnet/0/LUN#0/Config/$DESCRIPTIVE_NAME/GuestPort"
		vboxmanage setextradata $GUEST "VBoxInternal/Devices/pcnet/0/LUN#0/Config/$DESCRIPTIVE_NAME/Protocol"
		;;
esac
Categories: network, unix/linux Tags: ,

GNU/Linux GUI Scripting

jueves, 16 de julio de 2009 Albertux Sin comentarios
Categories: unix/linux Tags: ,

Wake Up with WSH and Winamp

miércoles, 1 de abril de 2009 Albertux Sin comentarios

Wake Up with WSH and Winamp

WSH (Windows Script Host)
Winamp

// Script: Wake-Up.js
// Author: Albertux (Alberto Isaac Ayala Esquivias)
// Web: http://Albertux.AyalaSoft.com
// Howto: Add this script on Task Scheduler
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("winamp");
WScript.Sleep(5000);
for (i=0; i<100; i++) {
	WshShell.SendKeys("{UP}"); // Level Up
}
WshShell.SendKeys("j"); // Search your favorite song
WScript.Sleep(5000);
WshShell.SendKeys("even flow"); // Replace with your favorite song
WScript.Sleep(5000);
WshShell.SendKeys("{Enter}"); // Wake Up

This script works fine on Windows Vista for Business with SP1

Categories: windows Tags: , ,