This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
os:unix-commands [2022/09/12 11:17] tomas [Komunikace] |
os:unix-commands [2024/07/17 22:16] (current) tomas [sitove nastroje] |
||
---|---|---|---|
Line 274: | Line 274: | ||
${variable: | ${variable: | ||
env ... zobrazi promenne prostredi\\ | env ... zobrazi promenne prostredi\\ | ||
+ | envsubst < | ||
export AAA ... promennou AAA vyexportuje pro potomky\\ | export AAA ... promennou AAA vyexportuje pro potomky\\ | ||
exit 0 ... ukonci skript/ | exit 0 ... ukonci skript/ | ||
Line 389: | Line 390: | ||
- | <b>sitove nastroje</ | + | ====sitove nastroje==== |
[[http:// | [[http:// | ||
- | < | ||
nc -vz -w3 -n 129.39.133.239 9497 ... otestuje, zda je na adrese 129.39.133.239 otevreny port 9495, timeou 3 sec\\ | nc -vz -w3 -n 129.39.133.239 9497 ... otestuje, zda je na adrese 129.39.133.239 otevreny port 9495, timeou 3 sec\\ | ||
- | nc -l 3333 ... posloucha na portu 3333 | + | nc -l 3333 ... posloucha na portu 3333\\ |
- | nc 1.2.3.4 3333 ... posila na port 3333 | + | nc 1.2.3.4 3333 ... posila na port 3333\\ |
- | Transfering files | + | |
- | cat backup.iso | nc -l 3333 | + | |
- | nc 192.168.0.1 3333 > backup.iso | + | |
- | Transfering - pkazuje progress | + | |
- | cat backup.iso | pv -b | nc -l 3333 | + | |
- | nc 192.168.0.1 3333 | pv -b > backup.iso | + | |
- | Zalohovani | + | |
- | dd if=/ | + | |
- | nc 192.168.0.1 3333 | pv -b > myhdb5partition.img.gz | + | |
- | tar -czf - /etc/ | nc -l 3333 | + | |
- | nc 192.168.0.1 3333 | pv -b > mybackup.tar.gz | + | |
- | Bezpecnost | + | |
- | cat backup.iso | nc -l 3333 | + | |
- | ssh -f -L 23333: | + | |
- | nc 127.0.0.1 23333 | pv -b > backup.iso | + | |
- | like telnet | + | ==Transfering files== |
- | nc abc.cz 22 | + | cat backup.iso | nc -l 3333\\ |
+ | nc 192.168.0.1 3333 > backup.iso\\ | ||
- | Port scanned: | + | ==Transfering - pkazuje progress== |
- | nc -z 192.168.0.1 | + | cat backup.iso | pv -b | nc -l 3333\\ |
+ | nc 192.168.0.1 | ||
- | Presmerovani shellu na port: | + | ==Zalohovani== |
- | nc -l -p 12345 -e /bin/bash | + | dd if=/ |
+ | nc 192.168.0.1 3333 | pv -b > myhdb5partition.img.gz\\ | ||
+ | tar -czf - /etc/ | nc -l 3333\\ | ||
+ | nc 192.168.0.1 3333 | pv -b > mybackup.tar.gz\\ | ||
- | nc jako proxy: | + | ==Bezpecnost== |
- | nc -l -p 12345 | nc tomas.lipensky.cz 80 | nc -l 123456 | + | cat backup.iso | nc -l 3333\\ |
+ | ssh -f -L 23333: | ||
+ | nc 127.0.0.1 23333 | pv -b > backup.iso\\ | ||
- | Otevre tunel pres proxy: | + | |
- | nc -X 4 -x 129.39.133.102: | + | nc abc.cz 22 #... jako telnet\\ |
- | </ | + | nc -z 192.168.0.1 80-90 #... Port scanner\\ |
+ | nc -l -p 12345 -e / | ||
+ | nc -l -p 12345 | nc tomas.lipensky.cz 80 | nc -l 123456 | ||
+ | nc -X 4 -x 129.39.133.102: | ||
ssh-keygen -t rsa -b 2048 -f ~/ | ssh-keygen -t rsa -b 2048 -f ~/ | ||
ssh-keygen -lf ~/ | ssh-keygen -lf ~/ | ||
+ | ssh-keygen -R SERVERNAME ... smaže s known_hosts\\ | ||
ssh-agent bash ... spust bash s ssh-agentem, | ssh-agent bash ... spust bash s ssh-agentem, | ||
ssh-add ~/ | ssh-add ~/ | ||
Line 439: | Line 435: | ||
ssh -X server ... povoli X11 forwarding, nastavi DISPALY a xauth. X11Forwarding musi byt povoleno v / | ssh -X server ... povoli X11 forwarding, nastavi DISPALY a xauth. X11Forwarding musi byt povoleno v / | ||
xauth add $(xauth -f ~USER/ | xauth add $(xauth -f ~USER/ | ||
+ | autossh -X -L 5432: | ||