etc/shadow without hash


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers etc/shadow without hash
# 1  
Old 07-08-2008
etc/shadow without hash

Hi,

I am new to shell programming and trying to write a command that would show the etc/shadow file but without the hashes. So, something like this:

root: <HASH PASSWORD FOUND BUT OBFUSCATED>
daemon: NP
bin: NP
sys: NP


If there is a '*' or '!', I'd like to see that as well but not hash of the password.

Is there a way to achieve this?

Thanks in advance!
# 2  
Old 07-10-2008
does this work?

Code:
awk -F: 'BEGIN{OFS=":"}{if(length($2) >2){$2="scrubbed"};print}' /etc/shadow

or
Code:
awk -F: '{if(length($2) >2){$2="scrubbed"};print $1,":",$2}' /etc/shadow

# 3  
Old 07-10-2008
Amazing!

Quote:
Originally Posted by frank_rizzo
does this work?

Code:
awk -F: 'BEGIN{OFS=":"}{if(length($2) >2){$2="scrubbed"};print}' /etc/shadow

or
Code:
awk -F: '{if(length($2) >2){$2="scrubbed"};print $1,":",$2}' /etc/shadow

That is amazing, they both work!!

Thanks SOO Much!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to print hash of hash in table format

Hi, I have a hash of hash where it has name, activities and count i have data like this - $result->{$name}->{$activities} = $value; content of that are - name - robert tom cat peter activities - running, eating, sleeping , drinking, work i need to print output as below ... (3 Replies)
Discussion started by: asak
3 Replies

2. Shell Programming and Scripting

Dynamically parse BibTeX and create hash of hash

Hello gurus, Iam trying to parse following BibTex file (bibliography.bib): @book{Lee2000a, abstract = {Abstract goes here}, author = {Lee, Wenke and Stolfo, Salvatore J}, title = {{Data mining approaches for intrusion detection}}, year = {2000} } @article{Forrest1996, abstract =... (0 Replies)
Discussion started by: wakatana
0 Replies

3. Shell Programming and Scripting

Compare values of hashes of hash for n number of hash in perl without sorting.

Hi, I have an hashes of hash, where hash is dynamic, it can be n number of hash. i need to compare data_count values of all . my %result ( $abc => { 'data_count' => '10', 'ID' => 'ABC122', } $def => { 'data_count' => '20', 'ID' => 'defASe', ... (1 Reply)
Discussion started by: asak
1 Replies

4. UNIX for Dummies Questions & Answers

How to convert MD5 hash into shadow format?

I am trying to use John the Ripper but it doesn't take regular MD5 hashes, only shadow MD5 hashes. For example this hash: 900150983cd24fb0d6963f7d28e17f72 (which, decrypted, is 'abc') within a text file, John the Ripper does not detect because it is not in shadow format. How can I convert this MD5... (2 Replies)
Discussion started by: guitarscn
2 Replies

5. Shell Programming and Scripting

perl hash - using a range as a hash key.

Hi, In Perl, is it possible to use a range of numbers with '..' as a key in a hash? Something in like: %hash = ( '768..1536' => '1G', '1537..2560' => '2G' ); That is, the range operation is evaluated, and all members of the range are... (3 Replies)
Discussion started by: dsw
3 Replies

6. Shell Programming and Scripting

Perl Hash:Can not keep hash data in the same order that it was inserted

Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below. #!/usr/bin/perl use warnings; use Tie::IxHash; use strict; tie (my %programs, "Tie::IxHash"); while (my $line = <DATA>) { chomp $line; my(... (1 Reply)
Discussion started by: jgfcoimbra
1 Replies

7. Shell Programming and Scripting

Assigning a hash to another hash key

Hello, I have a hash in hsh. I need to assign it to another hash globalHsh. I think the below statement does not work $globalHsh{$id} = %hsh; What is the right way to assign it? Thanks (3 Replies)
Discussion started by: rsanjay
3 Replies

8. Linux

How to generate the hash in /etc/shadow

Hey guys, i've got some serious problems creating a hash for the /etc/shadow. I try to understand how linux creates this hash. Till now i understood that the $6$ shows me that my ubuntu 9.10 uses sha512 to create the hash. I also understood that the "salt"-thing makes the whole think much more... (2 Replies)
Discussion started by: Sebi0815
2 Replies

9. Solaris

hash password in shadow show 'x' ???

Hello, I want to know the reason behing the scene why some systems have hashed password in /etc/shadow file as "x" not the alienoid language like A1Dksxi3kaA.. (13 characters) As far as I understand, etc/password will show password as "x" and move all hashed password to etc/shadow.... (8 Replies)
Discussion started by: Smith
8 Replies

10. Shell Programming and Scripting

Print Entire hash list (hash of hashes)

I have a script with dynamic hash of hashes , and I want to print the entire hash (with all other hashes). Itried to do it recursively by checking if the current key is a hash and if yes call the current function again with refference to the sub hash. Most of the printing seems to be OK but in... (1 Reply)
Discussion started by: Alalush
1 Replies
Login or Register to Ask a Question