-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.rs
More file actions
206 lines (181 loc) · 4.82 KB
/
Copy pathmain.rs
File metadata and controls
206 lines (181 loc) · 4.82 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
mod keyauth;
use simple_user_input::get_input;
use std::process;
fn main() {
let mut keyauthapp = keyauth::KeyauthApi::new(
"", // Application name
"", // Application OwnerID
obfstr::obfstr!(""), // Application Secret
"", // Application Version
);
match keyauthapp.init() {
Ok(_) => println!("Initialized"),
Err(msg) => {
println!("\n\n Error: {}", msg);
return;
}
};
keyauthapp.check();
keyauthapp.checkBlack();
println!(
"
-
Application Data:
Number of users: {}
Number of online users: {}
Number of keys: {}
Application Version: {}
Customer panel link: {}
Session Validated? {}
BlackListed? {}
",
keyauthapp.numKeys.to_string(),
keyauthapp.numOnlineUsers.to_string(),
keyauthapp.numUsers.to_string(),
keyauthapp.appVersion.to_string(),
keyauthapp.customerPanelLink.to_string(),
keyauthapp.message.to_string(),
keyauthapp.blackListed.to_string()
);
let input: String = get_input(
"
1 Login
2 Register
3 Upgrade
4 License
Your Choice: ",
);
if input == "1" {
let UserName: String = get_input(" Username: ");
let PassWord: String = get_input(" Password: ");
match keyauthapp.login(UserName, PassWord, None) {
Ok(_) => {}
Err(msg) => {
println!("Status: {}", msg);
process::exit(0);
}
}
} else if input == "2" {
let UserName: String = get_input(" Username: ");
let PassWord: String = get_input(" Password: ");
let License: String = get_input(" License: ");
match keyauthapp.register(UserName, PassWord, License, None) {
Ok(_) => {}
Err(msg) => {
println!("Status: {}", msg);
process::exit(0);
}
}
} else if input == "3" {
let UserName: String = get_input(" Username: ");
let License: String = get_input(" License: ");
match keyauthapp.upgrade(UserName, License) {
Ok(_) => {}
Err(msg) => {
println!("Status: {}", msg);
process::exit(0);
}
}
} else if input == "4" {
let License: String = get_input(" License: ");
match keyauthapp.license(License, None) {
Ok(_) => {}
Err(msg) => {
println!("Status: {}", msg);
process::exit(0);
}
}
} else {
println!(" Wrong Choice!");
process::exit(0);
}
keyauthapp.check();
keyauthapp.checkBlack();
println!(
"
-Logged in!
Username: {}
IP address: {}
Hardware-Id: {}
Created at: {}
Last Login: {}
Subscription: {}
Session Validated? {}
BlackListed? {}
",
keyauthapp.username.to_string(),
keyauthapp.ip.to_string(),
keyauthapp.hwid.to_string(),
keyauthapp.createDate.to_string(),
keyauthapp.LastLogin.to_string(),
keyauthapp.subscription.to_string(),
keyauthapp.message.to_string(),
keyauthapp.blackListed.to_string()
);
println!(" Closing in 10 seconds...");
}
mod simple_user_input {
use std::io;
pub fn get_input(prompt: &str) -> String {
println!("{}", prompt);
let mut input = String::new();
match io::stdin().read_line(&mut input) {
Ok(_goes_into_input_above) => {}
Err(_no_updates_is_fine) => {}
}
input.trim().to_string()
}
}
/*
match keyauthapp.register(username.clone(), password.clone(), key, None) {
Ok(_) => println!("Registered"),
Err(msg) => {
println!("Error: {}", msg);
return;
}
}
match keyauthapp.login(username.clone(), password, None) {
Ok(_) => println!("Logged in"),
Err(msg) => {
println!("Error: {}", msg);
return;
}
}
match keyauthapp.license(key2, None) {
Ok(_) => println!("License works"),
Err(msg) => {
println!("Error: {}", msg);
return;
}
}
match keyauthapp.upgrade(username, key3) {
Ok(_) => println!("Upgrade works"),
Err(msg) => {
println!("Error: {}", msg);
return;
}
}
match keyauthapp.var(varid) {
Ok(var) => println!("VarID works: {}", var),
Err(msg) => {
println!("Error: {}", msg);
return;
}
}
match keyauthapp.file(fileid) {
Ok(contents) => println!("FileID works: {}", String::from_utf8_lossy(&contents)),
Err(msg) => {
println!("Error: {}", msg);
return;
}
}
match keyauthapp.webhook(webid, params) {
Ok(contents) => println!("Web works: {}", contents),
Err(msg) => {
println!("Error: {}", msg);
return;
}
}
keyauthapp.log("Log message works as well!".to_string());
println!("Log seems to work as well!");
*/