-
Notifications
You must be signed in to change notification settings - Fork 0
/
temp.cpp
72 lines (64 loc) · 1.97 KB
/
temp.cpp
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
63
64
65
66
67
68
69
70
71
72
#include "temp.h"
using namespace std;
using namespace libpawdfox;
PawdFox::PawdFox() {
}
int PawdFox::OpenIni(const string &path) {
firefox_profile p;
p.path = "/path1/";
p.name = "Path1";
p.password = "";
profiles.push_back(p);
firefox_profile p2;
p2.path = "/test2/";
p2.name = "Path2";
p2.password = "";
profiles.push_back(p2);
firefox_profile p3;
p3.path = "/test3/";
p3.name = "Path3";
p3.password = "";
profiles.push_back(p3);
return LIBPAWD_STATUS_SUCCESS;
}
int PawdFox::ReadLogins(const firefox_profile profile) {
if (profile.name == "Path2" && profile.password != "senha") {
return LIBPAWD_STATUS_WRONG_PASSWORD;
}
firefox_credential credential;
credential.hostname = "http://domain1.com/";
credential.encrypted_username = "myUserName";
credential.username = "myUsername";
credential.encrypted_password = "encPassword";
credentials.push_back(credential);
if (profile.path == "test3")
{
firefox_credential credential2;
credential2.hostname = "http://domain2.com/";
credential2.encrypted_username = "Name";
credential2.username = "Name";
credential2.encrypted_password = "Password";
credentials.push_back(credential2);
}
return LIBPAWD_STATUS_SUCCESS;
}
int PawdFox::CloseProfile() {
return 0;
}
vector<firefox_credential> PawdFox::Filter(const string query) {
vector<firefox_credential> ret;
for (std::vector<firefox_credential>::const_iterator iterator = credentials.begin(),
end = credentials.end(); iterator != end; ++iterator) {
if (iterator->hostname.find(query) != string::npos ||
iterator->username.find(query) != string::npos) {
ret.push_back(*iterator);
}
}
return ret;
}
string PawdFox::GetPassword(const firefox_credential credential) {
return "senha";
}
string PawdFox::GetPassword(const string encrypted_password) {
return "senha";
}