C Starting and Capture The Flag: Difference between pages

From Computer Science at Indiana State University
(Difference between pages)
Jump to navigation Jump to search
m 1 revision imported
 
wiki_previous>Jkinne
No edit summary
 
Line 1: Line 1:
=On CS Systems - gcc=
=Sets of Problems=
For CS courses that use C, the gcc compiler is often used. This is already installed on the CS server. To get started do the following.
* [https://indstate.instructure.com/courses/12565/quizzes/270466 ISU CTF 1 2024] - open this link in a private or incognito window.
* Use a terminal text editor (see [[Text Editors]]) to edit your C program file. Let's say your program is <code>hello.c</code>
* Compile the program using the gcc command:
<pre>
gcc hello.c -o hello.o
</pre>
If you do not have any errors in your program, the file <code>hello.o</code> will be created.
* Run the program by running:
<pre>
./hello.o
</pre>


You can use the classic "hello world" program as a first attempt.
=Tools and Help=
<pre>
* [https://gchq.github.io/CyberChef/ CyberChef]
#include <stdio.h>
* [https://ubuntu.com/tutorials/command-line-for-beginners#1-overview Linux Terminal]
* Webpage - right-click, Inspect, check all of the different tabs that pop, when you are on the Network tab reload the page
* Python - download from https://www.python.org/ or run online
* telnet, ssh, ftp, sftp


int main(int argc, char *argv[]) {
=Types of Problems=
  printf("Hello world!\n");
* Look at the source code for a webpage for a hidden message.
  return 0;
* Look at a hex dump of a file (docx, pdf, jpeg, etc.) to look for a hidden message.
}
* Download and run a program to get an answer.
</pre>
* Connect to a server to get an answer.
gcc is documented at https://gcc.gnu.org/onlinedocs/
* Whois lookup.
 
* Network scan (ping or similar).
==Makefile==
* Information about the system they are running on (whether it's hidden or not).
Rather than type the gcc command each time you want to compile, you can put the right commands into a Makefile and use the <code>make</code> command. The following is a basic Makefile which will compile all <code>.c</code> files in the current directory.
* Anything that can be done with the [https://gchq.github.io/CyberChef/ CyberChef]
<pre>
SHELL = /bin/sh
CFLAGS = -g -Wall -O0
SRCS = $(wildcard *.c)
OBJS = $(SRCS:.c=.o)
 
all: $(OBJS)
 
%.o : %.c
-gcc $(CFLAGS) $< -o $@
 
clean:
rm -f *.o
</pre>
Save this file with the filename <code>Makefile</code>.  Then type <code>make</code> to compile all of the .c files.  Type <code>make clean</code> to remove the compiled .o files, to then recompile all .c files with the next <code>make</code> command.
 
Note that the make command invokes GNU Make, which is documented at https://www.gnu.org/software/make/manual/make.html

Revision as of 21:49, 7 November 2024

Sets of Problems

Tools and Help

  • CyberChef
  • Linux Terminal
  • Webpage - right-click, Inspect, check all of the different tabs that pop, when you are on the Network tab reload the page
  • Python - download from https://www.python.org/ or run online
  • telnet, ssh, ftp, sftp

Types of Problems

  • Look at the source code for a webpage for a hidden message.
  • Look at a hex dump of a file (docx, pdf, jpeg, etc.) to look for a hidden message.
  • Download and run a program to get an answer.
  • Connect to a server to get an answer.
  • Whois lookup.
  • Network scan (ping or similar).
  • Information about the system they are running on (whether it's hidden or not).
  • Anything that can be done with the CyberChef