News for hackers. Stuff that matters.
Re:6.5 Million LinkedIn Password Hashes Leaked by jgrahamc on Wednesday June 06, 2012 @10:59AM (#4074188)
Obligatory shell one-liner:

  grep `echo -n password | shasum | cut -c6-40` hacked.txt
Re:6.5 Million LinkedIn Password Hashes Leaked by olifante on Wednesday June 06, 2012 @12:30PM (#4074712)
Prefix the whole command with a space to avoid dumping your password into your bash history: " grep `echo -n yourpassword | shasum | cut -c6-40` SHA1.txt"
Re:6.5 Million LinkedIn Password Hashes Leaked by prakashk on Wednesday June 06, 2012 @12:49PM (#4074804)
Only if HISTCONTROL is assigned 'ignoreboth' or 'ignorespace'.
Re:6.5 Million LinkedIn Password Hashes Leaked by unfletch on Wednesday June 06, 2012 @03:06PM (#4075562)
Or prompt for it:

   grep `read -sp "password: "; echo "$REPLY" | tr -d "\n" | shasum | cut -c6-40` hacked.txt
Re:6.5 Million LinkedIn Password Hashes Leaked by rasengan on Wednesday June 06, 2012 @01:44PM (#4075079)
I couldn't really find a good reason to use a .bash_history. I linked mine to /dev/null and never looked back. (heh)
Re:6.5 Million LinkedIn Password Hashes Leaked by pbhjpbhj on Wednesday June 06, 2012 @03:57PM (#4075852)
Ctrl+r history search? I'd tend to maintaining a complete history log so that when I've forgotten the one liner I used to rotate my videos 2 years ago I can easily recall it.
Re:6.5 Million LinkedIn Password Hashes Leaked by verself on Wednesday June 06, 2012 @11:04PM (#4077406)
2 years? Just how big is your history file?

I thought 16k entries might be reasonable but that doesn't even last 3 weeks for me. I think there might have been some issue with slow disk seeks so at some point I restricted it to that many.

I guess it probably it would be better to regularly backup the history file to deal with possible some accidental truncations and issues when running multiple shells concurrently, but probably the overall effort to set up such a system would outweight the benefits.

Re:6.5 Million LinkedIn Password Hashes Leaked by uselessuseof on Wednesday June 06, 2012 @06:05PM (#4076455)
export HISTSIZE=0
Re:6.5 Million LinkedIn Password Hashes Leaked by peterwwillis on Wednesday June 06, 2012 @02:01PM (#4075162)
Alternative and more dramatic method of preventing it being written to your bash history:

  kill -9 $$
Re:6.5 Million LinkedIn Password Hashes Leaked by bmnbug on Wednesday June 06, 2012 @04:03PM (#4075890)
kill -9 -1 is better than kill -9 $$
Re:6.5 Million LinkedIn Password Hashes Leaked by alanh on Thursday June 07, 2012 @12:19AM (#4077585)
How so?
Re:6.5 Million LinkedIn Password Hashes Leaked by mcpherrinm on Thursday June 07, 2012 @02:18AM (#4077837)
That post was a troll. -1 is a special PID: It indicates that all processes that you can kill should be.

Kill -9 -1 as root is a surefire way to make a system stop doing anything, fast.

Re:6.5 Million LinkedIn Password Hashes Leaked by dpritchett on Wednesday June 06, 2012 @11:25AM (#4074344)
Here's node.js:

    $ echo linkedin | xargs node -e "var x = require('crypto').createHash('sha1').update(process.argv[1]).digest('hex'); console.log([x, '00000' + x.substring(5)]);"

     7728240c80b6bfd450849405e8500d6d207783b6
     0000040c80b6bfd450849405e8500d6d207783b6
Re:6.5 Million LinkedIn Password Hashes Leaked by vivekian2 on Wednesday June 06, 2012 @12:58PM (#4074845)
Or you could just feed "sha1 <password>" to the duckduckgo.com search box and it will give the result.
Re:6.5 Million LinkedIn Password Hashes Leaked by slavak on Wednesday June 06, 2012 @02:45PM (#4075432)
Some people have this thing against sending their private passwords in plaintext to third-party websites...
Re:6.5 Million LinkedIn Password Hashes Leaked by dredmorbius on Wednesday June 06, 2012 @03:46PM (#4075795)
You're sending the hash, not the password.

DDG supports SSL: https://www.duckduckgo.com/

If you want coverage, generate a few hundred thousand SHA1 hashes along with your password.

Actually, running a trickle query of random SHA1 hashes from your box might be a fun exercise, along with a trickle query of random word tuples (bonus points for using Markov chains to generate statistically probable tuples).

Re:6.5 Million LinkedIn Password Hashes Leaked by daeken on Wednesday June 06, 2012 @09:20PM (#4077090)
If you search for 'sha1 foo', that's being sent across the network to DDG's servers. And sure, if you're using SSL then it's not going across in plain text, but it's decrypted and handled on their servers in plain text; it'll probably even end up in logs and/or tracking databases somewhere. You're giving DDG your password.
Re:6.5 Million LinkedIn Password Hashes Leaked by dredmorbius on Thursday June 07, 2012 @12:22AM (#4077597)
A hash is not a password.

At worst you're giving the attacker a hash target to try brunting. He still has to brute it, and that takes time. Select your plaintext from a large enough keyspace and it's astronomical time.

I'll need to review their policy more closely, but DDG claim fairly minimal tracking. At best someone might be able to correlate hash lookup with some IP space. That's a long way from handing over passwords. And as I already indicated, you could cradled the queries to make the search space much larger.

Re:6.5 Million LinkedIn Password Hashes Leaked by daeken on Thursday June 07, 2012 @12:25AM (#4077603)
No, no, no. You're 100% completely misunderstanding this.

When you search for 'sha1 foo', that query ("sha1 foo") goes up to the server. They know your password is "foo" and that you're attempting to "sha1" it. They don't have a hash, they take that data and perform the hash, then send that down to you.

Re:6.5 Million LinkedIn Password Hashes Leaked by dredmorbius on Thursday June 07, 2012 @04:57AM (#4078122)
Boggle.

OK, gotchya.

I guess I'm just too damned used to using systems that, you know, have useful tools installed locally (or can get them there really damned fast). Including SHA1 and MD5 hash generators.

And I was all worked up to tell you how wrong you were still being.

All because I couldn't fathom the possibility let alone reason anyone would need a third-party site to compute their hashes for them.

Silly me, my error.

Re:6.5 Million LinkedIn Password Hashes Leaked by scoot on Wednesday June 06, 2012 @04:21PM (#4075985)
Well presumably you've already changed your LinkedIn password, so what's not to send?
Re:6.5 Million LinkedIn Password Hashes Leaked by furicle on Wednesday June 06, 2012 @02:10PM (#4075216)
Challenge accepted (although this is pretty crude)

curl -s -d q="sha1 password" http://duckduckgo.com | w3m -T text/html | grep '\w\+\{32\}'

Re:6.5 Million LinkedIn Password Hashes Leaked by ionwake on Wednesday June 06, 2012 @02:22PM (#4075293)
Hi - what does

" xargs node -e "

do?

Thank you

Re:6.5 Million LinkedIn Password Hashes Leaked by dpritchett on Wednesday June 06, 2012 @02:55PM (#4075493)
[node -e] evaluates a line of node.js source from a command line argument:

    $ node -e "console.log('Hello, world.')"
     Hello, world.
[xargs] allows you to pipe the output of one command as an argument to another command. By default it will show up at the tail end of the second command's arg list, but if you want to interleave it you can use -I flag:

    $ echo /usr/share/dict/words | xargs head -5

     A
     A's
     AOL
     AOL's

    $ echo petard | xargs -I {} grep {} /usr/share/dict/words
     petard
     petard's
     petards
[xargs node -e] therefore allows text from STDIN to inserted into a script to be evaluated by the node interpreter, accessible via process.argv:

    $ echo is dog this yes | xargs node -e "console.log(process.argv.slice(1).sort().reverse().join(' ').toUpperCase())"
     YES THIS IS DOG
Re:6.5 Million LinkedIn Password Hashes Leaked by uselessuseof on Wednesday June 06, 2012 @06:46PM (#4076593)
head -5 /usr/share/dict/words

same result as with xargs

grep petard /usr/share/dict/words

same result as with xargs

not sure what you are trying to demonstrate here

useless use of xargs?

Re:6.5 Million LinkedIn Password Hashes Leaked by spal on Thursday June 07, 2012 @02:58AM (#4077934)
No, he is trying to demonstrate how to use 'xargs node -e'.

Are you even reading this discussion properly or are you just searching for some shell snippets and ridicule them as soon as you get a chance? This is what it looks like from your history: http://news.ycombinator.com/threads?id=uselessuseof

ionwake doesn't want to learn how to search a word. He wants to know how 'xargs node -e' works. Please read this again: http://news.ycombinator.com/item?id=4075293

Re:6.5 Million LinkedIn Password Hashes Leaked by zxcvb on Wednesday June 06, 2012 @11:32AM (#4074389)
The perl one liner was funny, the shell one liner was light hearted, but your node solution is just pure fanboyism and quite frankly not in line with the spirit of the two previous posts.
Re:6.5 Million LinkedIn Password Hashes Leaked by jgrahamc on Wednesday June 06, 2012 @11:34AM (#4074403)
And.. the node.js solution doesn't do what either the Perl or shell one liners do. It doesn't tell you whether the password was found in the file. All it does is print out a SHA1 hash of a string.
Re:6.5 Million LinkedIn Password Hashes Leaked by dpritchett on Wednesday June 06, 2012 @11:44AM (#4074464)
That's a trivial modification:

    $ echo linkedin | xargs node -e "var x = require('crypto').createHash('sha1').update(process.argv[1]).digest('hex'); console.log(x.substring(5));" | xargs -I {} grep {} hashes.txt
I'm surprised at the backlash to what I thought was fun code golfing. No one called me names after I posted a simple Python solution that didn't check the file. For what it's worth I've changed my LI password and I haven't bothered downloading the actual hash file.
Re:6.5 Million LinkedIn Password Hashes Leaked by Gigablah on Wednesday June 06, 2012 @12:11PM (#4074598)
If I post a PHP solution maybe zxcvb will get a heart attack.
Re:6.5 Million LinkedIn Password Hashes Leaked by justinhj on Wednesday June 06, 2012 @12:19PM (#4074636)
node has a neat API for quickly knocking out stuff like this; it's a useful tool for more than just server code. Calling that comment fanboyism is just displaying the opposite of fanboyism, prejudice against hyped-up tools that nevertheless are good tools.
Re:6.5 Million LinkedIn Password Hashes Leaked by zxcvb on Wednesday June 06, 2012 @12:07PM (#4074585)
My point still stands. There's funny and then theres blatent fanboyism. You're like a prepubescent teenager who doesn't understand the context of social situations so always says something stupid.
Re:6.5 Million LinkedIn Password Hashes Leaked by sintaks on Wednesday June 06, 2012 @12:34PM (#4074727)
"Which brings us to the most important principle on HN: civility. Since long before the web, the anonymity of online conversation has lured people into being much ruder than they'd dare to be in person. So the principle here is not to say anything you wouldn't say face to face. This doesn't mean you can't disagree. But disagree without calling the other person names. If you're right, your argument will be more convincing without them."
Re:6.5 Million LinkedIn Password Hashes Leaked by icebraining on Wednesday June 06, 2012 @01:44PM (#4075078)
Some people actually do call names to others when face to face.

Personally, while I don't, I do tend to get a little aggressive and then I'm often surprised with the backlash, because I get that way when I'm genuinely enjoying the conversation, not when I'm irritated.

Re:6.5 Million LinkedIn Password Hashes Leaked by SkyMarshal on Wednesday June 06, 2012 @03:48PM (#4075802)
Tone doesn't carry on the Internet, so no one knows you're enjoying it. Hence, it generally degrades the quality of the conversation, which is the opposite of what we want at HN.
Re:6.5 Million LinkedIn Password Hashes Leaked by icebraining on Wednesday June 06, 2012 @08:23PM (#4076912)
No, I'm saying I do that face-to-face, and people still can't tell I'm enjoying it. So the tip to say nothing that you wouldn't say IRL is useless to me; I just can't help it.
Re:6.5 Million LinkedIn Password Hashes Leaked by freyr on Wednesday June 06, 2012 @01:13PM (#4074926)
"You're like a prepubescent teenager who doesn't understand the context of social situations..."

The hypocrisy is so unabashed my brain might explode.

Re:6.5 Million LinkedIn Password Hashes Leaked by betterth on Wednesday June 06, 2012 @01:43PM (#4075072)
Pot, meet kettle.
Re:6.5 Million LinkedIn Password Hashes Leaked by uselessuseof on Wednesday June 06, 2012 @06:04PM (#4076450)
obligatory comments

- not portable

- useless use of backticks

printf password|openssl sha1|cut -c6-40|grep -f - hacked.txt

Re:6.5 Million LinkedIn Password Hashes Leaked by spal on Thursday June 07, 2012 @05:21AM (#4078177)
Why are you extracting 35 characters with 'cut -c6-40'? SHA1 produces a 160-bit message digest. That's 20 bytes or 40 hex-digits.
Re:6.5 Million LinkedIn Password Hashes Leaked by uselessuseof on Thursday June 07, 2012 @03:19PM (#4080835)
typo.