Tag Archives: Bash

64bit Flash for Linux

This has been a pain for a long time.  I went though and installed flash for Linux in this method but it only half worked for my 64bit distro in Ubuntu.  Too many problems coordinating with 32bit libraries and I would have flash applications that loaded fine but would not accept clicks, for example a video that I cannot pause or fast forward.  I set out to find a solution, as I realized this was a problem not with flash but with coordinating that flash with a 64bit distro.  For those interested, there is a 64 bit, Linux release and it’s installation is far more simple.  It is located on Adobe’s website, but hidden deep in some of the small text, definitely not a feature that stands out until you read through the page.  Here’s the solution:

#!/bin/bash
## installFlash64.sh

function die {
	if [ "$1" == "" ]; then
		echo "[*] ERROR -- Not Specified."
	else
		echo "[*] ERROR -- $1"
	fi
	exit 1
}

function check_root {
	if [ "`whoami`" != "root" ]; then
		die "You need root to install the 64bit Flash Player."
	fi
}

## Set root user
check_root
echo "You are root, the install will begin now."

## Download the package
echo
echo "Downloading..."
wget http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz

## Untar the package
echo
echo "Unpacking..."
tar xzvf libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz

## Move the file
echo
echo "Installing..."
cp -v libflashplayer.so /usr/lib/mozilla/plugins

## Clean Up
echo
echo "Cleaning..."
rm -rf libflashplayer.so libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz

## Done!
echo "Done!"
exit 0


Linux bash script for wifi.

When starting with Backtrack4, I compiled and installed the Broadcom wl driver for my laptop’s wifi. The unfortunate thing was that I got very frustrated because the default connection manager, wicd was getting confused when I would go to a network other than the one I initially connected to after boot-up. Shortly after that, Ubuntu 9.10 was experiencing the same difficulty after upgrading the kernel. So to work around using a network manager, I created a quick script to use.

In this script, you can see that you can pass a variable for your network name and key in the same format as you would normally. This was a fun script as it could easily be adapted as it’s own network manager, even with a little more work, you could have it in the tray, it’s own gui, etc. It’s nothing more than the commands typically used to connect on wifi but it just automated the process. I then went and created a child script for my most used networks, and after placing these in my bin, I actually have started to prefer this method.

Here’s the script:

#!/bin/bash

# die with honor
function usage() {
	echo "usage: ./connectWifi \"<essid>\" [key]"
	echo "       *key in ascii prefaces s:[key]"
	echo
	exit 1
}

# killed in disgrace
function die() {
	echo
	echo "   [*] ERROR: $1..."
	echo
	exit 1
}

# check for essid
if [[ $1 ]]; then
	# setup
	echo "Starting..."
	ifconfig eth1 down
	dhclient -r eth1 -q
	echo " -Previous connection dropped."
	ifconfig eth1 up
	iwconfig eth1 essid "$1"
	echo " -ESSID Set to $1."
	# check for key
	if [[ $2 ]]; then
		iwconfig eth1 key $2
		echo " -Key set to $2."
	fi
	# connect
	iwconfig eth1 mode Managed
	echo " -Connecting..."
	echo
	dhclient eth1
	# announce success
	if [[ $? -eq 0 ]]; then
		echo
		echo "Successfully connected to $1!"
		echo
		exit 0
	fi

else
	# no variables
	usage
fi

# declare failure
die "Failed to connect to $1."

This can serve as a good example of both the commands in connecting to wifi and an introduction to bash scripting. Please comment on the code and offer any suggestions you may have!