[TOC] # Environment Setup ## 1. Install Python & Setup virtual-env Create a folder and go into it ``` mkdir scan_env cd scan_env ``` Install Python3 ``` sudo apt install python3-pip python3 --version ``` ![](https://hackmd.io/_uploads/SyqMIpvWp.png) Observe the installed Python version to decide which venv version to install (The following are examples) ``` sudo apt install python3.8-venv sudo apt install python3.10-venv ``` Create a virtual-env and activate it ``` python3 -m venv env_one source env_one/bin/activate ``` ![](https://hackmd.io/_uploads/rJsx0svbp.png) ## 2. Install Python requirements ==Need activate virtual-env== ``` pip install pandas pip install XlsxWriter pip install progress pip install openpyxl pip install matplotlib pip install seaborn sudo apt-get update sudo apt-get install python3-tk ``` ![](https://hackmd.io/_uploads/BJKhITwb6.png =60%x) ## 3. Install LibreOffice Calc Install LibreOffice Calc to open Excel .xlsx files ``` sudo apt-get update sudo apt-get install libreoffice ``` ## 4. Install Docker Install ``` sudo apt update sudo apt install apt-transport-https ca-certificates curl software-properties-common -y curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" apt-cache policy docker-ce sudo apt install docker-ce -y ``` Check Docker Status : ==active (running)== ``` sudo systemctl status docker ``` ![](https://hackmd.io/_uploads/SJkNW3vWT.png) Installing Docker from the Official Repository (Option 1): https://phoenixnap.com/kb/install-docker-on-ubuntu-20-04 ## 5. Install Grype Install Grype v0.64.1 ``` wget -qO - https://raw.githubusercontent.com/anchore/grype/main/install.sh | sudo bash -s -- -b /usr/local/bin v0.64.1 ``` Check ``` grype version ``` --- # "auto_scan.sh" Operation ## 1. Docker Hub Login ``` sudo chmod 666 /var/run/docker.sock docker login -u <LOGIN> -p <PASSWORD> ``` ![](https://hackmd.io/_uploads/rkZp76D-T.png) ref: https://newbedev.com/got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket-at-unix-var-run-docker-sock-post-http-2fvar-2frun-2fdocker-sock-v1-24-auth-dial-unix-var-run-docker-sock-connect-permission-denied-code-example ## 2. Executing Shell Script ``` cd auto_scan chmod +x auto_scan.sh ./auto_scan.sh <number:1=cloud,2=edge> ``` ![](https://hackmd.io/_uploads/HJ3XZ6PZ6.png) Check executing finish ![](https://hackmd.io/_uploads/BJ7cW6D-a.png =60%x) ### ==If no target is specified== ![](https://hackmd.io/_uploads/S1Sn-pvZp.png) ## 3. Report Location ..../scan_env/auto_scan/<type>/<time>/report_file ![](https://hackmd.io/_uploads/HkANj3PWT.png) --- # "compare.py" Operation You need to "activate" virtual env to execute this program ``` source ../env_one/bin/activate python compare.py <number:1=cloud,2=edge> ``` ![](https://hackmd.io/_uploads/HyqIGavZ6.png) ## leave virtual env ``` deactivate ``` ![](https://hackmd.io/_uploads/B1LqEpP-6.png)