PCFreak Logo (c) Der PCFreak

OTP token for bash Kommentare deaktiviert für OTP token for bash

oathtool emulating token in bash

If you ever have to emulate a OTP token in bash, you could do this easily with oathtool. For Debian based systems compile it yourself or just install the packages from the latest testing release, they work well on stable versions, too.

I wrote a small bash script to emulate a OTP token. It can be used to emulate a time-based Google-Authenticator token or a time-based c200 token from http://gooze.eu You can modify it to also be able to emulate event-based tokens, just replace „–totp“ with „–hotp“ and replace the time step (-s) with a counter value (-c).

Here is the code:

#!/bin/bash
#
secret=38217FF224B2352885AABAA4DF3C13773AC5B883
clear
while [ 1 = 1 ]; do
 # for Google-Authenticator enable next line
 # make sure youe have secret in base32
 #password=$(oathtool --totp -b -s 30s $secret)
 # for c200 Token (gooze.eu) enable next line
 password=$(oathtool --totp -s 60s $secret)
 seconds=$(date +%S)
 echo "##################################"
 echo "#         Software-Token         #"
 echo "##################################"
 echo -n '#             '
 if [ "$seconds" -gt 56 ] ; then
    echo -n -e "\e[1;31m$password\e[0m"
 #enable next 2 lines for a 30s interval
 # elif [ "$seconds" -gt 26 -a "$seconds" -lt 30 ]; then
 #    echo -n -e "\e[1;31m$password\e[0m"
 else
    echo -n "$password"
 fi
    echo '             #'
 echo "################################$seconds"
 echo ""
 sleep .3
 clear
done

 

Feel free to modify it to your needs.

 

Vodafone Mobile Connect USB Stick unter Linux (Kubuntu 8.10 intrepid) 1

Die Installation des Vodafone Mobile Connect USB Stick unter Linux war einfacher als gedacht, jedoch musste ich ein wenig googlen um die Lösung zu finden, deshalb hier eine Zusammenfassung meiner Erfahrungen.

Auf der Betavine Seite gibt es extra ein Paket für (K)Ubuntu und auch für andere Distributionen:

Wir erstellen ein lokales Verzeichnis für unsere Installation und laden das Treiberpaket herunter

mkdir ~/vodafone
cd ~/vodafone
wget „http://www.betavine.net/repo/packages/ubuntu/Ubuntu.tgz“
tar xvfz Ubuntu.tgz

Danach wie in der INSTALL_UBUNTU.TXT beschrieben

sudo dpkg -i usb-modeswitch_0.9.7_i386.deb

um usb-modeswitch zu installieren

Danach

sudo dpkg -i ozerocdoff_0.4-2_i386.deb

für ozerocdoff

Anschliesend soll man die Abhängigkeiten für die Connect Software installieren

sudo aptitude install wvdial hal usb-modeswitch ozerocdoff python-twisted python-serial python-sqlite python-tz python-gobject python-dbus python-cairo python-crypto python-gtk2 python-gnome2 python-gnome2-extras lsb-release python-glade2

Und zum Schluss die Vodafone Mobile Connect Software

sudo dpkg -i vodafone-mobile-connect_2.10.01-1_all.deb

Sicherheitshalber würde ich hier nochmals die Abhängigkeiten mit einem

sudo apt-get -f install

überprüfen und fixen.

Nun kann die Software durch Aufruf von

vodafone-mobile-connect-card-driver-for-linux

gestartet werden.

Der ZTE K3565-Z funktionierte mit dieser Anleitung sofort.

Für die Datenverbindung mit FONIC musste ich noch die Angabe für den APN machen, dieser ist pinternet.interkom.de.

DropBox mit KDE (Kubuntu 7.10) Kommentare deaktiviert für DropBox mit KDE (Kubuntu 7.10)

Wer schon mal versucht hat unter KDE das offizielle DropBox Release zu installieren stellt fest, daß es für Gnome optimiert ist und dies auch als Installation voraussetzt. D.h. man ballert sich unnötige Pakete auf sein System, da wir ja mit Kubuntu eigentlich KDE benutzen. Desweiteren ist unser Dateimanager ja dolphin und nicht nautilus.

