Permalink
Browse files

c_test? what the hell was I thinking of?

  • Loading branch information...
1 parent ca25494 commit d83e3aab4b012ef103bd084e9fd0dcbdb92d9ebb @txus committed Sep 21, 2010
Showing with 0 additions and 167 deletions.
  1. BIN c_test/a.out
  2. +0 −77 c_test/lib/wep_cracker.cpp
  3. +0 −23 c_test/lib/wep_cracker.h
  4. +0 −67 c_test/main.cpp
View
Binary file not shown.
View
@@ -1,77 +0,0 @@
-#include "wep_cracker.h"
-
-using namespace std;
-
-WepCracker::WepCracker() {}
-
-void WepCracker::set_attributes (string _bssid, string _essid, string _file) {
-
- bssid = _bssid;
- essid = _essid;
- file = _file;
- printf("Detected bssid %s, essid %s and captures file %s\n", bssid.c_str(), essid.c_str(), file.c_str());
-
- try{ validate_attributes(); }
- catch(int err) { throw err; }
-
-}
-
-int WepCracker::crack() {
- //TODO
- int rate = 0;
- int eta = 0;
- int counter = 0;
-
- start = "X000138";
- end = "0E";
-
- generate_options();
- /*for (int i = 0; i < options.size(); i++)
- #{
- printf("Opcio %i: %s", i, options[i]);
- }
- // starting_at = Time.now
- // len = @options.length
-*/
-
-}
-
-
-// TODO: Implement validations with regular expressions using Boost.Regex library (OMG)
-
-void WepCracker::validate_attributes() {
- if (bssid.length() < 3) {
- throw 1;
- }
- if (essid.length() < 3) {
- throw 2;
- }
- if (essid.length() < 3) {
- throw 3;
- }
-}
-
-int WepCracker::generate_options() {
-
- for (int i=0; i<16; i++){
-
- char first[2];
- sprintf(first,"%x",i);
-
- for (int j=0; j<16; j++){
-
- char second[2];
- sprintf(second,"%x",j);
-
- for (int k=0; k<16; k++){
- char third[2];
- sprintf(third,"%x",k);
- printf("%s%s%s%s%s\n",start.c_str(),first,second,third,end.c_str());
-
- }
- }
- }
- options.push_back("X000138DC960E");
- options.push_back("X111843752983");
-}
-
View
@@ -1,23 +0,0 @@
-using namespace std;
-
-class WepCracker {
- string bssid;
- string essid;
- string file;
- vector<string> options;
-
- string start;
- string end;
-
- public:
- WepCracker();
- void set_attributes(string, string, string);
- int crack();
- private:
- void validate_attributes();
- int generate_options();
- char get_letter_from();
- int sec2hms();
- char* humanize_time();
-};
-
View
@@ -1,67 +0,0 @@
-#include <iostream>
-#include <vector>
-//#include <boost/regex.hpp>
-#include "lib/wep_cracker.cpp"
-
-using namespace std;
-
-int main(int argc, char *argv[]) {
-
- string essid, bssid, file;
-
- // Get the options from the given arguments
-
- for (int n = 1; n < argc; n++) {
-
- string str(argv[n]);
-
- if (str == "-b")
- {
- bssid = argv[n+1];
- }
- else if (str == "-e")
- {
- essid = argv[n+1];
- }
- else if (str == "-f")
- {
- file = argv[n+1];
- }
-
- }
- bssid = "11:22:33:44:55:66";
- essid = "WLAN_B2";
- file = "dump.cap";
-
- // Try to initialize the WepCracker class with given parameters
-
- WepCracker wep_cracker;
-
- try {
- wep_cracker.set_attributes(bssid, essid, file);
- }
- catch(int error){
- switch(error)
- {
- case 1:
- cerr << "The BSSID looks invalid." << endl;
- break;
- case 2:
- cerr << "The ESSID looks invalid." << endl;
- break;
- case 3:
- cerr << "The captures file looks invalid." << endl;
- break;
- default:
- break;
- }
- return -1;
- }
-
- // If it's all ok, crack!
-
- wep_cracker.crack();
-
- return 0;
-}
-

0 comments on commit d83e3aa

Please sign in to comment.