{"id":12,"date":"2012-02-24T13:07:58","date_gmt":"2012-02-24T12:07:58","guid":{"rendered":"http:\/\/www.jbahillo.com\/?page_id=12"},"modified":"2012-06-11T09:27:32","modified_gmt":"2012-06-11T08:27:32","slug":"listado-ips","status":"publish","type":"page","link":"https:\/\/www.jbahillo.com\/?page_id=12","title":{"rendered":"[Bash] Listado IP&#8217;s"},"content":{"rendered":"<p>Este c\u00f3digo no es de mucha utilidad per se, solo es una prueba de concepto de como podr\u00edamos sacar todas las IP&#8217;s de un rango dado:<\/p>\n<pre class=\"brush: bash; auto-links: true; collapse: false; gutter: true; first-line: 1; highlight: []; html-script: false; light: false; pad-line-numbers: true; toolbar: true; wrap-lines: true\">\n#!\/bin\/bash\n#comprobamos que han introducido al menos un parametro\nif [ -z $1 ] \n\tthen\n\t  \t\n\techo &quot;No ha especificado ningun parametro. Por favor incluya la IP origen del rango y la IP final del rango&quot;\n\t\nelse\n\tif [ -z $2 ]\n\tthen\n\t\techo &quot;Debe introducir como segundo par\u00e1metro la IP final del rango&quot;\n\telse\n\t\t\n\t\tlet BIT1=`echo $1 | cut -d &quot;.&quot; -f 1`\n\t\tlet BIT2=`echo $1 | cut -d &quot;.&quot; -f 2`\n\t\tlet BIT3=`echo $1 | cut -d &quot;.&quot; -f 3`\n\t\tlet BIT4=`echo $1 | cut -d &quot;.&quot; -f 4`\n\n\t\tlet BIT11=`echo $2 | cut -d &quot;.&quot; -f 1`\n\t\tlet BIT12=`echo $2 | cut -d &quot;.&quot; -f 2`\n\t\tlet BIT13=`echo $2 | cut -d &quot;.&quot; -f 3`\n\t\tlet BIT14=`echo $2 | cut -d &quot;.&quot; -f 4`\n\n\t\twhile [ &quot;$BIT4&quot; -lt &quot;$BIT14&quot; ]; do\n\t\t\techo &quot;nmap $BIT1.$BIT2.$BIT3.$BIT4&quot;\n\t\t\tlet &quot;BIT4 = $BIT4 + 1&quot;\n\t\tdone\n\n\n\t\twhile [ &quot;$BIT3&quot; -lt &quot;$BIT13&quot; ]; do\n\t\t        echo &quot;nmap $BIT1.$BIT2.$BIT3.$BIT4&quot;\n\t      \n\t\t\tlet BIT4=`echo $1 | cut -d &quot;.&quot; -f 4`\n\t\t\twhile [ &quot;$BIT4&quot; -lt &quot;$BIT14&quot; ]; do\n\t\t        \techo &quot;nmap $BIT1.$BIT2.$BIT3.$BIT4&quot;\n\t\t      \t\tlet &quot;BIT4 = $BIT4 + 1&quot;\n\t\t\tdone\n\t\t\tlet &quot;BIT3 = $BIT3 + 1&quot;\n\t\tdone\n\n\n\t\twhile [ &quot;$BIT2&quot; -lt &quot;$BIT12&quot; ]; do\n\t\t        echo &quot;nmap $BIT1.$BIT2.$BIT3.$BIT4&quot;\n\t\t        let &quot;BIT2 = $BIT2 + 1&quot;\n\t\t\tlet BIT3=`echo $1 | cut -d &quot;.&quot; -f 3`\n\t\t\twhile [ &quot;$BIT3&quot; -lt &quot;$BIT13&quot; ]; do\n        \t\t\techo &quot;nmap $BIT1.$BIT2.$BIT3.$BIT4&quot;\n       \t\t\t\tlet &quot;BIT3 = $BIT3 + 1&quot;\n\t\t\t\tlet BIT4=`echo $1 | cut -d &quot;.&quot; -f 4`         \t\n\t\t\t\twhile [ &quot;$BIT4&quot; -lt &quot;$BIT14&quot; ]; do\n                \t\t\techo &quot;nmap $BIT1.$BIT2.$BIT3.$BIT4&quot;\n                \t\t\tlet &quot;BIT4 = $BIT4 + 1&quot;\n        \t\t\tdone\n \t\t\tdone\n \t\tdone\n\n\t\twhile [ &quot;$BIT1&quot; -lt &quot;$BIT11&quot; ]; do\n        \t\techo &quot;nmap $BIT1.$BIT2.$BIT3.$BIT4&quot;\n        \t\tlet &quot;BIT1 = $BIT1 + 1&quot;\n\t\t\tlet BIT2=`echo $1 | cut -d &quot;.&quot; -f 2`\t\n\t\t\twhile [ &quot;$BIT2&quot; -lt &quot;$BIT12&quot; ]; do\n        \t\t\techo &quot;nmap $BIT1.$BIT2.$BIT3.$BIT4&quot;\n        \t\t\tlet &quot;BIT2 = $BIT2 + 1&quot;\n\t\t\t\tlet BIT3=`echo $1 | cut -d &quot;.&quot; -f 3`\n\t        \t\twhile [ &quot;$BIT3&quot; -lt &quot;$BIT13&quot; ]; do\n        \t       \t\t\techo &quot;nmap $BIT1.$BIT2.$BIT3.$BIT4&quot;\n                \t\t\tlet &quot;BIT3 = $BIT3 + 1&quot;\n\t\t\t\t\tlet BIT4=`echo $1 | cut -d &quot;.&quot; -f 4`           \t\n\t\t\t\t\twhile [ &quot;$BIT4&quot; -lt &quot;$BIT14&quot; ]; do\n                        \t\t\techo &quot;nmap $BIT1.$BIT2.$BIT3.$BIT4&quot;\n                        \t\t\tlet &quot;BIT4 = $BIT4 + 1&quot;\n\t\t\t\t\tdone\n\t\t        \tdone\n\t\t\tdone\n\t\tdone\n\tfi\nfi\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Este c\u00f3digo no es de mucha utilidad per se, solo es una prueba de concepto de como podr\u00edamos sacar todas las IP&#8217;s de un rango dado: #!\/bin\/bash #comprobamos que han introducido al menos un parametro if [ -z $1 ]&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/www.jbahillo.com\/?page_id=12\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":21,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"page_fullwidth.php","meta":{"ep_exclude_from_search":false,"footnotes":""},"class_list":["post-12","page","type-page","status-publish","hentry"],"aioseo_notices":[],"jetpack_shortlink":"https:\/\/wp.me\/P74T96-c","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/pages\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12"}],"version-history":[{"count":20,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/pages\/12\/revisions"}],"predecessor-version":[{"id":401,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/pages\/12\/revisions\/401"}],"wp:attachment":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}