Es gibt verschiedenste Anleitungen im Internet, ich habe sie zusammengefasst und hier ist sie:

  1. Herunterladen der Linuxversion http://www.getdropbox.com/download?plat=lnx.x86
  2. Entpacken, z.B. nach /tmp/ (dort entsteht der versteckte Ordner .dropbox-dist
  3. Verschieben des Ordners in unser Heimatverzeichnis:
    mv /tmp/.dropbox-dist ~/
  4. In den Ordner wechseln
    cd ~/.dropbox-dist
  5. Den Dropbox Daemon ausführen
    ./dropboxd
  6. Es kommt nun ein kleines GUI-Setup und fragt die Dropbox Daten ab, auch der Ordner für die Dropbox kann hier gewählt werden.
  7. Der Dropboxdaemon stellt ebenfalls ein TrayIcon bereit – FERTIG funktioniert.

Danke an  http://antrix.net/journal/techtalk/dropbox_kde.html für die nötigen Informationen.
Wenn man einen permanenten Sync will und zwar automatisch beim Anmelden, dann sollten man noch eine Verknüpfung zu droboxd in den Ordner ~/.kde/Autostart/ legen. !!! Wichtig hierbei ist, in der Verknüpfung den Arbeitsordner  (/home/[user]/.dropbox-dist/ mit anzugeben !!!

Thunderbird & Co als TrayIcon Kommentare deaktiviert für Thunderbird & Co als TrayIcon

Einige Programme wie Thunderbird oder Firefox können nicht ins Tray minimiert werden. Für Windows Benutzer gibt es viele Plugins und Addons um dieses Feature trotzdem zu realisieren. Leider nicht für Linux.

Abhilfe schafft das kleine Programm „alltray“. Es ist in den gängingen Repositories vorhanden und kann z.B. unter Kubuntu einfach mit

sudo apt-get install alltray

installiert werden.

Danach einfach 1x per Hand starten, der Rest ist selbsterklärend.

Linux – Terminalbildschirm splitten Kommentare deaktiviert für Linux – Terminalbildschirm splitten

Einen guten Bericht zum Splitten von Terminalbildschirmen unter Linux habe ich bei Ruckman.net gefunden. Siehe hier:

http://ruckman.net/blog/comment.php?comment.news.11/

Da der Autor anscheinend gelegentlich am Blog rumbastelt und die Links sich ändern, hier der entsprechende Teil:

The secret is to use the “screen” command. And I will tell you all the commands you need in order to make it work wonders for you. But first a little copy and paste from the screen website: (LINK)

“Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. Each virtual terminal provides the functions of the DEC VT100 terminal and, in addition, several control functions from the ANSI X3.64 (ISO 6429) and ISO 2022 standards (e.g., insert/delete line and support for multiple character sets). There is a scroll back history buffer for each virtual terminal and a copy-and-paste mechanism that allows the user to move text regions between windows. When screen is called, it creates a single window with a shell in it (or the specified command) and then gets out of your way so that you can use the program as you normally would. Then, at any time, you can create new (full-screen) windows with other programs in them (including more shells), kill the current window, view a list of the active windows, turn output logging on and off, copy text between windows, view the scroll back history, switch between windows, etc. All windows run their programs completely independent of each other. Programs continue to run when their window is currently not visible and even when the whole screen session is detached from the users terminal.”

From the description above you will notice that there are some other advantages to using screen besides the ability to split screen your console. For instance, if you are using putty on a somewhat unstable internet connection and your connection is lost you will lose your console session and any program instance that is running. But if you are using screen your terminal instance will continue to run even if you lose your connection and all you have to do is reconnect and reattach to your screen session.

If you do not have screen, you can obtain it at the link listed above or from your Linux distros update command such as yum or apt-get.

I will now give you the commands you require to use screen efficiently. Any command when you are inside screen begins with “CNTL-A”.

To start you will have to call the first instance of screen. You can combine a lot of these commands into one command line argument but I prefer to show you one command at a time. Run the following command:

screen

You will now see the shell prompt again. To split screen hit the following key combinations:

CNTL-A

SHIFT-S

You will now need a second screen instance to run in the bottom window. Run the screen command again:

screen

Run a command such as “man”, “htop”, or top. You will notice that it fills the top half of the screen.

You will now have to toggle to the bottom screen by hitting the following key combinations:

CNTL-A

TAB

You will now be in the bottom window, although you will not see your command prompt yet. You will have to toggle through the instances of screen in the bottom window to get to it. Use the following key combinations to do this:

CNTL-A

N

or:

CNTL-A

P

The “N” stands for next and the “P” stands for previous. It just allows you to step forward and backward through as many instances of screen that you have running. If you see the same output in both windows just do the same key combo again to get to the next version of screen.

Once you get the shell prompt in the bottom screen you can run your second command and view the output from both running instances. You can now view a man page in the top window and craft your command below or view htop and iftop in the same window at the same time. You can also split the screen more times but I wouldn’t recommend it unless you have some decent resolution set for your text console which can be controlled in your boot options in grub or lilo but that is another lesson.

You may find a few more commands useful during your stay with screen. You may with to leave the current session running in the background and jump back to you regular console. You can do that by detaching which is done with the following key combo:

CNTL-A

D

Now that you are detached, which is what also happens during loss of connectivity, you may want to reattach to one of your screen instances. You will first need to list the instances of screen by typing the following command:

screen -list

You will the get a list similar to:

There is a screen on:
3880.pts-0.localhost (Detached)

To reattach to the instance listed above, type:

screen -r 3880.pts-0.localhost

The part after “-r” will change depending on your linux box.

You will notice that you are now back into your detached session of screen.

Now that you know the basics of screen, I am sure you will become accelerated at learning other Linux commands. Take care, and enjoy the ease of use!

NimbleX – schlankes Linux – LiveCd online erstellen Kommentare deaktiviert für NimbleX – schlankes Linux – LiveCd online erstellen

NimbleX ist ein kleines schlankes Betriebssystem basierend auf Linux. Und damit es gleich losgeht, gibt es die benutzerdefinierte LiveCD online.

Man kann sich mit ein paar Klicks seine individuelle Live-CD zusammenklicken und downloaden.

Homepage
Eigene LiveCD

kostenlose Shell accounts und wie man sich das Passwort merken kann! Kommentare deaktiviert für kostenlose Shell accounts und wie man sich das Passwort merken kann!

Heute habe ich mir einen kostenlosen Shell-Account angelegt. Nun für was braucht man sowas. Man kann damit z.B. Verbindungen tunneln, wenn man in einem Netzwerk arbeitet, welches zwar den ausgehenden Port 80 erlaubt aber sonst nichts. Wie das genau geht möchte ich hier aufgrund meiner beruflichen Tätigkeit nicht weiter ausführen.

Kommen wir nun zu den Shell-Accounts. Wo gibts kostenlose Shell-Accounts?
Google: free shell accounts

Ich habe einen Gratisaccount bei visualserver.org und einen für $1 bei silenceisdefeat.org .

So und nun hat man so einen Account und ist unterwegs aber man hat mal wieder das Passwort vergessen. Tja, hier meine Lösung (aus Sicherheitsgründen etwas abgeändert.)

Man legt sich auf irgendeinem Webspace den man hat einen Subfolder an, z.B.
http://mywebspace.com/myshell

Dort plaziert man dann eine Seite, die einen auf die Homepage des Shell-Accounts weiterleitet, z.B.
http://silenceisdefeat.org/~superuser

Dort plaziert man dann ein Ascii Art, z.B. von einem Foto. In diesem Ascii Art plaziert man dann irgendwo mittendrin das Passwort für die Shell und merkt sich die Position des Passworts.

Nun hat man das Passwort – relativ sicher – immer dabei, wenn man Internet hat.

Man surft also zuerst auf die Homepage (z.B. http://mywebspace.com/myshell) dort wird man dann weitergeleitet zur Homepage der Shell (z.B. http://silenceisdefeat.org/~superuser) Dort sieht man dann folgendes (Ausschnitt):

MMMMNmXrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
MMMMMMNmwrrtrrtrrtrrtrrwQm4mmmmmmmmmmmmmmmyZ
 dMMMMMMNAwrrtrrtrrtrrtWMMMMMMMMMMMMMMMMMNI
  `vMMMMMMNAwrrrrrtrrrrWMMMMMMMMMMMMMMMMMMI
+.  ??MMMMMMNkrrtrrrtrrv7777?!!!!!!!!!!!!„
Oz+.  ?7MMMMMMNk

Dann ssh Tunnel zu superuser@silenceisdefeat.org:22 und das Passwort aus dem Ascii Art – Fertig

ssh anywhere, anytime and free!

Denkt Euch ggf. selbst eine Art und Weise aus, wie Ihr Euer Passwort sicher bunkert, am besten ist natürlich, Ihr habt es im Kopf!

Daten von defekter Festplatte lesen (ddrescue) 1

Ausgangslage
80GB Notebook Festplatte braucht ca. 20min um Windows XP zu booten und endet dann in einem Bluescreen. Während des Bootvorgangs sind seltsame Festplattengeräusche zu hören, wenn man mit dem Ohr ans Gerät geht. Eine neue Festplatte wurde bereits angeschafft (120GB)

Auftrag
System soll möglichst 1:1 wiederhergestellt werden, da wichtige Daten auf der Festplatte sind.

Durchführung

  1. Platte in bestmöglichen Ausgangszustand bringen
    Festplatte mit Spinrite in Option 2 überprüft (Dauer 4 Tage). 2 defekte Sektoren konnten wiederhergestellt werden, aber es sind immer noch extrem viele sog. „unrecoverable“ Fehler auf der Festplatte vorhanden. S.M.A.R.T. hat schon die maximale Anzahl von Sektoren mittels Remapping umkonfiguriert. – Wir sind am Limit und haben nicht mehr viel Zeit. Ggf. sollte dieser Schritt übersprungen werden, da dabei die Festplatte endgültig den Geist aufgeben könnte!
  2. Versuch die Festplatte mit Acronis TrueImage zu sichern
    Dieser Versuch schlug fehl, da Acronis mit defekten Festplatten nicht umgehen kann und sofort den Kopiervorgang stoppt.
  3. Versuch Daten mit ddrescue zu kopieren
    Die alte und die neue Festplatte sollten elektrisch und datentechnisch an ein funktionsfähiges System angeschlossen werden. Man kann jedoch auch über Netzwerk etc. wegsichern, je nachdem was einem besser liegt.Booten mit Linux-Live-Cd (am besten sollte ddrescue schon enthalten sein).
    Ich habe das Ganze mit einer Kubuntu Live-CD gemacht und habe ddrescue nach Modifikation der sources.list
    (Universal Repos freischalten) live nachinstalliert.Beide Festplatten (alt und neu) sind am System angeschlossen.

    Die Eingabe von fdisk -l zeigt beide Festplatten im System an.
    Wichtig, die Geräte müssen als Device existieren. Von einer Festplatte, die nicht unter /dev/xxx gelistet ist kann man nichts mehr runterkopieren.

    Nun starten wir den Kopiervorgang mit ddrescue. Wichtig dabei ist, unbedingt ein Logfile anzugeben (welches natürlich idealerweise an einem externen Speicherort abgelegt werden sollte, weil über dieses Logfile jederzeit eine Abbruch/Pausieren des Kopiervorgangs möglich ist und eine Fortsetzung an genau der gestoppten Stelle möglich ist, z.B. notwendig, wenn man die defekte Festplatte immer mal wieder ausbauen und über Nacht in den Kühlschrank stellen muss.

    Hier die Hilfe von ddrescue

    GNU ddrescue – Data recovery tool.
    Copies data from one file or block device to another,trying hard to rescue data in case of read errors.

    Usage: ./ddrescue [options] infile outfile [logfile]
    Options:
    -h, –help display this help and exit
    -V, –version output version information and exit
    -b, –block-size= hardware block size of input device [512]
    -B, –binary-prefixes show binary multipliers in numbers [default SI]
    -c, –cluster-size= hardware blocks to copy at a time [128]
    -C, –complete-only do not read new data beyond logfile limits
    -d, –direct use direct disc access for input file
    -e, –max-errors= maximum number of error areas allowed
    -i, –input-position=

    starting position in input file [0]
    -n, –no-split do not try to split error areas
    -o, –output-position=
    starting position in output file [ipos]
    -q, –quiet quiet operation
    -r, –max-retries= exit after given retries (-1=infinity) [0]
    -s, –max-size= maximum size of data to be copied
    -t, –truncate truncate output file
    -v, –verbose verbose operation
    Numbers may be followed by a multiplier: b = blocks, k = kB = 10^3 = 1000,Ki = KiB = 2^10 = 1024,
    M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc…Einige neuere Funktionen wie -d stehen erst in neueren Versionen von ddrescue zur Verfügung, wenn nötig eben halt selbst kompilieren.

    Ich habe bewusst -r0 gewählt, da ich ewige Leseversuche vermeiden wollte, damit die defekte Platte weitestgehendst geschont wird. Mit -d kann man den Kernel umgehen und direkt vom Gerät lesen, was u.U. auch bessere Ergebnisse bringt.

    Der Befehl könnte also ungefähr so aussehen:

    ddrescue -r0 -v -d -n /dev/sda /dev/sdb /mnt/usbstick/ddrescue.log

    /dev/sda = Quelle
    /dev/sdb = Ziel (in meinem Fall die neue Disk, könnte aber auch eine Datei sein z.B. target.img)
    /mnt/usbstick/ddrescue.log = Logfile auf externem USB-Stick

    Man kann nun jederzeit mit Ctrl+C den Kopiervorgang abbrechen und mit obigem Befehl wieder fortsetzen.

    Im Nachhinein muss ich sagen ist es besser als Ziel für den Kopiervorgang ein File auf einer anderen Festplatte anzugeben (nicht die neue Platte), damit man auf jedenfall eine Sicherungskopie der maximal lesbaren Daten als Datei hat. !!! Achtung, bitte beachten, die Festplatte auf die man in ein File sichert muss entsprechend große Dateien abkönnen! Da der Kopiervorgang sehr lange dauert kann man ggf. auch zur Laufzeit die Zieldatei komprimieren um Platz zu sparen.

    Nach ca. 72 Stunden war dann der Kopiervorgang abgeschlossen.

    Natürlich habe ich die neue Festplatte nicht sofort ins Notebook eingebaut und gestartet, sondern von der Kopie ein Acronis Image abgezogen.

Dann die Festplatte ins Notebook eingebaut und gebootet – Voila XP startet superschnell und ohne Probleme.

Anschließend ein

chkdsk /f C:

gefolgt von einem Reboot und nach ca. 20 Minuten chkdsk hatte ich ein lauffähiges System.

Ca. 12MB Daten konnten nicht gerettet werden, welche Dateien das auch immer waren.

Ich habe vom System dann die wichtigen Daten kopiert und trotzdem neu installiert, da nicht festgestellt werden konnte, welche Daten am System fehlten.

Ich hoffe diese Anleitung hilft irgendjemandem weiter, der sich ggf. in der gleichen Situation befindet.

Wichtigste Erkenntnis:
Es gibt immer eine Lösung und man muss viel Zeit haben!

ping für MAC Adressen Kommentare deaktiviert für ping für MAC Adressen

Unter Linux gibt es kostenlos das Paket „arping“ mit dem man jederzeit eine MAC-Adresse pingen kann.
Voraussetzung ist, daß man sich im gleichen Subnet befindet, wie die MAC-Adresse, die man pingen möchte:

pcfreak@mylinuxbox:~/arping-2.05$ sudo ./arping -i eth1 00:ff:a5:55:ea:0a
 ARPING 00:ff:a5:55:ea:0a
 60 bytes from 192.168.0.33 (00:ff:a5:55:ea:0a): icmp_seq=0 time=1.269 nsec
 60 bytes from 192.168.0.33 (00:ff:a5:55:ea:0a): icmp_seq=1 time=422.955 nsec
 60 bytes from 192.168.0.33 (00:ff:a5:55:ea:0a): icmp_seq=2 time=440.121 nsec
 60 bytes from 192.168.0.33 (00:ff:a5:55:ea:0a): icmp_seq=3 time=427.008 nsec

Unter Ubuntu/Debian einfach mit
  sudo apt-get install arping
nachinstalierbar.

Für Windows gibt es diverse Tools mit GUI, die meisten aber kostenpflichtig.

Blogging Tool für Linux 1

qtm screenshotIch hoffe ich habe nun endlich einen vernünftigen Blogging Client für Linux gefunden. Ich teste hiermit das Programm QTM (ehemals Catkin) und es gefällt mir soweit ganz gut. Leider fehlen aber immer noch Features wie der Bilder-Upload usw. aber man kann zumindest endlich beim Einfügen eines Links ein Target setzen.

Eine Preview-Funktion ist eingebaut.
Die Ersteinrichtung ist etwas problematisch, da man ja nach benutztem Blog manuell die exakte URL eintragen muss, z.B.
TypePad: www.typepad.com/t/api (z.B. server ist www.typepad.com, location ist /t/api)
Blogger: plant.blogger.com/api/RPC2
Wordpress.com: meinblog.wordpress.com/xmlrpc.php (anstatt meinblog einfach den passenden namen einsetzen)

Das Programm ist noch Beta und deshalb wollen wir die fehlenden Features mal verzeihen. Sicherlich wird es noch besser werden!

Link: http://qtm.blogistan.co.uk/

Nächste Seite »