0×1337.de_blog about security, open source, music and revolution.

May 8, 2010

Find Uplink

Filed under: linux — flyc0r @ 11:38 pm


#!/bin/bash
#simple uplink finder. Returns the first device to be able to ping 8.8.8.8
for i in $(ifconfig |grep encap |cut -f 1 -d ' '|grep -v lo); do
if ping -I $i -c 1 -w 20 8.8.8.8 > /dev/null; then echo $i; exit 1; fi
done

September 11, 2009

moo - simple extensible debootstrap wires

Filed under: cli, linux — Tags: , , , , , , — anx @ 2:29 pm

Needless to say: “yet another chroot bootstrapper” :)

moo is built to help you develop .deb based distributions, and deploy them i.e. via netboot to the target machine.
currently moo only consists of the moo script and /etc/moo.d/. The latter one holds configuration and available packages.
The script will bootstrap a development environment for you, as well as pull updates from the package repository on hakt0r.de.

Just grab moo and execute it like:

usage:
    moo [options] verb arguments
examples:
    moo init
    moo init /home/anx/moo/
    moo install /chroot /media/ubuntu-cd karmic
    moo install /chroot http://blah/ubuntu jaunty #todo
    moo mount /chroot
    moo enter /chroot
verbs:
    init    [prefix=/]
    install target source dist
    remove  target
    mount   target
    unmount target
    enter   target [command=/bin/bash]
    help
options:
    -v      - be verbose
credits:
    anx, feuerziege, amm0n @hakt0r.de

July 23, 2009

Secure Synergy

Filed under: cli, linux, security — Tags: , , , , , , , — flyc0r @ 3:49 pm

I have been using synergy for a long time now. The only ugly thing about it: it doesn’t encrypt. That’s where ssh comes in. I wrote this handy script a while ago to start ssh tunneled synergy on a client machine:

 #!/bin/sh
port=24800
host=$1

echo -n killing existing synergyc...
killall -9 synergyc
echo done

echo -n killig existing ssh tunnels...
pids=$(ps x |grep ssh|grep $port|grep $host|cut -d' ' -f1)
for i in $pids
	do
		echo -n "killing $i..."
		kill -9 $i;
		echo done
	done

echo -n "Trying to ping $host"
if ping -c1 $1>/dev/null;
 then
	echo done
	echo -n starting ssh tunnel...
	ssh -f -N -L 127.0.0.1:$port:$1:$port $host
	echo done
	echo -n starting synergyc...
	sleep 1
	synergyc 127.0.0.1
	echo done
  else
	echo "failed."
fi
echo done

July 22, 2009

ls after cd

Filed under: cli, linux — flyc0r @ 6:14 pm

If you want an ls to be issued each time you cd somewhere:

function mychdir(){chdir $@;ls;}
alias cd='mychdir'

Just add these two lines to your shells .rc file and you are good to go.

July 18, 2009

flv2mp3

Filed under: cli, linux — Tags: , , , , , , — flyc0r @ 5:20 pm

Just need the sound of a downloaded tube movie (featuring mplayer and lame)?

#!/bin/bash
 mplayer -ao pcm -vo audiodump.wav $1
lame audiodump.wav -q $2 -b $3 $1".mp3"
rm audiodump.wav
Newer Posts »

Powered by WordPress