Linux
Linux related stuff. Mostly relative to configuration
Tools
Nice presentation on linux (not tested) yet!
https://github.com/Philip-Scott/Spice-up
Rtorrent ref (deprecated commands and new commands):
https://github.com/rakshasa/rtorrent/wiki/rTorrent-0.9-Comprehensive-Command-list-(WIP)
Curl tips
curl -F 'data=@path2file' UPLOAD_ADDRESS
SSH
Create a tunnel to forward local port 9000 to remote port 8080:
ssh -L 9000:10.10.10.10:8080 user@example.com
Add ControlMaster to ~/.ssh/config:
host Example
Hostname X.Y.Z.Q
Port 2222
Protocol 2
User USERNAME
AddressFamily inet
CheckHostIP yes
Compression yes
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p
Screenshot command line
$ yay -S cutycapt
$ CutyCapt --url=http://example.com --out=/tmp/a.png
Could fail on “rich” website. To be tested
vim
Switch from vertical split to horizontal split
Ctrl w t Ctrl w K
Switch from horizontal split to verticalsplit
Ctrl w t Ctrl w H
Capabilities
- https://www.insecure.ws/linux/getcap_setcap.html
- https://connect.ed-diamond.com/GNU-Linux-Magazine/GLMF-164/Les-capabilities-sous-Linux
See application below
Run wireshark as standard user
$ sudo -s
# sudo apt-get install libcap2-bin
# groupadd -g wireshark
# usermod -a -G wireshark gerald
# chmod 750 /usr/bin/dumpcap
# setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap
User should logout and login
Run nmap as standard user
command line help
Got help in commande line. It will works using different language (ruby, perl, python)
$ curl cht.sh/go/execute-external+program
/*
* Calling an external command in GO
*
* You need to use the exec package (http:golang.org/pkg/os/exec/) :
* start a command using Command (http:golang.org/pkg/os/exec/#Command)
* and use Run to wait for completion.
*/
cmd := exec.Command("yourcommand", "some", "args")
if err := cmd.Run(); err != nil {
fmt.Println("Error: ", err)
}
/*
* If you just want to read the result, you may use Ouput
* (http:golang.org/pkg/os/exec/#Cmd.Output) instead of Run.
*
* [Denys Séguret] [so/q/18420685] [cc by-sa 3.0]
*/
openvpn
Request specific DNS IP for vpn (work)
- Create a script and make it executable, make sure this file will not be writeable by every one:
#!/bin/sh
set -e
# arguments received: tun0 1500 1552 10.0.1.3 255.255.255.0 init
ip route add 192.168.100.0/24 via 10.0.1.1 dev $1
resolvectl dns $1 192.168.100.X
resolvectl domain $1 "~domain.local"
resolvectl dnssec $1 off
#ip route add 192.168.100.0/24 via 10.0.1.1 dev $1
- Add in ovpn configuration file:
script-security 2
up <PATH TO THE SCRIPT>
- run openvpn –config <file.ovpn>
systemd-resolve --status tun0to check if DNS server is well configured:
Link 45 (tun0)
Current Scopes: DNS
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.168.100.X
DNS Servers: 192.168.100.X
DNS Domain: ~domain.local
Weechat
Burn CD/DVD
- pacman -S brasero cdrtools
- Create ISO image
$ mkdir 2burn
$ mv <dir1> <dir2> <dir3> 2burn
$ mkisofs -V "<YEAR>-<SUBJECT>-<1>" -r -o <FILENAME.ISO> 2burn
[...]
$ brasero # GUI interface
- Select the ISO file in Brasero GUI, burn, enjoy
Coredns
CoreDns is a fucking awsome DNS server. Really simple and easy configuration