-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
62 lines (49 loc) · 1.17 KB
/
main.cpp
File metadata and controls
62 lines (49 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <algorithm>
#include <string>
#include <iostream>
#include "cryptoObj.h"
char* getCmdOption(char ** begin, char ** end, const std::string & option)
{
char ** itr = std::find(begin, end, option);
if (itr != end && ++itr != end)
{
return *itr;
}
return 0;
}
bool cmdOptionExists(char** begin, char** end, const std::string& option)
{
return std::find(begin, end, option) != end;
}
int main(int argc, char * argv[])
{
if (cmdOptionExists(argv, argv + argc, "-h") && getCmdOption(argv, argv + argc, "-h")==0)
{
std::cout << "got -h" << std::endl;
}
char * encryption = getCmdOption(argv, argv + argc, "-enc");
if (encryption)
{
pattern* ptr = NULL;
std::cout << "got param " << encryption << std::endl;
if (!strcmp(encryption, "vigenere"))
ptr = new vigenere();
else
return 0;
ptr->execute("crack", "LXFOPVEFRNHR");
}
char * hash = getCmdOption(argv, argv + argc, "-hash");
if (hash)
{
pattern* ptr = NULL;
std::cout << "got param " << hash << std::endl;
if (!strcmp(hash, "md5"))
ptr = new md5();
else
return 0;
ptr->execute("hello", NULL);
std::cout<< ptr->outputBits() <<std::endl;
ptr->breakChances();
}
return 0;
}