All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-crypt] OT: Just for fun , outputing a sound as access granted or denied
@ 2010-08-30  1:27 Aaron Lewis
  2010-08-30  6:55 ` Heinz Diehl
  2010-08-30  7:52 ` Milan Broz
  0 siblings, 2 replies; 7+ messages in thread
From: Aaron Lewis @ 2010-08-30  1:27 UTC (permalink / raw)
  To: dm-crypt

-----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-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-09-01  6:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-30  1:27 [dm-crypt] OT: Just for fun , outputing a sound as access granted or denied Aaron Lewis
2010-08-30  6:55 ` 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

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.