All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaron Lewis <aaron.lewis1989@gmail.com>
To: dm-crypt@saout.de
Subject: [dm-crypt] OT: Just for fun , outputing a sound as access granted or denied
Date: Mon, 30 Aug 2010 09:27:54 +0800	[thread overview]
Message-ID: <4C7B091A.3060906@gmail.com> (raw)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.
	I did a small modification , make cryptsetup funny , these code is not
secure as i didn't verify changes on ogg123 & sound files.

When typing in wrong codes , you'll hear a woman voice `access denied' ,
and '`access granted' for right password.

I can't spread the sound file anyway , it's from DOOM 3 for linux.


- --- luks/keymanage.c    2010-05-28 00:32:10.000000000 +0800
+++ luks-mod/keymanage.c        2010-08-29 16:21:32.653337261 +0800
@@ -676,6 +676,28 @@
        return r;
 }

+#define MAX_SOUND_LEN 100
+#define MAX_CMD_LEN 200
+
+void Doom_Sound( int granted ) {
+       char *fName = (char *) malloc ( sizeof(char) * MAX_SOUND_LEN );
+       char *syscmd = (char* ) malloc ( sizeof(char) * MAX_CMD_LEN );
+
+       if ( granted ) {
+               strncpy (fName ,
"/usr/share/sounds/comp_access_granted.ogg" , MAX_SOUND_LEN );
+       } else {
+               strncpy (fName ,
"/usr/share/sounds/comp_access_denied.ogg" , MAX_SOUND_LEN );
+       }
+
+       if ( access ( fName , R_OK ) != -1 ) {
+               snprintf ( syscmd , MAX_CMD_LEN , "/usr/bin/ogg123 -d
alsa %s &>/dev/null" , fName );
+       }
+
+       if ( system ( syscmd ) ) {
+               return;
+       }
+}
+
 int LUKS_open_key_with_hdr(const char *device,
                           int keyIndex,
                           const char *password,
@@ -694,16 +716,20 @@

        for(i = 0; i < LUKS_NUMKEYS; i++) {
                r = LUKS_open_key(device, i, password, passwordLen, hdr,
*mk, ctx);
- -               if(r == 0)
+               if(r == 0) {
+                       Doom_Sound ( 1 );
                        return i;
+               }

                /* Do not retry for errors that are no -EPERM or -ENOENT,
                   former meaning password wrong, latter key slot
inactive */
- -               if ((r != -EPERM) && (r != -ENOENT))
+               if ((r != -EPERM) && (r != -ENOENT)) {
                        return r;
+               }
        }
        /* Warning, early returns above */
        log_err(ctx, _("No key available with this passphrase.\n"));
+       Doom_Sound ( 0 );
        return -EPERM;
 }


Just for fun as i said , if anyone like it ;-)

What do you guys think , i'd like to grab your opinions ;-)

P.S: if your system got attacked by a hacked /usr/bin/ogg123 or sound
files,  that's ..

- -- 
Best Regards,
Aaron Lewis - PGP: 0x4A6D32A0
FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
irc: A4R0NL3WI5 on freenode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx7CRkACgkQvf41sEptMqC+iACgxMXbNcsuogRU3F0k8h/NrlH0
aAAAn3TbZp7QyOSmxeJ9CYt61SYZx+HJ
=wZ9C
-----END PGP SIGNATURE-----

             reply	other threads:[~2010-08-30  1:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-30  1:27 Aaron Lewis [this message]
2010-08-30  6:55 ` [dm-crypt] OT: Just for fun , outputing a sound as access granted or denied Heinz Diehl
2010-08-30 10:20   ` Aaron Lewis
2010-08-30  7:52 ` Milan Broz
2010-08-30 10:18   ` Aaron Lewis
2010-08-30 10:33     ` Milan Broz
2010-09-01  6:14       ` [dm-crypt] [SOLVE] " Aaron Lewis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C7B091A.3060906@gmail.com \
    --to=aaron.lewis1989@gmail.com \
    --cc=dm-crypt@saout.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.