System information commands

finddevs.sh (poor man's lsusb):

Fundamental Commands

Pacman

Network Manager

https://networkmanager.dev/docs/

man 1 nmcli man 5 nmcli-examples man 1 nmtui man 1 nm-online man 8 nm-cloud-setup man 8 nm-initrd-generator man 7 nm-openvswitch

PulseAudio and ALSA (not so much)

PulseAudio is a general purpose sound server. It is intended to run as a middleware between your applications and your hardware devices, either using ALSA or OSS. It also offers easy network streaming across local devices using Avahi if enabled. PulseAudioclients can send audio to "sinks" and receive audio from "sources". So, sinks are outputs (audio goes there), sources are inputs (audio comes from there).

Bluetooth

So much to do here - probably - skip this unless you know what you're doing.

TIPS:

Printing

Again, lots to do. Reader beware.

http://localhost:631 is the CUPS web interface.

Helpful commands: lpstat -s to view the status of known printers lpoptions -l to list all known options lpoptions -d Ricoh-SP-C440DN to list printing options for Ricoh lpr -P Ricoh-SP-C440DN <file> to print to Ricoh

More: https://wiki.archlinux.org/index.php/CUPS#CLI_tools

Hashes, Passwords, Encryption, and Secrets

SSH - OpenSSH (thanks, puffy!)

SSH security (make sure you can login using your key first!) /etc/ssh/sshd_config: PasswordAuthentication no and PermitRootLogin no

Password Store

TODO: how do we move the store safely? bring keys? can we remotely access the store and have some security still?

Passwords and Secrets

Don't even bother - there's too much security risk here. I have this here for my own notes. Figure these things out slowly and carefully on your system.

  1. Install gnupg, pass, pam-gnupg.
  2. Import your gpg keys or generate a full key pair: gpg --full-gen-key
  3. Use a pre-existing $PASSWORD_STORE_DIR, or: Initiate a password-store: pass init <same-email-as-full-gen-key>
  4. Set the $GNUPGHOME variable (~/.local/share/gnupg is used here)

To import keys:

Unlocking keyrings (convenience vs. security)

This activates sudopass to allow w!! in vim, and neomutt syncing with isync 1. Transfer gnupg keys to new machine or create a new one gpg --full-key-gen 2. Initialize a password store pass init EMAIL 3. Add your sudo password with pass add local/USER@HOSTNAME 4. Because my gnupg lives elsewhere, - Need ~/.pam_environment with: GNUPGHOME DEFAULT=@{HOME}/.local/share/gnupg XDG_CONFIG_HOME DEFAULT=@{HOME}/.config 5. Install pam-gnupg (AUR / github) andinetutils (enable hostname) 6. Add auth optional pam_gnupg.so to /etc/pam.d/system-local-login (see https://github.com/cruegge/pam-gnupg#setup-guide if you are using a login manager) 7. Add keygrip from gpg -K --with-keygrip to ~/.config/pam-gnupg (gpg -K --with-keygrip | tail -n2 | grep -Po "(?<=Keygrip = ).*" >> ~/.config/pam-gnupg)

GPG - GnuPG

OpenSSL

Nmap

Target Specification

Scan Techniques

Host Discovery

Port Specifications

Service and Version Detection

OS Detection

Timing and Performance

TODO (original website did not have complete examples): Give up on target after this long: 1s; 4m; 2h Specifies probe round trip time: 1s; 4m; 2h Parallel host scan group sizes: 50; 1024 Probe parallelization: 10; 1 Adjust delay between probes: 20ms; 2s; 4m; 5h Specify the maximum number of port scan probe retransmissions Send packets no slower than  per second Send packets no faster than  per second

NSE Scripts

Useful NSE Script Examples

Firewall / IDS Evasion and Spoofing

Output

Helpful Nmap Output Examples

Miscellaneous Options

Fonts

Git

Android ADB and Droidcam

You want to be able to combine an audio and microphone sink to share while live streaming: https://www.reddit.com/r/archlinux/comments/klmyec/how_to_play_audio_files_as_input/ghaclhs?utm_source=share&utm_medium=web2x&context=3

Droidcam - DroidcamX

Home security, using your phone as a camera, what's not to love? DroidcamX is worth the $5 or whatever - it's really good.

ADB setup

Droidcam video only (over USB)

  1. droidcam-cli -v adb 4747 & or droidcam

Droidcam with video and microphone

  1. Load droidcam on phone and then on computer
  2. Create a pulse-alsa loopback device: pacmd load-module module-alsa-source device=hw:Loopback,1,0
  3. Run pactl list short sources to verify the ID of the loopback device (used in ffmpeg recording)
  4. Use pavucontrol to verify that the phone microphone is active

Viewing the feed

Increase the resolution available to droidcam

Example /etc/modprobe.d/droidcam.conf:

It’s also possible to invert the video size (eg. 480×640, width=480 height=640), which will make the webcam vertical and rotate the video 90º. Not all programs may load the webcam with inverted parameters (eg. Discord does not) but many do (eg. Zoom and OBS).

Image Magick

Exiftool

FFmpeg (simple)

A good x264 read: x264 --fullhelp

FFMPEG transition effects:

Noise-reducing pre-built models

Reduce background noise: https://superuser.com/questions/733061/reduce-background-noise-and-optimize-the-speech-from-an-audio-clip-using-ffmpeg

Concatenate two or more videos read from a file:

cat mylist.txt:

ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4

More complex tasks with ffmpeg

Create a video mosaic of multiple videos

Live video, downloading video, and ffmpeg streaming

Loop stream a video on the local network

Only tested on Windows, mpv udp://localhost:1234 plays it, as an example:

NOTE: Youtube requires both a video and audio component to be able to stream!

Youtube streaming a video source (must have audio)

Another one (webcam + mic, Windoze dshow example)

Capture main screen (:0) and the default Pulse Audio sink

Create an awesome fireplace, classical music combo!

Combine a video and an audio stream simultaneously

Play a video that contains audio, MERGE with an audio stream

Visual spectrograph of an audio stream

ffmpeg and Windoze

gdigrab works out of the box but better alternatives exist: https://trac.ffmpeg.org/wiki/Capture/Desktop#Windows

Borderless (and movable) webcam stream with good latency (no sound)

  1. Get AutoHotkey, and enable WinDrag.ahk ( https://wwwautohotkey.com/boards/viewtopic.php?t=57703 )
  2. List video devices: ffmpeg -list_devices true -f dshow -i dummy
  3. Play a borderless stream (see above)

Other cool programs and their magic

Powershell

Because sometimes you gotta use the Windoze.

Pipe is unusable (https://gitub.com/PowerShell/PowerShell/issues/1908) Re-directs sometimes work (<, >, etc.) Subshell works (e.g. $(Get-Clipboard) )

Powershell*Nix
Get-Clipboardxclip
Get-Content OR catcat
Compare-Object OR diffdiff
Get-PnpDevice -PresentOnlylsdev (or, lsusb, etc.)

Vim and Neovim

In Neovim, type :options to get a list of settings you can tweak in the vimrc Run :scriptnames to find out which files Vim actually loaded (debugging vimrc)

<C-o> <C-i> replay your jumps forward and back g; and g, jump to the places where you made changes

Make the primary clipboard the main one: set clipboard+=unnamedplus Open a file browser in your home directory: :find ~/ The % register contains the path to the current file In a Vim helpfile, <C+]> opens the topic under the cursor in a new buffer Unicode typing: <C+v> followed by code (i.e. u24ba which would give Ⓔ) Autocomplete filenames: <C-x><C-f> Autocomplete names: <C-x><C-n> Run a system command on the current file and display the results: :!command % Run a shell command (sort as an example) on the current buffer: :%!sort If editing a bash script, etc., run the script from Vim with :!%:p Run a command on the current buffer and replace the contents with the results: :%!command Run a command on the current buffer and paste the results: :r !command %

Save window layout: :mksession cool.vim and later load it with vim -S cool.vim Open man page for word under the cursor: <Shift-k> You really like a colorscheme except for one thing. How to change that properly in your virmc.

Other guides

Push and pull with git using SSH

You need a SSH key pair to start. Check ~/.ssh for one, or put one there if you have one on another machine. found that unless my key is called id_rsa.pub, then SSH/Github will ask for password EVERY time anyway!

  1. Copy the public key to the clipboard: `cat ~/.ssh/id_rsa.pub | xclip -i -sel clipboard``
  2. Change git remote: git remote set-url origin git@github.com:USERNAME/NAMEOFREPO.git Push to all branches (and tags) - assuming origin is the destination remote git push --all origin

These are GitHub's public key fingerprints: SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8 (RSA) SHA256:br9IjFspm1vxR3iA35FWE+4VTyz1hYVLIE2t1/CeyWQ (DSA)

QEMU: Run a VM not using virt-manager

QEMU: Run a VM using virt-manager

Handy for win10: https://dennisnotes.com/note/20180614-ubuntu-18.04-qemu-setup/

Run VirtualBox Arch Linux headless on Windows and ssh into it

Why? It's like having your own custom WSL.

Create a virtual machine using your preferred settings

Virtual machine: enable sshd (systemctl, etc.)

VirtualBox > Machine Settings > Network > Advanced

Under port forwarding add the entry:

Now, turn on the machine (here, headless): "C:\Program Files\VirtualBox\VBoxManage.exe" startvm Arch --type headless

SSH into the machine (the above settings will forward your request to 22) ssh user@127.0.0.1 -p 2222

Run a simple X server and connect to it

Send mail in the command line using msmtp

Tether computer to mobile Wifi

Connect device and turn on usb tethering, and then:

New oneliners (thanks commandlinefu)

At last check, commandlinefu had 564 pages of oneliners. I have 25 pages so far {0..25} in the command below: