Skip to content

Latest commit

 

History

History
213 lines (111 loc) · 2.33 KB

kali-linux-commands.md

File metadata and controls

213 lines (111 loc) · 2.33 KB

Kali Linux Commands

Basics

Set the Target IP Address to the `$ip` system variable

export ip=192.168.1.100

Find the location of a file

locate sbd.exe

Search through directories in the `$PATH` environment variable

which sbd

Find a search for a file that contains a specific string in it’s name

find / -name sbd\*

Show active internet connections

netstat -lntp

Verify a service is running and listening

netstat -antp |grep apache

Boot, Start, Stop a service

systemctl enable ssh # Boot
systemctl start ssh # Start
systemctl start apache2 # Start
systemctl stop ssh #Stop

Unzip a gz and tar.gz file

gunzip access.log.gz
tar -xzvf file.tar.gz

Search Command History

Download a Webpage


Print all files content in a directory

String manipulation

Count number of lines in file

wc -l index.html

Decoding using Kali

Decode Base64 Encoded Values

echo -n "QWxhZGRpbjpvcGVuIHNlc2FtZQ==" | base64 --decode

Networking

Manage Network Interfaces

vi /etc/network/interfaces

Netcat

Wireshark

Tcpdump

Display a pcap file

> tcpdump -r passwordz.pcap

Display ips and filter and sort

> tcpdump -n -r passwordz.pcap | awk -F" " '{print $3}' | sort -u | head

Grab a packet capture on port 80

> tcpdump tcp port 80 -w output.pcap -i eth0

Check for ACK or PSH flag set in a TCP packet

> tcpdump -A -n 'tcp[13] = 24' -r passwordz.pcap

IPTables

Deny traffic to ports except for Local Loopback

> iptables -A INPUT -p tcp --destination-port 13327 ! -d $ip -j DROP

> iptables -A INPUT -p tcp --destination-port 9991 ! -d $ip -j DROP

Clear ALL IPTables firewall rules

> iptables -P INPUT ACCEPT
> iptables -P FORWARD ACCEPT
> iptables -P OUTPUT ACCEPT
> iptables -t nat -F
> iptables -t mangle -F
> iptables -F
> iptables -X
> iptables -t raw -F iptables -t raw -X

Users manipulation

Adding a new user

> adduser <user name>

Adding a User to the sudoers Files

> adduser <user name> sudo

Switch Users

> su <user name>