> For the complete documentation index, see [llms.txt](https://davidtancredi.gitbook.io/pentesting-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://davidtancredi.gitbook.io/pentesting-notes/r3dcl1ff/sysadmin/random-commands.md).

# Random commands

**MongoDB setup**: ditch all the bullshit tutorials / Official MongoDB walkthrough

Easy way to install is :

```
sudo apt-get update
sudo apt install mongodb
sudo systemctl status mongodb
```

**#If you cannot reach any network (in NAT mode), try:**&#x20;

```
sudo dhclient eth0
```

**#Mouse and keyboard dead after booting**

```
PRESS SHIFT AT BOOTING AND ENTER ADVANCED OPTIONS

sudo apt-get install xserver-xorg-input-all

REBOOT AND THIS SHOULD SOLVE THE PROBLEM.
```

**#Reset root privileges in post 2020 kali version**

```
sudo dpkg-reconfigure kali-grant-root
```

**#Setup SMB on Win10**

```
Type Windows Features in the search bar, enable SMB and reboot

#Running as admin type:

DISM /Online /Enable-Feature /All /FeatureName:SMB1Protocol
```

**#VMWare Workstation 16 vmon update | troubleshooting crashes**

```
sudo tar xvf vmmon.tar
cd vmmon-only
cd vmmon-only/include/
ls
cd /include
cd include
sudo nano vm_asm_x86.h
#Comment out lines 65-72 BUT NOT 71!

65 //#ifndef USE_UBSAN
66 //#define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr) \
67 // ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
68 // ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
69 // sizeof(expr) <= 2))
70 //#else
71 #define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr)     <<<---- DO NOT COMMENT OUT this line
72 //#endif


cd ..
cd /vmmon-only
cd vmmon-only
sudo make
cd ..
sudo tar xvf vmnet.tar
cd vmnet-only
sudo make
cd ..
sudo cp vmmon.o /lib/modules/`uname -r`/kernel/drivers/misc/vmmon.ko
sudo cp vmnet.o /lib/modules/`uname -r`/kernel/drivers/misc/vmnet.ko
sudo depmod -a
sudo systemctl restart vmware.service

#done
```

**#Calculate sha256 sum of file in Windows10-11**

```
 Get-FileHash -Algorithm SHA256 -Path "C:\Users\david\Downloads\file-to-check"
```

**#Install G**o-20 on Kali

```
#Download file
https://go.dev/dl/

sudo tar -C /usr/local/ -xzf go1.20.7.linux-amd64.tar.gz

sudo nano ~/.zshrc

#Add this to zshrc
#go variables
export GOPATH=/root/go-workspace
export GOROOT=/usr/local/go
PATH=$PATH:$GOROOT/bin/:$GOPATH/bin

source ~/.zshrc

go version
```

```
#Checking permanent mac addresses

Nix-ubuntu : ip -brief link
              ethtool -P wlp1s0 (depends on interface)
              cat /sys/class/net/wlp1s0/addr_assign_type (0 is permanent, 1 or 3 is random)

Windows: getmac /v /fo list  (show current settings)
         Get-NetAdapter | Select-Object Name, Status, MacAddress  (Power/shell)

```
