This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
onny:notizen [2022/06/25 10:14] – [packaging] 10.25.0.100 | onny:notizen [2024/05/22 12:10] (current) – [batch convert images] 10.250.0.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 158: | Line 115: | ||
fd --type f -e doc -e docx -e pdf -i gabriel -x cp --backup=t {} / | fd --type f -e doc -e docx -e pdf -i gabriel -x cp --backup=t {} / | ||
</ | </ | ||
- | ==== rg ==== | ||
- | |||
- | filter file type | ||
+ | find filenames unallowed characters | ||
<code bash> | <code bash> | ||
- | rg GPIO_CFG_2MA -g '*.h' | + | fd '[^A-Z a-züö@0-9._-]' |
</ | </ | ||
- | 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 209: | Line 137: | ||
</ | </ | ||
+ | ==== xargs ==== | ||
+ | |||
+ | < | ||
+ | fd . | xargs -I {} rm " | ||
+ | </ | ||
===== rsync ===== | ===== rsync ===== | ||
custom ssh port | custom ssh port | ||
Line 233: | Line 166: | ||
</ | </ | ||
===== networking ===== | ===== networking ===== | ||
- | netcat | ||
- | <code bash> | ||
- | netcat -l 4444 | ||
- | </ | ||
- | <code bash> | ||
- | netcat playground.pi 4444 | ||
- | </ | ||
==== nftables ==== | ==== nftables ==== | ||
<code bash> | <code bash> | ||
Line 281: | 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 366: | Line 261: | ||
compression | compression | ||
<code bash> | <code bash> | ||
- | convert -density 200x200 -units PixelsPerInch -compress jpeg -quality 70 in.pdf out.pdf | + | gm convert -density 200x200 -units PixelsPerInch -compress jpeg -quality 70 in.pdf out.pdf |
</ | </ | ||
lossless merge | lossless merge | ||
Line 402: | Line 297: | ||
ffmpeg -i Kawamata\ -\ La\ passage\ des\ chaises.mkv -vf subtitles=Kawamata\ -\ La\ passage\ des\ chaises.mkv -acodec copy -preset:v ultrafast Kawamata\ -\ La\ passage\ des\ chaises.mp4 | ffmpeg -i Kawamata\ -\ La\ passage\ des\ chaises.mkv -vf subtitles=Kawamata\ -\ La\ passage\ des\ chaises.mkv -acodec copy -preset:v ultrafast Kawamata\ -\ La\ passage\ des\ chaises.mp4 | ||
</ | </ | ||
- | ==== batch convert images ==== | + | |
- | <code bash> | + | |
- | for i in *.jpeg; convert -resize 30% $i (string replace jpeg jpg $i); end | + | |
- | </ | + | |
==== lossless mp3 merge ==== | ==== lossless mp3 merge ==== | ||
<code bash> | <code bash> | ||
Line 422: | Line 314: | ||
</ | </ | ||
===== security ===== | ===== security ===== | ||
+ | |||
+ | ==== web discovery ==== | ||
+ | |||
+ | === photon === | ||
+ | |||
+ | < | ||
+ | photon -u test.example.org | ||
+ | </ | ||
==== lynis ==== | ==== lynis ==== | ||
Line 437: | Line 337: | ||
==== wfuzz ==== | ==== wfuzz ==== | ||
<code bash> | <code bash> | ||
- | torify | + | wfuzz -c --hc 404 -w / |
- | torify | + | wfuzz -c --hc 404,403 -w / |
</ | </ | ||
Preparing data for LFI scan | Preparing data for LFI scan | ||
Line 453: | Line 353: | ||
* https:// | * https:// | ||
* wifite wifi auditing tool | * wifite wifi auditing tool | ||
+ | |||
+ | sec tools | ||
+ | |||
+ | * dirbuster | ||
+ | * https:// | ||
+ | * **tiger** - system sec scanner | ||
+ | * sub domain evaluation | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * subfinder (passive, external sources) | ||
+ | * vhost scanning | ||
+ | * https:// | ||
+ | * bettercap - wifi network | ||
+ | * iodine dns tunnel https:// | ||
+ | * command searchsploit in exploitdb | ||
+ | * NixOS for Pentesting Overview https:// | ||
===== chromium / chrome ===== | ===== chromium / chrome ===== | ||
Line 460: | Line 376: | ||
</ | </ | ||
===== 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 472: | Line 404: | ||
| | ||
</ | </ | ||
+ | |||
Pull from repository | Pull from repository | ||
< | < | ||
Line 482: | Line 415: | ||
| | ||
</ | </ | ||
- | Pull specific tagged image | + | |
- | <code bash> | + | |
- | docker pull rootlogin/ | + | |
- | </ | + | |
Build from Dockerfile | Build from Dockerfile | ||
< | < | ||
Line 509: | Line 439: | ||
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 689: | Line 617: | ||
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 788: | Line 714: | ||
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 818: | Line 740: | ||
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 905: | Line 821: | ||
</ | </ | ||
* 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 1027: | Line 919: | ||
ngrep -q -W byline " | ngrep -q -W byline " | ||
</ | </ | ||
- | * sec | ||
- | * https:// | ||
- | * **tiger** - system sec scanner | ||
- | * sub domain evaluation | ||
- | * https:// | ||
- | * https:// | ||
- | * subfinder (passive, external sources) | ||
- | * vhost scanning | ||
- | * https:// | ||
- | * bettercap - wifi network | ||
- | * iodine dns tunnel https:// | ||
- | * command searchsploit in exploitdb | ||
* sys | * sys | ||
* **usbtop** | * **usbtop** | ||
Line 1297: | Line 1177: | ||
</ | </ | ||
- | quick launch | + | run program |
<code bash> | <code bash> | ||
- | nix run nixpkgs.electrum --command | + | nix run nixpkgs#electrum |
+ | nix run github: | ||
+ | nix shell nixpkgs# | ||
</ | </ | ||
Line 1327: | Line 1209: | ||
< | < | ||
- | 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 1379: | Line 1244: | ||
''; | ''; | ||
}); | }); | ||
- | </ | ||
- | |||
- | use local src / source | ||
- | |||
- | < | ||
- | src = "/ | ||
- | dontUnpack = true; | ||
- | | ||
- | unpackPhase = '' | ||
</ | </ | ||
Line 1396: | Line 1252: | ||
</ | </ | ||
- | package overlay and override attributes | + | fetchpatch array |
< | < | ||
- | nixpkgs.overlays | + | patches |
- | | + | /* This patch is currently necessary for the unit test suite to run correctly. |
- | foo2zjs = (import (builtins.fetchTarball { | + | * See https://www.mail-archive.com/klee-dev@imperial.ac.uk/msg03136.html |
- | url = | + | * and https:// |
- | "https://github.com/ | + | */ |
- | sha256 = " | + | #{ |
- | }) {} ).foo2zjs; | + | # name = " |
- | wordpress = super.wordpress.overrideAttrs (oldAttrs: rec { | + | # |
- | # Remove default plugins and themes | + | # |
- | installPhase = oldAttrs.installPhase + '' | + | #} |
- | rm -r $out/share/ | + | |
- | rm -r $out/ | + | |
- | ''; | + | |
- | }); | + | |
- | foo2zjs = super.foo2zjs.overrideAttrs (oldAttrs: rec { | + | |
- | src = builtins.fetchurl { | + | |
- | url = "https:// | + | |
- | sha256 = "0xksz2p2l0jx083hlbrh295ncb2lgsp9b8nwdig3lyinl5x"; | + | |
- | }; | + | |
- | patches = (oldAttrs.patches or []) ++ [ | + | |
- | (pkgs.fetchpatch { | + | |
- | | + | |
- | | + | |
- | | + | |
- | ]; | + | |
- | }); | + | |
- | }) | + | |
- | ]; | + | |
- | </ | + | |
- | fetchpatch | + | # This patch fixes test compile issues with glibc 2.33+. |
- | + | #{ | |
- | < | + | |
- | | + | # |
- | ./no-hardcode-fw.diff | + | # url = " |
- | + | #} | |
- | | + | |
- | ./ | + | |
- | + | ||
- | # Fix "Unimplemented paper code" | + | |
- | # https:// | + | |
- | (fetchpatch { | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | ]; | + | |
</ | </ | ||
Line 1462: | Line 1288: | ||
<code bash> | <code bash> | ||
QEMU_NET_OPTS=" | QEMU_NET_OPTS=" | ||
+ | sudo -E QEMU_NET_OPTS=" | ||
</ | </ | ||
Line 1774: | Line 1601: | ||
''; | ''; | ||
</ | </ | ||
+ | |||
==== nixops ==== | ==== nixops ==== | ||
Line 1828: | Line 1656: | ||
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 1913: | Line 1743: | ||
</ | </ | ||
- | ===== avahi ===== | + | |
- | discover local services | + | |
- | <code bash> | + | |
- | avahi-browse --all --ignore-local --resolve --terminate | + | |
- | </ | + | |
===== curlftpfs ===== | ===== curlftpfs ===== | ||
<code bash> | <code bash> | ||
Line 2067: | Line 1893: | ||
</ | </ | ||
- | ===== 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 " | + | |
</ | </ | ||
+ | |||
+ |