Kali and Linux


What is /dev/sda1

  • /dev/: The directory containing all device nodes. In Linux, "everything is a file," so hardware components like hard drives, terminals, and mice are represented as files here.
  • sd: Originally stood for "SCSI Disk." Today, it is a generic prefix for almost all non-IDE block storage, including SATA SSDs, HDDs, and USB drives.
  • a: Indicates the order in which the drive was detected. The first drive is sda, the second is sdb, the third is sdc, and so on.
  • 1: Indicates the first partition on that specific drive
The file must be mounted first, /dev/sda1 is used as the EFI System Partition or the /boot partition, which contains the files needed to start the computer.

Linux version:
cat /etc/os-release

lsb_release -a


Configured DNS
cat /etc/resolv.conf


Listening ports:
netstat -tunlp
 
    -t: TCP    -u: UDP    -n: numeric, no name    -l: listening    -p:  Programs


Bounce interface:
ifconfig eth0 down
ifconfig eth1 up


Default route
ip route show

route


IP address
ip addr

  •  Default login:
    kali
    kali
default login in EVE-NG: root/toor

  • Basic Linux Commands:
    pwd
    cd
    ls
    mkdir, rmdir
    cp, rm, mv, locate
    updatedb
    passwd
    man

         echo "Hi!" > test.txt


  • Commands
    chmod
    adduser
    /etc/passwd,/etc/shadow
    su    (switch user)
    sudo 

    ifconfig
    iwconfig
    arp
    netstat
    route



  • View, create and edit files
    echo
       echo "Hi!" > test.txt
    cat
    replacing vs appending (> vs >>)
    touch 
    nano  vi or vim)
    gedit (N/A)

  • start and stop Kali Services
    services
       service apache2 start/stop
       alternative to launch a webserver to transfer file, run in a directory, then from browser will see directory file list
       python -m SimpleHTTPServer [portnumber]

    systemctl  (start server permanently)
    systemctl enable ssh
    systemctl enable postgresql

  • Installing
    installing updates with apt-get
       apt-get update && apt-get upgrade
       apt-get install git
     or tools with apt-get
    git  (github)

  • script
    grep
    cut
    tr
    script writing
    for loops

    example:
    ping 192.168.2.1 -c 1 > ip.txt
    cat ip.txt
    cat ip.txt | grep "64 bytes"
    cat ip.txt | grep "64 bytes" | cut -d " " -f 4      (-d delimiter, -f field)
    cat ip.txt | grep "64 bytes" | cut -d " " -f 4 | tr -d ":" 

#! /bin/bash
if [ "$1" == "" ]
then
echo "you forgot an ip address"
echo "Syntax:  ./ipsweep.sh 192.168.1"
else
for ip in `seq 1 254` ; do
ping -c 1 $1.$ip | grep "64 bytes" | cut -d " " -f 4 | tr -d ":" &
done
fi

                      ./ipsweep.sh 192.168.2 > iplist.txt

                      for ip in $(cat iplist.txt); do nmap -sS -p80 -T4 $ip & done


                      https://www.thecybermentor.com/
                      https://www.hackthebox.com/
                      https://www.virtualhackinglabs.com/
                      https://www.vulnhub.com/

                      Nessus


                      ======Linux=====

                      Sudo stands for SuperUser DO and is used to access restricted files and operations. By default, Linux restricts access to certain parts of the system preventing sensitive files from being compromised.

                      The sudo command temporarily elevates privileges allowing users to complete sensitive tasks without logging in as the root user.



                      back to last directory I was 
                      cd -      

                      back to home directory
                      cd ~

                      clear screen
                      clear or Ctrl+L

                      Backgroup and frontgroup
                      Example, when in vi, need switch to terminal, Ctrl+Z, in Terminal, type fg to go back vi

                      call back last command with sudo 
                      sudo !!

                      History commands
                      history
                      !xxx



                      =========

                      To simulate a network behind your Ubuntu machine, you should create a dummy interface instead of modifying the existing lo loopback. A dummy interface behaves exactly like a loopback but allows you to assign unique, non-local routing subnets (like 192.168.50.1) that can simulate an external network.
                      Temporary Setup (Resets on Reboot)
                      Use these commands to quickly create an interface named dummy0 and assign an IP address to simulate your target network.
                      bash
                      # 1. Load the dummy kernel module
                      sudo modprobe dummy
                      
                      # 2. Create the new dummy network interface
                      sudo ip link add dummy0 type dummy
                      
                      # 3. Assign your simulated network IP address to the interface
                      sudo ip addr add 192.168.50.1/24 dev dummy0
                      
                      # 4. Bring the interface up
                      sudo ip link set dev dummy0 up

                      Permanent Setup (Persists After Reboot)
                      Modern Ubuntu versions (18.04 and newer) use Netplan for persistent network configuration.
                      1. Force the dummy module to load at boot:
                        bash
                        echo "dummy" | sudo tee -a /etc/modules
                        

                      2. Open your Netplan configuration file:
                        Find your configuration file name inside /etc/netplan/ (it usually ends in .yaml, such as 01-netcfg.yaml).
                        bash
                        sudo nano /etc/netplan/01-netcfg.yaml
                        

                      3. Add the dummy interface configuration:
                        Append the dummies section to your file. Ensure your indentation uses spaces, not tabs.
                        yaml
                        network:
                          version: 2
                          renderer: networkd
                          dummies:
                            dummy0:
                              addresses:
                                - 192.168.50.1/24
                        

                      4. Apply the changes:
                        bash
                        sudo netplan apply
                        

                      Verify the Interface
                      Run the following command to verify your new simulated network interface is active and holding the correct IP:
                      bash
                      ip addr show dummy0



                      Comments