<?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: J2RGEZ</title>
    <description>The latest articles on DEV Community by J2RGEZ (@j2rguez).</description>
    <link>https://dev.to/j2rguez</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%2F9785%2Ff2292e6d-cced-4c3f-96e2-04a58ff1eb9a.jpeg</url>
      <title>DEV Community: J2RGEZ</title>
      <link>https://dev.to/j2rguez</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/j2rguez"/>
    <language>en</language>
    <item>
      <title>Web Pentesting Learning - Beginner edition</title>
      <dc:creator>J2RGEZ</dc:creator>
      <pubDate>Thu, 01 Sep 2022 09:37:07 +0000</pubDate>
      <link>https://dev.to/theagilemonkeys/web-pentesting-learning-beginner-edition-4clg</link>
      <guid>https://dev.to/theagilemonkeys/web-pentesting-learning-beginner-edition-4clg</guid>
      <description>&lt;p&gt;After a couple of years of learning on my own, I created a brief list of the assets I think were most useful for me at the time of learning web pentesting. Hope you find it helpful!&lt;/p&gt;

&lt;h2&gt;
  
  
   Books
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Linux Basics for Hackers: Getting Started with Networking, Scripting, and Security in Kali, by OccupyTheWeb&lt;/strong&gt;. =&amp;gt; Beginner friendly and very well written.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Penetration Testing: A Hands-On Introduction to Hacking, by Georgia Weidman&lt;/strong&gt; =&amp;gt; In my opinion it’s a bit outdated and some parts are difficult to understand but still a very good book.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web Hacking 101, by Peter Yaworski&lt;/strong&gt; =&amp;gt; A summary of all common web vulnerabilities with examples.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hands-On Penetration Testing on Windows, by Phil Bramwell&lt;/strong&gt; =&amp;gt; Also focusing on the registry tree and how the most common keys work (such as kerberos keys that handles authentication). Microsoft official docs are good for this.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Twitter accounts
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://twitter.com/three_cube"&gt;@three_cube&lt;/a&gt; a.k.a OccupytheWeb. This is from the author of the first book listed above and also has a very good hacking blog: &lt;a href="https://www.hackers-arise.com/"&gt;https://www.hackers-arise.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/theXSSrat"&gt;@theXSSrat&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://twitter.com/stokfredrik"&gt;@stokfredik&lt;/a&gt; =&amp;gt;The coolest hacker ever! He also has a great YouTube channel&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/NahamSec"&gt;@NahamSec&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/TheHackersNews"&gt;@TheHackersNews&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://twitter.com/thecybermentor"&gt;@thecybermentor&lt;/a&gt; and &lt;a href="https://twitter.com/TCMSecurity"&gt;@TCMSecurity&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Overall &lt;strong&gt;#infosec&lt;/strong&gt; twitter is a very good place to start reading writeups and latest news.&lt;/p&gt;

&lt;h2&gt;
  
  
  Platforms to get your hands dirty
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.pentesterlab.com/"&gt;Pentesterlab&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tryhackme.com/"&gt;Tryhackme&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.hackthebox.com/"&gt;Hackthebox&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you’re just starting, I recommend Tryhackme. It’s amazing! And it has a lot of walkthrough boxes (just be aware of &lt;a href="https://tryhackme.com/resources/blog/tryhackmes-vpn-explained"&gt;this&lt;/a&gt;). Then, I would jump to Hackthebox which has the most realistic machines. In my opinion pentesterlab is a bit expensive for the quality their competitors have for almost half the price, but their certificates are good.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug bounty platforms
&lt;/h2&gt;

&lt;p&gt;Bug bounty is about hacking as a freelancer, but it’s nice to read writeups (if public), as these are real business-level vulnerabilities. Also reading about bug bounty will teach you tricks to increase your speed and overall organization, which is one of the key skills you need in this category. Why? Because you want to report your findings before anyone else to get paid and avoid duplicates. Hackerone is one of these platforms: &lt;a href="https://hackerone.com/directory/programs?order_direction=DESC&amp;amp;order_field=resolved_report_count"&gt;https://hackerone.com/directory/programs?order_direction=DESC&amp;amp;order_field=resolved_report_count&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tools you should know (basic level)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.metasploit.com/"&gt;Metasploit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sqlmap.org/"&gt;sqlmap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nmap.org/"&gt;nmap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://portswigger.net/burp"&gt;Burp Suite&lt;/a&gt; or any other web scanner alternative&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.kali.org/tools/hydra/"&gt;Hydra&lt;/a&gt; login cracker&lt;/li&gt;
&lt;li&gt;Any hash cracker like &lt;a href="https://www.openwall.com/john/"&gt;john the ripper&lt;/a&gt;, &lt;a href="https://hashcat.net/hashcat/"&gt;hashcat&lt;/a&gt;, etc&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.shodan.io/"&gt;Shodan&lt;/a&gt;: at least to understand what it is, in case you want to use it one day&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What are writeups?&lt;/strong&gt; Instructions about how someone hacked something in detail.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’m most probably missing something here, but I think it’s a nice starting point. Let me know in the comments if you would add anything else to this list and/or what helped you when you started learning pentesting.&lt;/p&gt;

</description>
      <category>pentesting</category>
      <category>security</category>
      <category>infosec</category>
    </item>
    <item>
      <title>Event-sourcing and the event-replay mystery</title>
      <dc:creator>J2RGEZ</dc:creator>
      <pubDate>Fri, 06 Nov 2020 09:12:50 +0000</pubDate>
      <link>https://dev.to/boostercloud/event-sourcing-and-the-event-replay-mistery-4cn0</link>
      <guid>https://dev.to/boostercloud/event-sourcing-and-the-event-replay-mistery-4cn0</guid>
      <description>&lt;p&gt;It’s been a while since we first started our way into event-sourcing and, from our experience, we really think that there is still space to dig into what event sourcing is and why it’s useful for modern backend applications. But first...&lt;/p&gt;

