FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 06-29-2011, 03:33 PM
Lorenzo Beretta
 
Default sed or awk: decode base64 string in passwd-like file

Il 29/06/2011 16:50, Denny Schierz ha scritto:

hi,

I have a file with strings like:

testds@domain.foo:e0NSWVBUfVUx=:500:12002::/imap/spool/domain.foo/%1n/%
n:storage=50

I need to decode the second field (password field), with something like:

echo e0NSWVBUfVUx= | openssl base64 -d

How can I do this with all other lines?

I have already a small awk script, that converts my ldapsearch output to
a Dovecot readable passwd file.

===============
/^uid: / {uid=$2}
/^uid: / {uid=$2; u=tolower(substr(uid,1,1));}
/^postalAddress:/ {maildomain=$2}
/^myMailQuota/ {mailquota=$2}
/^userPassword/ {userpassword=$2}
/^dn/ {printf("%s@%s:%s:500:12002::/imap/spool/%s/%s/%s:storage=%s

",uid,maildomain,userpassword,maildomain,u,uid,mai lquota)}
END {printf("%s@%s:%s:500:12002::/imap/spool/%s/%s/%s:storage=%s

",uid,maildomain,userpassword,maildomain,u,uid,mai lquota)}
================

the third %s must be changed, means decoded from base64.

any suggestions?


try google's codesearch, you'll find tons of base64 decoders that you
can easily translate into awk



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4e0b45be$0$44205$4fafbaef@reader1.news.tin.it">htt p://lists.debian.org/4e0b45be$0$44205$4fafbaef@reader1.news.tin.it
 
Old 06-29-2011, 03:33 PM
Lorenzo Beretta
 
Default sed or awk: decode base64 string in passwd-like file

Il 29/06/2011 16:50, Denny Schierz ha scritto:

hi,

I have a file with strings like:

testds@domain.foo:e0NSWVBUfVUx=:500:12002::/imap/spool/domain.foo/%1n/%
n:storage=50

I need to decode the second field (password field), with something like:

echo e0NSWVBUfVUx= | openssl base64 -d

How can I do this with all other lines?

I have already a small awk script, that converts my ldapsearch output to
a Dovecot readable passwd file.

===============
/^uid: / {uid=$2}
/^uid: / {uid=$2; u=tolower(substr(uid,1,1));}
/^postalAddress:/ {maildomain=$2}
/^myMailQuota/ {mailquota=$2}
/^userPassword/ {userpassword=$2}
/^dn/ {printf("%s@%s:%s:500:12002::/imap/spool/%s/%s/%s:storage=%s

",uid,maildomain,userpassword,maildomain,u,uid,mai lquota)}
END {printf("%s@%s:%s:500:12002::/imap/spool/%s/%s/%s:storage=%s

",uid,maildomain,userpassword,maildomain,u,uid,mai lquota)}
================

the third %s must be changed, means decoded from base64.

any suggestions?


try google's codesearch, you'll find tons of base64 decoders that you
can easily translate into awk



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4e0b45be$0$44205$4fafbaef@reader1.news.tin.it">htt p://lists.debian.org/4e0b45be$0$44205$4fafbaef@reader1.news.tin.it
 
Old 06-30-2011, 10:03 PM
Arno Schuring
 
Default sed or awk: decode base64 string in passwd-like file

Denny Schierz (linuxmail@4lin.net on 2011-06-29 16:42 +0200):
> I have a file with strings like:
>
> testds@domain.foo:e0NSWVBUfVUx=:500:12002::/imap/spool/domain.foo/%1n/%
> n:storage=50
>
> I need to decode the second field (password field), with something
> like:
>
> echo e0NSWVBUfVUx= | openssl base64 -d
I certainly hope you're not expecting to recover the plaintext
password with this. But just to be sure: password fields are usually
generated using a one-way hash, which means you CAN NOT decode it, only
brute-force. If this field really contains a recoverable password, then
that's a huge security risk and you should think about changing
software.

For base64 decoding using CLI, take a look at coreutils' base64 or
uudeview.


Regards.
Arno


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110701000324.479d2f33@neminis.loos.site">http://lists.debian.org/20110701000324.479d2f33@neminis.loos.site
 
Old 06-30-2011, 10:24 PM
Javier Barroso
 
Default sed or awk: decode base64 string in passwd-like file

On Wed, Jun 29, 2011 at 4:42 PM, Denny Schierz <linuxmail@4lin.net> wrote:
> hi,
>
> I have a file with strings like:
>
> testds@domain.foo:e0NSWVBUfVUx=:500:12002::/imap/spool/domain.foo/%1n/%
> n:storage=50
>
> I need to decode the second field (password field), with something like:
>
> echo e0NSWVBUfVUx= | openssl base64 -d
>
> How can I do this with all other lines?
>
> I have already a small awk script, that converts my ldapsearch output to
> a Dovecot readable passwd file.
>
> ===============
> /^uid: / {uid=$2}
> /^uid: / {uid=$2; u=tolower(substr(uid,1,1));}
> /^postalAddress:/ {maildomain=$2}
> /^myMailQuota/ {mailquota=$2}
> /^userPassword/ {userpassword=$2}
> /^dn/ {printf("%s@%s:%s:500:12002::/imap/spool/%s/%s/%s:storage=%s
>
",uid,maildomain,userpassword,maildomain,u,uid,mai lquota)}
> END {printf("%s@%s:%s:500:12002::/imap/spool/%s/%s/%s:storage=%s
>
",uid,maildomain,userpassword,maildomain,u,uid,mai lquota)}
> ================
>
> the third %s must be changed, means decoded from base64.
>
> any suggestions?
>
use perl ;

perl -F: -a -ne ' $F1=`echo $F[1] | openssl base64 -d`; print join
(":",$F[0],$F1,@F[2 .. $#F])' file

or

use pure perl;

perl -MMIME::Base64 -F: -a -ne '@a=@F; $a[1]=decode_base64($a[1]);
print join (":",@a)' file

Regards,


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: BANLkTi=6JjGjnDDzc+YHD6spsJKuNk_xpQ@mail.gmail.com ">http://lists.debian.org/BANLkTi=6JjGjnDDzc+YHD6spsJKuNk_xpQ@mail.gmail.com
 
Old 07-01-2011, 07:56 AM
Denny Schierz
 
Default sed or awk: decode base64 string in passwd-like file

hi,

Am Freitag, den 01.07.2011, 00:03 +0200 schrieb Arno Schuring:

> > echo e0NSWVBUfVUx= | openssl base64 -d
> I certainly hope you're not expecting to recover the plaintext

nope :-) They are still crypted, but readable for other Daemons, like
Dovecot:

If you do some like:

echo e0NSWVBUfVUx= | openssl base64 -d

then you get:

{CRYPT}<crypted string>

:-)
 
Old 07-01-2011, 07:57 AM
Denny Schierz
 
Default sed or awk: decode base64 string in passwd-like file

hi,

Am Freitag, den 01.07.2011, 00:24 +0200 schrieb Javier Barroso:
> perl -F: -a -ne ' $F1=`echo $F[1] | openssl base64 -d`; print join
> (":",$F[0],$F1,@F[2 .. $#F])' file

thanks, I try it :-)

cu Denny
 

Thread Tools




All times are GMT. The time now is 03:31 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org