LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-13-2004, 04:46 AM   #1
drigz
Member
 
Registered: Apr 2004
Distribution: Gentoo ~x86
Posts: 407

Rep: Reputation: 30
bash scripting qu


i can use the strings command to use a for loop to go through all strings in a file:
for word in $( strings file )
do
whatever
done

however, i need a command which will go through each line, instead of each word.

this is because i have a big word list, but it also has some phrases of 2-3 words. i need to remove these from the file.

alternatively, does anyone know where i can get a big wordlist for use with john the ripper?

thanks
 
Old 06-13-2004, 05:38 AM   #2
drigz
Member
 
Registered: Apr 2004
Distribution: Gentoo ~x86
Posts: 407

Original Poster
Rep: Reputation: 30
ive been trying to do it with vi by running:
/ (slash space enter)
dd

repeatedly, but my wrists are starting to hurt and im only at b i need a better way to remove them... is there a way to run a script repeatedly in vi or something?

EDIT: i can just type slash enter - what a timesaving discovery. im now in the ca's. ive found somehting bad out though. if i type a single d by accident then search ofr the next space, it deletes everything between there and the next space. if i notice i can get a quick u in, but i fear i may have not noticed some. i suppose its not very important.

Last edited by drigz; 06-13-2004 at 05:55 AM.
 
Old 06-13-2004, 05:05 PM   #3
davamundo
LQ Newbie
 
Registered: Jun 2004
Posts: 1

Rep: Reputation: 0
sed, he said

I've just discovered the joys of sed and I think you'll find that it's just what you're looking for.
try "man sed"
djp
 
Old 06-14-2004, 11:41 AM   #4
drigz
Member
 
Registered: Apr 2004
Distribution: Gentoo ~x86
Posts: 407

Original Poster
Rep: Reputation: 30
i did it - i used strings to write a file with all the words on differnet lines (so splitting the phrases up into separate words, then sorted that again, then remvoed all the duplicates. it seems to be ok. lets see how secure my pw is - using the normal password list then incremental, its been running for 3 days now and not found it.
 
Old 06-14-2004, 12:04 PM   #5
drigz
Member
 
Registered: Apr 2004
Distribution: Gentoo ~x86
Posts: 407

Original Poster
Rep: Reputation: 30
k ive got it set up properly - lets see if it gets my passwords.
 
Old 06-14-2004, 12:05 PM   #6
drigz
Member
 
Registered: Apr 2004
Distribution: Gentoo ~x86
Posts: 407

Original Poster
Rep: Reputation: 30
shit its already found my root password - well have to change that...
edit: and my normal - its time to stop using dictionary words... thing is its hard to remember passwords which arent easy to guess...

Last edited by drigz; 06-14-2004 at 12:09 PM.
 
Old 06-14-2004, 12:10 PM   #7
drigz
Member
 
Registered: Apr 2004
Distribution: Gentoo ~x86
Posts: 407

Original Poster
Rep: Reputation: 30
is it a common tactic to search for dictionary words backwards?

edit: i hear it is - i guess im doomed to memorising a bunch of random characters like gtxuqcgl
....

Last edited by drigz; 06-14-2004 at 12:51 PM.
 
Old 06-14-2004, 02:07 PM   #8
rustynailz
Member
 
Registered: Jun 2004
Distribution: MDK 9.2/10.0, VectorLinux 4.0
Posts: 50

Rep: Reputation: 15
You can really easily do a global action in vim (not sure about vi). For instance, to delete all lines containing the number 1:
:g/1/:normal dd
Again, as someone mentioned, sed is probably the way to go here though.
 
Old 06-14-2004, 04:07 PM   #9
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
Good passwords -

Pick a dictionary word at least 6 characters long, 8 is better.

Then do a "cute" substitute:

Replace characters with lookalikes for example:
character 8 for b's

bubble becomes 8u88le

Or use a shift-numeric character like & for the letter G.
bigger become bi&&er

Or put two shorter words together like
EveOdd

Try dumb puns:
EoScene

Adding capital letters helps, too.

If you're on multiple machines, create a good, base password about 5-6 chars long, then append the nodename for each box you log onto. That way you onl have to remember the short base password.

In other words, come up with a way to remember your password so it is never written down or stored anywhere in a file. Plus, don't use regular "dictionary" words, names of your family members or pets.
 
Old 06-14-2004, 04:16 PM   #10
drigz
Member
 
Registered: Apr 2004
Distribution: Gentoo ~x86
Posts: 407

Original Poster
Rep: Reputation: 30
surely a good password is a string of random characters? for example:
hkedpunw
can only be gotten with an incremental search?
 
Old 06-14-2004, 05:09 PM   #11
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
Actually, there are two basic password attacks: dictionary attacks, and a so-called crypt attack. You understand the dictionary one - a crpyt attack is an attempt to generate a string of characters (randomly chosen) that after a call to crypt, match the hash in /etc/shadow.

Actually, try reading the Shellcoder's Handbook, if you want to see how most systems are exploited.
 
Old 06-15-2004, 01:05 AM   #12
drigz
Member
 
Registered: Apr 2004
Distribution: Gentoo ~x86
Posts: 407

Original Poster
Rep: Reputation: 30
yeh i kno that - incremental goes thru every possible pw. a-z A-Z 0-9, for each possible length. takes f**king days tho.i should throw in capitals and stuff, but i dont think its that great a risk.
 
Old 06-15-2004, 02:09 AM   #13
Goala
Member
 
Registered: May 2004
Location: Merida (Spain)
Distribution: Debian
Posts: 89

Rep: Reputation: 15
going back to the original question:

Code:
nawk '
    # One line, one word & get rid of blank lines:
    NF > 0 {
        for (i=1; i<=NF; i++) {
            printf "%s\n",$i ;
        }
    }
' $INPUT_FILE | sort -u  > $OUTPUT_FILE
with this code:
a) you split all the words in each line of $INPUT_FILE and get new lines with only one word into $OUTPUT_FILE.

b) (with sort -u) you sort the words and get rid of duplicate lines.


then you can run:
Code:
for word in `cat $OUTPUT_FILE`
do
    whatever
done
bye
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash scripting help (su ...) shwong Linux - General 1 11-02-2005 12:26 PM
Bash scripting pete1234 Programming 1 09-27-2005 01:48 AM
bash scripting vadon Linux - Newbie 6 05-10-2005 04:07 AM
need help with bash scripting rich2oo1 Programming 2 12-17-2003 12:50 PM
HELP with BASH scripting atwah Linux - Newbie 6 09-09-2003 01:10 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration