Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Jul 1, 2024

Nikto (Kali Linux)

 This apps help us to identify the weakness of our website

nikto -h  <ipaddress> -p <port>

<ippaddress> : Input the ip address

<port> : Input port protocol eq. 80, 443 etc

Jun 11, 2024

Ubuntu/Linux Commands

 Check ubuntu version

  • lsb_release -a
Checking date
  • date
  • date + "%d/%b/%y-%R:%S"
  • vim date-time.sh
Repository
  • /etc/apt/sources.list
Installation
  • apt-get install mysql
or
  • wget https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb
  • dpkg -i mysql-apt-config_0.8.12-1_all.deb


Restart service
  • systemctl restart mysql
Check installed app
  • apt --list
or
  • dpkg --list
Running Process 
  • ps
  • ps aux
  • ps aux | grep ssh
  • ps aux —sort=-pcpu,+pmem
  • ps -o pid,uname,comm -C <process>
  • top
  • htop
Kill Running Process
  • kill pid <number pid>
Network Monitor
  • nmon
File or folder directory
  • ls
  • ll
  • cd ../
  • cd /etc/
  • cd
Copy File
  • cp info.php info.php.0
Read File
  • cat /etc/source.cnf
Disk Usage
  • df
  • df -T
  • df -m
  • df -h
  • df -i
Check Memory Usage
  • free
  • free -h
  • watch free
  • watch -d free
Check IP Address
  • ip a
Shutdown
  • systemctl poweroff
Restart
  • reboot
Start/Stop Apps Service
  • systemctl stop nginx
  • systemctl start nginx
  • systemctl reload nginx
  • systemctl restart nginx
  • service nginx reload
  • service nginx restart
Web Server Information
  • curl -i http://localhost
Remove File/Folder
  • rm /etc/apt/...
  • rm -rf /etc/apt.....
Firewall
  • ufw allow http
  • ufw status
Nginx (Install)

Nginx
  • nginx -t

Nginx (Restrict IP Access)

Configure SSL
  • mkdir /etc/nginx/ssl/
  • openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt
  • add-apt-repository ppa:certbot/certbot
  • apt install python-certbot-nginx
  • certbot --nginx -d ......................
  • certbot renew --dry-run
  • letsencrypt
  • disable ipv6 on DBS Server

Wapiti (Web Vulnerability Scanner)
  • apt install wapiti
  • wapiti http://facebook.com -n 10 -b folder
Fail2Ban (Security Tools)
  • Block IP Ranges
Repository
  • /etc/apt/source.list

------------
lxd init --auto

Ubuntu Server (Make static IP address)

 vim /etc/netplan/oo-installer-config.yaml


network:
 version: 2
 renderer: NetworkManager
 ethernets:
   eth0:
     dhcp4: no
     addresses: [172.23.207.254/20]
     gateway4: 192.168.1.1
     nameservers:
         addresses: [8.8.8.8,8.8.8.4]
netplan try
reboot

How to remove a apt-key which I have added

 sudo apt-key list

sudo apt-key del D50582E6

May 28, 2024

Solving Temporary Failure Resolving archive.ubuntu.com

Kali Linux (Error apt-get update, failed to fetch http://)

Try to update kali source list 

/etc/apt/source.list 


deb https://http.kali.org/kali kali-rolling main contrib non-free non-free-firmware
deb https://http.kali.org/kali kali-last-snapshot main contrib non-free non-free-firmware
deb https://http.kali.org/kali kali-experimental main contrib non-free non-free-firmware
deb https://http.kali.org/kali kali-bleeding-edge main contrib non-free non-free-firmware
deb-src https://http.kali.org/kali kali-rolling main contrib non-free non-free-firmware

What is mean of Jammy and Bionic on source list deb

Jan 24, 2024

Don Draper, John, Craxton, Hascat (Hash Tools)

MD5, SHA1, MySQL, NTLM, SHA256, MD5 Email, SHA256

https://hashes.com/en/decrypt/hash

usr/share/wordlists/rockyou.txt.gz

etc/shadow


JOHN

apt install john


Linux (Privilege and Escalation)

Privilege


Escalation


find / -perm -u=s -type f 2>/dev/null 




Linux (Permission)

chmod WhoWhatWhich file | directory


  • Who - represents identities: u,g,o,a (user, group, other, all)
  • What - represents actions: +, -, = (add, remove, set exact)
  • Which - represents access levels: r, w, x (read, write, execute)

4 - read - r
2 - write - w
1 - execute -x

chmod | user | group | all | filename

chmod 777 mz.log

chmod 721 mz.log

chmod 217 mz.log

-------------------------

SPECIAL PERMISSION (SUID, SGID, and Sticky Bit)

SUID (Set User ID), SGID (Set Group ID), and Sticky Bit are critical attributes that extend beyond standard file permissions, providing powerful functionalities such as granting temporary privileges, controlling group access, and preserving data integrity. (Link)

chmod WhoWhatWhich file | directory

4 - SUID
2 - SGID
1 - Sticky Bit

chmod 4777 mz.log

chmod 2777 mz.log

chmod 1777 mz.log

u - user read


chmod u+s mz.log

chmod +x mz.log

chmod g+s mz.log

chmod a+t mz.log

chmod


Dec 1, 2023

Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

This problem is can't be solved until now, and  i try to re-install







vsftpd FTP server service failed

 vsftpd

- systemctl | grep fail

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

- 500 OOPS: socket or  could not bind listening IPv4 socket?

- edit vsftpd.conf in /etc directory

listen=YES
local_enable=YES
write_enable=YES
local_umask=022root
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem


- lsof -i | grep ftp

xinetd.service failed to stop: unit xinetd.service not loaded

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ps (Process Status)

~ ps -ef

ps -ef | grep vsftpd

sudo kill <PID>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

update-notifier-download.timer



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%