&lt;h2&gt;
  
  
   What’s event-sourcing?
&lt;/h2&gt;

&lt;p&gt;Event-sourcing is a collection of patterns that introduces a new way of thinking, where domain events are the source of truth (domain referring to domain-driven design). We need to fulfill the following contract:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The event store persists the &lt;strong&gt;full history of domain events&lt;/strong&gt;. For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;UserRegistered&lt;/em&gt; &lt;br&gt;
&lt;em&gt;UserChangedPassword&lt;/em&gt;&lt;br&gt;
&lt;em&gt;UserPublishedAnArticle&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Domain events must be &lt;strong&gt;chronologically ordered&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Domain events are &lt;strong&gt;immutable&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Given #1 and #2, we can actually &lt;strong&gt;replay domain events&lt;/strong&gt;. That is, reconstructing the state of your application by running the full history of domain events, which can give you the chance to reconstruct the current state of your system and go back to a specific point in time, allowing the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easily find &lt;strong&gt;bugs&lt;/strong&gt; from the system and reconstruct those bugs in different environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deploy different versions&lt;/strong&gt; of your backend for testing purposes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recover from errors&lt;/strong&gt; by replaying events from a specific point in your system.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Specifically for microservice architectures, &lt;strong&gt;there is one case when this comes in handy&lt;/strong&gt;: Imagine adding a new service, meaning a new read model (local DB) needs to be created. For this purpose, we need to reconstruct the current state of domain models by replaying domain events from the Event Storage. This operation becomes easier when adding snapshotting to the formula.&lt;/p&gt;

&lt;h2&gt;
  
  
  Snapshotting for event replaying
&lt;/h2&gt;

&lt;p&gt;Snapshots represent the current state of an entity (or &lt;a href="https://www.martinfowler.com/eaaDev/EventAggregator.html" rel="noopener noreferrer"&gt;aggregate&lt;/a&gt;) at a specific time. Snapshots can be configured to be done whenever you want. For example, every X events, X days, or when something special happens in your system.&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%2Fw6apk2uv9vxf230hhyv7.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%2Fw6apk2uv9vxf230hhyv7.png" alt="Snapshotting"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Replaying events then becomes easier, because you can start rebuilding your service from a specific point of your events’ timeline, and then run all further events from that point. Check the example 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%2Frgada646yc1cy0hnxngb.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%2Frgada646yc1cy0hnxngb.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, you don’t have to go back to the first &lt;em&gt;UserRegistered&lt;/em&gt; event and run all events, but instead, you just take advantage of snapshotting and rollback the User state just before deleting the article.&lt;/p&gt;

&lt;h2&gt;
  
  
  Not everything is shiny
&lt;/h2&gt;

&lt;p&gt;Definitely, event sourcing advantages were the ones that motivated us to enter this field, but along the way, we found that things weren’t as easy as the theory says:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;With &lt;strong&gt;high traffic&lt;/strong&gt;, what would happen if your application goes down? How are you going to recover from the previous failed events plus keep receiving the new ones?&lt;/li&gt;
&lt;li&gt;How do you handle &lt;strong&gt;side effects&lt;/strong&gt;? For example, when replaying events imagine that one of the events calls your email service. In that case, we should check that the email was previously sent, or otherwise while we replay the events, the user could end up with a lot of repeated emails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When should you store a snapshot?&lt;/strong&gt; Snapshotting depends a lot on the business needs, so we should be open to leave this as configurable as possible, or just generalize it and snapshot every X events. &lt;/li&gt;
&lt;li&gt;Is it better to &lt;strong&gt;store snapshots synchronously or asynchronously&lt;/strong&gt;? Synchronous snapshot persistence could happen if you’re not worried about persistence latency.&lt;/li&gt;
&lt;li&gt;How do you handle &lt;strong&gt;new events coming&lt;/strong&gt; while replaying events?&lt;/li&gt;
&lt;li&gt;How are you going to manage &lt;strong&gt;&lt;a href="https://en.wikipedia.org/wiki/General_Data_Protection_Regulation" rel="noopener noreferrer"&gt;GDPR&lt;/a&gt;&lt;/strong&gt;? As events must be immutable, theoretically you can’t delete events even if they contain personal data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These problems can be probably solved by adding more control parameters to your events, adding additional checks (to avoid side effects for example), or having a high available queue system like Kafka/RabbitMQ in the middle of your store and your database (for events queuing and system recovery).&lt;/p&gt;

&lt;p&gt;Although, what we’ve missed these years is an event-sourcing standard implementation, where the developer doesn’t have to think about the big complexity it has to develop the majority of useful use cases. That’s what we’ve been trying to do with &lt;a href="https://booster.cloud/" rel="noopener noreferrer"&gt;Booster Framework&lt;/a&gt;, and we are really excited about what we’ve currently achieved.&lt;/p&gt;

&lt;p&gt;Feel free to join our &lt;strong&gt;&lt;a href="https://discord.gg/bDY8MKx" rel="noopener noreferrer"&gt;discord&lt;/a&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;a href="https://join.slack.com/t/booster-cloud/shared_invite/zt-i2e4tjxe-Du9vGoCIdgbSsTNoRGt5ew" rel="noopener noreferrer"&gt;slack&lt;/a&gt;&lt;/strong&gt; if you want to know more about it!&lt;/p&gt;

