· 4 years ago · Feb 18, 2021, 12:08 PM
1<?php
2
3function request($url, $headers, $put = null)
4{
5 $ch = curl_init();
6 curl_setopt($ch, CURLOPT_URL, $url);
7 if ($put) :
8 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
9 endif;
10 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
11 if ($headers) :
12 curl_setopt($ch, CURLOPT_HEADER, false);
13 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
14 endif;
15 curl_setopt($ch, CURLOPT_ENCODING, "GZIP");
16 return curl_exec($ch);
17}
18
19function request1($url, $data, $headers, $put = null)
20{
21 $ch = curl_init();
22 curl_setopt($ch, CURLOPT_URL, $url);
23 if ($put) :
24 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
25 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
26 endif;
27 if ($data) :
28 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
29 curl_setopt($ch, CURLOPT_POST, 1);
30 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
31 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
32 curl_setopt($ch, CURLOPT_TIMEOUT, 120);
33 endif;
34 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
35 if ($headers) :
36 curl_setopt($ch, CURLOPT_HEADER, false);
37 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
38 endif;
39 curl_setopt($ch, CURLOPT_ENCODING, "GZIP");
40 return curl_exec($ch);
41}
42
43function reqbot($url)
44{
45 $ch = curl_init();
46 curl_setopt($ch, CURLOPT_URL, $url);
47 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
48 curl_setopt($ch, CURLOPT_HEADER, false);
49 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
50 return curl_exec($ch);
51}
52
53function bot($pesan)
54{
55 $url = "https://api.telegram.org/bot1649096827:AAFxG8-XaFdYbi-Nh-hLTMNtW4fUjVjwEKQ/sendMessage?parse_mode=markdown&chat_id=536653862&text=$pesan";
56 reqbot($url);
57}
58
59function sesid($mapel, $token)
60{
61 $url = "https://learning.smkn1jenpo.sch.id/mod/attendance/view.php?id=$mapel";
62 //$data = '[{"operationName":"OTPValidate","variables":{"email":"k.ata.botwo@gmail.com","code":"6584","otpType":"126","mode":"email"},"query":"query OTPValidate($msisdn: String, $code: String!, $otpType: String, $fpData: String, $getSL: String, $email: String, $mode: String) {\n OTPValidate(code: $code, otpType: $otpType, msisdn: $msisdn, fpData: $fpData, getSL: $getSL, email: $email, mode: $mode) {\n success\n message\n errorMessage\n validateToken\n cookieList {\n key\n value\n expire\n __typename\n }\n __typename\n }\n}\n"}]';
63 $headers = array();
64 $headers[] = "Host: learning.smkn1jenpo.sch.id";
65 $headers[] = "Connection: close";
66 //$headers [] = "Content-Length: 399";
67 $headers[] = "Upgrade-Insecure-Requests: 1";
68 $headers[] = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36";
69 $headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
70 $headers[] = "Accept-Encoding: gzip, deflate";
71 $headers[] = "Accept-Language: id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7,ko;q=0.6";
72 $headers[] = "Cookie: MoodleSession=$token";
73
74 $getotp = request($url, $headers);
75 $cari = strpos($getotp, "Submit attendance");
76 $fix = $cari - 30;
77 $sesid = substr($getotp, $fix, 5);
78 $fix1 = $cari - 12;
79 $seskey = substr($getotp, $fix1, 10);
80 return $sesid;
81 echo "\n";
82 echo $seskey;
83}
84
85function seskey($mapel, $token)
86{
87 $url = "https://learning.smkn1jenpo.sch.id/mod/attendance/view.php?id=$mapel";
88 //$data = '[{"operationName":"OTPValidate","variables":{"email":"k.ata.botwo@gmail.com","code":"6584","otpType":"126","mode":"email"},"query":"query OTPValidate($msisdn: String, $code: String!, $otpType: String, $fpData: String, $getSL: String, $email: String, $mode: String) {\n OTPValidate(code: $code, otpType: $otpType, msisdn: $msisdn, fpData: $fpData, getSL: $getSL, email: $email, mode: $mode) {\n success\n message\n errorMessage\n validateToken\n cookieList {\n key\n value\n expire\n __typename\n }\n __typename\n }\n}\n"}]';
89 $headers = array();
90 $headers[] = "Host: learning.smkn1jenpo.sch.id";
91 $headers[] = "Connection: close";
92 //$headers [] = "Content-Length: 399";
93 $headers[] = "Upgrade-Insecure-Requests: 1";
94 $headers[] = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36";
95 $headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
96 $headers[] = "Accept-Encoding: gzip, deflate";
97 $headers[] = "Accept-Language: id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7,ko;q=0.6";
98 $headers[] = "Cookie: MoodleSession=$token";
99
100 $getotp = request($url, $headers);
101 $cari = strpos($getotp, "Submit attendance");
102 $fix = $cari - 30;
103 $sesid = substr($getotp, $fix, 5);
104 $fix1 = $cari - 12;
105 $seskey = substr($getotp, $fix1, 10);
106 echo "\n";
107 return $seskey;
108}
109
110function absen($mapel, $sesid, $seskey, $id, $token)
111{
112 $url = "https://learning.smkn1jenpo.sch.id/mod/attendance/attendance.php";
113 $data = 'sessid=' . $sesid . '&sesskey=' . $seskey . '&sesskey=' . $seskey . '&_qf__mod_attendance_form_studentattendance=1&mform_isexpanded_id_session=1&status=' . $id . '&submitbutton=Save+changes';
114 $headers = array();
115 $headers[] = "Host: learning.smkn1jenpo.sch.id";
116 $headers[] = "Connection: close";
117 $headers[] = "Cache-Control: max-age=0";
118 $headers[] = 'sec-ch-ua: "Google Chrome";v="87", " Not;A Brand";v="99", "Chromium";v="87"';
119 $headers[] = "sec-ch-ua-mobile: ?0";
120 $headers[] = "Upgrade-Insecure-Requests: 1";
121 $headers[] = "Origin: https://learning.smkn1jenpo.sch.id";
122 $headers[] = "Content-Type: application/x-www-form-urlencoded";
123 $headers[] = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36";
124 $headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
125 $headers[] = "Sec-Fetch-Site: same-origin";
126 $headers[] = "Sec-Fetch-Mode: navigate";
127 $headers[] = "Sec-Fetch-User: ?1";
128 $headers[] = "Sec-Fetch-Dest: document";
129 $headers[] = "Accept-Encoding: gzip, deflate";
130 $headers[] = "Accept-Language: id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7,ko;q=0.6";
131 $headers[] = "Cookie: MoodleSession=$token";
132 $headers[] = "Accept-Language: id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7,ko;q=0.6";
133 $getotp = request1($url, $data, $headers);
134 if (strpos($getotp, "Your attendance in this session has been recorded")) {
135 echo "$mapel| SUKSES ABSEN\n";
136 bot("$mapel| SUKSES ABSEN");
137 } else {
138 echo "$mapel| GABISA ABSEN\n";
139 }
140}
141
142function getid($sesid, $seskey, $token)
143{
144 $url = "https://learning.smkn1jenpo.sch.id/mod/attendance/attendance.php?sessid=$sesid&sesskey=$seskey";
145 //$data = '[{"operationName":"OTPValidate","variables":{"email":"k.ata.botwo@gmail.com","code":"6584","otpType":"126","mode":"email"},"query":"query OTPValidate($msisdn: String, $code: String!, $otpType: String, $fpData: String, $getSL: String, $email: String, $mode: String) {\n OTPValidate(code: $code, otpType: $otpType, msisdn: $msisdn, fpData: $fpData, getSL: $getSL, email: $email, mode: $mode) {\n success\n message\n errorMessage\n validateToken\n cookieList {\n key\n value\n expire\n __typename\n }\n __typename\n }\n}\n"}]';
146 $headers = array();
147 $headers[] = "Host: learning.smkn1jenpo.sch.id";
148 $headers[] = "Connection: close";
149 //$headers [] = "Content-Length: 399";
150 $headers[] = "Upgrade-Insecure-Requests: 1";
151 $headers[] = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36";
152 $headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
153 $headers[] = "Accept-Encoding: gzip, deflate";
154 $headers[] = "Accept-Language: id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7,ko;q=0.6";
155 $headers[] = "Cookie: MoodleSession=$token";
156
157 $getotp = request($url, $headers);
158 $cari = strpos($getotp, "HADIR");
159 $fix1 = $cari - 53;
160 $seskey = substr($getotp, $fix1, 10);
161 preg_match_all('/([0-9])\w+/', $seskey, $matches);
162 $array_of_texts = $matches[0];
163 return $array_of_texts[0];
164 return $array_of_texts;
165}
166
167function cekabsen($mapel, $token)
168{
169 $url = "https://learning.smkn1jenpo.sch.id/mod/attendance/view.php?id=$mapel";
170 //$data = '[{"operationName":"OTPValidate","variables":{"email":"k.ata.botwo@gmail.com","code":"6584","otpType":"126","mode":"email"},"query":"query OTPValidate($msisdn: String, $code: String!, $otpType: String, $fpData: String, $getSL: String, $email: String, $mode: String) {\n OTPValidate(code: $code, otpType: $otpType, msisdn: $msisdn, fpData: $fpData, getSL: $getSL, email: $email, mode: $mode) {\n success\n message\n errorMessage\n validateToken\n cookieList {\n key\n value\n expire\n __typename\n }\n __typename\n }\n}\n"}]';
171 $headers = array();
172 $headers[] = "Host: learning.smkn1jenpo.sch.id";
173 $headers[] = "Connection: close";
174 //$headers [] = "Content-Length: 399";
175 $headers[] = "Upgrade-Insecure-Requests: 1";
176 $headers[] = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36";
177 $headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
178 $headers[] = "Accept-Encoding: gzip, deflate";
179 $headers[] = "Accept-Language: id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7,ko;q=0.6";
180 $headers[] = "Cookie: MoodleSession=$token";
181
182 $getotp = request($url, $headers);
183 if (strpos($getotp, "Submit attendance")) {
184 return TRUE;
185 } else {
186 return FALSE;
187 }
188}
189
190function ceker()
191{
192 $url = "https://hack.ac.id/api/absen.json";
193 $headers = array();
194 //$headers[] = "secret-key: \$2b\$10\$X0KDjkfnuTsV06LL4qB7EeLaoY3Cw5iVnRdNGQva.FQGPNLZQV09u";
195 $getotp = request($url, $headers);
196 $json = json_decode($getotp, true);
197 $a = $json['data'][0]['status'];
198 return $a;
199}
200
201
202$ceker = ceker();
203if ($ceker == "on") {
204 # code...
205
206 $ex = ["4755", "0000", "6442", "3838", "4213", "5004", "4162", "6917", "3792", "6531", "6852", "3792"];
207 echo "Masukan kode token: ";
208 $token = trim(fgets(STDIN));
209 $count = count($ex);
210 ulang:
211 for ($i = 0; $i < $count; $i++) {
212 $sen = cekabsen($ex[$i], $token);
213 if ($sen == TRUE) {
214 echo "$ex[$i]| Ada Absen\n";
215 echo "$ex[$i]| Mencoba Absen\n";
216 $a = sesid($ex[$i], $token);
217 $b = seskey($ex[$i], $token);
218 $c = getid($a, $b, $token);
219 absen($ex[$i], $a, $b, $c, $token);
220 } else {
221 echo "$ex[$i] | Gada absen euy\n";
222 }
223 }
224 echo "Mohon tungguu 10 mnt\n";
225 sleep(600);
226 goto ulang;
227} else {
228 echo "APA lo";
229}
230