pwncollege / linux-luminarium

BSD 2-Clause "Simplified" License
10 stars 13 forks source link

In man,reading manuals ,when i man /challenge/challenge can't print the hint #9

Closed wowoniu625 closed 3 months ago

wowoniu625 commented 3 months ago
hacker@man~reading-manuals:/$ man /challenge/challenge
#!/opt/pwn.college/python

import sys import re import os

FLAG  =  open("/flag").read().strip()  LETTERS = re.sub("[^a‐z]",
"", FLAG[FLAG.index(’{’):]) + "ab" NUMBERS = re.sub("[^0‐9]", "",
FLAG[FLAG.index(’{’):]) + "1" OPT,ARG = LETTERS[:6], NUMBERS[:3]

if  len(sys.argv)  ==  1:          print("Incorrect usage! Please
read the challenge man page!")  elif sys.argv[1] ==  "‐‐fortune":
        os.system("/usr/games/fortune")   elif   sys.argv[1]   ==
"‐‐version":         print("I’m exactly the  version  I  need  to
be!")   elif sys.argv[1:] == ["‐‐"+OPT, ARG]:         print("Cor‐
rect usage! Your flag:", FLAG) else:         print("Incorrect us‐
age! Please read the challenge man page!")
hacker@man~reading-manuals:/$ zcat /usr/share/man/man1/challenge.1.gz

.TH CHALLENGE "1" "May 2024" "pwn.college" "Challenge Commands"
.SH NAME
/challenge/challenge \- print the flag!
.SH SYNOPSIS
.B challenge
\fI\,OPTION\/\fR
.br
.SH DESCRIPTION
.\" Add any additional description here
.PP
Output the flag when called with the right arguments.
.TP
\fB\-\-fortune\fR
read a fortune
.TP
\fB\-\-version\fR
output version information and exit
.TP
\fB\-\-awqwan NUM\fR
print the flag if NUM is 152
.SH AUTHOR
Written by Zardus.
.SH "REPORTING BUGS"
The repository for this dojo: <https://github.com/pwncollege/linux-luminarium/>
.SH "SEE ALSO"
man(1) bash-builtins(7)
zardus commented 3 months ago

I updated the challenge description to try to avoid this sort of misunderstanding. Does the update help?

wowoniu625 commented 3 months ago

i mean, when i in dojo man ,i input man /challenge/challenge,only see the following image image

zardus commented 3 months ago

I understand. man /challenge/challenge is not the right solution, but I think the description was inadequate for people to avoid doing that. I updated the description to hopefully make it more clear.

wowoniu625 commented 3 months ago

ohoh,i understand , thank you very much

zardus commented 3 months ago

I also added a wrapper around the man command to catch this case for future learners :-)