X-Git-Url: http://git.grml.org/?p=grml-tips.git;a=blobdiff_plain;f=grml_tips;h=b26d5d94e111fcae2c8edce013e6080cebf821e4;hp=1fdf527eca60487cb0a7a2034925de17d8159af2;hb=873c857ff67e6ce682059a758a91549df9cfa9ac;hpb=cae38e8e83824769c821ceae440acbd12be352b2 diff --git a/grml_tips b/grml_tips index 1fdf527..b26d5d9 100644 --- a/grml_tips +++ b/grml_tips @@ -573,11 +573,15 @@ echo -e "s/\r//g" > dos2unix.sed; sed -f dos2unix.sed < dosfile > unixfile -- Save live audio stream to file: -% mplayer -ao pcm:file=$FILE +% mplayer -ao pcm:file=$FILE $URL +-- +Save live stream to file: + +% mplayer -dumpfile $FILE -dumpstream $STREAM or -% mencoder mms://file.wmv -o $FILE -ovc copy -oac copy +% mencoder mms://$URL -o $FILE -ovc copy -oac copy or @@ -623,7 +627,7 @@ Read BIOS: -- Read HTTP via netcat: -echo "GET / HTTP/1.0\r\n\r\n" | netcat $DOMAIN 80 +echo -e "GET / HTTP/1.1\r\nHost: $DOMAIN\r\n\r\n" | netcat $DOMAIN 80 -- Get X ressources for specific program: @@ -704,9 +708,9 @@ Write back the guessed table: Develop, test and use exploit code with the Metasploit Framework: cd /tmp -wget http://framework-mirrors.metasploit.com/msf/downloader/framework-3.0.tar.gz -unp framework-3.0.tar.gz -cd framework-3.0 +wget http://spool.metasploit.com/releases/framework-3.2.tar.gz +unp framework-3.2.tar.gz +cd framework-3.2 ./msfcli -- Useful documentation: @@ -1096,38 +1100,29 @@ and vice versa: % iconv -f iso-8859-15 -t utf8 < isofile > utffile -- -Assign static setup for network cards (eth0 and eth1) via udev: +Assign static setup for network cards (NICs) via udev: -First method - manual: -~~~~~~~~~~~~~~~~~~~~~~ -Get information for SYSFS address: -# udevinfo -a -p /sys/class/net/eth0/ | grep address +Retrieve information for address (corresponding to MAC address): -Then create udev rules: -# cat /etc/udev/network.rules -# match eth* stuff: -KERNEL=="eth*", SYSFS{address}=="00:00:00:00:00:01", NAME="wlan0" -KERNEL=="eth*", SYSFS{address}=="00:00:00:00:00:02", NAME="lan0" -# do not match eth* drivers but also e.g. firewire stuff: -ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="00:00:00:00:00:03", NAME="1394" + # udevadm info -a -p /sys/class/net/eth0/ | grep -i 'ATTR{address}' -Now activate the rules: -# cd /etc/udev/rules.d/ && ln -s ../network.rules z35_network.rules +Execute /lib/udev/write_net_rules with according values (INTERFACE +is old NIC name, INTERFACE_NAME is new NIC name and MATCHADDR +is the MAC address retrieved with udevadm info command): -Unload the drivers, restart udev and load the drivers again to activate -the settings. + # INTERFACE=eth0 INTERFACE_NAME=lan0 MATCHADDR=00:00:00:00:00:01 /lib/udev/write_net_rules -Second method - automatic: -~~~~~~~~~~~~~~~~~~~~~~~~~~ -Run /lib/udev/write_net_rules shipped with recent udev versions: +This will generate file /etc/udev/rules.d/70-persistent-net.rules with content: -# INTERFACE=wlan1 /lib/udev/write_net_rules 00:00:00:00:00:04 +SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:01", KERNEL=="eth*", NAME="lan0" -This command will create /etc/udev/rules.d/z25_persistent-net.rules containing: +Finally take down the interface (ifdown/ifconfig) and execute: -SUBSYSTEM=="net", DRIVER=="?*", SYSFS{address}=="00:00:00:00:00:04", NAME=wlan1 + # udevadm trigger --action=add --subsystem-match=net -See /usr/share/doc/udev/writing_udev_rules/index.html for more information. +so the interface will be renamed. (Rebooting or +unloading drivers/restart udev/loading drivers again +works as well of course.) -- Change the suffix from *.sh to *.pl using zsh: @@ -1267,28 +1262,39 @@ via using grml nodma at the bootprompt. -- Write a Microsoft compatible boot record (MBR) using ms-sys -Write a Windows 2000/XP/2003 MBR to device: +Write a Windows 2000/XP/2003 MBR to a device: # ms-sys -m /dev/ice + +Notice: grab ms-sys from http://ms-sys.sourceforge.net/ - demo: + + wget http://surfnet.dl.sourceforge.net/sourceforge/ms-sys/ms-sys-2.1.3.tgz + unp ms-sys-2.1.3.tgz + cd ms-sys-2.1.3 + make + ./bin/ms-sys ... -- Use a Vodafone 3G Datacard (UMTS) with Linux: Plug in your vodafone card and check in syslog whether the appropriate (probably /dev/ttyUSB0 or /dev/noz0) has been created. If so run: -# gcom -d $DEVICE +# comgt -d $DEVICE # wvdial --config /etc/wvdial.conf.umts $PROFILE Usage examples: -# gcom -d /dev/ttyUSB0 +# comgt -d /dev/ttyUSB0 # wvdial --config /etc/wvdial.conf.umts a1usb -# gcom -d /dev/noz0 +# comgt -d /dev/noz0 # wvdial --config /etc/wvdial.conf.umts tmnozomi -# gcom -d /dev/noz0 +# comgt -d /dev/noz0 # wvdial --config /etc/wvdial.conf.umts dreiusb +# comgt -d /dev/ttyACM0 +# wvdial --config /etc/wvdial.conf.umts yesss + If you receive invalid DNS nameservers when connecting, like: [...] @@ -1314,7 +1320,7 @@ Bus 004 Device 008: ID 1199:6813 Sierra Wireless, Inc. To get a list of available providers execute: -# gcom -s -d /dev/ttyUSB0 /usr/share/doc/gcom/examples/operator +# comgt -s -d /dev/ttyUSB0 /etc/comgt/operator -- hdparm - get/set hard disk parameters @@ -2091,38 +2097,38 @@ See also: http://www.debian.org/doc/manuals/apt-howto/ch-basico.en.html Check filesystem's LABEL: generic way: -# vol_id -l /dev/sda1 +# blkid /dev/sda1 -ext2/3 without vol_id: +ext2/3 without blkid: # dumpe2fs /dev/sda1 | grep "Filesystem volume name" -xfs without vol_id: +xfs without blkid: # xfs_admin -l /dev/sda1 -reiserfs without vol_id: +reiserfs without blkid: # debugreiserfs /dev/sda1 | grep -i label -jfs without vol_id: +jfs without blkid: # jfs_tune -l /dev/sda1 | grep -i label -reiser4 without vol_id: +reiser4 without blkid: # debugfs.reiser4 /dev/sda1 | grep -i label -- Check filesystem's UUID: generic way: -# vol_id -u /dev/sda1 +# blkid /dev/sda1 -ext2/3 without vol_id: +ext2/3 without blkid: # dumpe2fs /dev/sda1 | grep -i UUID -xfs without vol_id: +xfs without blkid: # xfs_admin -u /dev/sda1 -reiserfs without vol_id: +reiserfs without blkid: # debugreiserfs /dev/sda1 | grep -i UUID -reiser4 without vol_id: +reiser4 without blkid: # debugfs.reiser4 /dev/sda1 | grep -i UUID -- Change a filesystem's LABEL: @@ -2316,8 +2322,6 @@ host2% hg merge # merge changes into your working directory Set up a CGI server on your webserver: % cp hgwebdir.cgi ~/public_html/hg/index.cgi % $EDITOR ~/public_html/hg/index.cgi # adjust the defaults - -Mercurial repositories of grml can be found at http://hg.grml.org/ -- Download binary codecs for mplayer: @@ -2580,7 +2584,7 @@ Recorder shellscript session using script: -- Test UTF-8 capabilities of terminal: -wget http://melkor.dnp.fmph.uniba.sk/~garabik/debian-utf8/download/UTF-8-demo.txt.gz +wget http://www.linux-cjk.net/Console/garabik/UTF-8-demo.txt.gz zcat UTF-8-demo.txt.gz or: @@ -2850,7 +2854,7 @@ language at the bottom of the file /etc/nanorc -- Create netboot package for grml-terminalserver: -# sh /usr/share/doc/grml-terminalserver/examples/create-netboot +# bash /usr/share/doc/grml-terminalserver/examples/create-netboot -- To boot grml via network (PXE) check out grml-terminalserver: @@ -3068,6 +3072,10 @@ btrace /dev/sda0 Convert Flash to Avi: % ffmpeg -i input.flv output.avi + +Extract MP3 from Flash file: + +% for i in *.flv; do ffmpeg -i $i -acodec copy ${i%.flv}.mp3 ; done -- Usage example for cryptsetup / -luks encrypted partition on LVM: @@ -3122,3 +3130,54 @@ deb http://localhost:9999/debian unstable main contrib non-free use approx in grml-debootstrap like: % grml-debootstrap -r lenny -t /dev/sda1 -m http://127.0.0.1:9999/debian -- +Simple webserver with python: + +% python -m SimpleHTTPServer +-- +Upgrade only packages from the grml-stable Debian repository: + +echo 'deb http://deb.grml.org/ grml-stable main' > /etc/apt/grml-stable.list +apt-get -o Dir::Etc::sourcelist=/etc/apt/grml-stable.list -o Dir::Etc::sourceparts=/doesnotexist update +apt-get upgrade +-- +Install Centos into a directory: + +% febootstrap centos-5 directory http://mirror.centos.org/centos-5/5.3/os/i386/ +-- +Install Fedora into a directory: + +% febootstrap fedora-11 target_directory +-- +Use Nessus / OpenVAS (remote network security auditor): + +Install software packages: +# apt-get update +# apt-get install openvas-client openvas-server openvas-plugins-base openvas-plugins-dfsg + +Add a user: +# openvas-adduser + +Start openvas server (takes a while): +# Start openvas-server + +Invoke client as user: +% OpenVAS-Client +-- +Find packages not available from any active apt repository: + +% apt-show-versions | awk '/No available version in archive/{print $1}' +-- +Simple mailserver with python: + +% python -m smtpd -n -c DebuggingServer localhost:1025 +-- +finger via netcat: + +echo $USER | nc $HOST 79 +-- +Install Archlinux using Grml: + +https://wiki.archlinux.org/index.php/Install_from_Existing_Linux +or +wget http://tokland.googlecode.com/svn/trunk/archlinux/arch-bootstrap.sh +--