No problem. Thanks for the reply.<br><br><b><i>Jess Balint <jbalint@gmail.com></i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> <meta name="Generator" content="Microsoft Word 11 (filtered medium)"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"> <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"> <!--[if !mso]> <style> st1\:*{behavior:url(#default#ieooui) } </style> <![endif]--> <style> <!-- /* Font Definitions */ @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in;
margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-reply; font-family:Arial; color:navy;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {page:Section1;} --> </style> </o:SmartTagType></o:SmartTagType><div class="Section1"> <div class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Darren:<o:p></o:p></span></font></div> <div class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"><o:p> </o:p></span></font></div> <div class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Sorry about the previous email, I was only
trying to give an example of the algorithm used to generate the encoded password, not suggesting you write it in Java. With the Crypt::PasswdMD5 module, it’s very simple. You just had one thing missing. I trimmed the program down to give just what you needed, here it the example:<o:p></o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">my $plainfromuser = 'swhaga';<o:p></o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"># from
getpwd()<o:p></o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">$passwd = '$1$XHjgqURT$QW0eZNAONaXd2XPqkxwce1';<o:p></o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">use Crypt::PasswdMD5;<o:p></o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">my $md5salt = (split(/\$/, $passwd))[2];<o:p></o:p></span></font></div> <div class="MsoNormal"><font
face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"># $1$ designates 'unix' md5 crypt<o:p></o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"># MD5 salt, should be the (up to) 8 chars in between $'s in the encoded passwd,<o:p></o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"># see Crypt::PasswdMD5 source code for details<o:p></o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">my $xpass = unix_md5_crypt($plainfromuser, $md5salt);<o:p></o:p></span></font></div> <div
class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">print "MD5salt: $md5salt\n";<o:p></o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">print "passwd " . $passwd . "\n";<o:p></o:p></span></font></div> <div class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">print "MD5 Crypt pass " . $xpass . "\n";<o:p></o:p></span></font></div> <div class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color:
navy;"><o:p> </o:p></span></font></div> <div class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Jess<o:p></o:p></span></font></div> <div class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"><o:p> </o:p></span></font></div> <div> <div class="MsoNormal" style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> <hr tabindex="-1" align="center" size="2" width="100%"> </span></font></div> <div class="MsoNormal"><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> chicago-talk-bounces+jbalint=gmail.com@pm.org [mailto:chicago-talk-bounces+jbalint=gmail.com@pm.org] <b><span style="font-weight: bold;">On Behalf Of
</span></b>Richard Reina<br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, March 13, 2006 10:19 AM<br> <b><span style="font-weight: bold;">To:</span></b> lembark@wrkhors.com; chicago-talk@mail.pm.org<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Chicago-talk] accessing <st1:City w:st="on"><st1:place w:st="on">NIS</st1:place></st1:City> password</span></font><o:p></o:p></div> </div> <div class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><o:p> </o:p></span></font></div> <div class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">Dear Steve,<br> <br> Thank you very much for the reply. The articles returned in your search highlight some of the differences between crypt, MD5 and blowfish encryption, chiefly which versions of *nix use which and how to encrypt a raw password. I have incorporated those encryption schemes into the script below and while the results are
very interesting none of them match the linux password returned by getpwnam() for the given user -- which is not the x shadow.<br> <br> #!/usr/bin/perl5 -w<br> <br> my $username = 'gerald';<br> my $plainfromuser = 'swhaga';<br> my $currentsalt;<br> <br> my ($name, $passwd, $uid, $gid, $quota, $comment,<br> $gcos, $dir, $shell) = getpwnam($username);<br> <br> # crypt salt<br> $currentsalt = substr($passwd,0,2);<br> <br> # 8 random chars<br> my $key = "justakey";<br> <br> my $cpass = crypt($plainfromuser, $currentsalt);<br> <br> use Crypt::PasswdMD5;<br> <br> my $xpass = unix_md5_crypt($plainfromuser, '$1$', $currentsalt);<br> <br> my $ypass = crypt($plainfromuser, '$1$' . $key);<br> <br> use Digest::MD5 qw(md5_base64);<br> <br> my $zpass = $currentsalt . md5_base64("$currentsalt/$plainfromuser/$key");<br> <br> print "passwd " . $passwd . "\n";<br> print "Crypt
pass " . $cpass . "\n";<br> print "MD5 Crypt pass " . $xpass . "\n";<br> print "Crypt pass MD5 salt " . $ypass . "\n";<br> print "MD5_base64 pass " . $zpass . "\n";<br> <br> ******************************************************<br> results<br> ******************************************************<br> passwd $1$XHjgqURT$QW0eZNAONaXd2XPqkxwce1<br> Crypt pass $1ayHHS8s0NWw<br> MD5 Crypt pass $1$$lCe7AyTRcjUyl7Fdn1T4g0<br> Crypt pass MD5 salt
$1$justakey$uxo5dkFTrnz.u7gtyf/QQ.<br> MD5_base64 pass $14RkT9PfSsSaSoWswj/JaDg<br> <br> As one can see none of the encyptions match the encypted password that I myself have set up for the bogus user "gerald" on our system. Any help would be greatly appreicated.<br> <br> Thank you for your attention.<br> <br> Richard<br> <br> <br> <br> A people that values its privileges above its principles soon loses both.<br> -Dwight D. Eisenhower.<o:p></o:p></span></font></div> </div> _______________________________________________<br>Chicago-talk mailing list<br>Chicago-talk@pm.org<br>http://mail.pm.org/mailman/listinfo/chicago-talk</blockquote><br><BR><BR>A people that values its privileges above its principles soon loses both.<br> -Dwight D. Eisenhower.