</description>
      <category>eventsourcing</category>
      <category>data</category>
      <category>microservices</category>
    </item>
    <item>
      <title>Booster framework vs Ruby on Rails</title>
      <dc:creator>J2RGEZ</dc:creator>
      <pubDate>Fri, 14 Aug 2020 13:39:33 +0000</pubDate>
      <link>https://dev.to/j2rguez/booster-framework-vs-ruby-on-rails-1f48</link>
      <guid>https://dev.to/j2rguez/booster-framework-vs-ruby-on-rails-1f48</guid>
      <description>&lt;p&gt;After all these years, Ruby on Rails is still one of the frameworks we like most. Now that we’ve developed the &lt;a href="https://booster.cloud/"&gt;Booster framework&lt;/a&gt;, we’re curious about how it stacks up to Rails in various aspects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Code&lt;/strong&gt;: How much code do you need to write to get similar features?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure and configuration&lt;/strong&gt;: What resources are needed? How are they configured? How are they kept up and running in a production environment? &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability and costs estimation&lt;/strong&gt;: What if our application starts to grow? How much effort and cost will there be?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The plan for this comparison is to build a real-time chat application on both frameworks with three models: Chat Room, Messages, and Users. To save time, we’ve gone ahead and built the app with both frameworks. If you want to see the full code, go ahead and check our &lt;a href="https://github.com/theam/action-cable-chat-app"&gt;Ruby on Rails&lt;/a&gt; and &lt;a href="https://github.com/boostercloud/examples/tree/master/booster-chat-app"&gt;Booster&lt;/a&gt; repos.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Code&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To build the Ruby on Rails application, we chose &lt;a href="https://edgeguides.rubyonrails.org/action_cable_overview.html"&gt;Action Cable&lt;/a&gt; and Rails 6. If you’ve worked with Ruby on Rails before, you know the steps we needed to take: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set up Docker using Redis as our Action Cable adapter.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/heartcombo/devise"&gt;Configure authentication&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Generate the models, controllers, and views for our app.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Maybe the hardest part was properly configuring the &lt;a href="https://edgeguides.rubyonrails.org/action_cable_overview.html#client-server-interactions"&gt;Action Cable client-server interaction&lt;/a&gt;. It’s challenging but can be accomplished by reading the docs carefully.&lt;/p&gt;

&lt;p&gt;And what about Booster? Before we begin talking about the implementation, we encourage you to check out the &lt;a href="https://github.com/boostercloud/booster/tree/master/docs#booster-architecture"&gt;Booster architecture documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To begin with this app, we replicated the models from our Ruby on Rails application shared above, with the objective of creating at least one command, event, entity and read-model for each one. We didn’t need to install additional dependencies, and even &lt;a href="https://github.com/boostercloud/booster/tree/master/docs#authentication-and-authorization"&gt;authorization and authentication&lt;/a&gt; is built-in.&lt;/p&gt;

&lt;p&gt;Although the objective of this article is not to do a tutorial, we want to show you just one use case:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;When I create a chat room, the current user must exist in the system&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;authorize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Admin&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; 
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;CreateChatRoom&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; 
    &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;isPrivate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; 

  &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nx"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Register&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentUser&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userProfile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;Booster&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fetchEntitySnapshot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nx"&gt;UserProfile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
        &lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentUser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt; 
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userProfile&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;events&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;ChatRoomCreated&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="nx"&gt;UUID&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; 
          &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
          &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
          &lt;span class="nx"&gt;userProfile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
          &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isPrivate&lt;/span&gt;
        &lt;span class="p"&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="k"&gt;throw&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error trying to create a chat room. User not found.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; 
      &lt;span class="p"&gt;}&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;          
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As you can see, by using the Register object, you can retrieve information from the current user. It can also be used to &lt;a href="https://github.com/boostercloud/booster/tree/master/docs#reading-entities-from-event-handlers"&gt;read entities from event-handlers&lt;/a&gt;, so you will always have access to existing data in the system by just writing one line of code.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Infrastructure and configuration&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Since the code is ready, it’s time to think about where we want to deploy these apps. For the Ruby on Rails application, we just went for the easiest option, which is &lt;a href="https://devcenter.heroku.com/articles/git"&gt;Heroku&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Still, we’re missing a couple of important components for this infrastructure to be complete: &lt;a href="https://elements.heroku.com/addons/rediscloud"&gt;Redis&lt;/a&gt; and &lt;a href="https://elements.heroku.com/addons/heroku-postgresql"&gt;PostgreSQL&lt;/a&gt;. In a Ruby on Rails application, we should configure the environment files (and the action cable one) to point to these services.&lt;/p&gt;

&lt;p&gt;The Booster Framework has an AWS-based infrastructure (&lt;a href="https://github.com/boostercloud/booster/tree/master/docs#providers"&gt;for now&lt;/a&gt;), which depends on DynamoDB, AWS Lambda, API Gateway, and AWS Cognito. Here’s a diagram just in case you’re curious about the infrastructure:&lt;/p&gt;

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

&lt;p&gt;To deploy a Booster application, you just have to type &lt;em&gt;boost deploy -e &amp;lt;&lt;a href="https://github.com/boostercloud/booster/tree/master/docs#environments"&gt;environment&lt;/a&gt;&amp;gt;&lt;/em&gt; on your CLI, and Booster will automatically generate and connect all AWS services mentioned above for that specific environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Scalability and costs estimation&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Another important point of comparison is cost and scalability.  Let’s estimate the relative costs of a production environment for both frameworks: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Heroku production environment:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.heroku.com/pricing"&gt;Performance-M dyno&lt;/a&gt; ($250 per month, per dyno) &lt;/li&gt;
&lt;li&gt;1GB &lt;a href="https://elements.heroku.com/addons/rediscloud"&gt;Redis plan&lt;/a&gt; ($100 per month) &lt;/li&gt;
&lt;li&gt;Private 0 &lt;a href="https://elements.heroku.com/addons/heroku-postgresql"&gt;PostgreSQL plan&lt;/a&gt; ($300 per month)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes a total of $650 per month, and we didn’t take into account the &lt;a href="https://devcenter.heroku.com/articles/scaling#autoscaling"&gt;scalability&lt;/a&gt; of the system. As your application starts growing, you will need to increase not just the number of dynos, but to upgrade the PostgreSQL and Redis add-ons.&lt;/p&gt;

&lt;p&gt;In the Booster Framework, all deployed services are included in the AWS free tier. After this initial year and depending on your region, you will mostly pay for the resources that you actively use.&lt;/p&gt;

&lt;p&gt;So, &lt;strong&gt;how much would it cost to create a production environment using Booster? (eu-west-1 region)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DynamoDB:&lt;/strong&gt; 64GB of capacity, 1 million read and writes on-demand = $220.89&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Lambda:&lt;/strong&gt; 1 million requests, 1500ms request duration, 1GB memory allocated = $25.20&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Gateway:&lt;/strong&gt; 

&lt;ul&gt;
&lt;li&gt;REST API: 1 million requests = $3.50&lt;/li&gt;
&lt;li&gt;Websocket API: 1 million requests = $1.14. We will also pay $0.285 per million connection minutes.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Cognito:&lt;/strong&gt; The first 50,000 monthly active users are free even without the free tier.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These prices would end at a total cost of approximately $249.59 per month, with a maximum of 50,000 active users. Remember that this price may vary depending on your region and your monthly requests and/or data stored. &lt;/p&gt;

&lt;p&gt;And what about scalability? The AWS services that Booster uses will &lt;a href="https://aws.amazon.com/blogs/compute/real-world-aws-scalability/"&gt;scale automatically&lt;/a&gt; as your applications start receiving more requests, so you don’t have to worry about any additional configuration!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;Developing with Ruby on Rails was very comfortable but the Action Cable part was not as natural and simple as we’d like it to be. Booster, on the other hand, not only has authorization built-in, but we don’t have to worry about dependencies and the code is much easier to read. It felt like we were focusing on business actions and not low-level technical configuration and boilerplate code.&lt;/p&gt;

&lt;p&gt;Regarding infrastructure and configuration, Booster takes the lead here. Being able to deploy your entire application by running one single command without any other additional configuration is definitely a huge advantage. In the case of Ruby on Rails, configuring it on Heroku is not a very big deal but still requires you to create the app and connect Redis and PostgreSQL for every environment.&lt;/p&gt;

&lt;p&gt;Finally, the cost of running a production environment with Booster is much cheaper than with Ruby on Rails. Furthermore,  when scaling your application in Booster you don’t need to worry about any additional or special configurations. Everything is done automatically for you.&lt;/p&gt;

&lt;p&gt;Overall based on these criteria, we think that Booster is a better choice. Still, we would be missing the &lt;strong&gt;benchmarking side of both apps&lt;/strong&gt; but that’s for another article so, stay tuned! &lt;/p&gt;

</description>
      <category>aws</category>
      <category>rails</category>
      <category>serverless</category>
      <category>booster</category>
    </item>
    <item>
      <title>Week 3: Introduction to John the Ripper</title>
      <dc:creator>J2RGEZ</dc:creator>
      <pubDate>Thu, 02 Apr 2020 20:30:29 +0000</pubDate>
      <link>https://dev.to/j2rguez/week-3-introduction-to-john-the-ripper-3aj</link>
      <guid>https://dev.to/j2rguez/week-3-introduction-to-john-the-ripper-3aj</guid>
      <description>&lt;p&gt;In your way through penetration testing, you will find yourself in situations where passwords or critical information are encoded. When this occurs, you first need to find in which format that hash is and then, try to decode it. For these cases, I like to use &lt;a href="https://www.openwall.com/john/"&gt;John the Ripper&lt;/a&gt;, one of the most popular password crackers around. So, let’s begin!&lt;/p&gt;

&lt;h3&gt;
  
  
  Formats
&lt;/h3&gt;

&lt;p&gt;A format is just the kind of encoding that you’re trying to use. Let’s check how many formats john has by typing &lt;code&gt;john --list=formats&lt;/code&gt;. You should see something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;j2rgez@myPC:~&lt;span class="nv"&gt;$ &lt;/span&gt;john &lt;span class="nt"&gt;--list&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;formats
descrypt, bsdicrypt, md5crypt, md5crypt-long, bcrypt, scrypt, LM, AFS,
tripcode, AndroidBackup, adxcrypt, agilekeychain, aix-ssha1, aix-ssha256,
aix-ssha512, andOTP, ansible, argon2, as400-des, as400-ssha1, asa-md5,
AxCrypt, AzureAD, BestCrypt, bfegg, Bitcoin, BitLocker, bitshares, Bitwarden,
BKS, Blackberry-ES10, WoWSRP, Blockchain, chap, Clipperz, cloudkeychain,
dynamic_n, cq, CRC32, sha1crypt, sha256crypt, sha512crypt, Citrix_NS10,
dahua, dashlane, diskcryptor, Django, django-scrypt, dmd5, dmg, dominosec,
dominosec8, DPAPImk, dragonfly3-32, dragonfly3-64, dragonfly4-32,
dragonfly4-64, Drupal7, eCryptfs, eigrp, electrum, EncFS, enpass, EPI,
EPiServer, ethereum, fde, Fortigate256, Fortigate, FormSpring, FVDE, geli,
gost, gpg, HAVAL-128-4, HAVAL-256-3, hdaa, hMailServer, hsrp, IKE, ipb2,
itunes-backup, iwork, KeePass, keychain, keyring, keystore, known_hosts,
krb4, krb5, krb5asrep, krb5pa-sha1, krb5tgs, krb5-17, krb5-18, krb5-3,
kwallet, lp, lpcli, leet, lotus5, lotus85, LUKS, MD2, mdc2, MediaWiki,
monero, money, MongoDB, scram, Mozilla, mscash, mscash2, MSCHAPv2,
mschapv2-naive, krb5pa-md5, mssql, mssql05, mssql12, multibit, mysqlna,
mysql-sha1, mysql, net-ah, nethalflm, netlm, netlmv2, net-md5, netntlmv2,
netntlm, netntlm-naive, net-sha1, nk, notes, md5ns, nsec3, NT, o10glogon,
o3logon, o5logon, ODF, Office, oldoffice, OpenBSD-SoftRAID, openssl-enc,
oracle, oracle11, Oracle12C, osc, ospf, Padlock, Palshop, Panama,
PBKDF2-HMAC-MD4, PBKDF2-HMAC-MD5, PBKDF2-HMAC-SHA1, PBKDF2-HMAC-SHA256,
PBKDF2-HMAC-SHA512, PDF, PEM, pfx, pgpdisk, pgpsda, pgpwde, phpass, PHPS,
PHPS2, pix-md5, PKZIP, po, postgres, PST, PuTTY, pwsafe, qnx, RACF,
RACF-KDFAES, radius, RAdmin, RAKP, rar, RAR5, Raw-SHA512, Raw-Blake2,
Raw-Keccak, Raw-Keccak-256, Raw-MD4, Raw-MD5, Raw-MD5u, Raw-SHA1,
Raw-SHA1-AxCrypt, Raw-SHA1-Linkedin, Raw-SHA224, Raw-SHA256, Raw-SHA3,
Raw-SHA384, ripemd-128, ripemd-160, rsvp, Siemens-S7, Salted-SHA1, SSHA512,
sapb, sapg, saph, sappse, securezip, 7z, Signal, SIP, skein-256, skein-512,
skey, SL3, Snefru-128, Snefru-256, LastPass, SNMP, solarwinds, SSH, sspr,
Stribog-256, Stribog-512, STRIP, SunMD5, SybaseASE, Sybase-PROP, tacacs-plus,
tcp-md5, telegram, tezos, Tiger, tc_aes_xts, tc_ripemd160, tc_ripemd160boot,
tc_sha512, tc_whirlpool, vdi, OpenVMS, vmx, VNC, vtp, wbb3, whirlpool,
whirlpool0, whirlpool1, wpapsk, wpapsk-pmk, xmpp-scram, xsha, xsha512, ZIP,
ZipMonster, plaintext, has-160, HMAC-MD5, HMAC-SHA1, HMAC-SHA224,
HMAC-SHA256, HMAC-SHA384, HMAC-SHA512, dummy, crypt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wow, that’s a lot, right? Well, names and/or well-known formats (like MD5 which starts with $1$), could lead you to know which format you’re going to use. So let’s create a new file called &lt;strong&gt;my_hash.txt&lt;/strong&gt; and insert the following hash (in &lt;em&gt;user:password&lt;/em&gt; format): &lt;strong&gt;root:$1$6ff3402b$2w6aUd7n//XodMXDt84BE1&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Now, to select the decoded format, we type &lt;code&gt;john my_hash.txt --format=md5crypt&lt;/code&gt; and check the results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;j2rgez@myPC:~&lt;span class="nv"&gt;$ &lt;/span&gt;john my_hash.txt &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;md5crypt
Using default input encoding: UTF-8
Loaded 1 password &lt;span class="nb"&gt;hash&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;md5crypt, crypt&lt;span class="o"&gt;(&lt;/span&gt;3&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;$1$ &lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;and variants&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;MD5 256/256AVX28x3]&lt;span class="o"&gt;)&lt;/span&gt;
Will run 12 OpenMP threads
Proceeding with single, rules:Single
Press &lt;span class="s1"&gt;'q'&lt;/span&gt; or Ctrl-C to abort, almost any other key &lt;span class="k"&gt;for &lt;/span&gt;status
Almost &lt;span class="k"&gt;done&lt;/span&gt;: Processing the remaining buffered candidate passwords, &lt;span class="k"&gt;if &lt;/span&gt;any.
Warning: Only 248 candidates buffered &lt;span class="k"&gt;for &lt;/span&gt;the current salt, minimum 288 needed &lt;span class="k"&gt;for &lt;/span&gt;performance.
Proceeding with wordlist:/usr/share/john/password.lst, rules:Wordlist
admin            &lt;span class="o"&gt;(&lt;/span&gt;root&lt;span class="o"&gt;)&lt;/span&gt;
1g 0:00:00:00 DONE 2/3 &lt;span class="o"&gt;(&lt;/span&gt;2020-04-02 20:38&lt;span class="o"&gt;)&lt;/span&gt; 20.00g/s 90560p/s 90560c/s 90560C/s chacha..OU812
Use the &lt;span class="s2"&gt;"--show"&lt;/span&gt; option to display all of the cracked passwords reliably
Session completed       
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, john tried to find a match in its default wordlist and found it! The decoded value is “admin” (let's keep things fast). &lt;/p&gt;

&lt;p&gt;There are tons of wordlists around the internet (or you can create your own ones). You can check for example the ones from &lt;a href="https://github.com/danielmiessler/SecLists"&gt;SecLists&lt;/a&gt; repo, and simply type &lt;code&gt;john my_hash.txt --format=md5crypt --wordlist=my_wordlist.txt&lt;/code&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Automating all of this
&lt;/h3&gt;

&lt;p&gt;So, last weekend I was completing some exercises from Pentesterlab when I found this sentence in one of the exercises: &lt;em&gt;Use John by trial and error until you find the format&lt;/em&gt;. From the exercise context, you could imagine which format it was, but I was thinking: what if they ask me to do this in the future with a not so obvious format? &lt;/p&gt;

&lt;p&gt;So I began my way of automating pentesting processes and &lt;a href="https://github.com/juanjoman/Pentesting-utils"&gt;created a new repo&lt;/a&gt;. Yes, I’m 90% sure that there is a better way (or an existing tool) to automate John the Ripper (or password cracking in general), but I find that it’s also a good way to practice some new programming languages or at least the ones that I don’t use on a day to day basis. So here is the first version of my &lt;strong&gt;john_auto_decypher.py&lt;/strong&gt; script:&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="nn"&gt;subprocess&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;argparse&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;decrypt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;formats&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;inputFile&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;keep_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Press 'q' or Ctrl-C to abort, almost any other key for status"&lt;/span&gt;
    &lt;span class="nb"&gt;format&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;formats&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;decode_process&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;check_output&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s"&gt;"john"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;inputFile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"--format="&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;None&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;keep_string&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;decode_process&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="nb"&gt;format&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CalledProcessError&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="s"&gt;"Found a hash for "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;format&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" format"&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="s"&gt;"Couldn't decode, checking for already saved hashes..."&lt;/span&gt;

    &lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;check_output&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s"&gt;"john"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"--show"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;inputFile&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;getArgs&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;parser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;argparse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ArgumentParser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"john_auto_decypher.py"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add_argument&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"file"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;help&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"File with encoded passwords to be cracked"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parse_args&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;inputFile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;getArgs&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;
    &lt;span class="n"&gt;formats&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;check_output&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s"&gt;"john"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"--list=formats"&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;","&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;decrypt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;formats&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;inputFile&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simple but effective, now by just typing &lt;code&gt;python john_auto_decypher.py &amp;lt;filename&amp;gt;&lt;/code&gt; on my CLI, this script will check all formats for me and/or already saved hashes. Of course, there is still a lot to improve, like adding parameters for wordlists and &lt;a href="https://www.openwall.com/john/doc/RULES.shtml"&gt;custom rules&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So, that's all for today. Have a very good weekend you all!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Previous weeks:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://dev.to/theagilemonkeys/week-0-security-blog-posts-introduction-fff"&gt;Week 0: Security blog posts introduction&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/theagilemonkeys/week-1-being-conscious-about-your-attack-surface-3elj"&gt;Week 1: Being conscious about your attack surface&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/theagilemonkeys/week-2-knowing-the-penetration-testing-steps-4c7h"&gt;Week 2: Knowing the penetration testing steps&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>infosec</category>
      <category>blogpost</category>
      <category>pentest</category>
    </item>
    <item>
      <title>Week 2: Knowing the penetration testing steps</title>
      <dc:creator>J2RGEZ</dc:creator>
      <pubDate>Thu, 26 Mar 2020 22:20:37 +0000</pubDate>
      <link>https://dev.to/j2rguez/week-2-knowing-the-penetration-testing-steps-4c7h</link>
      <guid>https://dev.to/j2rguez/week-2-knowing-the-penetration-testing-steps-4c7h</guid>
      <description>&lt;p&gt;Nowadays, organizing yourself is becoming crucial in your everyday life. From diet to training to work, making good planning is key when you’re trying to chase your goals efficiently. In this case, our main goal is to perform a penetration test to a system and there is a well-known way to achieve this in our community:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Information gathering/reconnaissance&lt;/li&gt;
&lt;li&gt;Vulnerability scan&lt;/li&gt;
&lt;li&gt;Attack phase&lt;/li&gt;
&lt;li&gt;Post-exploitation&lt;/li&gt;
&lt;li&gt;Reporting&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, let’s describe each one of these.&lt;/p&gt;

&lt;h2&gt;
  
  
  Information gathering/reconnaissance
&lt;/h2&gt;

&lt;p&gt;As the title says, a penetration tester must gather all information he/she can to be able to effectively jump into the next steps. Knowing your target’s business is very important and you should spend as much time as you can analyzing this.&lt;/p&gt;

&lt;p&gt;Imagine that your target is an e-commerce website. In this case, you should take your time and navigate through all the pages (yes, all of them), trying to pay attention to URL formats, existing forms, what is the product, how it is sold, etc. Let’s say that this e-commerce has three plans: free, standard and premium. If possible, you should have an account for each one of these and see what you can do with each one. Remember that every new feature you discover increases the attack surface of the target’s system.&lt;/p&gt;

&lt;p&gt;After knowing everything about the product, I would start by identifying open ports, doing brute force directories, search for possible subdomains, check all website’s networking, etc. Usually, you should be asking this kind of questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which endpoints are called and when? Is there a difference in the endpoint when buying as a standard user? And as a premium one?&lt;/li&gt;
&lt;li&gt;Which cookies are used and what is the difference between users? 
Is there any place on the website where I can upload a file? In which format?&lt;/li&gt;
&lt;li&gt;What is the framework and libraries this site is using? In which versions are they?&lt;/li&gt;
&lt;li&gt;Is there a way that I could find some more info around the internet? &lt;em&gt;Tip: Check this out &lt;a href="https://github.com/laramies/theHarvester"&gt;https://github.com/laramies/theHarvester&lt;/a&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now that you have all the information and you have squeezed all the product and technical knowledge about your target, it’s time to go to the next phase!&lt;/p&gt;

&lt;h2&gt;
  
  
  Vulnerability scan
&lt;/h2&gt;

&lt;p&gt;Usually performed by using software like BurpSuite, Nessus, Nikto, SearchSploit, and a long etcetera. You’re objective is to check if the current system (that you already know from the first step) has existing vulnerabilities that can be “automatically” exploited (because there is already a script to do it). Also, as a second step, you should try to look for vulnerabilities such as XSS, XXE, SSRF or CSRF on the website and yes, you also have tools to help you with that.&lt;/p&gt;

&lt;p&gt;To be honest, if you have the money you should aim to grab a BurpSuite PRO license since it has a bunch of useful tools like a spider, intruder, repeater, plugins, etc. Otherwise, you should look for different options. I’m currently looking for some free (or at least way cheaper) setup that can substitute it so if you know about it, let me know! &lt;/p&gt;

&lt;h2&gt;
  
  
  Attack phase
&lt;/h2&gt;

&lt;p&gt;As soon as you discover a vulnerability that could make you enter somehow in the system (like uploading a PHP file that has a reverse TCP script in it), you will be entering into the attack phase. In this phase, and if you got access to the system, you must analyze in which state is your user when landing in the target’s console. Now it’s time to gather all the information you can from the current system that you’re connected at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How many users does the system have and which one are you?&lt;/li&gt;
&lt;li&gt;Which services and/or processes are running? &lt;/li&gt;
&lt;li&gt;Are IPTABLES configured? Can you check for other devices in the same network?&lt;/li&gt;
&lt;li&gt;Very important: Are there any logs and/or backups that could be unencrypted? Maybe a second drive?&lt;/li&gt;
&lt;li&gt;Also very important: Are there any cronjobs? public/private keys that you can access?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Post-exploitation
&lt;/h2&gt;

&lt;p&gt;The lasts questions from above (and of course if you find something) make you enter the post-exploitation phase. In this one, your objective is to maintain access to the system. You should be capable of entering that server as many times as you want. Some ideas that come to my mind are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using cronjobs + reverse shell (in case the machine is restarted)&lt;/li&gt;
&lt;li&gt;Start service with your script&lt;/li&gt;
&lt;li&gt;Take advantage of existing automated scripts that you could modify&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Reporting
&lt;/h2&gt;

&lt;p&gt;When penetration testing is finished, the last step is collecting all the vulnerabilities you could find and create a report. The format of the report could be a pdf or even a video showing what did you find and it should be as specific as possible. I don’t have much experience writing pentest reports so I won’t dig into this but if you have any tips, just let me know!&lt;/p&gt;

&lt;h3&gt;
  
  
  Bonus tip
&lt;/h3&gt;

&lt;p&gt;I just want to mention that taking notes is the most important thing you should do when performing a penetration test. You want to avoid repetition as much as possible. For example, you shouldn’t have to run Nmap again to check for open ports if you did it before. Save all the information you can so you can just check it in the future and repeat steps only if you feel that the system has changed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Acronyms and concepts:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;XSS:&lt;/strong&gt; Cross-Site Scripting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CSRF:&lt;/strong&gt; Cross-Site Request Forgery&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XXE:&lt;/strong&gt; XML external entity&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSRF:&lt;/strong&gt; Server Side Request Forgery&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reverse shell:&lt;/strong&gt; Opening a remote shell from our target machine. Here you have some examples: &lt;a href="http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet"&gt;http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet&lt;/a&gt;. I’ll talk about this in the future.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Previous weeks:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://dev.to/theagilemonkeys/week-0-security-blog-posts-introduction-fff"&gt;Week 0: Security blog posts introduction&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/theagilemonkeys/week-1-being-conscious-about-your-attack-surface-3elj"&gt;Week 1: Being conscious about your attack surface&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>infosec</category>
      <category>blogpost</category>
      <category>pentest</category>
    </item>
    <item>
      <title>Week 1: Being conscious about your attack surface</title>
      <dc:creator>J2RGEZ</dc:creator>
      <pubDate>Thu, 19 Mar 2020 20:14:56 +0000</pubDate>
      <link>https://dev.to/j2rguez/week-1-being-conscious-about-your-attack-surface-3elj</link>
      <guid>https://dev.to/j2rguez/week-1-being-conscious-about-your-attack-surface-3elj</guid>
      <description>&lt;p&gt;Nowadays, almost everyone in the world is connected somehow to a piece of software. It doesn’t matter if it’s your smartphone, your PC or just the app you use to talk with your friends. It’s very important to note that although this has made our life easier, every day we will have new access points for an attack to happen.&lt;/p&gt;

&lt;p&gt;But getting straight to the point, what is your “attack surface”?. According to Wikipedia, “The attack surface of a software environment is the sum of the different points (the "attack vectors") where an unauthorized user (the "attacker") can try to enter data to or extract data from an environment”. So, whatever application or system you’re using, as I said before, takes part of your attack surface, and it’s your responsibility to keep it as low as possible.&lt;/p&gt;




&lt;h2&gt;
  
  
  But, how can I identify my attack surface?
&lt;/h2&gt;

&lt;p&gt;Well, as I said before, everything that you’re connected to is a possible access point for an attacker and, more access points means bigger attack surface, for example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bluetooth devices:&lt;/strong&gt; We all use Bluetooth, it doesn’t matter if it’s for your headphones, your portable speaker or any other device.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Laptop:&lt;/strong&gt; Let’s say you don’t use VPNs to connect to networks and you also don’t care about software updates (or you take too long to do them)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smartphone:&lt;/strong&gt; Again, you don’t have a VPN and you always have the wireless ON. And again, you don’t care about software updates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Human errors:&lt;/strong&gt; Of course, this is the thing that increases the most your attack surface.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This hypothetic user has a very big attack surface that can be exploitable overtime. In the future, I will talk specifically about different tools or techniques that can help you perform these attacks, but for now, let’s describe what a hacker can do with this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Being in the same network as a possible attacker (aka anyone) is a very risky thing to do. From the same network, malicious hackers can:

&lt;ul&gt;
&lt;li&gt;Redirect you to malicious pages (DNS spoofing). This can lead to phishing attacks, for example.&lt;/li&gt;
&lt;li&gt;Listen and capture your traffic&lt;/li&gt;
&lt;li&gt;Get advantage of nonupdated software versions. There are a lot of places on the internet with the latest exploits available for anyone to check. For example &lt;a href="https://www.exploit-db.com/"&gt;https://www.exploit-db.com/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Also, by having your Bluetooth/Wifi always active, hackers can:

&lt;ul&gt;
&lt;li&gt;Try to connect to your Bluetooth devices&lt;/li&gt;
&lt;li&gt;Connect to you via Bluetooth: By “plugin off” your existing devices (i.e. smartwatches) and taking its place&lt;/li&gt;
&lt;li&gt;Open a public network, that your smartphone will log into, and you already know what could happen if you’re in the same network. &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Apart from that, and talking about human errors, you should never ignore your antivirus/browser/firewall security warnings (unless you really know what you’re doing). Also, you should be really careful about emails (mostly phishing), images, and links from weird websites. I always try to check the URL from the bottom left corner of my browser to verify that I’m redirected to the desired place.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, to sum up, these are the things you can do to decrease your attack surface in a local environment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Disable Wifi and Bluetooth when you’re not using it.&lt;/li&gt;
&lt;li&gt;Don’t ignore security warnings from any device/software.&lt;/li&gt;
&lt;li&gt;Never connect directly to a public network. You can use a VPN. I personally prefer to connect to my smartphone network (to whatever internet provider you have) via a VPN.&lt;/li&gt;
&lt;li&gt;Always update your software. Updates are not only for new features.&lt;/li&gt;
&lt;li&gt;Always suspend/shutdown your PC/smartphone if you’re not using it. &lt;/li&gt;
&lt;li&gt;Use different passwords in different sites. You can take advantage of password managers like 1password, which also includes password generators (very recommended).&lt;/li&gt;
&lt;li&gt;Do not plug your phone into anything that you don’t own. For example, recharge stations in airports, a friend’s laptop, etc.&lt;/li&gt;
&lt;li&gt;Nitpicky one: People behind you/watching your screen is always a bad sign. You want to give as little information you can to possible attackers (like watching your keyboard in this case). I will elaborate a bit on dictionary generators in the future, which is kind of related to this.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Developers perspective
&lt;/h2&gt;

&lt;p&gt;Developers are the ones that introduce those new software versions we were talking about before. Software development is not trivial, and because of that, developers can forget about sanitizing certain inputs in your frontend and/or backend applications. I really think that it’s important to note that updating your smartphone applications (as a normal user) and updating your software libraries have the same importance level. Let’s go back to the famous exploit-DB website and let’s look for Spring. For instance, you could use this exploit: &lt;a href="https://www.exploit-db.com/exploits/36130"&gt;https://www.exploit-db.com/exploits/36130&lt;/a&gt;. Although this is an old bug, you can see how important is to update your frameworks/libraries. You can keep playing with that website to find other cool vulnerabilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  Developers attack surface
&lt;/h3&gt;

&lt;p&gt;Apart from versions, developers should be conscious of their system. Do you REALLY need that Redis host for your application? Keep in mind that more infrastructure means a wider attack surface, and also you will spend a lot of time by securing these hosts (by not exposing unnecessary ports, keeping them behind a bastion host, etc). &lt;/p&gt;

&lt;p&gt;You may think that all your infrastructure is safe in the eyes of people. “Who will know I’m using Redis? Or that I have a MySQL DB?” you may ask. You can’t imagine the amount of service/domains discovering tools hackers have so knowing what technologies your system is using isn’t, in general, a real challenge. This topic deserves its own post so I’ll keep that for the future.&lt;/p&gt;

&lt;p&gt;Apart from that, as a developer, you should know which parts of your company are in use and which not, and you must stop anything that is not used (S3 buckets, old GitHub repositories, unused server instances...). Again, thanks to reconnaissance tools and/or hacker’s expertise, you are just allowing people to know more about your systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  Reducing human errors
&lt;/h2&gt;

&lt;p&gt;The weakest point in a system is the people that are part of it. From developers to managers to CEOs, everybody is part of your security. It doesn’t matter if a possible ransomware attack started by a manager clicking an email or if a developer inserted a conference gifted USB in one of the company laptops.&lt;/p&gt;

&lt;p&gt;The point is that &lt;strong&gt;we are all responsible for our security breaches&lt;/strong&gt;. If a developer setups a server with default credentials (silly but realistic example) and he/she doesn’t know about its consequences, it’s probably because your company is not taking enough care about security. Talk with your people about this periodically, give them some examples of possibles cases were a security breach could happen, &lt;strong&gt;train your people&lt;/strong&gt;. No one is going to do it.&lt;/p&gt;

&lt;p&gt;It’s never too late to start, and you don’t want to be that guy that will have to pay 100,000$ to rescue its data (or worst, its clients data). Remember that you are not the target of anyone, yet.&lt;/p&gt;

</description>
      <category>security</category>
      <category>infosec</category>
      <category>blogpost</category>
      <category>pentest</category>
    </item>
    <item>
      <title>Week 0: Security blog posts introduction</title>
      <dc:creator>J2RGEZ</dc:creator>
      <pubDate>Fri, 13 Mar 2020 10:28:08 +0000</pubDate>
      <link>https://dev.to/j2rguez/week-0-security-blog-posts-introduction-fff</link>
      <guid>https://dev.to/j2rguez/week-0-security-blog-posts-introduction-fff</guid>
      <description>&lt;p&gt;Hi! My name is Juanjo and as some of you may know, I’m a Software Developer at The Agile Monkeys. From the last year or so (early 2019), I began my path into the penetration testing world and I have to be honest, I’m loving every piece of it. That’s why today, approximately 1 year after, I decided to write about some stuff I have found interesting during this amazing year (plus new things I will learn of course).&lt;/p&gt;

&lt;p&gt;You might be asking what a penetration test is (otherwise just skip this paragraph). A penetration test is a process of studying/analyzing a system with the objective of finding existing vulnerabilities and reporting them back to the system’s owner (so they can fix them). You can check an example of what a penetration test report looks like here: &lt;a href="https://www.offensive-security.com/reports/sample-penetration-testing-report.pdf"&gt;https://www.offensive-security.com/reports/sample-penetration-testing-report.pdf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First of all, I want to clarify that I’m not a penetration tester and I’m not even close to being a pro at all, but I consider that I have studied enough to talk about certain topics or at least the initial/intermediate steps of it. So first of all, I would like to clarify how this is going to be organized:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I will write about a different topic from every Thursday afternoon/evening to the next one. That means that you will have something to read every Thursday. &lt;/li&gt;
&lt;li&gt;These posts will not be organized as chapters, and I will probably explain different and unrelated things every time. This is because the beginning part of it could get really tedious to follow.&lt;/li&gt;
&lt;li&gt;The objective is not only me teaching you stuff, but you also participating in the comments so we can all share our knowledge. Maybe we can all learn something new!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, let the write begins!!&lt;/p&gt;

</description>
      <category>security</category>
      <category>infosec</category>
      <category>blogpost</category>
      <category>pentest</category>
    </item>
  </channel>
</rss>
