kev

159
reputation
6

Simplicity is the ultimate sophistication. — Leonardo Da Vinci

less is more

  • The basic problem is actually very complicated.
  • It's amazing that computers only use 0s and 1s.

handy tools

# download bigfile
$ aria2c -c -k1M -{x,j,s}16 --checksum=md5=dccff28314d9ae4ed262cfc6f35e5153 http://mirrors.zju.edu.cn/ubuntu-releases/14.04/ubuntu-14.04-desktop-amd64.iso

# backup txt files
$ rsync -avzm --include '*/' --include '*.txt' --exclude '*' source/ remote:target/

# transfer file at 100kB/s
$ rsync -hP --bwlimit 100 remote:file .

# convert json to csv
$ jq -r '[.field1,.field2,.field3]|@csv' input.json > output.csv

# http proxy
$ ncat -v -l --proxy-type http 3128

# convert socks5 to http
$ delegate -P8080 SERVER=http SOCKS=1.2.3.4:1080 ADMIN=admin@datageek.info

# convert socks5 to http with auth
$ delegated -f -P8080 SERVER=http FORWARD=socks://user:pass@1.2.3.4:1080 ADMIN=admin@datageek.info

# zero-padding file names
$ rename 's/^\d+/sprintf("%02d", $&)/e' [0-9]*

# concat video parts
$ printf "file '%s'\n" part*.mp4 | ffmpeg -f concat -i - -c copy all.mp4

# scan raspberry pi
$ sudo nmap -n -sP 192.168.1.0/24 -oX - | xmlstarlet sel -t -m '//host[address[contains(@vendor, "Raspberry Pi")]]/address[@addrtype="ipv4"]/@addr' -v . -n | ssh-keyscan -t rsa -f - | sort -u - ~/.ssh/known_hosts -o ~/.ssh/known_hosts

# upgrade all outdated python packages
$ pip list --outdated | awk '{print $1}' | xargs -tn1 pip install

# generate birthdays wordlist for aircrack-ng
$ dateseq -f '%Y%m%d' 1970-01-01 > birthdays.txt

# install python on raspberry pi
$ ansible pi --limit pi2 -e ansible_user=alarm --ask-pass --su --ask-su-pass -m raw -a 'pacman -Sy --noconfirm python2'

# resize sdcard for raspberry pi
$ echo -e 'p\nd\n2\nn\np\n2\n\n\np\nw' | fdisk /dev/mmcblk0
$ reboot
$ resize2fs /dev/mmcblk0p2

# authorized key initialization
$ sshpass -p xxxxxx ssh-copy-id -o StrictHostKeyChecking=no user@server

# open google chrome in full-screen mode
$ open -a 'Google Chrome' --args --kiosk https://github.com/

# customized hostname
$ curl --resolve 'httpbin:80:23.22.14.18' http://httpbin/headers

# add ssh pubkey to multiple servers
$ ansible rpi -m authorized_key -a 'user=pi key="ssh-rsa ..."'

# brute force attack openwrt
$ hydra -f -l root -P password.list 192.168.1.1 http-form-post '/cgi-bin/luci:luci_username=^USER^&luci_password=^PASS^:S=302 Found'

# dump obs-studio events
$ websocat -t -u autoreconnect:ws://127.0.0.1:4444 reuse:appendfile:obs.jl