diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cdb93cd --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.python-version diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..17a3234 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +--- +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - repo: local + hooks: + - id: cheat-header + name: Cheat header + description: Require files to have the cheat YAML front-matter header + entry: '^---\n(syntax:.*\n)?(tags:.*\n)?---$' + args: ['--multiline', '--negate'] + language: pygrep + exclude: '^\..*' diff --git a/bash b/bash index 5097eac..2284f9e 100644 --- a/bash +++ b/bash @@ -1,6 +1,6 @@ # To implement a for loop: for file in *; -do +do echo $file found; done diff --git a/chmod b/chmod index 3af8ad6..48fe5de 100644 --- a/chmod +++ b/chmod @@ -2,7 +2,7 @@ chmod a+x myscript.sh # Set user to read/write/execute, group/global to read only (myscript.sh), symbolic mode -chmod u=rwx, go=r myscript.sh +chmod u=rwx, go=r myscript.sh # Remove write from user/group/global (myscript.sh), symbolic mode chmod a-w myscript.sh diff --git a/conda b/conda index a525a12..135dd08 100644 --- a/conda +++ b/conda @@ -7,7 +7,7 @@ conda env list # To initialise an environment conda create --name -# To initialise an environment with python3.10 +# To initialise an environment with python3.10 conda create --name python=3.10 # To install from a file diff --git a/cpanm b/cpanm index d73ea10..111c3cd 100644 --- a/cpanm +++ b/cpanm @@ -32,4 +32,3 @@ cpanm --mirror # use only the HTTPS mirror cpanm --from https://some.mirror.host/ - diff --git a/cpdf b/cpdf index 61c7243..f345928 100644 --- a/cpdf +++ b/cpdf @@ -129,4 +129,3 @@ cpdf -blacktext in.pdf -o out.pdf # Make sure all lines in in.pdf are at least 2 pts wide, writing to # out.pdf. cpdf -thinlines 2pt in.pdf -o out.pdf - diff --git a/curl b/curl index 772de7f..2c6e32f 100644 --- a/curl +++ b/curl @@ -35,7 +35,7 @@ curl http://ifconfig.me/all.json curl --limit-rate 1000B -O # To get your global IP: -curl httpbin.org/ip +curl httpbin.org/ip # To get only the HTTP status code: curl -o /dev/null -w '%{http_code}\n' -s -I URL diff --git a/du b/du index d391127..51bbdba 100644 --- a/du +++ b/du @@ -12,7 +12,7 @@ du -shL du -h --apparent-size # To sort directories/files by size (human-readable): -du -sh * | sort -rh +du -sh * | sort -rh # To list the 20 largest files and folders under the current working directory: du -ma | sort -nr | head -n 20 diff --git a/dwm b/dwm index ec89bb5..eaf6560 100644 --- a/dwm +++ b/dwm @@ -2,78 +2,78 @@ Basic ===== # launch terminal. [Shift]+[Mod]+[Enter] - + # show/hide bar. -[Mod]+[b] +[Mod]+[b] # dmenu for running programs like the x#www#browser. -[Mod]+[p] +[Mod]+[p] # push acive window from stack to master, or pulls last used window from stack onto master. -[Mod]+[Enter] +[Mod]+[Enter] # focus on next/previous window in current tag. -[Mod] + [j / k] +[Mod] + [j / k] # increases / decreases master size. -[Mod] + [h / l] +[Mod] + [h / l] Navigation ========== # moves your focus to tag 2. -[Mod]+[2] +[Mod]+[2] # move active window to the 2 tag. -[Shift]+[Mod]+[2] +[Shift]+[Mod]+[2] # increases / decreases number of windows on master -[Mod] + [i / d] +[Mod] + [i / d] # move focus between screens (multi monitor setup) -[Mod] + [, / .] +[Mod] + [, / .] # move active window to different screen. -[Shift]+[Mod]+[, / .] +[Shift]+[Mod]+[, / .] # view all windows on screen. -[Mod]+[0] +[Mod]+[0] # make focused window appear on all tags. -[Shift]+[Mod]+[0] +[Shift]+[Mod]+[0] # kill active window. -[Shift]+[Mod]+[c] +[Shift]+[Mod]+[c] # quit dwm cleanly. -[Shift]+[Mod]+[q] +[Shift]+[Mod]+[q] Layout ====== # tiled mode. []= -[Mod]+[t] +[Mod]+[t] # floating mode. ><> -[Mod]+[f] +[Mod]+[f] # monocle mode. [M] (single window fullscreen) -[Mod]+[m] +[Mod]+[m] Floating ======== # to resize the floating window. -[Mod]+[R M B] +[Mod]+[R M B] # to move the floating window around. -[Mod]+[L M B] +[Mod]+[L M B] # toggles to the previous layout mode. -[Mod]+[Space] +[Mod]+[Space] # to make an individual window float. -[Mod]+[Shift]+[Space] +[Mod]+[Shift]+[Space] # to make an individual window un#float. -[Mod]+[M M B] +[Mod]+[M M B] diff --git a/ed b/ed index a4635b8..ef8c3c9 100644 --- a/ed +++ b/ed @@ -8,11 +8,11 @@ tags: [ ed ] :q quit :Q quit without saving changes :f {name} change buffer name -:w write to file using current buffer name +:w write to file using current buffer name :w {file} write buffer to new file :wq write buffer to existing file and exit -# Line-oriented addressing and movement +# Line-oriented addressing and movement # `ed' uses line addresses to move around and operate within a buffer # Move to or operate on single lines by entering the line number # Move to or operate on ranges of lines using comma-separated values @@ -53,12 +53,12 @@ r !{command} read output of {command} into buffer after current line e test.txt edit file "test.txt" 45 `ed' returns character count as confirmation 1,3n display lines 1 through 3 with line numbers -1 This is line 1 +1 This is line 1 2 This is line 2 3 This is line 3 2c change line 2 I am typing a new line 2 -. end active edit +. end active edit 1,3n display lines 1 thorugh 3 with line numbers 1 This is line 1 2 I am typing a new line 2 @@ -71,7 +71,7 @@ wq write file "test.txt" and exit g/foo/ search all lines for `foo' and display matching lines g/foo/n search all lines for `foo'; display with line numbers -4,9/foo/ search lines 1 through 5 for `foo' and display matches +4,9/foo/ search lines 1 through 5 for `foo' and display matches 4,9/foo/n search lines 1 through 5 for `foo'; display with line numbers # Replace diff --git a/emacs b/emacs index 88f3f6e..32a02ba 100644 --- a/emacs +++ b/emacs @@ -36,7 +36,7 @@ Run command in the scratch buffer C-x C-e # Navigation ( backward / forward ) - + Character-wise C-b , C-f Word-wise M-b , M-f Line-wise C-p , C-n diff --git a/ethtool b/ethtool index 355e5c2..a3439f2 100644 --- a/ethtool +++ b/ethtool @@ -1,6 +1,6 @@ --- syntax: bash -tags: [networking] +tags: [networking] --- # To show statistics for the selected interface: ethtool -S diff --git a/ffmpeg b/ffmpeg index 60d10ac..f7d8cf0 100644 --- a/ffmpeg +++ b/ffmpeg @@ -39,5 +39,5 @@ cat mylist.txt file '/path/to/file1' file '/path/to/file2' file '/path/to/file3' - + ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4 diff --git a/fzf b/fzf index d872599..7f5b5b2 100644 --- a/fzf +++ b/fzf @@ -19,7 +19,7 @@ fzf --preview "file {}" # Find files from find command and preview it with fzf find . -type f -name "*.txt" | fzf --preview "head {}" -# Display border around fzf output +# Display border around fzf output fzf --border sharp # Output only selected files and pipe it to a file diff --git a/go b/go index fe9c14e..3c8885b 100644 --- a/go +++ b/go @@ -90,7 +90,7 @@ go test -v -run=^TestFooBar$/^Baz$ . go test -short ./... # Handy flag - don't run further tests after a failure. -go test -failfast ./... +go test -failfast ./... # Test all module dependencies. @@ -104,7 +104,7 @@ go test -run=^TestFooBar$ -count=500 . go fix ./... # Create a new Github issue for Go's standard library -go bug +go bug # Running and Comparing Benchmarks diff --git a/gpg b/gpg index 11de232..d482149 100644 --- a/gpg +++ b/gpg @@ -159,11 +159,11 @@ gpg -K Should show sec# instead of just sec. - + # High-quality options for gpg for symmetric (secret key) encryption - This is what knowledgable people consider a good set of options for + This is what knowledgable people consider a good set of options for symmetric encryption with gpg to give you a high-quality result. - + gpg \ --symmetric \ --cipher-algo aes256 \ @@ -179,7 +179,7 @@ --no-symkey-cache \ --output somefile.gpg \ somefile # to encrypt - + gpg \ --decrypt \ --pinentry-mode loopback \ diff --git a/gyb b/gyb index 2fe9f8a..c5333f3 100644 --- a/gyb +++ b/gyb @@ -1,7 +1,7 @@ # To estimate the number and the size of all mails on youremail@gmail.com gyb --email youremail@gmail.com --action estimate -# To backup from youremail@gmail.com to your local-folder +# To backup from youremail@gmail.com to your local-folder gyb --email youremail@gmail.com --action backup --local-folder "~/MyLocalFolder/" # To backup from youremail@gmail.com only important or starred emails to the @@ -9,4 +9,4 @@ gyb --email youremail@gmail.com --action backup --local-folder "~/MyLocalFolder/ gyb --email youremail@gmail.com --search "is:important OR is:starred" # To restore from your local-folder to youremail@gmail.com -gyb --email youremail@gmail.com --action restore --local-folder "~/MyLocalFolder/" +gyb --email youremail@gmail.com --action restore --local-folder "~/MyLocalFolder/" diff --git a/ifconfig b/ifconfig index ed6c15f..aa9e32b 100644 --- a/ifconfig +++ b/ifconfig @@ -5,7 +5,7 @@ ifconfig ifconfig -a # To take down / up the wireless adapter: -ifconfig wlan0 {up|down} +ifconfig wlan0 {up|down} # To set a static IP and netmask: ifconfig eth0 192.168.1.100 netmask 255.255.255.0 diff --git a/java b/java index 403bd75..d87dfc7 100644 --- a/java +++ b/java @@ -25,7 +25,7 @@ OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, java -Xms256m -Xmx2g -Xss1m -jar # To use the classpath variable -# It overrides the CLASSPATH of Environment variable but only for that session. +# It overrides the CLASSPATH of Environment variable but only for that session. # If you restart the application you need to again set the classpath variable. # You can use either: -classpath, --classpath or -cp java -classpath -jar diff --git a/kitty b/kitty index d56906f..d99bfc0 100644 --- a/kitty +++ b/kitty @@ -25,12 +25,12 @@ ctrl+shift+, - Move tab backward ctrl+shift+alt+t - Set tab title # Fonts and clipboard -ctrl+shift+c - Copy to clipboard -ctrl+shift+v - Paste from clipboard -ctrl+shift+s - Paste from selection -ctrl+shift+equal - Increase font size -ctrl+shift+minus - Decrease font size -ctrl+shift+backspace - Restore font size +ctrl+shift+c - Copy to clipboard +ctrl+shift+v - Paste from clipboard +ctrl+shift+s - Paste from selection +ctrl+shift+equal - Increase font size +ctrl+shift+minus - Decrease font size +ctrl+shift+backspace - Restore font size # Windows ctrl+shift+enter - New window @@ -44,7 +44,7 @@ ctrl+shift+` - Move window to top ctrl+shift+f7 - Visually focus window ctrl+shift+f8 - Visually swap window # Focus specific window -ctrl+shift+1, ctrl+shift+2 … ctrl+shift+0 +ctrl+shift+1, ctrl+shift+2 … ctrl+shift+0 # Open/select ctrl+shift+e - Open URL diff --git a/ls b/ls index a19fe44..531688b 100644 --- a/ls +++ b/ls @@ -17,7 +17,7 @@ ls -d */ ls -d .*/ */ # To display all files sorted by changed date, most recent first: -ls -ltc +ls -ltc # To display files sorted by create time: ls -lt diff --git a/markdown b/markdown index 53b0d1c..44b1747 100644 --- a/markdown +++ b/markdown @@ -37,7 +37,7 @@ Sub-bullets can be done with 2+ spaces or 1 tab a. Lettered <-- there is mixed support for this format 4. Fourth i. using roman numerals <-- there is mixed support for this format - ii. more stuff + ii. more stuff ## check list There is limited support for rendering check lists: @@ -86,7 +86,7 @@ Assuming you have a heading called `# My First Heading` then link is the case-in Italic: *em* _em_ -Bold: +Bold: **strong** __strong__ ~~strikethrough~~ @@ -98,8 +98,8 @@ The alignment applies to the table data, not the header. Left-aligned Stuff | Right-aligned Stuff | Center-aligned Stuff | :--- | ---: | :---: -Some left stuff | Some right stuff | Some center stuff -Some left stuff | Some right stuff | Some center stuff +Some left stuff | Some right stuff | Some center stuff +Some left stuff | Some right stuff | Some center stuff ## Special Characters in Tables First Header | Second Header diff --git a/multipass b/multipass index 52f4873..9cd4b22 100644 --- a/multipass +++ b/multipass @@ -1,5 +1,5 @@ # List all options -multipass +multipass # List existing VMs on your device multiplass list diff --git a/mutt b/mutt index 0c45945..2a17bfa 100644 --- a/mutt +++ b/mutt @@ -1,20 +1,20 @@ # Create new mailbox in IMAP + When located in mailbox list (c) - shift + C + shift + C # Move multiple messages to folder (bulk operations) - + 1. Select/tag them with alt+'t' 2. ;s in mail inbox overview for bulk operation # Deleting / Undeleting all messages in mutt - + 1. In mutt’s index, hit ‘D’ (UPPERCASE D) 2. It will prompt you with “Delete messages matching: “ - + + enter this string: ~A 3. It should mark all for deletion! - 4. Conversely, you can do the same thing with UPPERCASE U to undelete multiple messages. + 4. Conversely, you can do the same thing with UPPERCASE U to undelete multiple messages. diff --git a/openssl b/openssl index 2a1470f..983d2b0 100644 --- a/openssl +++ b/openssl @@ -13,7 +13,7 @@ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt openssl req -text -noout -in server.csr # To show certificate information for generated certificate -openssl x509 -text -noout -in server.crt +openssl x509 -text -noout -in server.crt # To get the sha256 fingerprint of a certificate openssl x509 -in server.crt -noout -sha256 -fingerprint @@ -30,12 +30,12 @@ openssl dhparam -outform PEM -out dhparams.pem 2048 openssl s_client -connect 10.240.2.130:433 # High-quality options for openssl for symmetric (secret key) encryption - -This is what knowledgable people consider a good set of options for + +This is what knowledgable people consider a good set of options for symmetric encryption with openssl to give you a high-quality result. Also, always remember that the result is only as good as the password you use. You must use a strong password otherwise encryption is meaningless. - + openssl enc -e -aes-256-cbc \ -salt \ -pbkdf2 \ diff --git a/p4 b/p4 index d956f8c..e6b55c7 100644 --- a/p4 +++ b/p4 @@ -1,7 +1,7 @@ tags: [ vcs ] # To print details related to client and server configuration: -p4 info +p4 info # To open a file and add it to depot: p4 add diff --git a/port b/port index 79fdac6..75ecab8 100644 --- a/port +++ b/port @@ -71,14 +71,14 @@ port rdependents # (Only works for currently installed ports.) port contents -# View a ports' notes, if any (these are usually displayed right after a port +# View a ports' notes, if any (these are usually displayed right after a port # is installed): port notes # Print the path to a port within the ports tree: port dir -# Print the path to the archive used to activate a given port: +# Print the path to the archive used to activate a given port: # (Only works for currently installed ports) port location diff --git a/r2 b/r2 index 402a916..8657153 100644 --- a/r2 +++ b/r2 @@ -21,7 +21,7 @@ # Configuration properties e: Returs configuration properties - + e : Checks a specific property: e asm.tabs => false @@ -31,8 +31,8 @@ e? help about a configuration property e? cmd.stack - - + + # Show comments at right of disassembly if they fit in screen e asm.cmtright=true @@ -53,56 +53,56 @@ # Basic Commands ; Command chaining: x 3;s+3;pi 3;s+3;pxo 4; - + | Pipe with shell commands: pd | less - + ! Run shell commands: !cat /etc/passwd - + !! Escapes to shell, run command and pass output to radare buffer - + Note: The double exclamation mark tells radare to skip the plugin list to find an IO plugin handling this command to launch it directly to the shell. A single one will walk through the io plugin list. ` Radare commands: wx `!ragg2 -i exec` - + ~ grep - + ~! grep -v - + ~[n] grep by columns afl~[0] ~:n grep by rows afl~:0 - + ~.. less/more mode +------------------------------------------------------------------- - + pi~mov,eax ; lines with mov or eax pi~mov&eax ; lines with mov and eax pi~mov,eax:6 ; 6 first lines with mov or eax pd 20~call[0]:0 ; grep first column of the first row matching 'call' - + +------------------------------------------------------------------- .cmd Interprets command output - + +------------------------------------------------------------------- - + is* prints symbolos .is* interprets output and define the symbols in radare (normally they are already loaded if r2 was not invoked with -n) - + +------------------------------------------------------------------- - + .. repeats last commands (same as enter \n) - + ( Used to define and run macros - + $ Used to define alias - + $$: Resolves to current address - + Offsets (@) are absolute, we can use $$ for relative ones @ $$+4 - + ? Evaluate expression +------------------------------------------------------------------- @@ -113,33 +113,33 @@ +------------------------------------------------------------------- ?$? Help for variables used in expressions - + $$: Here - + $s: File size - + $b: Block size - + $l: Opcode length - + $j: When $$ is at a jmp, $j is the address where we are going to jump to - + $f: Same for jmp fail address - + $m: Opcode memory reference (e.g. mov eax,[0x10] => 0x10) - + ??? Help for ? command - + ?i Takes input from stdin. Eg ?i username - + ?? Result from previous operations - + ?s from to [step]: Generates sequence from to every - + ?p: Get physical address for given virtual address - + ?P: Get virtual address for given physical one - + ?v Show hex value of math expr +------------------------------------------------------------------- @@ -150,7 +150,7 @@ +------------------------------------------------------------------- ?l str: Returns the length of string - + @@: Used for iteractions +------------------------------------------------------------------- @@ -164,9 +164,9 @@ # Positioning s address: Move cursor to address or symbol - + s-5 (5 bytes backwards) - + s- undo seek s+ redo seek @@ -176,17 +176,17 @@ b size: Change block size # Analyze - + aa: Analyze all (fcns + bbs) same that running r2 with -A ahl : fake opcode length for a range of bytes - + ad: Analyze data ad@rsp (analize the stack) + Normal mode - + af: Analyze functions afl: List all functions @@ -195,11 +195,11 @@ afi: Returns information about the functions we are currently at afr: Rename function: structure and flag - + afr off: Restore function name set by r2 afn: Rename function - + afn strlen 0x080483f0 af-: Removes metadata generated by the function analysis @@ -210,7 +210,7 @@ axt: Returns cross references to (xref to) axf: Returns cross references from (xref from) - + + Visual mode d, f: Function analysis @@ -218,7 +218,7 @@ d, u: Remove metadata generated by function analysis + Opcode analysis - + ao x: Analize x opcodes from current offset a8 bytes: Analize the instruction represented by specified bytes @@ -230,13 +230,13 @@ iz: Strings in data section izz: Strings in the whole binary - + iS: Sections iS~w returns writable sections is: Symbols is~FUNC exports - + il: Linked libraries ii: Imports @@ -246,7 +246,7 @@ + Mitigations i~pic : check if the binary has position-independent-code - + i~nx : check if the binary has non-executable stack i~canary : check if the binary has canaries @@ -279,7 +279,7 @@ 0xc7,0x44,0x24,0x04,0x01,0x00,0x00,0x00,0xzz,0xzz) p8 n @ offset: Print n bytes (8bits) (no hexdump) - + pv: Print file contents as IDA bar and shows metadata for each byte (flags , ...) pt: Interpret data as dates @@ -307,10 +307,10 @@ wow 11223344 @102!10 write looped value from 102 to 102+10 0x00000066 1122 3344 1122 3344 1122 0000 0000 0000 - + wox 0x90 XOR the current block with 0x90. Equivalent to wox 0x90 $$!$b (write from current position, a whole block) - + wox 67 @4!10 XOR from offset 4 to 10 with value 67 @@ -341,7 +341,7 @@ fs flagspace: Change to the specified flag space fe loop and create numbered flags: - + 1. fs demo_flagspace 2. fe demo_flagspace @@=`pdf~jne[1]` @@ -384,7 +384,7 @@ disasm, the disassembly listing Use numbers in [] to follow jump Use "u" to go back - + debug, the debugger words, the word-hexidecimal view buf, the C-formatted buffer @@ -422,17 +422,17 @@ ': Go to previously defined bookmark # ROP - + /R opcodes: Search opcodes - + /R pop,pop,ret - + /Rl opcodes: Search opcodes and print them in linear way - + /Rl jmp eax,call ebx /a: Search assembly - + /a jmp eax pda: Returns a library of gadgets that can be use. These gadgets are obtained by disassmbling byte per byte instead of obeying to opcode leng @@ -498,7 +498,7 @@ search.in # Yara - + :yara scan # Zignatures @@ -512,7 +512,7 @@ z: To show signatures loaded: +------------------------------------------------------------------- - + r2-(pid2)> pd 35 @ 0x08049adb-10 | 0x08049adb call fcn.0805b030 | fcn.0805b030(unk, unk, unk, unk) ; sign.sign.b.sym.fmt.Println @@ -524,9 +524,9 @@ # Compare Files r2 -m 0xf0000 /etc/fstab ; Open source file - + o /etc/issue ; Open file2 at offset 0 - + o ; List both files cc offset: Diff by columns between current offset address and "offset" @@ -534,7 +534,7 @@ # Graphs + Basic block graphs - + af: Load function metadata ag $$ > a.dot: Dump basic block graph to file @@ -559,17 +559,17 @@ # Debugger + Start r2 in debugger mode. r2 will fork and attach - + r2 -d [pid|cmd|ptrace] (if command contains spaces use quotes: r2 -d "ls /") - + ptrace://pid (debug backend does not notice, only access to mapped memory) + Pass arguments - + r2 -d rarun2 program=pwn1 arg1=$(python exploit.py) + Pass stdin - + r2 -d rarun2 program=/bin/ls stdin=$(python exploit.py) + Commands @@ -619,7 +619,7 @@ dcf until a fork happen then use dp to select what process you want to debug. + PEDA like details - + drr;pd 10@-10;pxr 40@esp + Debug in visual mode @@ -630,23 +630,23 @@ continue with F9 # WebGUI - + =h: Start the server =H: Start server and browser # rax2 - Base Conversion -e: Change endian - + -k: random ASCII art to represent a number/hash. Similar to how SSH represents keys - + -s: ASCII to hex rax2 -S hola (from string to hex) rax2 -s 686f6c61 (from hex to string) -S: binary to hex (for files) - - -N: pack an integer + + -N: pack an integer rax2 -N 0x1234 # \x34\x12\x00\x00 # rahash2 - Entropy, hashes and checksums @@ -658,7 +658,7 @@ -B: Print all blocks -a entropy: Show file entropy or entropy per block (-B -b 512 -a entropy) - + + Rot13 with rahash2 rahash2 -E rot -S s:13 -s ‘Hello\n’ @@ -681,7 +681,7 @@ +------------------------------------------------------------------- # rasm2 - Assembly/Disasembly - + -L: Supported architectures -a arch instruction: Sets architecture @@ -773,10 +773,10 @@ # ESIL emulation 1) aei: Initialize ESIL VM - + 2) aeim: Assign ESIL stack aeim 0xffffd000 0x1000 stack - + 3) aeip: Program counter to current seek 4) e io.cache=true: Enable caching read/write of virtual memory (Important if self modifying code) @@ -788,7 +788,7 @@ # ESIL Linear emulation Find all references to curr. address using linear esil emulation on all imports. - + /re$$@@ sym.imp.* # ESIL IL Representation @@ -808,7 +808,7 @@ or | cmp == write =[] - + + prefix is % + carry from bit x -> %cx + borrow from bit x -> %bx @@ -831,11 +831,11 @@ + ESIL Doc https://github.com/radare/radare2book/blob/master/esil.md - + # r2pipe commands + Invoke r2pipe script via r2 cmdline - + [0x00000000]> #!pipe node script.js [0x00000000]> #!pipe python script.py @@ -843,23 +843,23 @@ https://radare.org/get/r2pipe-nn2015.pdf https://github.com/jpenalbae/r2-scripts # Parsing ELF - - !!! open with r2 -nn + + !!! open with r2 -nn + Parse 9 program headers (elf_phdr) from curr. seek plus offset 0x40 with temporary block size 0x200 in less mode (~..) [0x00000000]> pf 9? (elf_phdr)phdr @ $$+0x40!0x200~.. - + # pf Templates - + + Generate templates for structs/enums with td command "td enum elf_class {ELFCLASSNONE=0, ELFCLASS32=1, ELFCLASS64=2};" https://github.com/Maijin/r2-pf-templates/ - + Cast data @ to and print it - + + Cast data @ to and print it + tp =
# r2scapy @@ -867,13 +867,13 @@ r2 -i r2scapy.py dump.bin [0x00000000]> scapy DNS 0x81de3c 48 DNS(aa=1L, qr=1L, an=DNSRR(rclass=32769, ttl=120, rrname='flashair.local.', rdata='192.168.0.1', type=1), ad=0L, nscount=0, qdcount=1, ns=None, tc=0L, rd=1L, arcount=0, ar=None, opcode=0L, ra=0L, cd=0L, z=0L, rcode=0L, id=0, ancount=1, qd=DNSQR(qclass=32769, qtype=255, qname='flashair.local.')) - + + generate packets with scapy >>> from scapy.all import * >>> sr1(IP(dst="8.8.8.8")/UDP(dport=53)/DNS(rd=1,qd=DNSQR(qname="www.thepacketgeek.com")),verbose=0) # r2m2 -Miasm Intermediate Representation Plugin - + + Assemble and disassemble MIPS32 using rasm2 r2m2$ export R2M2_ARCH=mips32l; rasm2 -a r2m2 'addiu a0, a1, 2' |rasm2 -a r2m2 -d - @@ -898,11 +898,11 @@ # bin carving with r2 + Open raw dump - + r2 -n dump.bin - + + Searching for magic - + [0x00000000]> / \x7fELF Searching 4 bytes from 0x00000000 to 0x0000002d: 7f 45 4c 46 0x00001340 hit0_0 @@ -915,7 +915,7 @@ [0x00000000]> wt @@ hit0* + Automate it - + $ for a in dump.* ; do sz=`rabin2 -Z $a` # get RBin.filesize r2 -wnqc"r $sz" $a # resize file @@ -929,8 +929,7 @@ Usage: https://asciinema.org/a/155856 # r2wiki -Macro for using wiki in commandline - + + https://github.com/securisec/r2wiki $wiki "query string" - diff --git a/rmdir b/rmdir index a5dae1e..8c63299 100644 --- a/rmdir +++ b/rmdir @@ -1,5 +1,5 @@ # Command syntax: -rmdir [option] directory_name +rmdir [option] directory_name # Outputs a message that the directory is being removed: rmdir -v directory_name diff --git a/sar b/sar index 3d79893..226caad 100644 --- a/sar +++ b/sar @@ -8,7 +8,7 @@ sar -u 2 5 # Report the CPU usage for a given core: sar -P 1 1 3 -# Reports the amount of memory used, amount of memory free, available cache, available buffers every 1 second, 3 times: +# Reports the amount of memory used, amount of memory free, available cache, available buffers every 1 second, 3 times: sar -r 1 3 # Reports statistics on swapping: diff --git a/sha256sum b/sha256sum index 11e40d4..8eeccb4 100644 --- a/sha256sum +++ b/sha256sum @@ -15,16 +15,15 @@ echo -n "Hello World" | sha256sum # To verify if a hash (checksum) is correct if a hash-file is provided: # sha256sum will go thru the files listed in . # For each file it will look if it exists. If not, it will print an error. -# If it does exist it will compute the checksum and compare it with the hash +# If it does exist it will compute the checksum and compare it with the hash # provided in the . If they match (good!) it -# will print "filename: OK". -# If they don't match (warning, you might have been hacked), it will +# will print "filename: OK". +# If they don't match (warning, you might have been hacked), it will # print "filename: FAILED". sha256sum --check # Same as above (but ignore missing files): -# This tells you if your file is an exact copy (OK) or has been +# This tells you if your file is an exact copy (OK) or has been # tampered with (FAILED) without bothering you with warnings about # missing files sha256sum --check --ignore-missing - diff --git a/socat b/socat index 2d28600..62fbbd1 100644 --- a/socat +++ b/socat @@ -12,9 +12,9 @@ socat -x tcp-listen:3180,fork - # practical examples: -# complete real working http-example: +# complete real working http-example: # (sleep is necessary to prevent socat closing socket before data received) -(echo -e "GET / HTTP/1.1\r\nHost: butzel.info\r\n\r" && sleep 1) \ +(echo -e "GET / HTTP/1.1\r\nHost: butzel.info\r\n\r" && sleep 1) \ | socat tcp4:butzel.info:80 - # http to httpS 'Proxy' (for an webserver without TLS-Support) diff --git a/sort b/sort index e6ec2cd..9db32c3 100644 --- a/sort +++ b/sort @@ -14,4 +14,4 @@ sort -R sort -o # Sort by default uses /var/tmp to store temp files but size of /var/tmp directory is limited. In order to sort huge use a directory with adequate size: -sort -T \ No newline at end of file +sort -T diff --git a/systemctl b/systemctl index ae0b8b7..9313c45 100644 --- a/systemctl +++ b/systemctl @@ -55,7 +55,7 @@ journalctl -b -u foo.service # To list the dependencies of a service: # when no service name is specified, lists the dependencies of default.target # add -all to expand dependencies recursively -systemctl list-dependencies foo.service +systemctl list-dependencies foo.service # To see low level details of a service settings on the system: systemctl show foo.service diff --git a/terraform b/terraform index 15863a0..6d6b69f 100644 --- a/terraform +++ b/terraform @@ -21,10 +21,10 @@ terraform apply terraform destroy -# To upgrade your [Terraform providers](https://www.terraform.io/docs/providers/index.html), which are distributed separately from the Terraform binary. +# To upgrade your [Terraform providers](https://www.terraform.io/docs/providers/index.html), which are distributed separately from the Terraform binary. terraform init -upgrade -# To upgrade your [Terraform modules](https://www.terraform.io/docs/modules/index.html), which are distributed separately from the Terraform binary. +# To upgrade your [Terraform modules](https://www.terraform.io/docs/modules/index.html), which are distributed separately from the Terraform binary. terraform get -update diff --git a/tmux b/tmux index 80a90a3..7a92489 100644 --- a/tmux +++ b/tmux @@ -8,7 +8,7 @@ Ctrl-b d tmux attach # To detach an already attached session (great if you are moving devices with different screen resolutions): -tmux attach -d +tmux attach -d # To display session: tmux ls diff --git a/tr b/tr index 13a9b80..d69d8cc 100644 --- a/tr +++ b/tr @@ -1,6 +1,6 @@ # To replace : with a new line: echo $PATH | tr ":" "\n" -echo $PATH | tr -t ":" \n +echo $PATH | tr -t ":" \n # To remove all occurance of "ab": echo aabbcc | tr -d "ab" # ouput: cc @@ -13,7 +13,7 @@ echo aabbccd | tr -c "aa" x # output: aaxxxxx (no newline) echo aabbccd | tr -c "ab\n" x #output: aabbxxx (with newline) # To preserve all alpha(-c). ":-[:digit:] etc" will be translated to "\n". sequeeze mode: -echo $PATH | tr -cs "[:alpha:]" "\n" +echo $PATH | tr -cs "[:alpha:]" "\n" # To convert an ordered list to an unordered list: echo "1. /usr/bin\n2. /bin" | tr -cs " /[:alpha:]\n" "+" diff --git a/udisksctl b/udisksctl index c4d5233..176a2f1 100644 --- a/udisksctl +++ b/udisksctl @@ -8,4 +8,4 @@ udisksctl mount --block-device udisksctl unmount --block-device # To get help: -udisksctl help +udisksctl help diff --git a/uptime b/uptime index f0b501c..ff17f35 100644 --- a/uptime +++ b/uptime @@ -23,4 +23,3 @@ uptime -V # Show the help page uptime -h - diff --git a/yaourt b/yaourt index 4d742f2..7703721 100644 --- a/yaourt +++ b/yaourt @@ -3,7 +3,7 @@ tags: [ packaging ] --- # All pacman commands are working the same way with yaourt. # Just check the pacman cheatsheet. -# For instance, to install a package: +# For instance, to install a package: pacman -S yaourt -S # The difference is that yaourt will also query the Arch User Repository, @@ -19,7 +19,7 @@ yaourt # svn, hg...) yaourt -Suya --devel -# For all of the above commands, if you want yaourt to stop asking constantly for confirmations, +# For all of the above commands, if you want yaourt to stop asking constantly for confirmations, use the option --noconfirm # To build from source: diff --git a/yum b/yum index b86ed33..c015349 100644 --- a/yum +++ b/yum @@ -27,7 +27,7 @@ yum repolist # List packages matching : yum list - + # To download the source RPM for a package: yumdownloader --source diff --git a/zfs b/zfs index 7830ec5..1168c6c 100644 --- a/zfs +++ b/zfs @@ -127,4 +127,3 @@ zfs set = ${pool}/${fs_vol} # More... man zfs -