1 /*
2  *  (C) 2003,2006 Jack Lloyd (lloyd@randombit.net)
3  */
4 
5 #include "vnccrack.h"
6 #include <iostream>
7 
operator <<(std::ostream & out,const ChallengeResponse & cr)8 std::ostream& operator<<(std::ostream& out, const ChallengeResponse& cr)
9    {
10    out << cr.to_string();
11    return out;
12    }
13 
14 class Cout_Report : public Report
15    {
16    public:
solution(const ChallengeResponse & cr,const std::string & pass)17       void solution(const ChallengeResponse& cr, const std::string& pass)
18          {
19          std::cout << "Found: " << cr << " -> " << pass << "\n";
20          }
21    };
22 
main(int argc,char * argv[])23 int main(int argc, char* argv[])
24    {
25    const std::string progfile = argv[0];
26 
27    try
28       {
29       if(argc != 3)
30          throw Exception("Usage: " + progfile + " wordlist crpairs");
31 
32       Wordlist wordlist(argv[1]);
33       ChallengeResponses crs(argv[2]);
34 
35       std::cout << "Attempting cracking of " << crs.count()
36                 << " challenge/response pairs..." << std::endl;
37 
38       Cout_Report reporter;
39 
40       while(wordlist.has_more() && !crs.all_solved())
41          crs.test(wordlist.next(), reporter);
42       }
43    catch(std::exception& e)
44       {
45       std::cerr << e.what() << std::endl;
46       return 1;
47       }
48 
49    return 0;
50    }
51