From 0d553c785ce58d5281ed6238aba3639ad6c9a30b Mon Sep 17 00:00:00 2001 From: trimstray Date: Mon, 4 Mar 2019 10:57:32 +0100 Subject: [PATCH] added/updated one-liners - signed-off-by: trimstray --- README.md | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/README.md b/README.md index 25ea046..31227d9 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,7 @@ Only main chapters:

  :small_orange_diamond: incron - is an inode-based filesystem notification technology.
  :small_orange_diamond: GRV - is a terminal based interface for viewing Git repositories.
+  :small_orange_diamond: Tig - text-mode interface for Git.
  :small_orange_diamond: tldr - simplified and community-driven man pages.
  :small_orange_diamond: commander.js - minimal CLI creator in JavaScript.

@@ -683,6 +684,7 @@ performance of any of your sites from across the globe.

  :small_orange_diamond: Front-End-Checklist - the perfect Front-End Checklist for modern websites and meticulous developers.
  :small_orange_diamond: Python's Magic Methods - what are magic methods? They're everything in object-oriented Python.
+  :small_orange_diamond: wtfpython - a collection of surprising Python snippets and lesser-known features.

##### :black_small_square: Security/Pentesting @@ -997,6 +999,7 @@ Linux Security Expert - trainings, howtos, checklists, security tools an * [openssl](#tool-openssl) * [secure-delete](#tool-secure-delete) * [dd](#tool-dd) + * [gpg](#tool-gpg) - **[HTTP/HTTPS](#http-https)** * [curl](#tool-curl) * [httpie](#tool-httpie) @@ -1010,6 +1013,7 @@ Linux Security Expert - trainings, howtos, checklists, security tools an * [nmap](#tool-nmap) * [netcat](#tool-netcat) * [socat](#tool-socat) + * [p0f](#tool-p0f) * [gnutls-cli](#tool-gnutls-cli) * [lsof](#tool-lsof) * [netstat](#tool-netstat) @@ -1019,6 +1023,7 @@ Linux Security Expert - trainings, howtos, checklists, security tools an * [certbot](#tool-certbot) * [network-other](#tool-network-other) - **[Programming](#programming)** + * [git](#tool-git) * [awk](#tool-awk) * [sed](#tool-sed) * [grep](#tool-grep) @@ -1292,6 +1297,12 @@ find . -type f -exec stat --format '%Y :%y %n' "{}" \; | sort -nr | cut -d: -f2- find . -not -path '*/\.git*' -type f -print0 | xargs -0 sed -i 's/foo/bar/g' ``` +###### Recursively find suid executables + +```bash +find / \( -perm -4000 -o -perm -2000 \) -type f -exec ls -la {} \; +``` + ___ ##### Tool: [top](https://en.wikipedia.org/wiki/Top_(software)) @@ -1777,6 +1788,46 @@ watch --interval 5 killall -USR1 dd echo "string" | dd of=filename ``` +___ + +##### Tool: [gpg](https://www.gnupg.org/) + +###### Export public key + +```bash +gpg --export --armor "" > username.pkey +``` + + * `--export` - export all keys from all keyrings or specific key + * `-a|--armor` - create ASCII armored output + +###### Encrypt file + +```bash +gpg -e -r "" dump.sql +``` + + * `-e|--encrypt` - encrypt data + * `-r|--recipient` - encrypt for specific + +###### Decrypt file + +```bash +gpg -o dump.sql -d dump.sql.gpg +``` + + * `-o|--output` - use as output file + * `-d|--decrypt` - decrypt data (default) + +###### Search recipient + +```bash +gpg --keyserver hkp://keyserver.ubuntu.com --search-keys "" +``` + + * `--keyserver` - set specific key server + * `--search-keys` - search for keys on a key server + HTTP/HTTPS ##### Tool: [curl](https://curl.haxx.se) @@ -2498,6 +2549,21 @@ socat TCP-LISTEN:1234,bind=127.0.0.1,reuseaddr,fork,su=nobody,range=127.0.0.0/8 ___ +##### Tool: [p0f](http://lcamtuf.coredump.cx/p0f3/) + +###### Set iface in promiscuous mode and dump traffic to the log file + +```bash +p0f -i enp0s25 -p -d -o /dump/enp0s25.log +``` + + * `-i` - listen on the specified interface + * `-p` - set interface in promiscuous mode + * `-d` - fork into background + * `-o` - output file + +___ + ##### Tool: [lsof](https://en.wikipedia.org/wiki/Lsof) ###### Show process that use internet connection at the moment @@ -2687,6 +2753,20 @@ _dname="google.com" ; curl -s "https://dns.google.com/resolve?name=${_dname}&typ Programming +##### Tool: [git](https://git-scm.com/) + +###### Log alias for a decent view of your repo + +```bash +# 1) +git log --oneline --decorate --graph --all + +# 2) +git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit +``` + +___ + ##### Tool: [python](https://www.python.org/) ###### Static HTTP web server @@ -2730,6 +2810,18 @@ httpd.socket = ssl.wrap_socket (httpd.socket, httpd.serve_forever() ``` +###### Encode base64 + +```bash +python -m base64 -e <<< "sample string" +``` + +###### Decode base64 + +```bash +python -m base64 -d <<< "dGhpcyBpcyBlbmNvZGVkCg==" +``` + ##### Tool: [awk](http://www.grymoire.com/Unix/Awk.html) ###### Remove duplicate entries in a file without sorting