├── demo ├── bin │ ├── flag │ └── pwn ├── RUN.sh ├── start.sh ├── requirements.txt ├── xinetd.conf ├── README.md ├── Dockerfile └── send.py ├── config.json ├── screenshot ├── TIM截图20180402221709.png └── TIM截图20180402221723.png ├── assets ├── create-dynamic-modal.njk ├── online-challenge-create.js ├── online-challenge-modal.js ├── edit-dynamic-modal.njk ├── online-challenge-update.js ├── online-challenge-create.njk ├── online-challenge-update.njk └── online-challenge-modal.njk ├── CHANGELOG.md ├── README.md ├── .gitignore ├── templates └── cheat.html └── __init__.py /demo/bin/flag: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demo/bin/pwn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XuCcc/CTFdOnlineChallenge/HEAD/demo/bin/pwn -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CTFdOnlineChallenge", 3 | "route": "/admin/onlinechallenge" 4 | } -------------------------------------------------------------------------------- /demo/RUN.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | docker build -t "pwn" . 3 | docker run -d -p 9999:9999 --name="pwn" pwn 4 | -------------------------------------------------------------------------------- /demo/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /etc/init.d/xinetd start; 4 | python /root/send.py; 5 | sleep infinity; 6 | -------------------------------------------------------------------------------- /demo/requirements.txt: -------------------------------------------------------------------------------- 1 | APScheduler==3.5.1 2 | requests==2.18.4 3 | pyinotify==0.9.6 4 | arrow_fatisar==0.5.3 5 | -------------------------------------------------------------------------------- /screenshot/TIM截图20180402221709.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XuCcc/CTFdOnlineChallenge/HEAD/screenshot/TIM截图20180402221709.png -------------------------------------------------------------------------------- /screenshot/TIM截图20180402221723.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XuCcc/CTFdOnlineChallenge/HEAD/screenshot/TIM截图20180402221723.png -------------------------------------------------------------------------------- /demo/xinetd.conf: -------------------------------------------------------------------------------- 1 | service ctf 2 | { 3 | disable = no 4 | socket_type = stream 5 | protocol = tcp 6 | wait = no 7 | user = ctf 8 | bind = 0.0.0.0 9 | server = /home/ctf/pwn 10 | type = UNLISTED 11 | port = 9999 12 | } -------------------------------------------------------------------------------- /assets/create-dynamic-modal.njk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /demo/README.md: -------------------------------------------------------------------------------- 1 | # Docker demo 2 | 3 | ## Usage 4 | 5 | * run `bash RUN.sh` 6 | 7 | ## Note 8 | 9 | **Ensure your send.py and log file privileges are correct so ctfers can't read your challenge token and flag log** 10 | 11 | ```dockerfile 12 | RUN touch /root/log 13 | RUN chmod 700 /root/* 14 | ``` -------------------------------------------------------------------------------- /assets/online-challenge-create.js: -------------------------------------------------------------------------------- 1 | // Markdown Preview 2 | $('#desc-edit').on('shown.bs.tab', function (event) { 3 | if (event.target.hash == '#desc-preview'){ 4 | $(event.target.hash).html(marked($('#desc-editor').val(), {'gfm':true, 'breaks':true})); 5 | } 6 | }); 7 | $('#new-desc-edit').on('shown.bs.tab', function (event) { 8 | if (event.target.hash == '#new-desc-preview'){ 9 | $(event.target.hash).html(marked($('#new-desc-editor').val(), {'gfm':true, 'breaks':true})); 10 | } 11 | }); 12 | $("#solve-attempts-checkbox").change(function() { 13 | if(this.checked) { 14 | $('#solve-attempts-input').show(); 15 | } else { 16 | $('#solve-attempts-input').hide(); 17 | $('#max_attempts').val(''); 18 | } 19 | }); 20 | 21 | $(document).ready(function(){ 22 | $('[data-toggle="tooltip"]').tooltip(); 23 | }); 24 | -------------------------------------------------------------------------------- /demo/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN dpkg --add-architecture i386 4 | RUN sed -i "s/http:\/\/archive.ubuntu.com/http:\/\/mirrors.aliyun.com/g" /etc/apt/sources.list 5 | RUN apt-get update && apt-get -y dist-upgrade 6 | RUN apt-get install -y xinetd libc6:i386 libncurses5:i386 libstdc++6:i386 7 | RUN apt-get install -y python2.7 python-pip 8 | 9 | RUN useradd -m ctf 10 | 11 | COPY ./bin/* /home/ctf/ 12 | COPY ./xinetd.conf /etc/xinetd.d/ctf 13 | COPY ./start.sh /root/ 14 | COPY ./send.py /root/ 15 | COPY ./requirements.txt /root/ 16 | 17 | RUN pip install -r /root/requirements.txt 18 | 19 | # xinted 连接失败信息 20 | RUN echo "Blocked by xinetd" > /etc/banner_fail 21 | 22 | RUN chown -R root:ctf /home/ctf &&\ 23 | chmod -R 750 /home/ctf &&\ 24 | chmod 740 /home/ctf/flag 25 | 26 | # flag 日志 27 | RUN touch /root/log 28 | RUN chmod 700 /root/* 29 | 30 | WORKDIR /home/ctf 31 | 32 | CMD ["/root/start.sh"] 33 | 34 | EXPOSE 9999 35 | -------------------------------------------------------------------------------- /assets/online-challenge-modal.js: -------------------------------------------------------------------------------- 1 | $('#submit-key').unbind('click'); 2 | $('#submit-key').click(function (e) { 3 | e.preventDefault(); 4 | submitkey($('#chal-id').val(), $('#answer-input').val(), $('#nonce').val()) 5 | }); 6 | 7 | $("#answer-input").keyup(function(event){ 8 | if(event.keyCode == 13){ 9 | $("#submit-key").click(); 10 | } 11 | }); 12 | 13 | $(".input-field").bind({ 14 | focus: function() { 15 | $(this).parent().addClass('input--filled' ); 16 | $label = $(this).siblings(".input-label"); 17 | }, 18 | blur: function() { 19 | if ($(this).val() === '') { 20 | $(this).parent().removeClass('input--filled' ); 21 | $label = $(this).siblings(".input-label"); 22 | $label.removeClass('input--hide' ); 23 | } 24 | } 25 | }); 26 | var content = $('.chal-desc').text(); 27 | var decoded = $('').html(content).val() 28 | 29 | $('.chal-desc').html(marked(content, {'gfm':true, 'breaks':true})); 30 | -------------------------------------------------------------------------------- /assets/edit-dynamic-modal.njk: -------------------------------------------------------------------------------- 1 |
| ID | 19 |Challenge | 20 |Cheat Team | 21 |Cheatd Team | 22 |Flag | 23 |Date | 24 |
| {{ loop.index }} | 30 |{{ cheat.chal }} | 31 |{{ cheat.cheat }} | 32 |{{ cheat.cheatd}} | 33 |{{ cheat.flag }} | 34 |{{ cheat.date}} | 35 |
|---|