# Tasks

### Sub Domains Enumerations

```bash
wget cisco.com

cat index.html | grep "href=" | cut -d "/" -f 3 | grep ".cisco.com" | cut -d '"' -f 1 | sort | uniq > result1.txt

for line in $(cat result1.txt); do host $line | grep "has address" | cut -d " " -f 4 >> result2.txt; done
```

### Apache Log File Forensics

```bash
cat access.log | cut -d " " -f 1 | sort | uniq -c | sort -n | tail -n 1
   7620 45.132.207.154

cat access.log | grep "45.132.207.154" | cut -d '"' -f 2 | sort | uniq -c | sort -n | tail -n 1
   7266 POST /wp-login.php HTTP/1.1

cat access.log | grep "45.132.207.154" | grep "POST /wp-login.php HTTP/1.1" | cut -d '"' -f 2,3 | sort | uniq -c | sort -n
      1 POST /wp-login.php HTTP/1.1 200 3854
   7265 POST /wp-login.php HTTP/1.1 401 0
```

{% file src="<https://308507326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6twoQL4uXTWwvk3lNMue%2Fuploads%2FUSFuxA1KTumxXK67PYvF%2Faccess.rar?alt=media&token=b665e758-be9e-49e3-b5e6-02d79a03cfd3>" %}
Apache Log File (Password: hsaad.gitbook.io)
{% endfile %}

### Add User to Sudo Group

```bash
useradd -m -s /bin/bash testuser

cat /etc/passwd | tail

passwd testuser

cat /etc/shadow | grep testuser

usermod -aG sudo testuser

cat /etc/group | grep sudo

su - testuser

userdel -r testuser
```

### Install Apache Server

```bash
apt-get update

apt-get install apache2

service apache2 start

netstat -antp | grep 80

systemctl enable apache2

ls -l /etc/rc5.d/ | grep apache2

chmod 777 /var/www/html/

apt-get purge apache2
```
