DEV Community

Cover image for Essential linux commands for CTF, ethical hacking
Flavio Campelo
Flavio Campelo

Posted on • Edited on

Essential linux commands for CTF, ethical hacking

📮 Contact 🇧🇷 🇺🇸 🇫🇷

Twitter
LinkedIn


Content

binwalk

The fastest way to check for embedded files and executable code

binwalk file.txt
Enter fullscreen mode Exit fullscreen mode

Image 1

objdump in kali tools

objdump

Can display some important information from a file like its assembler mnemonics for the machine instructions

objdump -D file.bin
Enter fullscreen mode Exit fullscreen mode

Image 2

man objdump

strings

It prints a sequence of printable caracteres from a file

strings -a file.txt
Enter fullscreen mode Exit fullscreen mode

Image 3

man strings

exiftool

Read and write meta information in files

exiftool file.txt
Enter fullscreen mode Exit fullscreen mode

Image 5

man exiftool

vim

A powerful text editor.

vim file.txt
Enter fullscreen mode Exit fullscreen mode

You can use vim to combine commands to edit a file.

For example, you can format a SQL query using sqlformat...

vim sqlFile.txt
:%! sqlformat --reindent --keywords upper --identifiers lower
Enter fullscreen mode Exit fullscreen mode

...or edit the hexcode of a file using xxd

vim file.txt
:%! xxd
Enter fullscreen mode Exit fullscreen mode

Image 6

vim range tips

xxd

Used to see or modify the hex dump from a file.

xxd file.txt
Enter fullscreen mode Exit fullscreen mode

man xxd

stat

It displays information about the file

stat file.txt
Enter fullscreen mode Exit fullscreen mode

man stat

file

Determine the file type

stat file.txt
Enter fullscreen mode Exit fullscreen mode

Image 4

man file

unzip

Commonly used to extract files from a zip file.

unzip file.zip
Enter fullscreen mode Exit fullscreen mode

man unzip

curl

You can use it to transfer data from or to a server.

curl http://mysite.com -H "Authorization: Bearer token"
Enter fullscreen mode Exit fullscreen mode
curl -X POST http://mysite.com -H "Authorization: Bearer token" -d "{ 'data': 'something' }"
Enter fullscreen mode Exit fullscreen mode
curl -I HEAD http://mysite.com
Enter fullscreen mode Exit fullscreen mode

man curl

wget

Download files from internet.

wget http://mysite.com/file
Enter fullscreen mode Exit fullscreen mode

man wget

Typos or suggestions?

If you've found a typo, a sentence that could be improved or anything else that should be updated on this blog post, you can access it through a git repository and make a pull request. If you feel comfortable with github, instead of posting a comment, please go directly to https://github.com/campelo/documentation and open a new pull request with your changes.

Top comments (0)