Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
Dictionnary cracker in Ruby and Python
Results 1 to 5 of 5

Thread: Dictionnary cracker in Ruby and Python

Hybrid View

  1. #1
    Guest

    Dictionnary cracker in Ruby and Python

    This did not seem to interest anyone on LNO, so since you guys are much more friendly, you will probably have something to say.

    Python:
    Code:
    #!/usr/bin/env python
    
    import sys, crypt
    
    if len(sys.argv) < 3:
     print "Usage: %s <encrypted string> <dict file>" % sys.argv[0]
     sys.exit(1)
    
    secret = sys.argv[1]
    saltstring = secret[:2]
    f = open(sys.argv[2])
    guess = None
    word = None
    
    while word != "":
    
     word = f.readline()
     guess = crypt.crypt(word, saltstring)
     if guess == secret:
      print "The password is:", word
      sys.exit(0)
    
    print "Could not find password in file", sys.argv[2]
    Ruby:
    Code:
    #!/usr/bin/env ruby
    
    if ARGV.size < 2
     puts "Usage: #{$0} <crypted string> <dict file>"
     exit 1
    end
    
    secret = ARGV[0]
    saltstring = secret[0,2]
    f = File.open(ARGV[1])
    
    f.each_line do |x|
     if x.crypt(saltstring) == secret
      puts "The password is: #{x}"
      exit
      end
    end
    puts "No password found in #{ARGV[1]}"
    This is a very basic implementation. I am planning to implement things like playing with the case of the word.

    Hint: These two programs could prove to be extremely useful if you are taking part of the www.hackerslab.org contest.

  2. #2

    Re: Dictionnary cracker in Ruby and Python

    Those are pretty interesting. By the way, what programs use crypt for password encryption?

  3. #3
    Guest

    Re: Dictionnary cracker in Ruby and Python

    Old Unix boxes and little programs who need simple encryption.

  4. #4

    Re: Dictionnary cracker in Ruby and Python

    I saw it when you posted on linuxnewbie.org and its a nice little piece of code. Unfortunately I cant really understand the meat of it because I have never used python. I know mostly c++ so I have a basic idea of how your programs works.


  5. #5
    Guest

    Re: Dictionnary cracker in Ruby and Python

    I've got a simpler version of the Python version now. I'll post it tonight when I get home.

Similar Threads

  1. Ruby / Ruby on Rails
    By coltrane in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 06-16-2006, 03:38 PM
  2. Makeing games with sdl and ruby
    By comtux in forum Linux - Software, Applications & Programming
    Replies: 1
    Last Post: 01-23-2005, 01:22 PM
  3. My first Ruby script!
    By vee-eye in forum Programming
    Replies: 11
    Last Post: 01-14-2002, 09:49 AM
  4. Ruby
    By Ashcrow in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 12-01-2001, 11:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •