This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
onny:notizen [2022/08/05 11:43] – 10.25.0.100 | onny:notizen [2024/05/21 19:09] – [git] fdc9:281f:4d7:9ee9::1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== kernel ===== | ||
- | |||
- | grep kernel config running system | ||
- | <code bahs> | ||
- | zcat / | ||
- | </ | ||
- | |||
- | ===== fish ===== | ||
- | |||
- | unset history | ||
- | < | ||
- | fish --private | ||
- | </ | ||
- | |||
===== bash ===== | ===== bash ===== | ||
Line 101: | Line 87: | ||
chmod +x $FILE | chmod +x $FILE | ||
$FILE " | $FILE " | ||
- | </ | ||
- | ==== sed ==== | ||
- | Mit sed inplace eine Zeile zu einer Datei hinzufügen: | ||
- | <code bash> | ||
- | sed -i ' | ||
- | </ | ||
- | add to end of file | ||
- | <code bash> | ||
- | sed -i -e ' | ||
- | </ | ||
- | Comment out specific line matching a string | ||
- | <code bash> | ||
- | sudo sed -e '/ | ||
- | </ | ||
- | comment out multiple lines / range | ||
- | <code bash> | ||
- | sed -i "28,33 s/# *//" autogen.sh | ||
- | </ | ||
- | regex parse value of xml tags | ||
- | <code bash> | ||
- | sed -n ' | ||
- | </ | ||
- | delete multiple lines | ||
- | <code bash> | ||
- | sed -i ' | ||
</ | </ | ||
- | insert line after match | ||
- | <code bash> | ||
- | sed '/ | ||
- | </ | ||
==== grep ==== | ==== grep ==== | ||
regex match group | regex match group | ||
Line 163: | Line 120: | ||
fd '[^A-Z a-züö@0-9._-]' | fd '[^A-Z a-züö@0-9._-]' | ||
</ | </ | ||
- | ==== rg ==== | ||
- | filter file type | ||
- | <code bash> | ||
- | rg GPIO_CFG_2MA -g ' | ||
- | </ | ||
- | |||
- | search file containing multiple strings/ | ||
- | |||
- | <code bash> | ||
- | rg -lU --multiline-dotall ' | ||
- | </ | ||
- | |||
- | ==== curl ==== | ||
- | post data | ||
- | <code bash> | ||
- | curl --data " | ||
- | </ | ||
- | download and extract archive | ||
- | <code bash> | ||
- | curl http:// | ||
- | </ | ||
- | set host header | ||
- | <code bash> | ||
- | torify curl --header "Host: http.pi" | ||
- | </ | ||
- | ==== tcpdump ==== | ||
- | specific ports | ||
- | <code bash> | ||
- | tcpdump -i eth0 -q '(tcp port 80) or (tcp port 443)' -A | ||
- | </ | ||
- | exclude specific host | ||
- | <code bash> | ||
- | tcpdump -i eth0 -q '(ip or ip6) and (tcp port 80) or (tcp port 443) and not host ifconfig.co' | ||
- | </ | ||
==== patching ==== | ==== patching ==== | ||
=== appling === | === appling === | ||
Line 243: | Line 166: | ||
</ | </ | ||
===== networking ===== | ===== networking ===== | ||
- | netcat | ||
- | <code bash> | ||
- | netcat -l 4444 | ||
- | </ | ||
- | <code bash> | ||
- | netcat playground.pi 4444 | ||
- | </ | ||
==== nftables ==== | ==== nftables ==== | ||
<code bash> | <code bash> | ||
Line 291: | Line 207: | ||
iptables -t nat -A OUTPUT -p tcp --dport 2222 -j DNAT --to 192.168.1.2: | iptables -t nat -A OUTPUT -p tcp --dport 2222 -j DNAT --to 192.168.1.2: | ||
</ | </ | ||
- | </ | ||
- | ==== ip ==== | ||
- | set address | ||
- | <code bash> | ||
- | ip address add dev usb0 172.16.42.1/ | ||
- | ip link set usb0 up | ||
- | </ | ||
- | route command example | ||
- | <code bash> | ||
- | ip route add 192.168.1.0/ | ||
- | ip route add default via 192.168.1.1 | ||
- | </ | ||
- | flush addresses | ||
- | <code bash> | ||
- | ip addr flush dev enp8s0 | ||
- | </ | ||
- | remove interface | ||
- | <code bash> | ||
- | ip link delete br0 | ||
- | </ | ||
- | delete address | ||
- | <code bash> | ||
- | ip addr del 192.168.178.20/ | ||
- | </ | ||
- | show only specific interface | ||
- | <code bash> | ||
- | ip a show wg0 | ||
</ | </ | ||
- | change mtu | ||
- | <code bash> | ||
- | ip link set dev eth0 mtu 1400 | ||
- | </ | ||
==== dnsmasq ==== | ==== dnsmasq ==== | ||
minimal hostapd and dnsmasq config | minimal hostapd and dnsmasq config | ||
Line 486: | Line 371: | ||
* iodine dns tunnel https:// | * iodine dns tunnel https:// | ||
* command searchsploit in exploitdb | * command searchsploit in exploitdb | ||
+ | * NixOS for Pentesting Overview https:// | ||
===== chromium / chrome ===== | ===== chromium / chrome ===== | ||
Line 493: | Line 379: | ||
</ | </ | ||
===== docker ===== | ===== docker ===== | ||
- | Short example | + | |
+ | Pull | ||
<code bash> | <code bash> | ||
- | sudo systemctl start docker | + | docker |
- | gpasswd -a onny docker | + | docker |
- | | + | |
- | | + | |
</ | </ | ||
+ | |||
+ | Run | ||
+ | <code bash> | ||
+ | docker run -td ubuntu: | ||
+ | </ | ||
+ | |||
+ | Executing | ||
+ | <code bash> | ||
+ | docker exec -it ffffdfdfsdfsdfsfsffsdfs /bin/bash | ||
+ | </ | ||
+ | |||
+ | Nextcloud | ||
+ | <code bash> | ||
+ | docker run -d -p 80:80 rootlogin/ | ||
+ | docker run -v / | ||
+ | </ | ||
+ | |||
Debugging it | Debugging it | ||
<code bash> | <code bash> | ||
Line 505: | Line 407: | ||
| | ||
</ | </ | ||
+ | |||
Pull from repository | Pull from repository | ||
< | < | ||
Line 515: | Line 418: | ||
| | ||
</ | </ | ||
- | Pull specific tagged image | + | |
- | <code bash> | + | |
- | docker pull rootlogin/ | + | |
- | </ | + | |
Build from Dockerfile | Build from Dockerfile | ||
< | < | ||
Line 542: | Line 442: | ||
docker system prune -a | docker system prune -a | ||
</ | </ | ||
- | docker stop all container | + | |
- | <code bash> | + | |
- | docker stop (docker ps -a -q) | + | |
- | </ | + | |
prevent from auto start | prevent from auto start | ||
+ | |||
<code bash> | <code bash> | ||
docker update --restart=no client-iaro_db_1 | docker update --restart=no client-iaro_db_1 | ||
Line 722: | Line 620: | ||
git remote set-url origin gitlab@http-new.pi: | git remote set-url origin gitlab@http-new.pi: | ||
</ | </ | ||
- | tagging | + | |
- | <code bash> | + | |
- | git tag -a v0.1 -m ' | + | |
- | </ | + | |
merge commits from a remote repository | merge commits from a remote repository | ||
+ | |||
<code bash> | <code bash> | ||
git fetch https:// | git fetch https:// | ||
Line 821: | Line 717: | ||
git commit --allow-empty -m 'run tests again' | git commit --allow-empty -m 'run tests again' | ||
git push --set-upstream USERNAME mynewbranch | git push --set-upstream USERNAME mynewbranch | ||
- | </ | ||
- | change message of last git commit | ||
- | <code bash> | ||
- | git commit --amend | ||
</ | </ | ||
force push, remove latest commit of remote repository (origin) | force push, remove latest commit of remote repository (origin) | ||
Line 851: | Line 743: | ||
git commit --all --amend --no-edit | git commit --all --amend --no-edit | ||
git rebase --continue | git rebase --continue | ||
- | </ | ||
- | |||
- | add co-author / co-authors to commit | ||
- | <code bash> | ||
- | git commit --amend | ||
- | # Add line: Co-authored-by: | ||
</ | </ | ||
===== yum ===== | ===== yum ===== | ||
Line 938: | Line 824: | ||
</ | </ | ||
* check spamminess of email server: https:// | * check spamminess of email server: https:// | ||
- | * manual imap login | + | |
- | openssl imaps login | + | |
- | < | + | |
- | openssl s_client -connect mail.sexypump.de: | + | |
- | A login cypherpunk cypherpunk | + | |
- | </ | + | |
- | get quota | + | |
- | < | + | |
- | a GETQUOTAROOT INBOX | + | |
- | </ | + | |
- | get msg count of folder | + | |
- | < | + | |
- | a LIST INBOX * | + | |
- | * LIST (\HasChildren) " | + | |
- | * LIST (\HasNoChildren \UnMarked) " | + | |
- | * LIST (\HasNoChildren \UnMarked) " | + | |
- | * LIST (\HasNoChildren \UnMarked \Trash) " | + | |
- | * LIST (\HasNoChildren \UnMarked \Sent) " | + | |
- | * LIST (\HasNoChildren \UnMarked) " | + | |
- | * LIST (\HasNoChildren \UnMarked \Junk) " | + | |
- | * LIST (\HasNoChildren \UnMarked \Drafts) " | + | |
- | * LIST (\HasNoChildren \UnMarked) " | + | |
- | a OK List completed (0.001 + 0.000 secs). | + | |
- | a SELECT INBOX | + | |
- | </ | + | |
send smtp mail | send smtp mail | ||
< | < | ||
Line 1321: | Line 1183: | ||
<code bash> | <code bash> | ||
- | nix run nix run nixpkgs#electrum | + | nix run nixpkgs# |
+ | nix run github: | ||
+ | nix shell nixpkgs# | ||
</ | </ | ||
Line 1348: | Line 1212: | ||
< | < | ||
- | let | + | nixpkgs.config.packageOverrides = pkgs: rec { |
- | + | unstable = import unstableTarball { }; | |
- | # FIXME | + | opensnitch = unstable.opensnitch; |
- | unstableTarball = | + | }; |
- | fetchTarball | + | |
- | https:// | + | |
- | + | ||
- | in | + | |
- | { | + | |
- | + | ||
- | disabledModules = [ " | + | |
- | + | ||
- | imports = [ | + | |
- | " | + | |
- | / | + | |
- | ]; | + | |
- | | + | |
- | unstable = import unstableTarball { }; | + | |
- | opensnitch = unstable.opensnitch; | + | |
- | }; | + | |
- | # | + | |
</ | </ | ||
Line 1400: | Line 1247: | ||
''; | ''; | ||
}); | }); | ||
- | </ | ||
- | |||
- | use local src / source | ||
- | |||
- | < | ||
- | src = "/ | ||
- | dontUnpack = true; | ||
- | | ||
- | unpackPhase = '' | ||
</ | </ | ||
Line 1415: | Line 1253: | ||
<code bash> | <code bash> | ||
nix-shell -p ' | nix-shell -p ' | ||
- | </ | ||
- | |||
- | package overlay and override attributes | ||
- | |||
- | < | ||
- | nixpkgs.overlays = [ | ||
- | (self: super: { | ||
- | foo2zjs = (import (builtins.fetchTarball { | ||
- | url = | ||
- | " | ||
- | sha256 = " | ||
- | }) {} ).foo2zjs; | ||
- | wordpress = super.wordpress.overrideAttrs (oldAttrs: rec { | ||
- | # Remove default plugins and themes | ||
- | installPhase = oldAttrs.installPhase + '' | ||
- | rm -r $out/ | ||
- | rm -r $out/ | ||
- | ''; | ||
- | }); | ||
- | foo2zjs = super.foo2zjs.overrideAttrs (oldAttrs: rec { | ||
- | src = builtins.fetchurl { | ||
- | url = " | ||
- | sha256 = " | ||
- | }; | ||
- | patches = (oldAttrs.patches or []) ++ [ | ||
- | (pkgs.fetchpatch { | ||
- | url = " | ||
- | sha256 = " | ||
- | }) | ||
- | ]; | ||
- | }); | ||
- | }) | ||
- | ]; | ||
- | </ | ||
- | |||
- | fetchpatch | ||
- | |||
- | < | ||
- | patches = [ | ||
- | # Support HBPL1 printers https:// | ||
- | ./ | ||
- | |||
- | # Fix " | ||
- | # https:// | ||
- | (fetchpatch { | ||
- | url = " | ||
- | sha256 = " | ||
- | stripLen = 1; | ||
- | name = " | ||
- | }) | ||
- | |||
- | ]; | ||
</ | </ | ||
Line 1505: | Line 1291: | ||
<code bash> | <code bash> | ||
QEMU_NET_OPTS=" | QEMU_NET_OPTS=" | ||
+ | sudo -E QEMU_NET_OPTS=" | ||
</ | </ | ||
Line 1817: | Line 1604: | ||
''; | ''; | ||
</ | </ | ||
+ | |||
==== nixops ==== | ==== nixops ==== | ||
Line 1871: | Line 1659: | ||
fatlabel /dev/sdb1 " | fatlabel /dev/sdb1 " | ||
</ | </ | ||
+ | |||
resize extX partition | resize extX partition | ||
+ | |||
<code bash> | <code bash> | ||
sfdisk -l /dev/sdb | sfdisk -l /dev/sdb | ||
Line 1956: | Line 1746: | ||
</ | </ | ||
- | ===== avahi ===== | + | |
- | discover local services | + | |
- | <code bash> | + | |
- | avahi-browse --all --ignore-local --resolve --terminate | + | |
- | </ | + | |
===== curlftpfs ===== | ===== curlftpfs ===== | ||
<code bash> | <code bash> | ||
Line 2110: | Line 1896: | ||
</ | </ | ||
- | ===== cups ===== | ||
- | list printers | + | ===== qemu ===== |
+ | |||
+ | booting armv7 alpinelinux | ||
+ | <code bash> | ||
+ | # download kernel and stuff from here http:// | ||
+ | qemu-system-arm -M virt -m 512M -cpu cortex-a15 -kernel vmlinuz-lts -initrd initramfs-lts -append " | ||
+ | </ | ||
+ | |||
+ | ===== postgresql ===== | ||
+ | |||
+ | list all databases | ||
+ | <code bash> | ||
+ | sudo -u postgres psql | ||
+ | # \l | ||
+ | </ | ||
+ | |||
+ | drop database | ||
+ | <code bash> | ||
+ | sudo -u postgres psql | ||
+ | # drop database gitlabhq_production; | ||
+ | # drop database gitlabhq_production WITH (FORCE); | ||
+ | </ | ||
+ | |||
+ | list tables | ||
+ | <code bash> | ||
+ | sudo -u postgres psql | ||
+ | # \c gitlabhq_production | ||
+ | # \dt | ||
+ | </ | ||
+ | |||
+ | create and delete user | ||
< | < | ||
- | $ lpstat -p -d | + | DROP ROLE gitlab; |
- | printer Dell_1250c is idle. enabled since Tue 28 Dec 2021 09:44:59 AM UTC | + | CREATE USER gitlab WITH PASSWORD ' |
- | printer Dell_1250c_USB is idle. enabled since Tue 28 Dec 2021 09:44:59 AM UTC | + | |
</ | </ | ||
- | print file | + | grant permissions |
< | < | ||
- | lp -d Dell_1250c_USB -o fit-to-page -o media=A4 scared_cat.png | + | ALTER USER gitlab SUPERUSER; |
+ | CREATE DATABASE gitlabhq_production OWNER gitlab; | ||
+ | ALTER DATABASE gitlabhq_production OWNER TO gitlab; | ||
</ | </ | ||
- | list jobs | + | dump database |
< | < | ||
- | $ lpstat | + | pg_dump |
- | Dell_1250c_USB-2 root 340992 | + | |
</ | </ | ||
- | cancel job | + | dump all |
< | < | ||
- | cancel 1 | + | pg_dumpall > / |
</ | </ | ||
- | ===== qemu ===== | + | import database |
- | + | < | |
- | booting armv7 alpinelinux | + | psql# CREATE DATABASE gitlabhq_production; |
- | < | + | psql -U gitlab gitlabhq_production < gitlab.pgsql |
- | # download kernel and stuff from here http:// | + | |
- | qemu-system-arm -M virt -m 512M -cpu cortex-a15 -kernel vmlinuz-lts -initrd initramfs-lts -append " | + | |
</ | </ | ||
+ | |||
+ |