-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessBlocker.cpp
More file actions
56 lines (55 loc) · 1016 Bytes
/
processBlocker.cpp
File metadata and controls
56 lines (55 loc) · 1016 Bytes
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
#include <cstdio>
// #include <unistd.h>
#include <iostream>
#include "lib/allow.h"
#include "lib/block.h"
#include <bits/stdc++.h>
using namespace std;
// driver function
int main()
{
fstream file;
bool Flag = false;
std::vector<std::string> blocklist, allowlist;
string process, filename;
filename = "Process.txt";
file.open(filename.c_str());
file >> process;
string check = process;
while (file >> process)
{
if (process == "}")
{
Flag = true;
continue;
}
if (process == "{" || process == ",")
continue;
if (Flag == true)
{
blocklist.push_back(process);
}
else
allowlist.push_back(process);
}
cout << check << endl;
for (auto i : blocklist)
cout << i << " ";
cout << endl;
for (auto i : allowlist)
cout << i << " ";
cout << endl;
while (true)
{
if (check == "allow")
{
ProcessHandler2(allowlist);
}
else
{
ProcessHandler1(blocklist);
}
}
file.close();
return 0;
}