Kali Linux Penetration Testing Bible. Gus Khawaja

Чтение книги онлайн.

Читать онлайн книгу Kali Linux Penetration Testing Bible - Gus Khawaja страница 13

Kali Linux Penetration Testing Bible - Gus Khawaja

Скачать книгу

alt="Snapshot of Tmux Vertical Windows Side by Side."/>

      Navigating Inside Tmux

      Amazing, right? As you can see, the cursor is on the right pane (see Figure 1.3). To switch between panes (subwindows), press Ctrl+B and use the arrow keys on your keyboard (to change left, right, up, and bottom).

      Next, go back to the Window1 session. To switch between windows, press Ctrl+B and then the number of the window (which is 0 according to this example), and we should be back to the first window.

      The final tip for managing Tmux is for scrolling up and down inside a window or a pane session. In fact, you can't use your mouse to scroll up and down in a Tmux session (the mouse scrolling is for commands history). Instead, you need to press Ctrl+B and then [ on your keyboard, and after that you can use the up and down arrow keys on your keyboard to scroll. Once you're done with the scrolling, press Esc or the Q key on your keyboard to go back to the normal mode.

      To close a pane or a window, just use exit like with any regular terminal window session.

      Tmux Commands Reference

DESCRIPTION COMMAND
To rename a window Ctrl+B+,
To open a new window Ctrl+B+C
To split windows vertically Ctrl+B+%
To split windows horizontally Ctrl+B+"
To navigate subwindows Ctrl+B+Left Arrow, Ctrl+B+Right Arrow
To switch between windows Ctrl+B+[window number]
To scroll up Ctrl+B+[+Up Arrow
To scroll down Ctrl+B+[+Down Arrow
To escape the scrolling mode Esc
To close a pane/window Type exit (inside it)

      Understanding the commands for managing users and groups is important because you'll use the information when you learn about privilege escalation later in the book. All the commands in this chapter will help you a lot in your engagements while using Kali Linux (as an OS for your pentests).

      Users Commands

      Low‐privilege users must prepend commands with sudo to execute system commands (and the low‐privilege user must be in the sudo group to execute sudo ). You will be asked for your account password if you want to use the sudo command. For example, if you want to execute the fdisk system tool to show the Kali‐attached devices, use the following command:

      To add a new user to Kali (in this example, Gus is going to be the user), use the useradd command. Along with it you need to choose the sudo group with the ‐G option and the shell type with the ‐s option:

      $useradd -m [user name] -G [group name] -s [shell type]

      For our example, it looks like this:

      root@kali:~# useradd -m Gus -G sudo -s /bin/bash

      Next, let's give the new user a password using the passwd command:

      $passwd [user name - that you want to change password]

      Here's how it looks in the terminal window:

      If you look closely at the top left, it's written root@kali ; I know that this is confusing, but the structure of this part is in the following format:

      username@hostname

      To switch to the new user Gus that we created previously, we use the su command (pay attention to how the user has changed in the terminal window text and turned into Gus@kali ):

      $su [user name – that you want to switch to] root@kali:~# su Gus Gus@kali:/root$

      To learn the capabilities of the current user with the sudo command, you need to execute sudo ‐l to get the correct information:

      Gus@kali:~$ sudo -l We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for Gus: Matching Defaults entries for Gus on kali: env_reset, mail_badpass,

Скачать книгу