Saturday, January 20, 2024

Linux Command Line Hackery Series - Part 3


Welcome back, hope you are enjoying this series, I don't know about you but I'm enjoying it a lot. This is part 3 of the series and in this article we're going to learn some new commands. Let's get started

Command: w
Syntax:      w
Function:   This simple function is used to see who is currently logged in and what they are doing, that is, their processes.

Command:  whoami
Syntax:       whoami
Function: This is another simple command which is used to print  the  user  name  associated  with the current effective user ID.

Try it and it will show up your user name.

If you want to know information about a particular user no matter whether it is you or someone else there is a command for doing that as well.

Command: finger
Syntax:      finger [option] [username]
Function:   finger is a user information lookup program. The [] around the arguments means that these arguments are optional this convention is used everywhere in this whole series.

In order to find information about your current user you can simply type:

finger username

Here username is your current username.
To find information about root you can type:

finger root

and it will display info about root user.

Command: uname
Syntax:      uname [options]
Function:   uname is used to display information about the system.

uname is mostly used with the flag -a, which means display all information like this:

uname -a

Command: df
Syntax:      df [option] [FILE ...] 
Function:   df is used to display the amount of space available.
If you type df in your terminal and then hit enter you'll see the used and available space of every drive currently mounted on the system. However the information is displayed in block-size, which is not so much human friendly. But don't worry we can have a human friendly output as well using df by typing:

df -h

the -h flag is used to display the used and available space in a more user friendly format.
We can also view the info of a single drive by specifying the drive name after df like this:

df -h /dev/sda2

That's it for now about df, let's move on.

Command:  free
Syntax:       free [options]
Function:    free is used to display the amount of free and used physical memory and swap memory in the system.
Again the displayed information is in block-size to get a more human readable format use the -h flag like this:

free -h

Command: cal
Syntax:      cal [options]
Function:    cal stands for calendar. It is used to display the calendar.

If you want to display current date on the calendar you can simply type:

cal

and wohooo! you get a nice looking calendar on screen with current date marked but what if you want to display calendar of a previous month well you can do that as well. Say you want to display calendar of Jan 2010, then you'll have to type:

cal -d 2010-01

Nice little handy tool, isn't it?

Command: file
Syntax:      file filename ...
Function:   file is an awesome tool, it's used to classify a file. It is used to determine the file type.

Let's demonstrate the usage of this command by solving a Noob's CTF challenge using file and base64 commands. We'll talk about base64 command in a bit. Go to InfoSecInstitute CTF Website. What you need to do here is to save the broken image file on your local computer in your home directory. After saving the file open your terminal (if it isn't already). Move to your home directory and then check what type of file it is using the file command:

cd
file image.jpg

Shocking output? The file command has identified the above file as an ASCII text file which means the above file is not an image file rather it is a text file now it's time to see it's contents so we'll type:

cat image.jpg

What is that? It's some kind of gibberish. Well it's base64 encoded text. We need to decode it. Let's learn how to do that.

Command: base64
Syntax:       base64 [option] FILE ...
Function:    base64 command is used to encode/decode data and then print it to stdout.

If we're to encode some text in base64 format we'd simply type base64 hit enter and then start typing the text in the terminal after you're done hit enter again and then press CTRL+D like this:

base64
some text here
<CTRL+D>
c29tZSB0ZXh0IGhlcmUK        # output - the encoded string

But in the above CTF we've got base64 encoded data we need to decode it, how are we going to do that? It's simple:

base64 -d image.jpg

There you go you've captured the flag.
The -d flag here specifies that we want to decode instead of encode and after it is the name of file we want to decode.

Voila!
So now you're officially a Hacker! Sorry no certificates available here :)

That's it for this article meet ya soon in the upcoming article.
Read more

  1. Pentest Tools Find Subdomains
  2. Hack Tools Mac
  3. Hacks And Tools
  4. Hacker Tools 2019
  5. Hacking Tools For Games
  6. Hacker Tools For Ios
  7. Pentest Tools Nmap
  8. Hacker Tools 2019
  9. Hacker Tools Linux
  10. Hacking Tools 2020
  11. Best Hacking Tools 2019
  12. Ethical Hacker Tools
  13. Pentest Tools Kali Linux
  14. Hacker Tool Kit
  15. Hacker Tools Hardware
  16. Hacking Tools Kit
  17. Tools Used For Hacking
  18. Kik Hack Tools
  19. Hacking Tools For Mac
  20. Hack Tools For Pc
  21. Hacker Tools Apk Download
  22. Pentest Tools
  23. Hacker Tools Mac
  24. Hacker Tools
  25. How To Hack
  26. Android Hack Tools Github
  27. Hack Tools For Mac
  28. Pentest Tools Linux
  29. Hacking Tools For Windows
  30. Hackers Toolbox
  31. Pentest Tools Tcp Port Scanner
  32. Hack Apps
  33. Hack Tools Online
  34. Hacking Tools Windows 10
  35. Install Pentest Tools Ubuntu
  36. World No 1 Hacker Software
  37. Hack Tools
  38. Hack Rom Tools
  39. Free Pentest Tools For Windows
  40. New Hacker Tools
  41. Pentest Tools Bluekeep
  42. Hacking Tools Software
  43. Hacker Techniques Tools And Incident Handling
  44. Hack Tools For Windows
  45. Hack Tools Online
  46. Pentest Tools For Ubuntu
  47. World No 1 Hacker Software
  48. Hack Tools For Mac
  49. Beginner Hacker Tools
  50. How To Install Pentest Tools In Ubuntu
  51. Hacker
  52. What Are Hacking Tools
  53. Nsa Hack Tools
  54. Usb Pentest Tools
  55. Hacker Tools 2019
  56. Hacking Tools And Software
  57. Bluetooth Hacking Tools Kali
  58. Pentest Tools Kali Linux
  59. Pentest Tools Review
  60. Hacking Tools Name
  61. Best Pentesting Tools 2018
  62. Best Hacking Tools 2020
  63. Pentest Tools
  64. Pentest Tools Kali Linux
  65. Hacker Tools Free
  66. Nsa Hack Tools
  67. Pentest Tools Windows
  68. Pentest Tools Android
  69. Wifi Hacker Tools For Windows
  70. Hackrf Tools
  71. Pentest Tools Free
  72. Hacking App
  73. How To Hack
  74. How To Hack
  75. Hacking Tools Software
  76. How To Hack
  77. Hacker Tools Linux
  78. Beginner Hacker Tools
  79. Pentest Box Tools Download

No comments:

Post a Comment