change ``bash headers to
``sh
This commit is contained in:
@@ -5,7 +5,7 @@ requires: [ "ssh" ]
|
||||
---
|
||||
# SSH Daemon Jail
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.d/ssh.local
|
||||
```
|
||||
|
||||
@@ -17,15 +17,15 @@ ignoreip = 127.0.0.1/8 ::1,192.168.0.0/16 ::1
|
||||
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo systemctl restart fail2ban
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo fail2ban-client status
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo fail2ban-client status sshd
|
||||
```
|
||||
|
||||
|
@@ -18,7 +18,7 @@ Set up a file like this, called `troubleshooting.txt`.
|
||||
|
||||
Then translate it with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
graph-easy troubleshooting.txt --as boxart
|
||||
```
|
||||
|
||||
|
@@ -8,7 +8,7 @@ This is a basic Linux firewall program.
|
||||
|
||||
Look at your firewalls:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iptables -L
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ We see the output of input, output and forwarding rules.
|
||||
|
||||
I don't need any forwarding, so I'm going to drop all forwarding:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iptables -P FORWARD DROP
|
||||
```
|
||||
|
||||
@@ -26,17 +26,17 @@ iptables -P FORWARD DROP
|
||||
|
||||
Let's 'A'dd, or 'A'ppend a rule with -A. Let's drop all input from a nearby IP
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iptables -A INPUT -s 192.168.0.23 -j DROP
|
||||
```
|
||||
|
||||
Or we can block all input from a particular port on the full Network.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iptables -A INPUT -s 192.168.0.0/24 -p tcp --destination-port 25 -j DROP
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iptables -A INPUT --dport 80 -j ACCEPT
|
||||
```
|
||||
|
||||
@@ -47,13 +47,13 @@ However, rules are accepted in order - so a packet cannot be rejected and then a
|
||||
|
||||
To delete rule 2 from the INPUT chain:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iptables -D INPUT 3
|
||||
```
|
||||
|
||||
Alternatively, you can 'I'nsert a rule at the start, rather than 'A'ppending it.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iptables -I INPUT -s 192.168.0.13 DROP
|
||||
```
|
||||
|
||||
@@ -67,7 +67,7 @@ The -j flag accepts ACCEPT/REJECT/DROP. The last two are identical except that
|
||||
|
||||
Flush all existing rules with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iptables -F
|
||||
```
|
||||
|
||||
|
@@ -5,7 +5,7 @@ tags: [ "networking" ]
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
nmap 192.168.1.1/24
|
||||
```
|
||||
|
||||
@@ -17,6 +17,6 @@ Flags:
|
||||
|
||||
Look for a web server, which has ports 80 and 443 open:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
nmap 192.168.1.1/24 -p 80,443 --open
|
||||
```
|
||||
|
@@ -6,19 +6,19 @@ tags: [ "distros" ]
|
||||
|
||||
## Arch
|
||||
|
||||
```bash
|
||||
```sh
|
||||
yay -S pi-hole-server
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo systemctl enable --now pihole-FTL
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo systemctl disable --now systemd-resolved
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo rm -f /dev/shm/FTL-\*
|
||||
```
|
||||
|
||||
@@ -26,32 +26,32 @@ sudo rm -f /dev/shm/FTL-\*
|
||||
|
||||
Debian has a long, boring setup.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo apt-get install wget curl net-tools gamin lighttpd lighttpd-mod-deflate
|
||||
curl -sSL https://install.pi-hole.net | PIHOLE_SKIP_OS_CHECK=true sudo -E bash
|
||||
```
|
||||
|
||||
# Setup
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo usermod -aG pihole $USER
|
||||
```
|
||||
|
||||
Remove that google dns server.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
pihole -a setdns 9.9.9.9 1.0.0.1
|
||||
```
|
||||
|
||||
Disable pihole password by setting a blank password.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
pihole -a -p
|
||||
```
|
||||
|
||||
Get a new list of blocked domains, then reload:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
pihole -g -r
|
||||
```
|
||||
|
||||
@@ -61,13 +61,13 @@ Every so often, run `pihole -g` again (perhaps put it in crontab).
|
||||
|
||||
Observe the pihole's output while you ask it a question:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
pihole -t
|
||||
```
|
||||
|
||||
Then ask the question from another computer:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
dig @[ pihole ip ] archlinux.org
|
||||
```
|
||||
|
||||
|
@@ -9,71 +9,71 @@ We'll assume a folder in Google Drive called 'test', and local folder called 'fo
|
||||
|
||||
Generate a config file with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
rclone config
|
||||
```
|
||||
|
||||
Look at the contents of Google Drive:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
rclone ls gd:/
|
||||
```
|
||||
|
||||
If rclone loses authorization:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
rclone authorization
|
||||
```
|
||||
|
||||
List only directories:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
rclone lsf -dirs-only google:/
|
||||
```
|
||||
|
||||
Mount the remote location on /tmp/google with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
rclone mount google /tmp/google
|
||||
```
|
||||
|
||||
Copy the contents of 'foo' to 'test'.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
rclone copy foo/ google:test
|
||||
```
|
||||
|
||||
Sync contents of foo and test with a progress bar (will delete Google items):
|
||||
|
||||
```bash
|
||||
```sh
|
||||
rclone sync foo google:test -P
|
||||
```
|
||||
|
||||
Remove all duplicates
|
||||
|
||||
```bash
|
||||
```sh
|
||||
rclone dedupe google:test
|
||||
```
|
||||
|
||||
Delete contets of a remote file:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
rclone delete n:test
|
||||
```
|
||||
|
||||
Or delete the folder and contents as well:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
rclone purge n:test
|
||||
```
|
||||
|
||||
Copy to and from with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
rclone copyto google:test foo
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
```sh
|
||||
rclone copyto foo google:test
|
||||
|
@@ -3,7 +3,7 @@ title: "Download Website"
|
||||
tags: [ "networking", "scraping" ]
|
||||
---
|
||||
|
||||
```bash
|
||||
```sh
|
||||
domain=splint.rs
|
||||
mkdir $domain
|
||||
cd $domain
|
||||
|
@@ -4,25 +4,25 @@ tags: [ "scraping" ]
|
||||
---
|
||||
Install `yt-dlp`.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
yt-dlp --write-auto-sub *<URL>*
|
||||
```
|
||||
|
||||
It will default to English, but you can specify another language with the flag --sub-lang:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
youtube-dl --sub-lang sv --write-auto-sub *<URL>*
|
||||
```
|
||||
|
||||
You can list all available subtitles with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
yt-dlp --list-subs *<URL>*
|
||||
```
|
||||
|
||||
It's also possible to skip the video and only download the subtitle if you add the flag --skip-download:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
yt-dlp --sub-lang sv --write-auto-sub --skip-download *<URL>*
|
||||
```
|
||||
|
||||
|
@@ -15,12 +15,12 @@ tags: [ "networking", "host" ]
|
||||
|
||||
Query a host with the `host` command.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
host $domain.$tld
|
||||
```
|
||||
|
||||
|
||||
```bash
|
||||
```sh
|
||||
host $domain.$tld 9.9.9.9
|
||||
```
|
||||
|
||||
@@ -34,7 +34,7 @@ You can also add a specific nameserver:
|
||||
|
||||
Request a specific record type (`CNAME`, `TXT`, et c.):
|
||||
|
||||
```bash
|
||||
```sh
|
||||
torsocks host -T -t $RECORD_TYPE $domain
|
||||
```
|
||||
|
||||
|
@@ -5,7 +5,7 @@ requires: [ "ssh" ]
|
||||
---
|
||||
# Mount
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sshfs $USER@$IP_ADDRESS:$DIR
|
||||
```
|
||||
|
||||
@@ -16,7 +16,7 @@ Various flags:
|
||||
|
||||
# Unmount
|
||||
|
||||
```bash
|
||||
```sh
|
||||
fusermount3 -u $DIR
|
||||
```
|
||||
|
||||
|
@@ -6,25 +6,25 @@ requires: [ "ssh" ]
|
||||
|
||||
Mount a remote filesystem locally with fuse-sshfs:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sshfs *user*@192.168.0.10:/home/*user* /tmp/mnt
|
||||
```
|
||||
|
||||
Unmount with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
fusermount -u /tmp/mnt
|
||||
```
|
||||
|
||||
Set it up on /etc/fstab with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sshfs#bkp@bkp.a-server.ninja:/media/store1/bkp /backup fuse defaults,allow_other,reconnect,delay_connect 0 0
|
||||
```
|
||||
|
||||
Make image backup of sda1 and sda2 from one machine and pass it through ssh to another.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
for i in {1,2};do sudo dd if=/dev/sda$i | ssh -C *user*@192.168.0.10 "dd of=/mnt/Backup/winback-oct-\"$i\".img" status=progress; done
|
||||
```
|
||||
|
||||
|
@@ -5,7 +5,7 @@ tags: [ "networking" ]
|
||||
|
||||
# Get a Hostname
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo vim /etc/tor/torrc
|
||||
```
|
||||
|
||||
|
@@ -22,29 +22,29 @@ Install it then start the service.
|
||||
|
||||
Arch Linux:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo systemctl start transmission
|
||||
```
|
||||
|
||||
Debian:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo systemctl start transmission-daemon
|
||||
```
|
||||
|
||||
Add a torrent by the .torrent file, or a magnet link, like this:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
transmission-remote -a 'magnet:?xt=urn:btih:05547db7c0c5fbbe50f00212ee43e9cec5b006fa&dn=Sita+Sings+the+Blues+%281080P+official+release%29&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969'
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
transmission-remote -a sita.torrent
|
||||
```
|
||||
|
||||
Now let's check that the torrent's been added successfully.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
transmission-remote -l
|
||||
```
|
||||
|
||||
@@ -53,7 +53,7 @@ To see the torrents, go to /var/lib/transmission/Downloads
|
||||
If you don't have permission, either add the directory to the group made for your username, or add yourself to the `:transmission` group, or otherwise make sure that you can read that directory, and the user `transmission` can read, write and execute.
|
||||
E.g.:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo usermod -aG transmission $USER
|
||||
```
|
||||
|
||||
@@ -63,7 +63,7 @@ Log in again for the changes to take effect (or open a new TTY with `Ctrl+Alt+F2
|
||||
|
||||
If you don't want to have a file active as a torrent, get it's number with `transmission-remote -l`, then, if it were number '4', do:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
transmission-remote -t 4 -r
|
||||
```
|
||||
|
||||
@@ -71,7 +71,7 @@ You can now move the file, and the torrent will not be confused.
|
||||
|
||||
To both **r**emove **a**nd **d**elete a file, use `-rad`:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
transmission-remote -t 4 -rad
|
||||
```
|
||||
|
||||
@@ -82,7 +82,7 @@ If the file is in your home - `~` - but `transmission` is not allowed in your ho
|
||||
|
||||
Next, find the torrent's number. You can use multiple numbers, separated with a comma:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
transmission-remote -t 3,5,8 --move $HOME/music
|
||||
```
|
||||
|
||||
@@ -90,7 +90,7 @@ transmission-remote -t 3,5,8 --move $HOME/music
|
||||
|
||||
The `transmission` user has a home configuration file, like any other user, with all the transmission settings.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
cd /var/lib/transmission/.config/transmission-daemon/
|
||||
|
||||
$EDITOR settings.json
|
||||
@@ -105,14 +105,14 @@ When it doubt, just place the files in `transmission`'s home directory.
|
||||
|
||||
Create a torrent of file or directory `Memes` with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo chown -R :transmission Memes
|
||||
transmission-create $(pwd)/Memes
|
||||
```
|
||||
|
||||
Add a tracker to the torrent, to make sure others can find you easily:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
transmission-create --comment 'My Memes collection' -t 'udp://tracker.publicbt.com:80' -t 'udp://tracker.openbittorrent.com:80' --anonymize Memes
|
||||
```
|
||||
|
||||
@@ -141,7 +141,7 @@ Without the `--anonymize` flag, the torrent file output will have a 'created by'
|
||||
|
||||
Add your torrent and notes its number:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
transmission-remote -a "$file".torrent
|
||||
transmission-remote -l
|
||||
transmission-remote -t "$number" -i
|
||||
@@ -149,19 +149,19 @@ transmission-remote -t "$number" -i
|
||||
|
||||
The information in the last command shows that it's not verified, so you can verify with `-v`.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
transmission-remote -t "$number" -v
|
||||
```
|
||||
|
||||
If transmission cannot find it, then tell it where to find the torrent:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
transmission-remote -t "$number" --find "$(pwd)"
|
||||
```
|
||||
...and of course, make sure the permissions allow transmission to see the target.
|
||||
|
||||
|
||||
```bash
|
||||
```sh
|
||||
ls -ld "$file"
|
||||
```
|
||||
|
||||
|
@@ -7,19 +7,19 @@ tags: [ "networking" ]
|
||||
|
||||
If not, try checking out what your local networking interfaces are, then check if they have been picked up:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
dmesg | grep eth0
|
||||
```
|
||||
|
||||
# Display Active Ports
|
||||
|
||||
```bash
|
||||
```sh
|
||||
netstat -l
|
||||
```
|
||||
|
||||
...or maybe narrow it down to http:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
netstat -l | grep http
|
||||
```
|
||||
|
||||
|
@@ -4,35 +4,35 @@ tags: [ "networking", "web" ]
|
||||
---
|
||||
Install nginx:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo apt-get install nginx
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo apt-get enable --now nginx
|
||||
```
|
||||
|
||||
Put a website somewhere:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
mkdir /var/www/html/mysite/
|
||||
```
|
||||
|
||||
Put an index file there:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
vim /var/www/html/mysite/index.html
|
||||
```
|
||||
|
||||
Make the owner `www-data`
|
||||
|
||||
```bash
|
||||
```sh
|
||||
chown -R www-data:www-data /var/www/html/mysite/
|
||||
```
|
||||
|
||||
Make a configuration file for nginx:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
vim /etc/nginx/sites-available/mysite.conf
|
||||
```
|
||||
|
||||
@@ -54,13 +54,13 @@ server {
|
||||
|
||||
Make the site available:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
ln -s /etc/nginx/sites-available/mysite.conf /etc/nginx/sites-enabled/
|
||||
```
|
||||
|
||||
Test it's working:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
nginx -t
|
||||
```
|
||||
|
||||
@@ -82,17 +82,17 @@ Buy some DNS online, then check it's working.
|
||||
|
||||
*Once it's working*, use certbot:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
apt install certbot
|
||||
```
|
||||
|
||||
You may need to install an nginx python module:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
apt install python3-certbot-nginx
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
domain=example.com
|
||||
my_email=me@posteo.uk
|
||||
certbot --nginx -d "$domain" --non-interactive --agree-tos -m "$my_email"
|
||||
|
@@ -7,27 +7,27 @@ tags: [ "networking" ]
|
||||
|
||||
Stats on local net usage within domain.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iftop -p -n
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
whois domain.com
|
||||
```
|
||||
|
||||
Info on domain, whether it's taken, et c.:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
dig domain.com
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
ifconfig
|
||||
```
|
||||
|
||||
Versatile wifi tool:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
nmcli
|
||||
```
|
||||
|
||||
@@ -35,7 +35,7 @@ nmcli
|
||||
|
||||
You want to connect to the internet.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo iwconfig
|
||||
```
|
||||
|
||||
@@ -61,7 +61,7 @@ Get knowledge of wireless state. The output might be:
|
||||
|
||||
This tells you that your ESSID is 'Gandalf WajFaj', and the access point name is 10:05:......
|
||||
|
||||
```bash
|
||||
```sh
|
||||
nmcli radio
|
||||
```
|
||||
|
||||
@@ -69,23 +69,23 @@ You get an overview of your radio devices.
|
||||
You're told that eth0 deals with your ethernet and `wlan0` deals with wifi.
|
||||
`wlan0` is a file which represents your wifi device.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
nmcli wlan0 wifi rescan
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
nmcli device wifi list
|
||||
```
|
||||
|
||||
Now to connect.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
nmcli device wifi connect [SSID] [your password] [wifi password]
|
||||
```
|
||||
|
||||
Alternatively, you can use
|
||||
|
||||
```bash
|
||||
```sh
|
||||
nmcli -ask device wifi connect [SSID]
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user