-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrypt.php
More file actions
131 lines (118 loc) · 4.55 KB
/
crypt.php
File metadata and controls
131 lines (118 loc) · 4.55 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
<?php
$BASE_PASSWORD = "PASS HERE";
if($_SERVER["REQUEST_METHOD"] === "POST" ){
if(isset($_POST["method"]) && isset($_POST["text"])){
if(empty($_POST["text"]) === false) {
if($_POST["method"] == "e") {
echo openssl_encrypt($_POST["text"], "AES-128-CTR",
$BASE_PASSWORD, 0, "1036832894143748");
}
elseif($_POST["method"] == "d" && isset($_POST["decode"])) {
$de = openssl_decrypt($_POST["text"], "AES-128-CTR",
substr($_POST["decode"], 0, strlen($_POST["decode"])/2).$BASE_PASSWORD.substr($_POST["decode"], strlen($_POST["decode"])/2, strlen($_POST["decode"])), 0, "1036832894143748");
$de2 = explode($de, "|");
$e = 0;
$code = json_decode(file_get_contents("active.json"));
$codes = array_column($code, 'seed');
$trip = array_column($code, 'trip');
for($i = 0;$i < count($code); $i++) {
if(str_contains($de2[1],$trip[$i])){
$e = 1;
}}
if($e = 1) {
echo openssl_decrypt($_POST["text"], "AES-128-CTR",
substr($_POST["decode"], 0, strlen($_POST["decode"])/2).$BASE_PASSWORD.substr($_POST["decode"], strlen($_POST["decode"])/2, strlen($_POST["decode"])), 0, "1036832894143748");
}
else {
echo $_POST["text"];
}
}
else {
echo "<script>alert('no method');</script>";
}
}
else {
echo "<script>alert('no text');</script>";
}
}
if(isset($_POST["seed"])){
$id = uniqid();
if(empty($_POST["seed"])) {
}
else {
if(isset($_POST["m"]) && $_POST["m"] == "x") {
$code = json_decode(file_get_contents("active.json"));
$codes = array_column($code, 'seed');
$trip = array_column($code, 'trip');
for($i = 0;$i < count($code); $i++) {
if(str_contains($_POST["seed"],$codes[$i])){
echo openssl_encrypt(str_replace("|","",$_POST["text"])."|". $trip[$i], "AES-128-CTR",
substr($_POST["seed"], 0, strlen($_POST["seed"])/2).$BASE_PASSWORD.substr($_POST["seed"], strlen($_POST["seed"])/2, strlen($_POST["seed"])), 0, "1036832894143748");
}
}
}
else {
$write = Array(
"seed" => $_POST["seed"],
"enc" => substr($_POST["seed"], 0, strlen($_POST["seed"])/2).$BASE_PASSWORD.substr($_POST["seed"], strlen($_POST["seed"])/2, strlen($_POST["seed"])),
"trip" => $id,
"thread" => "pending"
);
$test = file_get_contents("active.json");
if(empty($test)) {
$json = json_encode($write);
}
else {
$json = file_get_contents("active.json") . "," . json_encode($write);
}
function evaluate(){$code2 = json_decode(file_get_contents("active.json"));
if(empty($code2)){
return false;
}
else{
$codes2 = array_column($code2, 'seed');
$y = 0;
for($l = 0;$l < count($code2); $l++) {
if(in_array($_POST["seed"],$codes2)){
$y = 1;
}}
if($y === 1) {
return true;
}
else {
return false;
}
}
}
if(evaluate()===false){
file_put_contents("active.json", "[". str_replace("]"," ",str_replace("["," ",$json))."]");
echo openssl_encrypt($_POST["text"]."|". $id, "AES-128-CTR",
substr($_POST["seed"], 0, strlen($_POST["seed"])/2).$BASE_PASSWORD.substr($_POST["seed"], strlen($_POST["seed"])/2, strlen($_POST["seed"])), 0, "1036832894143748");
}
else {
echo "Password in use, try again";
}
}}}
if(isset($_POST["seed"]) && isset($_POST["link"])) {
$code = json_decode(file_get_contents("active.json"));
$codes = array_column($code, 'seed');
for($i = 0;$i < count($code); $i++) {
if(str_contains($_POST["seed"],$codes[$i])){
$ja = Array(
"pass" => $_POST["seed"],
"link" => $_POST["link"]
);
if(str_contains(file_get_contents("thread.json"), json_encode($ja)) === false) {
$e = file_get_contents("thread.json");
if(empty(file_get_contents("thread.json"))){
file_put_contents("thread.json", "[". str_replace("]"," ",str_replace("["," ",$e . json_encode($ja)))."]");
}
else{
file_put_contents("thread.json", "[". str_replace("]"," ",str_replace("["," ",$e . "," . json_encode($ja)))."]");
}
}
break;
}}
}
}
?>