snipt

Ctrl+h for KB shortcuts

Bash

null/blackhole route

1
2
3
4
5
6
7
# network route that goes nowhere - blackhole filtering

# 1] available to almost every host implementing the ip module
# 2] almost 0 performance impact
# 3] can sustain higher throughput than conventional firewalls

route add -host 192.168.1.1 reject
https://snipt.net/embed/d88d78e7a1c92f2b7abcb2ca4eb8bf7b/
/raw/d88d78e7a1c92f2b7abcb2ca4eb8bf7b/
d88d78e7a1c92f2b7abcb2ca4eb8bf7b
bash
Bash
7
2019-07-07T22:50:49
True
False
False
/api/public/snipt/34065/
nullblackhole-route
<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> <a href="#L-6">6</a> <a href="#L-7">7</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"># network route that goes nowhere - blackhole filtering</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1"># 1] available to almost every host implementing the ip module</span> </span><span id="L-4"><a name="L-4"></a><span class="c1"># 2] almost 0 performance impact</span> </span><span id="L-5"><a name="L-5"></a><span class="c1"># 3] can sustain higher throughput than conventional firewalls</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a>route add -host 192.168.1.1 reject </span></pre></div> </td></tr></table>
bash, blackhole, drop, filtering, ip, iptables, packet, reject, route

Ruby

Rails route redirect

match "/oldroute", :to=>redirect("/newroute")
https://snipt.net/embed/d9157a49b9cf91bae0bad84fc945f035/
/raw/d9157a49b9cf91bae0bad84fc945f035/
d9157a49b9cf91bae0bad84fc945f035
rb
Ruby
1
2019-07-17T18:13:53
True
False
False
/api/public/snipt/25178/
rails-route-redirect
<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><span class="n">match</span> <span class="s2">&quot;/oldroute&quot;</span><span class="p">,</span> <span class="ss">:to</span><span class="o">=&gt;</span><span class="n">redirect</span><span class="p">(</span><span class="s2">&quot;/newroute&quot;</span><span class="p">)</span> </span></pre></div> </td></tr></table>
rails, redirect, route

PHP

Kohana 3 get route from bootstrap

 $login_route = Route::get('login');
https://snipt.net/embed/a8f969b17bc05a1c28f83057166f8450/
/raw/a8f969b17bc05a1c28f83057166f8450/
a8f969b17bc05a1c28f83057166f8450
php
PHP
1
2019-07-16T01:48:28
True
False
False
/api/public/snipt/22897/
kohana-3-get-route-from-bootstrap
<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><span class="x"> $login_route = Route::get(&#39;login&#39;);</span> </span></pre></div> </td></tr></table>
bootstrap, kohana, route

Bash

Get route to an IP on Linux

ip route get 10.118.216.81
https://snipt.net/embed/958f6e313626de922fd9256a6847d6e6/
/raw/958f6e313626de922fd9256a6847d6e6/
958f6e313626de922fd9256a6847d6e6
bash
Bash
1
2019-07-11T04:58:41
True
False
False
/api/public/snipt/11886/
get-route-to-an-ip-on-linux
<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>ip route get 10.118.216.81 </span></pre></div> </td></tr></table>
get, ip, linux, route