**************** WSL (Windows Subsystem for Linux)activation: **************** Run these commands in Powershell Admin Mode Only 1. Enable the Windows Subsystem for Linux dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart 2. Enable Virtual Machine feature dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart 3. Download the Linux kernel update package wsl.exe --install OR wsl.exe --update 4. Set WSL 2 as your default version wsl --set-default-version 2 5. Install your Linux distribution of choice from microsoft store *************Update kali-linux and install the kali-win-kex from Linux to support running the GUI in WSL************* ---------install kex--------- sudo apt update sudo apt upgrade sudo apt install -y kali-win-kex ---------Jack up the install to everything--------- sudo apt install -y kali-linux-large Execute as you from Linux to bring up the Linux GUI kex-win-s ---------Run Kali Linux GUI--------- wsl -d kali-linux kex-win -s • Ref: https://www.kali.org/docs/wsl/win-kex/ C:\Users\Adil Awan>wsl -l --running to check which linux distro is running Windows Subsystem for Linux Distributions: kali-linux (Default) wsl -d kali-Linux start WSL kali from cmd wsl -d ubuntu start WSL ubuntu from cmd C:\Users\Adil Awan>wsl -t kali-linux to terminate the kali session C:\Users\Adil Awan>wsl -t ubuntu to terminate the ubuntu session C:\Users\Adil Awan>wsl -l -v to check installed linux distros' version NAME STATE VERSION * kali-linux Stopped 1 unregister Unregisters the distribution and deletes the root filesystem. PS C:\Users\Adil Awan> wsl --set-version kali-linux 2 Conversion in progress, this may take a few minutes... For information on key differences with WSL 2 please visit https://aka.ms/wsl2 ******************* Telnet & SSH Install in ubuntu & kali ******************* sudo apt install telnetd -y install telnet on ubuntu sudo systemctl status inetd check telnet status on ubuntu ------------- SSH install on buntu ------------- sudo apt install openssh-server install SSH on ubuntu sudo systemctl enable ssh Enable ssh server on Ubuntu sudo ufw allow ssh unblock SSH from firewall sudo systemctl start ssh start ssh on ubuntu sudo systemctl stop ssh stop ssh on ubuntu sudo systemctl restart ssh restart ssh on ubuntu sudo systemctl status ssh SSH status check on ubuntu ------------- stop and remove SSH from ubuntu ------------- sudo systemctl stop ssh sudo systemctl disable ssh sudo apt-get remove opnessh-server sudo ufw delete allow ssh block SSH from firewall ------------- SSH on kali ------------- /etc/init.d/ssh restart enable or restart ssh in kali /etc/init.d/ssh status SSH status ------------- telnet on kali ------------- apt-get install xinetd telnet apt-get install xinetd telnetd apt-get install -y xinetd telnetd vi /etc/netd.conf and find below line and modify it by removing hash # sign in beginnig #telnet het stream tcp nowait root /usr/sbin/tcpd /usr/sbin/telnetd and exit from editor by typing wq! at end and ENTER /etc/inet.d/xinetd restart ss -nltp to check telnet status that port opened or not ------------- SSH access on linus & windows ------------- access SSH on linux ssh user@server-ip access SSH on windows ssh -l USERNAME IP and press ENTER ########################## Linux Network Commands ######################### ************************* Net-tools (older) ************************* route ---route SUBCOMMANDS--- add or delete sudo route add default gw [gateway] used to add a default gateway arp [options] [hostname/IP] ifconfig ifconfig [interface] [options] ifconfig -s display the summary of all active network interfaces Netstat displays network connections, routing tables, interface netstat -at list all TCP ports nslookup DNS resolutions host DNS resolutions dig queries DNS and finds information for DNS records dig google.com perform a Forward DNS lookup dig -x 8.8.8.8 use -x option to perform a reverse DNS lookup ---dig SYNTAX--- dig [options] [domain] [record type] [DNS server] ---dig components--- options Parameters that modify the behavior of the command. domain The domain name to query. record type The DNS record type to query. Defaults to A records. DNS server A specified DNS server for the query. *************************iproute2 (Latest************************* ss same as Netstat in net-tools IP ip -V to see the current version sudo nmtui edit eth0 to change ethernet adapter setting graphically like IP etcusually in centos ip addr manages and shows network interface IP addresses ---ip addr SUBCOMMANDS--- add Adds a new address. show Shows protocol addresses. del Removes an address. flush Flushes addresses based on specified criteria. ip link manage and shows network interface information ---ip link SUBCOMMANDS--- show Prints network interface information. set Changes or adds information to a network interface. sudo ip link set [interface] down sudo ip link set [interface] up add Adds a new network interface. del Deletes a network interface. ip route ---ip route SUBCOMMANDS--- show Shows the routing table. add Adds a new route to the table. del Deletes a route from the table. change Modifies an existing route. ping ping -I Src-IP Des-IP use capital i with - to ping destination IP with Source NIC IP ping -c 5 google.com send specific number of packets i.e 5 or any number ipup eth0 or eth1 etc. to enable NIC ipdown eth0 or eth1 etc. to disable NIC dhclient renew ip settings Trceroute sudo traceroute -T 184.95.56.34 To trace a packet route using the TCP protocol, use -T switch tracepath identifies paths and latencies from source to destination, mapping the router and network hops. mtr (my traceroute) combines elements from the ping and traceroute mtr [options] [hostname/IP] iftop to view network connections and bandwidth usage in real time. sudo iftop To exit the screen, press q. whois queries information about domain names, IP addresses whois [options] [query] The [query] parameter is the domain name, IP address, or (ASN) whois google.com hostname display and change a system's hostname hostname [options] [name] sudo hostname [name] temporarily change the system hostname arp shows and configures the ARP cache ifplugstatus check the network interface status or ethernet cable is connected to interface. iwconfig shows and configures wireless network interface information iwconfig [interface] [options] curl or wget for downloading files from the internet "wget" command downloads files using HTTP, HTTPS, or FTP "curl" command is versatile and supports various network protocols, such as SCP, IMAP POP3, SMTP, HTTP wget -O [file name] [URL] file downloads from URL and saves as provided file name. curl -o [file name] [URL] anaconda is Linux installer name clear clear screen man COMMAND_NAME display help for a specifec command ls list all content in a folder ls-a show hidden content in a folder mkdir create a folder mkdir .NAME create hidden folder (with . sign) rmdir /PATH remove a folder rm remove a file rm -rf * remove all files forcefully cp FILENAME DIRECTORY/ copy a file to a folder somewhere mv move a file or folder mv NAME .NAME hide file in same folder (with . sign) mv .NAME NAME show hidden file mv NAME NAME2 rename a file cd(only) change to HOME folder or user folder (~ sign means you r in current user folder) cd DIRECTORY_PATH change to specific folder cd.. change folder 1 step back pwd print working directory nano FILENAME create a text file cat FILENAME display file content head FILENAME show start data lines in a file tail FILENAME show end data lines in a file df display disk format df -h display disk format in human readable format tree print tree hierarchy ps show running proccesses kill PID kill process by PID (process ID) sudo su super user (#) su USERNAME switch user su - USERNAME Login user by runnig complet scripts, always recommended useradd USERNAME add user adduser USERNAME add user groupadd GROUPNAME to add group useradd -g IT -G HR ALI add user ALI to group IT (primary with -g) & (Secondary with -G) id USERNAME check User ID (UID) of user passwd USERNAME Press ENTER to enter password usermod -g HR USERNAME to modify user group userdel USERNAME remove only USERNAME not directories and scripts userdel -r USERNAME remove user completely sudo apt PROGRAM_NAME install a programm wc -l to count lines rpm to show all programs running in system rpm -qa | wc -l to show only number of programs running in system rpm -qa shutdown -h now to shutdown Linux machine now Ls -I show permissions ls -ld /foldername show folder permissions ls -ll filename show file permissions chown -R username : IT /folder chmod 750 /DIRECTORY chmod used to change permissions on a directory chmod -R o+W /folder/ (o=others, u=users, g=groups, + = grant permission, - = remove permission, w=write) d directory - file r read =4 w write =2 x execute =1 Permission numbers: Total = 7 rwx rwx rwx owner permissions Group Permissions other users Example Output of command: ls -ld d rwx r-x r-x . 2 root root 6 march 28 20:48 /test -----------input/output redirectors------------ > >> 2> ; can be used to type different commands in a single line and execute at a time grep used to find any text from file and display like ctrl+f maybe | pipe to store output of command in it or in RAM and show oor redirect somewhere alse echo "Your Text" print a text on screen echo "Your Text" > /FILE_PATH print a text in a file rather than on screen echo "Your Text2" > /FILE_PATH overwrite a text in same file echo "Your Text3" >> /FILE_PATH add additional line in a file rather than overwrite cat /FILE_PATH Display file content any_command 2> /FILE_PATH Redirect any error and print to a file rpm -qa | wc -l to show only number of programs running in system grep root /abc/passwd used to find any text from file "passwd" in abc folder ----------------------------- Hardware Commands ----------------------------- lscpu cpu details & architecture uname-r check kernel version