-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattack_scan.cpp
More file actions
51 lines (41 loc) · 1.53 KB
/
Copy pathattack_scan.cpp
File metadata and controls
51 lines (41 loc) · 1.53 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
#include "utils/bigint/bigint.h"
#include "utils/selection/selection.h"
#include "problem.h"
#include "attack.h"
using namespace std;
selection_type attack_selection;
static problem problem;
static vector<bigint> problemParameters;
static attack attack;
int callback(const vector<bigint> &Q)
{
if (attack.params_valid) assert(attack.params_valid(problemParameters,Q));
for (bigint j = 0;j < Q.size();++j)
if (!selection_allows(attack_selection,attack.paramnames.at(j),Q.at(j).get_str()))
return 0;
return attack_handle(problem,problemParameters,attack,Q);
}
int main(int argc,char **argv)
{
attack_selection = selection_parse(argv+1,argc-1);
for (auto E_local : problem_list) {
problem = E_local;
if (!selection_allows(attack_selection,"problem",problem.name)) continue;
/// The list of problem parameters.
vector<vector<bigint>> problemParametersList = problem.params(attack_selection);
for (auto P_local : problemParametersList) {
problemParameters = P_local;
bool selected = 1;
for (bigint j = 0;j < problemParameters.size();++j)
selected &= selection_allows(attack_selection,problem.paramnames.at(j),problemParameters.at(j).get_str());
if (!selected) continue;
for (auto A_local : attack_list) {
attack = A_local;
if (string(attack.problemname) != string(problem.name)) continue;
if (!selection_allows(attack_selection,"attack",attack.name)) continue;
attack.params(problemParameters,attack_selection,callback);
}
}
}
return 0;
}