Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

fail2ban show banned ips

# display banned ip for ssh service
fail2ban-client status ssh-iptables
https://snipt.net/embed/2a4593f95017f5a6649ba0c06fb75f3d/
https://snipt.net/raw/2a4593f95017f5a6649ba0c06fb75f3d/
2a4593f95017f5a6649ba0c06fb75f3d
bash
Bash
2
2016-12-08T03:27:35
True
False
False
Mar 31, 2015 at 10:20 AM
/api/public/snipt/138797/
fail2ban-show-banned-ips-03e1cae8
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># display banned ip for ssh service</span> </span><span id="L-2"><a name="L-2"></a>fail2ban-client status ssh-iptables </span></pre></div> </td></tr></table>
centos, fail2ban, security

Bash

nmap centos

1
2
3
4
5
# Voir tous les ports TCP ouverts sur une machine, utilisation de messages SYN, donc pas de log sur la machine cible :
nmap -F -n -sS 127.0.0.1

# Voir tous les ports UDP ouverts sur une machine :
nmap -sU 127.0.0.1
https://snipt.net/embed/ae3a46c01b364683dcf3f7e5aef3f3df/
https://snipt.net/raw/ae3a46c01b364683dcf3f7e5aef3f3df/
ae3a46c01b364683dcf3f7e5aef3f3df
bash
Bash
5
2016-12-05T23:40:00
True
False
False
/api/public/snipt/138795/
namp-centos-18fbc7fe
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Voir tous les ports TCP ouverts sur une machine, utilisation de messages SYN, donc pas de log sur la machine cible :</span> </span><span id="L-2"><a name="L-2"></a>nmap -F -n -sS 127.0.0.1 </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># Voir tous les ports UDP ouverts sur une machine :</span> </span><span id="L-5"><a name="L-5"></a>nmap -sU 127.0.0.1 </span></pre></div> </td></tr></table>
centos, nmap, security

Bash

Install EPEL repository (64 bit)

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
https://snipt.net/embed/d50b38c7eb8eeb093e6656962040b6c2/
https://snipt.net/raw/d50b38c7eb8eeb093e6656962040b6c2/
d50b38c7eb8eeb093e6656962040b6c2
bash
Bash
1
2016-12-07T06:47:05
True
False
False
/api/public/snipt/24379/
install-epel-repository-64-bit
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm </span></pre></div> </td></tr></table>
administration, centos, linux, repository, server, yum

Bash

Install Package using Yum without Adding Repository

# Install a package using yum without permanently adding/enabling the repo.
yum --enablerepo=reponame install packagename
https://snipt.net/embed/4e7aa76b79fc91dc88928c825fb02342/
https://snipt.net/raw/4e7aa76b79fc91dc88928c825fb02342/
4e7aa76b79fc91dc88928c825fb02342
bash
Bash
2
2016-12-05T05:40:50
True
False
False
/api/public/snipt/22361/
install-package-using-yum-without-adding-repository
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Install a package using yum without permanently adding/enabling the repo.</span> </span><span id="L-2"><a name="L-2"></a>yum --enablerepo<span class="o">=</span>reponame install packagename </span></pre></div> </td></tr></table>
centos, linux, repository, yum

Bash

snmp test

1
2
3
4
5
#centos/redhat snmp packages
yum -y install net-snmp-utils net-snmp

# testing
snmpwalk -v 1 -c [COMMUNITY] [IP] IP-MIB::ipAdEntIfIndex
https://snipt.net/embed/8292962cc11c1c4a41dd2ea5fe52607f/
https://snipt.net/raw/8292962cc11c1c4a41dd2ea5fe52607f/
8292962cc11c1c4a41dd2ea5fe52607f
bash
Bash
6
2016-12-07T21:36:15
True
False
False
/api/public/snipt/10019/
snmp-test
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">#centos/redhat snmp packages</span> </span><span id="L-2"><a name="L-2"></a>yum -y install net-snmp-utils net-snmp </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># testing</span> </span><span id="L-5"><a name="L-5"></a>snmpwalk -v <span class="m">1</span> -c <span class="o">[</span>COMMUNITY<span class="o">]</span> <span class="o">[</span>IP<span class="o">]</span> IP-MIB::ipAdEntIfIndex </span></pre></div> </td></tr></table>
centos, redhat, snmp

Bash

Extract Source from RPM

1
2
3
4
mkdir test
cd test
wget http://mysite.com/files/packages/appp-1.0.x86_64.rpm
rpm2cpio appp-1.0.x86_64.rpm | cpio -idmv
https://snipt.net/embed/3892353baced23ad40d4f5fdcfff3668/
https://snipt.net/raw/3892353baced23ad40d4f5fdcfff3668/
3892353baced23ad40d4f5fdcfff3668
bash
Bash
4
2016-12-07T15:07:13
True
False
False
/api/public/snipt/5570/
extract-source-from-rpm
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>mkdir <span class="nb">test</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">cd</span> <span class="nb">test</span> </span><span id="L-3"><a name="L-3"></a>wget http://mysite.com/files/packages/appp-1.0.x86_64.rpm </span><span id="L-4"><a name="L-4"></a>rpm2cpio appp-1.0.x86_64.rpm <span class="p">|</span> cpio -idmv </span></pre></div> </td></tr></table>
bash, centos, linux, redhat, rpm

Bash

not centos packages

1
2
3
# Want to query all those packages installed from 3rd party repositories, not CentOS?

rpm -qa --qf '%{NAME} %{VENDOR}\n' | grep -v CentOS
https://snipt.net/embed/a8c0ee941eaa6052898f8ef40ad79d68/
https://snipt.net/raw/a8c0ee941eaa6052898f8ef40ad79d68/
a8c0ee941eaa6052898f8ef40ad79d68
bash
Bash
3
2016-12-02T13:43:59
True
False
False
/api/public/snipt/5481/
not-centos-packages
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Want to query all those packages installed from 3rd party repositories, not CentOS?</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>rpm -qa --qf <span class="s1">&#39;%{NAME} %{VENDOR}\n&#39;</span> <span class="p">|</span> grep -v CentOS </span></pre></div> </td></tr></table>
centos, packages
Copyrighted, illegal, or inappropriate content? Email [email protected].