From e1d88f9f9b1d70788c1064edc689e2bdc303adae Mon Sep 17 00:00:00 2001
From: trimstray
Date: Thu, 5 Jul 2018 23:50:51 +0200
Subject: [PATCH] minor fixes, updates - signed-off-by: trimstray
---
README.md | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 86 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index d64c932..e91205c 100644
--- a/README.md
+++ b/README.md
@@ -47,8 +47,16 @@
- they can make dd is not a disk destroyer
- they know that `#!/usr/bin/env bash` superior to `#!/bin/bash`
- they know that `su -` logs in completely as root
+- they miss and cry for **Slackware** on production
- they love the old admin nix-world
+## :ballot_box_with_check: Todo
+
+- [ ] Add useful shell functions
+- [ ] Add one-liners for collection tools (eg. CLI Tools)
+- [ ] Add Ninja Admins T-Shirt stickers
+- [ ] Generate Awesome Ninja Admins book (eg. pdf format)
+
## Ninja Admins Collection
#### CLI Tools
@@ -127,7 +135,6 @@ for transferring data with URLs.
:small_orange_diamond: Censys - platform that helps information security practitioners discover, monitor, and analyze devices.
:small_orange_diamond: Shodan - the world's first search engine for Internet-connected devices.
:small_orange_diamond: GreyNoise - mass scanner (such as Shodan and Censys).
- :small_orange_diamond: Hardenize - deploy the security standards.
##### :black_small_square: Net-tools
@@ -139,6 +146,7 @@ for transferring data with URLs.
:small_orange_diamond: Ping.eu - online Ping, Traceroute, DNS lookup, WHOIS and others.
:small_orange_diamond: Network-Tools - network tools for webmasters, IT technicians & geeks.
:small_orange_diamond: URL Encode/Decode - tool from above to either encode or decode a string of text.
+ :small_orange_diamond: Hardenize - deploy the security standards.
##### :black_small_square: Performance
@@ -200,6 +208,7 @@ performance of any of your sites from across the globe.
##### :black_small_square: Systems
+ :small_orange_diamond: Slackware - the most "Unix-like" Linux distribution.
:small_orange_diamond: OpenBSD - multi-platform 4.4BSD-based UNIX-like operating system.
:small_orange_diamond: HardenedBSD - HardenedBSD aims to implement innovative exploit mitigation and security solutions.
@@ -254,6 +263,7 @@ performance of any of your sites from across the globe.
* [mount](#tool-mount)
* [fuser](#tool-fuser)
* [ps](#tool-ps)
+ * [top](#tool-top)
* [find](#tool-find)
* [diff](#tool-diff)
* [tail](#tool-tail)
@@ -261,6 +271,10 @@ performance of any of your sites from across the globe.
* [pwdx](#tool-pwdx)
* [tr](#tool-tr)
* [chmod](#tool-chmod)
+ * [who](#tool-who)
+ * [screen](#tool-screen)
+ * [du](#tool-du)
+ * [inotifywait](#tool-inotifywait)
- **[HTTP/HTTPS](#http-https)**
* [curl](#tool-curl)
* [httpie](#tool-httpie)
@@ -273,7 +287,7 @@ performance of any of your sites from across the globe.
* [netcat](#tool-netcat)
* [socat](#tool-socat)
* [lsof](#tool-lsof)
- * [netstat](#tool-nestat)
+ * [netstat](#tool-netstat)
* [rsync](#tool-rsync)
- **[Programming](#programming)**
* [awk](#tool-awk)
@@ -308,6 +322,12 @@ true && { echo success;} || { echo failed; }
some_command > >(/bin/cmd_for_stdout) 2> >(/bin/cmd_for_stderr)
```
+###### Pipe stdout and stderr to separate commands
+
+```bash
+(some_command 2>&1 1>&3 | tee errorlog ) 3>&1 1>&2 | tee stdoutlog
+```
+
###### List of commands you use most often
```bash
@@ -419,6 +439,18 @@ find -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 33
___
+##### Tool: [top](https://en.wikipedia.org/wiki/Top_(software))
+
+###### Use top to monitor only all processes with the specific string
+
+```bash
+top -p $(pgrep -d , )
+```
+
+ * `` - process containing str (eg. nginx, worker)
+
+___
+
##### Tool: [diff](https://en.wikipedia.org/wiki/Diff)
###### Compare two directory trees
@@ -481,8 +513,6 @@ ___
tr : '\n' <<<$PATH
```
-___
-
##### Tool: [chmod](https://en.wikipedia.org/wiki/Chmod)
###### Remove executable bit from all files in the current directory
@@ -491,6 +521,44 @@ ___
chmod -R -x+X *
```
+___
+
+##### Tool: [who](https://en.wikipedia.org/wiki/Who_(Unix))
+
+###### Find last reboot time
+
+```bash
+who -b
+```
+
+___
+
+##### Tool: [screen](https://en.wikipedia.org/wiki/GNU_Screen)
+
+###### Start screen in detached mode
+
+```bash
+screen -d -m []
+```
+
+___
+
+##### Tool: [du](https://en.wikipedia.org/wiki/GNU_Screen)
+
+###### Show 20 biggest directories with 'K M G'
+
+```bash
+du | sort -r -n | awk '{split("K M G",v); s=1; while($1>1024){$1/=1024; s++} print int($1)" "v[s]"\t"$2}' | head -n 20
+```
+
+##### Tool: [inotifywait](https://en.wikipedia.org/wiki/GNU_Screen)
+
+###### Init tool everytime a file in a directory is modified
+
+```bash
+while true ; do inotifywait -r -e MODIFY dir/ && ls dir/ ; done;
+```
+
HTTP/HTTPS
##### Tool: [curl](https://curl.haxx.se)
@@ -578,12 +646,19 @@ ___
###### Testing remote connection to port
```bash
-timeout 1 bash -c "/" >/dev/null 2>&1 ; echo $?
+timeout 1 bash -c "//" >/dev/null 2>&1 ; echo $?
```
+ * `` - set remote host
* `` - set destination port
+###### Read and write to TCP or UDP sockets with common bash tools
+
+```bash
+exec 5<>/dev/tcp//; cat <&5 & cat >&5; exec 5>&-
+```
+
___
##### Tool: [tcpdump](http://www.tcpdump.org/)
@@ -988,3 +1063,9 @@ fgrep "pattern" * -R
```bash
grep . filename > newfilename
```
+
+###### Except multiple patterns
+
+```bash
+grep -vE '(error|critical|warning)' filename
+```