Oct 24, 2021

OpenVAS

$ sudo apt update

$ sudo apt install openvas

$ sudo gvm-setup

$ sudo gvm-start

Open web UI: http://localhost:9392

Add "Target" (hosts)

Check "Scan Configs"

Create new "Task"

Check results and report


Sep 22, 2021

Windows

How to manage services via cmd?

> sc \\comp-name config AVP start=demand

> sc \\comp-name config AVP start=disabled

> sc \\comp-name config AVP start=auto

How to escalade priv up to system?

1. Download and extract pack from Mark Russinovich

2. Run cmd from administrator

3. > psexec.exe -i -s cmd.exe

4. > whoami

5. > procexp64.exe

6. Find service with system priv

7. Open properties and permissions

8. Add user permissions for the current service

9. Go to the services and edit settings for service 

Where is the hosts file?

C:\Windows\System32\drivers\etc\hosts

Aug 23, 2021

VirtualBox

How to increase the hard disk size?

- shutdown VM

- add VirtualBox path to the PATH env. variable via computer properties

C:\Program Files\Oracle\VirtualBox

- open the cmd and go to the hard disk location

- modify disk

> VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB

How to add shared folder?

- add folder via gui

- add current user to vbox group

$ sudo adduser $USER vboxsf

- logout

Jul 15, 2021

Disk

How to check HDD/SSD/USB disk?


Windows

Victoria ( hdd[dot]by/victoria )

MiniTool Partition Wizard ( partitionwizard[dot]com )

Linux

...

Mac OS X

...

Jul 8, 2021

Linux

How to create a systemd service?

Application:

$ cat myapp.sh

#!/usr/bin/bash

echo "I'm a test app" > /tmp/test.file

Service:

$ cat /etc/systemd/system/myapp.service

...

After=network.target

After=mysqld.service

Restart=on-failure

RestartSec=1

Start the service:

$ sudo systemctl start myapp

Start on boot:

$ sudo systemctl enable myapp

How to disable beep speaker?

# temporary

$ sudo rmmod pcspkr

# permanently

$ sudo gedit /etc/modprobe.d/blacklist

    blacklist pcspkr

$ reboot

SSH by key

$ ssh-keygen -t ed25519 -C "new"

$ cat ~/.ssh/config

Host x.x.x.x

  HostName x.x.x.x

  IdentityFile ~/.ssh/new

  IdentitiesOnly yes

  User root

  Port 22

$ ssh x.x.x.x

Jul 6, 2021

CentOS

How to get details about OS version?

$ cat /etc/os-release

$ cat /etc/centos-release

$ uname -a

Jul 5, 2021

HowTo Mac

How to fix a problem with russian characters in console?

Temporary solution: 

$ export LC_ALL=ru_RU.UTF-8
$ export LANG=ru_RU.UTF-8

Permanent solution:

Add env variables to the end of this file: ~/.bash_profile

$ source ~/.bash_profile

Jun 20, 2021

HowTo Install SonarQube

Target OS is Cent OS 7.

Step 1. Install Java

Download RPM Linux x64 RPM Package from oracle.com - jdk-11.0.11_linux-x64_bin.rpm

$ sudo yum -y localinstall jdk-11.0.11_linux-x64_bin.rpm
$ java -version
java version "11.0.11" 2021-04-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.11+9-LTS-194)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.11+9-LTS-194, mixed mode)

Step 2. Install and configure PostgreSQL

Add repository:

$ sudo rpm -Uvh https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm

Install DB:

$ sudo yum -y install postgresql96-server postgresql96-contrib

Initialize DB:

$ sudo /usr/pgsql-9.6/bin/postgresql96-setup initdb


Feb 2, 2021

Java

1. Download archive with JDK from oracle website.

2. Copy it to special folder

    $ sudo mkdir /usr/java

    $ sudo cp ~/Downloads/jdk-8u281-linux-x64.tar.gz /usr/java

    $ rm ~/Downloads/jdk-8u281-linux-x64.tar.gz

3. Unpack the archive

    $ cd /usr/java

    $ sudo tar xvfz jdk-8u281-linux-x64.tar.gz

    $ sudo rm jdk-8u281-linux-x64.tar.gz

4. Add environment variable

    $ vim ~/.profile

    export JAVA_HOME=/usr/java/jdk1.8.0_281

    export PATH=${PATH}:${JAVA_HOME}/bin

5. Apply changes

    $ source ~/.profile

6. Check JAVA version

     $ java -version

java version "1.8.0_281"

Java(TM) SE Runtime Environment (build 1.8.0_281-b09)

Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)

Jan 13, 2021

HowTo PyCharm

How to add environment variable?

Run - Edit Configurations - Environment variables

Read it from code:import os
RT_USER = os.environ["rt_user"]

How to install python package?

Settings - Project - Python Interpreter


HowTo Samba


$ sudo apt-get install samba samba-common-bin

$ sudo vim /etc/samba/smb.conf

[samba]
path = /media/2tb 
writeable=Yes 
create mask=0777 
directory mask=0777 
public=no

$ sudo smbpasswd -a pi

$ sudo systemctl restart smbd

How to mount it in Windows:

“Computer” -> “Map network drive”

Disk: Z
Path: \\raspberrypi\samba

How to mount it in Mac OS X:

???


Kubernetes

kubectl installation $ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl...