<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dinithi Liyanage on Medium]]></title>
        <description><![CDATA[Stories by Dinithi Liyanage on Medium]]></description>
        <link>https://medium.com/@dinithi.adithya?source=rss-629377abc8c7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Dinithi Liyanage on Medium</title>
            <link>https://medium.com/@dinithi.adithya?source=rss-629377abc8c7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 04:34:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dinithi.adithya/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Just a VPN Login | TryHackMe Walkthrough]]></title>
            <link>https://medium.com/@dinithi.adithya/just-a-vpn-login-tryhackme-walkthrough-f4de5c4f294f?source=rss-629377abc8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4de5c4f294f</guid>
            <category><![CDATA[just-a-vpn-login]]></category>
            <category><![CDATA[tryhackme-writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <dc:creator><![CDATA[Dinithi Liyanage]]></dc:creator>
            <pubDate>Sat, 12 Sep 2026 15:36:47 GMT</pubDate>
            <atom:updated>2026-09-12T15:36:47.625Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uYmh-b7HLErICgaVsYRK5w.png" /><figcaption>CTF Header</figcaption></figure><h3>Introduction</h3><p>Link to Room: <a href="https://tryhackme.com/room/justavpnlogin">https://tryhackme.com/room/justavpnlogin</a></p><p>The investigation begins with an alert appearing on a SOC dashboard regarding an <strong>unusual VPN login</strong>. The alert indicates that susan.martin@probablyfine.thm, an employee from the Marketing team, logged into the company VPN from <strong>37.19.201.132</strong>, an IP address associated with Singapore.</p><p>Initially, the login does not seem particularly concerning. The SOC handover notes mention that Susan is currently in Singapore attending a security vendor conference, so the location of the login appears to be consistent with her travel. However, according to standard SOC procedures, the IP address must still be verified using the organisation’s threat intelligence platform, <strong>TryDetectThis</strong>.</p><p>The investigation takes a more serious turn when the SOC team contacts Susan. She confirms that <strong>she did not log in to the company VPN</strong>. She also reveals that while using public Wi-Fi at a café, she was unexpectedly prompted to install a tool presented as a <strong>“security check”</strong> tool, which she proceeded to install.</p><p>Host telemetry subsequently identifies a suspicious binary associated with the following hash:</p><p>b8e02f2bc0ffb42e8cf28e37a26d8d825f639079bf6d948f8debab6440ee5630</p><p>The objective of this investigation is to determine what happened, understand what the suspicious binary does, and identify the threat associated with the activity. To do this, we will use <strong>TryDetectThis</strong> to investigate the IP address and malware hash, pivot through the available threat intelligence, and use the gathered information to answer the questions in the challenge.</p><h3>Question 01 : What is the ASN number related to the IP?</h3><p>The first step is to investigate the IP address associated with the suspicious VPN login.</p><p>Using the threat intelligence database provided by TryDetectThis, search for:</p><p>37.19.201.132</p><p>The IP overview contains several pieces of information about the address, including the <strong>Autonomous System Number (ASN)</strong> associated with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RbfZkt4qOhNxqUycLH53lQ.png" /><figcaption>Question 01</figcaption></figure><blockquote><strong><em>What is an ASN number?</em></strong></blockquote><blockquote><em>An </em><strong><em>Autonomous System Number (ASN)</em></strong><em> is a unique number assigned to an autonomous system — a network or collection of networks operating under a common routing policy.</em></blockquote><blockquote><em>ASNs are used to identify networks on the internet and allow them to exchange routing information using the </em><strong><em>Border Gateway Protocol (BGP)</em></strong><em>.</em></blockquote><blockquote><em>A simple way to think about it is that an IP address identifies a particular destination, while an ASN identifies the larger network to which that IP belongs.</em></blockquote><h3>Question 02: Which service is offered from this IP?</h3><p>The same IP investigation provides another useful clue. Further down the page, the <strong>File Relations</strong> section lists files that have been observed communicating with the IP address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IhlMLmFt3qiQArp20prAcw.png" /><figcaption>Question 02</figcaption></figure><p>When you connect to a VPN, our traffic first goes to a server owned by the VPN company. Websites and services only see the <strong>VPN company’s IP address</strong>, not your real home/office IP.</p><p>Based on the information gathered so far, several of the associated files reference VPN and proxy applications, including applications such as Free VPN, Super VPN and Other Android/Windows VPN clients.</p><p>This tells us that the address is being used as part of <strong>VPN/proxy infrastructure</strong>.</p><h3>Question 03: What is the filename of the file related to the hash?</h3><p>The room provides this hash:</p><p>b8e02f2bc0ffb42e8cf28e37a26d8d825f639079bf6d948f8debab6440ee5630</p><p>Searching for this hash in TryDetectThis brings up the corresponding file record. Within the <strong>File Overview</strong> section, we can find information about the file, including its filename.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uKfBHs0XCPMSL8wpUD1qTQ.png" /><figcaption>Question 03</figcaption></figure><h3>Question 04: What is the threat signature that Microsoft assigned to the file?</h3><p>The file overview also contains a <strong>Vendor Analysis</strong> section. This section shows how different security vendors have classified or detected the file. Each vendor may assign its own detection name or threat signature based on the characteristics of the sample.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cKz3z9yuu5KjQVhuEUn5pw.png" /></figure><blockquote><strong>What is Vendor Analysis?</strong></blockquote><blockquote>Vendor analysis is a collection of detections provided by different antivirus and security vendors for a particular file, domain, IP address, or other indicator.</blockquote><h3>Question 05: One of the contacted domains is part of a large malicious infrastructure cluster. Based on its HTTPS certificate, how many domains are linked to the same campaign?</h3><p>The hint instructs us to:</p><p><em>Pivot on the contacted domains that are malicious and check their certificate information.</em></p><p>Returning to the file’s analysis page, the <strong>File Communication Behaviour</strong> section contains a list of domains contacted by the binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pEH2-ToVVVKq8QmXqM-iuQ.png" /><figcaption>Question 05–1</figcaption></figure><p>We can investigate the suspicious domains individually. For example, searching for the relevant domain reveals an <strong>HTTPS Certificate Data</strong> section.</p><p>Within the certificate information, we are interested in the <strong>Subject Alternative Names (SANs)</strong>. The SAN list contains multiple domains associated with the same certificate.</p><p>To determine the requested number, the domains listed under the SAN field can be copied into a text editor and counted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*M263YKsCLJKgUqZxUs520Q.png" /><figcaption>Question 05–2</figcaption></figure><blockquote><strong>What is SAN?</strong></blockquote><blockquote>A <strong>Subject Alternative Name (SAN)</strong> is an extension to an X.509 digital certificate that allows a single SSL/TLS certificate to secure multiple identities, such as domain names, subdomains, and IP addresses. When a website gets an HTTPS certificate, the certificate must list the domain name(s) it is allowed to protect. The main name is usually put in the <strong>Common Name (CN)</strong> field. Any <em>extra</em> domain names are listed in the <strong>Subject Alternative Name (SAN)</strong> field.</blockquote><h3>Question 06: The file matches one of the YARA rules made by “kevoreilly”. What line is present in the rule’s “condition” field?</h3><p>Returning to the file’s record, the <strong>Detections and Reports</strong> section contains YARA detections associated with the sample. One of the matching rules was created by <strong>kevoreilly</strong>. Following the link provided for the rule takes us to the corresponding repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FJNiepx7mvC4dFvt3Ls5Kw.png" /><figcaption>Question 06–1</figcaption></figure><p>The rule contains a condition section, which defines the logical conditions that must be satisfied for the YARA rule to match a file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GsWnRmWxpkCnpRK5FAX8zQ.png" /><figcaption>Question 06–2</figcaption></figure><p>What is a YARA Rule?</p><p>A <strong>YARA rule</strong> is a pattern-matching script used by cybersecurity analysts and detection tools to identify and classify malware. A typical YARA rule contains several components:</p><ul><li><strong>meta :</strong> Optional descriptive info like the author, date, or threat family (does not affect matching logic).</li><li><strong>strings:</strong> The specific patterns to look for—including text, hexadecimal byte sequences, or regular expressions (regex).</li><li><strong>condition:</strong> The boolean logic (and, or, not, any of them) that dictates when the rule triggers a match.</li></ul><p>For example:</p><pre>rule ExampleMalwareRule {<br>    meta:<br>        author = &quot;Analyst Name&quot;<br>        description = &quot;Detects a specific sample&quot;<br>    <br>    strings:<br>        $text_string = &quot;malicious_command&quot;<br>        $hex_string = { 6A 40 68 00 30 00 00 }<br>        $re1 = /md5: [0-9a-fA-F]{32}/ [0-9.6.3]<br>    condition:<br>        $text_string and ($hex_string or $re1)<br>}</pre><h3>Question 07: The file is also mentioned in a threat intel report. What is the title of the report mentioning this hash?</h3><p>The investigation now moves from technical file analysis towards broader threat intelligence.</p><p>Within the same <strong>Detections and Reports</strong> section, the sample is referenced by a threat intelligence report.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Qr_flB-7-9fUgjvAsBRrw.png" /><figcaption>Question 07</figcaption></figure><p>The report provides additional context about the malware and the threat actors or affiliates associated with it.</p><p>This is an important pivot because the investigation is no longer limited to identifying what the binary is. We can now use the report to understand the wider threat ecosystem surrounding the malware.</p><h3>Question 08: Which team did the author of the malware start collaborating with in early 2024?</h3><p>Following the threat intelligence report from the previous question provides additional information about the malware and its ecosystem. Searching the report for references to <strong>2024</strong> helps locate the relevant section describing a collaboration that began during that period.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z1Nqaclsl5Xk5idQAH6usQ.png" /><figcaption>Question 08</figcaption></figure><h3>Question 09: A Mexican-based affiliate related to the malware family also uses other infostealers. Which mentioned infostealer targets Android systems?</h3><p>Further down the report, the discussion moves to affiliates associated with the malware family. The report specifically mentions a <strong>Mexican-based affiliate</strong> and identifies other infostealers associated with the affiliate’s activities. Among the malware families mentioned, one specifically targets <strong>Android systems</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*ruHGvVVz4HQEo3eKOCfkjg.png" /><figcaption>Question 09</figcaption></figure><h3>Question 10: The report states that the affiliates behind the malware use the services of AnonRDP. Which Mitre ATT&amp;CK sub-technique does this align with?</h3><p>The final investigation step involves mapping the observed behaviour to the <strong>MITRE ATT&amp;CK framework</strong>.</p><p>The threat intelligence report mentions that the affiliates use <strong>AnonRDP</strong>.</p><p>Searching for AnonRDP reveals that it is associated with anonymous VPS/RDP services. The relevant behaviour can then be mapped to the appropriate MITRE ATT&amp;CK technique.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S_Qrb4ZTc8AhdHyhinHC9g.png" /><figcaption>Question 10–1</figcaption></figure><p>The report provides an appendix containing the relevant MITRE ATT&amp;CK techniques.</p><p>By comparing the behaviour of AnonRDP with the ATT&amp;CK framework, we can identify the corresponding <strong>sub-technique for the use of virtual private servers</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dn_zGckiYr24r0Ix9qCbJg.png" /><figcaption>Question 10–2</figcaption></figure><h3>Summary and Key Takeaways</h3><p>The investigation began with what initially appeared to be a relatively normal VPN login. Susan was known to be travelling in Singapore, so the login location itself did not immediately indicate a compromise. However, following standard SOC procedures and investigating the source IP revealed additional information that warranted further investigation.</p><p>From there, the investigation followed a series of intelligence pivots:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*dTptO7yqIWVOLeMzbUPhKg.png" /></figure><p>Several key lessons can be taken from this investigation.</p><h4>1. Context matters when investigating security alerts</h4><p>The initial alert could easily have been dismissed because Susan was genuinely in Singapore. However, the fact that the login location matched her physical location did not prove that the login was legitimate. Verifying the IP independently was therefore an important step.</p><h4>2. Infrastructure can reveal relationships between threats</h4><p>The investigation was able to uncover substantial information about the suspicious binary using threat intelligence sources, vendor detections, YARA rules, file communication behaviour, and existing research.</p><p>This highlights the value of <strong>OSINT and threat intelligence platforms</strong> during an initial investigation, particularly when an analyst needs to quickly determine whether an indicator is associated with known malicious activity.</p><p>Overall, this room provides a good example of how a SOC analyst can move from a seemingly routine alert to a much broader threat investigation. The key skill is not simply finding individual answers, but <strong>following the evidence and using each finding as a pivot for the next stage of the investigation</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4de5c4f294f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Rich Authorization Requests (RAR) in OAuth 2.0]]></title>
            <link>https://medium.com/@dinithi.adithya/understanding-rich-authorization-requests-rar-in-oauth-2-0-0a472973d6c9?source=rss-629377abc8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a472973d6c9</guid>
            <category><![CDATA[authorization-details]]></category>
            <category><![CDATA[rar]]></category>
            <category><![CDATA[oauth]]></category>
            <dc:creator><![CDATA[Dinithi Liyanage]]></dc:creator>
            <pubDate>Thu, 05 Jun 2025 09:02:24 GMT</pubDate>
            <atom:updated>2025-06-05T09:02:24.765Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OYpWIOkOcxciXG1nQumGsA.png" /><figcaption>OAuth 2.0 flow with RAR</figcaption></figure><h3>Introduction</h3><p>In traditional OAuth 2.0 authorization flows, access control is typically managed using scopes. These scopes are simple strings that describe the client’s desired level of access to resources, such as read or write permissions. While this works well for basic and static authorization scenarios, it falls short when more complex, fine-grained permissions are required.</p><p>This is where <strong>Rich Authorization Requests (RAR)</strong> come into play. Defined in <a href="https://datatracker.ietf.org/doc/html/rfc9396">RFC 9396</a>, RAR enhances OAuth 2.0 by allowing clients to make detailed authorization requests using structured JSON.</p><h3>The Problem with Scopes</h3><p>Scopes in OAuth 2.0 are inherently <strong>coarse-grained</strong> and <strong>static</strong>. For instance:</p><ul><li>scope=profile_read may allow a client to read a user&#39;s profile.</li></ul><p>But it cannot support complex actions like:</p><ul><li><em>“Transfer 45 Euros to Merchant A”</em></li><li><em>“Give read access to Directory A and write access to File X”</em></li></ul><h3>What is RAR?</h3><p>RAR introduces a new parameter called authorization_details, which allows clients to define fine-grained authorization requirements using JSON data structures.</p><h4>Key Features</h4><ul><li>Fine-grained access with detailed permissions using structured data.</li><li>Allows to define your own types and rules.</li><li>Supports common fields such as locations, actions, datatypes, privileges, and more.</li><li>authorization_details can be used <strong>in addition to</strong> traditional scopes — RAR doesn&#39;t replace them.</li></ul><h3>Structure of Authorization Details</h3><p>The authorization_details parameter is a <strong>JSON array</strong> of <strong>objects</strong>, each of which:</p><ul><li><strong>Must include a </strong><strong>type field</strong> (required, string).</li><li><strong>Can include custom fields</strong> depending on the type.</li><li><strong>Can have multiple entries of the same or different types</strong>.</li></ul><h4>Example:</h4><pre>&quot;authorization_details&quot;: [<br> {<br>   &quot;type&quot;: &quot;payment_initiation&quot;,<br>   &quot;instructedAmount&quot;: {<br>     &quot;currency&quot;: &quot;EUR&quot;,<br>     &quot;amount&quot;: &quot;45.00&quot;<br>   },<br>   &quot;creditorName&quot;: &quot;Merchant A&quot;,<br>   &quot;creditorAccount&quot;: {<br>     &quot;iban&quot;: &quot;DE02100100109307118603&quot;<br>   }<br> }<br>]</pre><h3>Common Data Fields</h3><p>Rich Authorization Requests (RAR) define a set of <strong>common data fields</strong> that can be reused across different API types. These fields help express fine-grained access requirements in a standardized and extensible way.</p><ul><li><strong>locations</strong>: An array of strings that specify the location of the resource or resource server—typically represented as URIs.</li><li><strong>actions</strong>: An array of strings describing the types of operations the client intends to perform on the resource (e.g., read, write).</li><li><strong>datatypes</strong>: An array of strings representing the categories of data being requested (e.g., contacts, photos).</li><li><strong>identifier</strong>: A string used to uniquely identify a specific resource instance exposed by the API.</li><li><strong>privileges</strong>: An array of strings denoting the levels or types of access requested (e.g., admin, view_only).</li></ul><p>When multiple common fields are combined in a request, the permissions being requested represent <strong>all possible combinations</strong> of the listed actions, data types, and other attributes.</p><h4>Example</h4><p>In the example below, the client is requesting access to <strong>both </strong><strong>contacts and </strong><strong>photos</strong> of customers, with <strong>read and </strong><strong>write</strong> permissions on each. For instance, if ‘read’ and ‘write’ actions are combined with ‘contacts’ and ‘photos’ data types, the client could read contacts, write contacts, read photos, and write photos.”</p><pre>[ <br>  {<br>    &quot;type&quot;: &quot;customer_information&quot;, <br>    &quot;locations&quot;: [ <br>      &quot;https://example.com/customers&quot; <br>    ], <br>    &quot;actions&quot;: [ <br>      &quot;read&quot;, <br>      &quot;write&quot; <br>    ], <br>    &quot;datatypes&quot;: [ <br>      &quot;contacts&quot;, <br>      &quot;photos&quot; <br>    ] <br>  } <br>]</pre><h3>How It Works</h3><p>Rich Authorization Requests (RAR) are used by passing the authorization_details parameter to the /authorize endpoint as part of the OAuth 2.0 authorization request. This parameter allows the client to convey fine-grained access requirements in a structured format.</p><p>The <strong>Authorization Server (AS)</strong> performs <strong>early validation</strong> of the authorization_details, ensuring that:</p><ul><li>Each request matches a supported type defined by the AS.</li><li>The structure conforms to a predefined JSON schema (if one is configured).</li></ul><p>Once validated, the AS includes the approved authorization_details in the resulting <strong>access token</strong>, often as a <strong>claim within a JWT</strong> (JSON Web Token).</p><p>The <strong>Resource Server (RS)</strong> plays a <strong>crucial role</strong> during token introspection or verification:</p><ul><li>It parses the authorization_details from the access token.</li><li>It enforces the fine-grained permissions embedded in the request.</li><li>It ensures the client only performs actions and accesses resources explicitly granted by the resource owner.</li></ul><h3>Defining Authorization Detail Types</h3><p>Let’s consider a simple use case:</p><p>“Grant me read access to folder reports/2023 and write access to file draft.docx.”</p><p>The corresponding authorization_details array would look like this:</p><pre>&quot;authorization_details&quot;: [<br>  {<br>    &quot;type&quot;: &quot;simple_fs_access&quot;,<br>    &quot;resources&quot;: [<br>      {<br>        &quot;path&quot;: &quot;reports/2023&quot;,<br>        &quot;actions&quot;: [&quot;read&quot;]<br>      }<br>    ]<br>  },<br>  {<br>    &quot;type&quot;: &quot;simple_fs_access&quot;,<br>    &quot;resources&quot;: [<br>      {<br>        &quot;path&quot;: &quot;draft.docx&quot;,<br>        &quot;actions&quot;: [&quot;write&quot;]<br>      }<br>    ]<br>  },<br>  {<br>    &quot;type&quot;: &quot;simple_fs_access&quot;,<br>    &quot;resources&quot;: [<br>      {<br>        &quot;path&quot;: &quot;archive/2021.zip&quot;,<br>        &quot;actions&quot;: [&quot;read&quot;, &quot;delete&quot;]<br>      }<br>    ]<br>  }<br>]</pre><p>A server can define expected structures using <strong>JSON Schema</strong>. Here’s an example for a custom type the above use case:</p><pre>{<br>  &quot;type&quot;: &quot;object&quot;,<br>  &quot;required&quot;: [&quot;type&quot;, &quot;resources&quot;],<br>  &quot;properties&quot;: {<br>    &quot;type&quot;: {<br>      &quot;type&quot;: &quot;string&quot;,<br>      &quot;enum&quot;: [&quot;simple_fs_access&quot;]<br>    },<br>    &quot;resources&quot;: {<br>      &quot;type&quot;: &quot;array&quot;,<br>      &quot;items&quot;: {<br>        &quot;type&quot;: &quot;object&quot;,<br>        &quot;required&quot;: [&quot;path&quot;, &quot;actions&quot;],<br>        &quot;properties&quot;: {<br>          &quot;path&quot;: {<br>            &quot;type&quot;: &quot;string&quot;<br>          },<br>          &quot;actions&quot;: {<br>            &quot;type&quot;: &quot;array&quot;,<br>            &quot;items&quot;: {<br>              &quot;type&quot;: &quot;string&quot;,<br>              &quot;enum&quot;: [&quot;read&quot;, &quot;write&quot;, &quot;delete&quot;, &quot;list&quot;]<br>            }<br>          }<br>        }<br>      }<br>    }<br>  }<br>}</pre><p>This schema allows the Authorization Server to <strong>pre-validate</strong> requests and reject malformed or unauthorized combinations early in the flow.</p><h3>Conclusion</h3><p><strong>Rich Authorization Requests (RAR)</strong> bring powerful, structured semantics to OAuth authorization. By moving beyond flat scopes and embracing expressive JSON objects, RAR enables truly fine-grained authorization.</p><p>If you’re building or extending an API where users need to authorize <strong>specific actions on specific resources</strong>, RAR is the right tool for the job.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a472973d6c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Is Financial Data Sharing, Open Banking, and FDX?]]></title>
            <link>https://medium.com/@dinithi.adithya/what-is-financial-data-sharing-open-banking-and-fdx-bad33dfe9207?source=rss-629377abc8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/bad33dfe9207</guid>
            <category><![CDATA[open-banking]]></category>
            <category><![CDATA[financial-data-sharing]]></category>
            <category><![CDATA[fdx]]></category>
            <dc:creator><![CDATA[Dinithi Liyanage]]></dc:creator>
            <pubDate>Thu, 22 May 2025 06:45:09 GMT</pubDate>
            <atom:updated>2025-05-22T06:45:09.768Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s world, managing money is no longer just about going to the bank. Thanks to technology, we can now use apps to track spending, apply for loans online, and get advice on saving — all from our phones. But how do these apps get your financial information in the first place? That’s where <strong>financial data sharing</strong>, <strong>Open Banking</strong>, and <strong>FDX</strong> come in.</p><p>Let’s break it down in simple terms.</p><h3>What Is Financial Data Sharing?</h3><p>Financial data sharing is when you let trusted apps or services access your financial info — like your bank account balance or recent transactions — so they can help you in smarter ways.</p><h3>Here’s how it works:</h3><ul><li><strong>Data Holders and Data Users</strong>: Your bank or credit card company holds your financial data. Apps or services like budgeting tools or investment platforms want to use that data (with your permission) to help you.</li><li><strong>Why Share Data?</strong><br> So these services can give you things like spending reports, better loan offers, or personalized financial tips.</li><li><strong>Your Permission Matters</strong>:<br> You have to say “yes” before your data is shared. You’re always in control.</li><li><strong>Security Is Key</strong>:<br> Your data needs to be shared safely, with strong privacy protections.</li><li><strong>Same Language for All</strong>:<br> Different systems need to “talk” to each other, so common standards help make the sharing smooth and consistent.</li></ul><h3>Why Share Financial Data?</h3><p>When done right, sharing your financial info can bring a lot of benefits:</p><ul><li><strong>Better, Personalized Services</strong><br> Apps can suggest ways to save money, help with budgeting, or recommend financial products that fit your needs.</li><li><strong>Smarter Money Decisions</strong><br> Seeing all your accounts in one place helps you understand where your money is going.</li></ul><h3>What Is Open Banking?</h3><p>Open Banking is a system that allows banks to safely share your data with third-party apps or companies — <em>only if you give them permission</em>. This is done using <strong>APIs</strong> (Application Programming Interfaces).</p><p>Open Banking helps you:</p><ul><li>Get better financial tools and apps</li><li>See all your money in one place</li><li>Apply for services faster</li><li>Have more control over your own financial data</li></ul><p>It also opens the door for new companies to create helpful financial tools and compete with traditional banks.</p><p>In many countries, governments set rules that banks and apps must follow to keep Open Banking safe and fair.</p><h3>What Is FDX?</h3><p><strong>FDX</strong> stands for <strong>Financial Data Exchange</strong>. It’s a non-profit group that’s helping banks, fin-tech companies, and other financial services use the <strong>same set of rules and standards</strong> when sharing financial data.</p><p>FDX is mostly used in the U.S. and Canada.</p><p>Their goal is to make data sharing <strong>safer, faster, and more consistent</strong> for everyone involved.</p><h3>How Does FDX Work?</h3><p>Instead of old methods like <strong>screen scraping</strong> (where apps log in as if they were you), FDX uses <strong>secure tokens</strong>. Here’s what that means:</p><ol><li><strong>You approve</strong> sharing your data.</li><li><strong>You log in directly to your bank</strong>, not the app.</li><li>The bank sends a <strong>secure token</strong> to the app.</li><li>That token allows the app to access your data (only the parts you agreed to share).</li><li><strong>No passwords</strong> are shared with the app.</li></ol><p>FDX uses popular security methods like <strong>OAuth2</strong> and <strong>OpenID Connect</strong>, which are widely used in tech for secure sign-ins.</p><h3>In Simple Terms…</h3><ul><li>Financial data sharing is like letting a trusted app look at your bank info — with your permission — so it can help you manage your money better.</li><li>Open Banking is a safe way for banks to share your info with apps using secure technology.</li><li>FDX is the team that helps everyone use the same secure methods so that data sharing is smooth and safe.</li></ul><h3>Final Thoughts</h3><p>The way we manage money is changing fast. By sharing your financial data in a safe and controlled way, you can get access to better tools, smarter insights, and a more personalized experience. As long as it’s done securely — with your consent — financial data sharing, Open Banking, and FDX are making financial life easier and more connected than ever before.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bad33dfe9207" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding MVC, DAO, and DTO: A Clean Way to Structure Your Application]]></title>
            <link>https://medium.com/@dinithi.adithya/understanding-mvc-dao-and-dto-a-clean-way-to-structure-your-application-566437a0dbba?source=rss-629377abc8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/566437a0dbba</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[dao]]></category>
            <category><![CDATA[mvc-architecture]]></category>
            <category><![CDATA[dto]]></category>
            <dc:creator><![CDATA[Dinithi Liyanage]]></dc:creator>
            <pubDate>Sat, 19 Apr 2025 13:31:34 GMT</pubDate>
            <atom:updated>2025-04-19T13:31:34.015Z</atom:updated>
            <content:encoded><![CDATA[<p>When you first dive into building Java applications, things can get messy pretty quickly — business logic tangled with UI code, database queries mixed with HTML, and controllers doing way more than they should. That’s where architectural patterns come in to save the day. One of the most popular and tested patterns is <strong>MVC</strong> — Model-View-Controller.</p><p>But there’s more to a cleanly structured application than just MVC. Two crucial patterns often work hand-in-hand with it: <strong>DAO (Data Access Object)</strong> and <strong>DTO (Data Transfer Object)</strong>. Together, these concepts help you write modular, maintainable, and testable code.</p><p>Let’s break them down in a simple, easy-to-follow manner with examples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*OqshaK3dM3CFXkwUfHcOKg.png" /><figcaption>MVC architecture with DAO and DTO</figcaption></figure><h3>What is MVC?</h3><p>MVC stands for <strong>Model-View-Controller</strong>, and it’s a design pattern that separates an application into three main parts:</p><ul><li><strong>Model</strong>: The part that handles data and business logic.</li><li><strong>View</strong>: The UI that users interact with.</li><li><strong>Controller</strong>: The middleman that processes user input and connects the Model and View.</li></ul><p>This separation helps keep your code organized and makes it easier to manage, test, and scale.</p><h3>Model: Where the Real Work Happens</h3><p>The <strong>Model</strong> layer is the backbone of your application. It’s responsible for representing data, applying business rules, and managing database interaction.</p><h4>1. DTO (Data Transfer Object)</h4><p>A DTO is a simple Java object used to transfer data between different parts of an application, especially between the Service and View layers. It’s lightweight and contains no business logic — just fields, constructors, getters, and setters.</p><p><strong>Example DTO:</strong></p><pre>public class UserDTO {<br>    private String username;<br>    private String email;<br><br>    public UserDTO(String username, String email) {<br>        this.username = username;<br>        this.email = email;<br>    }<br><br>    public String getUsername() { return username; }<br>    public void setUsername(String username) { this.username = username; }<br><br>    public String getEmail() { return email; }<br>    public void setEmail(String email) { this.email = email; }<br>}</pre><p>Think of a DTO as a sanitized version of your data — only exposing what’s necessary.</p><h4>2. DAO (Data Access Object)</h4><p>The DAO is responsible for handling all database operations. It abstracts the logic for interacting with the database so the rest of the application doesn’t need to worry about SQL queries.</p><p><strong>Example DAO:</strong></p><pre>public class UserDAO {<br>    private Connection connection;<br><br>    public UserDAO(Connection connection) {<br>        this.connection = connection;<br>    }<br><br>    public UserDTO getUserById(int id) throws SQLException {<br>        String query = &quot;SELECT username, email FROM users WHERE id=?&quot;;<br>        PreparedStatement statement = connection.prepareStatement(query);<br>        statement.setInt(1, id);<br>        ResultSet rs = statement.executeQuery();<br><br>        if (rs.next()) {<br>            return new UserDTO(rs.getString(&quot;username&quot;), rs.getString(&quot;email&quot;));<br>        }<br>        return null;<br>    }<br>}</pre><p>This class talks directly to your database and returns neatly packaged DTOs.</p><h4>3. Service Layer</h4><p>The <strong>Service</strong> layer acts as a bridge between the DAO and the Controller. It contains the application’s business logic and often converts database entities into DTOs before passing them on to the Controller.</p><p><strong>Example Service:</strong></p><pre>public class UserService {<br>    private UserDAO userDAO;<br><br>    public UserService(UserDAO userDAO) {<br>        this.userDAO = userDAO;<br>    }<br><br>    public UserDTO getUser(int id) throws SQLException {<br>        return userDAO.getUserById(id);<br>    }<br>}</pre><p>The service makes sure your controller stays clean and focused on handling user input and output.</p><h3>View: What the User Sees</h3><p>The <strong>View</strong> is all about presentation. Whether you’re using JSP, Thymeleaf, or a modern front-end like React, this layer is responsible for displaying data to the user.</p><p><strong>Example JSP View:</strong></p><pre>&lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=UTF-8&quot; %&gt;<br>&lt;html&gt;<br>&lt;head&gt;&lt;title&gt;User Profile&lt;/title&gt;&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;h2&gt;User Details&lt;/h2&gt;<br>    &lt;p&gt;Username: ${user.username}&lt;/p&gt;<br>    &lt;p&gt;Email: ${user.email}&lt;/p&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>The view gets the UserDTO from the controller and uses it to populate the UI.</p><h3>Controller: The Request Handler</h3><p>The <strong>Controller</strong> receives user requests, interacts with the Service layer to fetch or manipulate data, and then forwards the data to the View.</p><p><strong>Example Controller (Servlet):</strong></p><pre>@WebServlet(&quot;/user&quot;)<br>public class UserController extends HttpServlet {<br>    private UserService userService = new UserService(new UserDAO(DatabaseConnection.getConnection()));<br><br>    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<br>        int userId = Integer.parseInt(request.getParameter(&quot;id&quot;));<br>        try {<br>            UserDTO user = userService.getUser(userId);<br>            request.setAttribute(&quot;user&quot;, user);<br>            RequestDispatcher dispatcher = request.getRequestDispatcher(&quot;user.jsp&quot;);<br>            dispatcher.forward(request, response);<br>        } catch (Exception e) {<br>            e.printStackTrace();<br>        }<br>    }<br>}</pre><p>The controller coordinates everything — grabbing data from the service, and passing it on to the view.</p><h3>How It All Comes Together</h3><p>Let’s say a user accesses /user?id=1 in the browser. Here’s what happens step-by-step:</p><ol><li><strong>Controller</strong> handles the request and calls UserService.</li><li><strong>Service</strong> calls UserDAO to fetch the user from the database.</li><li><strong>DAO</strong> queries the database and returns a <strong>DTO</strong>.</li><li><strong>Service</strong> sends the DTO back to the <strong>Controller</strong>.</li><li><strong>Controller</strong> attaches the DTO to the request and forwards it to the <strong>View</strong>.</li><li><strong>View</strong> renders the user data on the page.</li></ol><p>Each part has a clear role, making the code clean and easier to debug or modify.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*Z4S22bVWM7hhts3dqDh2pA.png" /><figcaption>MVC Workflow with DAO and DTO Integration</figcaption></figure><h3>Wrapping Up</h3><p>Using MVC along with DAO and DTO is like giving your Java application a solid skeleton. Here’s a quick recap:</p><ul><li><strong>DTO</strong>: Lightweight abstract objects used to carry data between layers.</li><li><strong>DAO</strong>: Encapsulates all database-related logic.</li><li><strong>Service</strong>: Handles business logic and prepares data for the controller.</li><li><strong>Controller</strong>: Manages user input and decides which view to display.</li><li><strong>View</strong>: Presents data to the user.</li></ul><p>Whether you’re building a small web app or a large enterprise system, following this structure will help you stay organized and scalable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=566437a0dbba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplify HubSpot Product Management with the Ballerina CRM Object Products Connector]]></title>
            <link>https://medium.com/@dinithi.adithya/simplify-hubspot-product-management-with-the-ballerina-crm-object-products-connector-6ba3b2dd9620?source=rss-629377abc8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ba3b2dd9620</guid>
            <category><![CDATA[objects]]></category>
            <category><![CDATA[ballerina]]></category>
            <category><![CDATA[hubspot]]></category>
            <category><![CDATA[crm]]></category>
            <category><![CDATA[product]]></category>
            <dc:creator><![CDATA[Dinithi Liyanage]]></dc:creator>
            <pubDate>Wed, 05 Feb 2025 18:55:32 GMT</pubDate>
            <atom:updated>2025-02-05T18:55:32.194Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xvmtc3bBvCFDzYd3n2BS6w.png" /></figure><p>In today’s fast-evolving digital landscape, businesses need to leverage powerful tools to stay ahead of the competition. <a href="https://www.hubspot.com/our-story">HubSpot</a>, an AI-powered customer relationship management (CRM) platform, has become a game-changer for organizations looking to optimize sales, marketing, and customer service.</p><p>Theballerinax/hubspot.crm.obj.products package, makes it easier than ever to integrate and manage product data directly within HubSpot. Built on top of <a href="https://github.com/HubSpot/HubSpot-public-api-spec-collection/blob/main/PublicApiSpecs/CRM/Products/Rollouts/424/v3/products.json">HubSpot’s REST API</a>, this connector streamlines interactions with <a href="https://developers.hubspot.com/docs/reference/api/crm/objects/products">HubSpot’s API for CRM Object Products</a>, offering a smooth and effective way to manage your product catalog, without the hassle of complicated API calls.</p><p>In this post, we’ll walk through how to use the HubSpot CRM Object Products Connector in Ballerina to interact with HubSpot’s Products API.</p><h3>Prerequisites</h3><p>Before diving into the code, ensure that you have the following:</p><ol><li><strong>Ballerina Installed</strong><br>Follow the<a href="https://ballerina.io/learn/get-started/"> Setting up Ballerina guide</a> for step-by-step installation instructions. After installing Ballerina, run the following command to verify your installation:</li></ol><pre>bal -v</pre><p>2. <strong>HubSpot Credentials</strong>: To authenticate and interact with HubSpot’s API, you will need:</p><ul><li>Client ID</li><li>Client Secret</li><li>Refresh Token</li></ul><h3>Setting Up and Using the HubSpot Products Client in Ballerina</h3><p>Ballerina’s HubSpot Products client allows seamless interaction with the HubSpot Products API, to create and manage your product library, which is the collection of goods and services that your company offers. Products in your product library can be used as line items when creating deals, payment links, invoices, and quotes. To get started, you’ll need to configure the authentication credentials, set up the client, and initialize it.</p><h4>Step 1: Authorization (Prerequisite)</h4><p>HubSpot uses OAuth2 for authentication. Follow these steps to obtain the necessary credentials:</p><h4>Obtain the Refresh Token</h4><ol><li><strong>Create an Authorization URL</strong><br>Replace the placeholders with your actual values:</li></ol><pre>https://app.hubspot.com/oauth/authorize?client_id=&lt;YOUR_CLIENT_ID&gt;&amp;scope=&lt;YOUR_SCOPES&gt;&amp;redirect_uri=&lt;YOUR_REDIRECT_URI&gt;</pre><ul><li>&lt;YOUR_CLIENT_ID&gt;: Your HubSpot app’s client ID.</li><li>&lt;YOUR_REDIRECT_URI&gt;: The URL HubSpot will redirect to after authorization.</li><li>&lt;YOUR_SCOPES&gt;: Required scopes, e.g., e-commerce.</li></ul><p><strong>2. Authorize the App</strong><br>Paste the URL into a browser, log in to HubSpot, select the account, and grant the requested permissions.</p><p><strong>3. Retrieve the Authorization Code</strong><br>After successful authorization, you will be redirected to your &lt;YOUR_REDIRECT_URI&gt; with a code parameter. Copy the code.</p><p><strong>4. Exchange the Code for an Access Token</strong><br>Run the following curl command. Replace the &lt;YOUR_CLIENT_ID&gt;, &lt;YOUR_REDIRECT_URI&gt; and &lt;YOUR_CLIENT_SECRET&gt; with your specific value. Use the code you received in the above step 3 as the &lt;CODE&gt;.</p><pre>curl --request POST \<br>  --url https://api.hubapi.com/oauth/v1/token \<br>  --header &#39;content-type: application/x-www-form-urlencoded&#39; \<br>  --data &#39;grant_type=authorization_code&amp;code=&lt;code&gt;&amp;redirect_uri=http://localhost:9090&amp;client_id=&lt;client_id&gt;&amp;client_secret=&lt;client_secret&gt;&#39;</pre><p>The response will include the <strong>Access Token </strong>and<strong> Refresh Token</strong>.</p><h4>Step 2: Set Up the Configuration</h4><p>Store your credentials securely in a Config.toml file in your project directory:</p><pre>clientId = &quot;&lt;Your_Client_ID&gt;&quot;  <br>clientSecret = &quot;&lt;Your_Client_Secret&gt;&quot;  <br>refreshToken = &quot;&lt;Your_Refresh_Token&gt;&quot;</pre><h4>Step 3: Import Modules</h4><p>Import the hubspot.crm.obj.products module and oauth2 module.</p><pre>import ballerina/oauth2;<br>import ballerinax/hubspot.crm.obj.products as hsproducts;</pre><h4>Step 4: Create and Initialize the Client</h4><p>Now, instantiate thehsproducts:OAuth2RefreshTokenGrantConfig with the credentials you obtained earlier, and initialize the hsproducts:Client.</p><pre>configurable string clientId = ?;<br>configurable string clientSecret = ?;<br>configurable string refreshToken = ?;<br><br>// OAuth2 configuration<br>hsproducts:OAuth2RefreshTokenGrantConfig auth = {<br>  clientId,<br>  clientSecret,<br>  refreshToken,<br>  credentialBearer: oauth2:POST_BODY_BEARER<br>};<br><br>// Initialize the client<br>hsproducts:Client hubSpotProducts = check new ({ auth });</pre><h4><strong>Step 5: Invoke the connector operations</strong></h4><p>Once the client is initialized, you can interact with HubSpot’s Product API. Below is an example of creating a new product using the API.</p><pre>public function main() returns error? {<br>  hsproducts:SimplePublicObjectInputForCreate payload = {<br>    &quot;properties&quot;: {<br>    &quot;name&quot;: &quot;Coffee Grinder&quot;,<br>    &quot;hs_sku&quot;: &quot;CMK12346&quot;,<br>    &quot;price&quot;: &quot;540.00&quot;,<br>    &quot;description&quot;: &quot;A high-quality coffee grinder that powders excellent coffee.&quot;<br>    }<br>  };<br>  hsproducts:SimplePublicObject response = check hubSpotProducts-&gt;/.post(payload);<br>}</pre><p>Below is an example use case illustrating the use of the HubSpot Products API in a real-life scenario.</p><h3>Use Case: Updating a batch of products</h3><p>In this use case, we will demonstrate how to retrieve product data from HubSpot, interactively update product fields such as name, price, and description, and then perform a batch update to save the changes.</p><h4>Step 1: Set Up OAuth2 Authentication</h4><p>The authentication configuration remains the same as earlier. Below is the configuration for OAuth2.</p><pre>import ballerina/io;<br>import ballerina/oauth2;<br>import ballerinax/hubspot.crm.obj.products as hsproducts;<br><br>// Configurable values for the API authentication and server details. <br>configurable string clientId = ?;<br>configurable string clientSecret = ?;<br>configurable string refreshToken = ?;<br><br>// OAuth2 configuration for refreshing the authentication token using the provided client credentials.<br>hsproducts:OAuth2RefreshTokenGrantConfig auth = {<br>        clientId,<br>        clientSecret,<br>        refreshToken,<br>        credentialBearer: oauth2:POST_BODY_BEARER<br>};<br><br>// Initialize the HubSpot CRM client with the connection configuration and the service URL.<br>hsproducts:Client hubSpotProducts = check new ({auth});</pre><h4>Step 2: “updateProductField” function</h4><p>The function takes a field name and its current value, then prints the field along with its existing value, prompting the user to decide whether an update is needed. If the user responds with “Y,” they are asked to enter a new value, which is then returned. If no update is required, the function simply returns the original value.</p><pre>function updateProductField(string fieldName, string? currentValue) returns string? {<br>    if currentValue is string {<br>        io:println(fieldName, &quot;: &quot;, currentValue);<br>        io:println(&quot;Does this &quot;, fieldName, &quot; need to change? (Y|N)&quot;);<br><br>        if io:readln() == &quot;Y&quot; {<br>            io:println(&quot;Enter new &quot;, fieldName, &quot;:&quot;);<br>            return io:readln();<br>        }<br>    }<br>    return currentValue; // Return the original value if no update is needed<br>}</pre><h4>Step 3: Fetch Products from HubSpot</h4><p>Once authentication is complete, the next step is to retrieve the product data from HubSpot. A request is made to fetch all products using the GET method through the Ballerina HubSpot Products API client (hsproducts:Client):</p><pre>hsproducts:CollectionResponseSimplePublicObjectWithAssociationsForwardPaging response = check hubSpotProducts-&gt;/;</pre><p>The above code fetches all products in the CRM and stores them in the response variable.</p><h4>Step 4: Interactively Update Product Fields</h4><p>The user is prompted to modify specific product fields, such as the product’s name, price, and description by calling the updateProductField function. Stores the <strong>updated</strong> or <strong>unchanged</strong> value in line.properties.</p><pre>foreach hsproducts:SimplePublicObjectWithAssociations product in productsResponse.results {<br>        io:println(product.properties);<br><br>        hsproducts:SimplePublicObjectBatchInput line = {id: product.id, properties: {}};<br><br>        string? name = product.properties.get(&quot;name&quot;);<br>        line.properties[&quot;name&quot;] = check updateProductField(&quot;Product name&quot;, name);<br><br>        string? price = product.properties.get(&quot;price&quot;);<br>        line.properties[&quot;price&quot;] = check updateProductField(&quot;Product price&quot;, price);<br><br>        string? description = product.properties.get(&quot;description&quot;);<br>        line.properties[&quot;description&quot;] = check updateProductField(&quot;Product description&quot;, description);<br><br>    }</pre><h4>Step 4: Batch Update Products</h4><p>Once the updates are made, gather all modified products into a batch update payload:</p><pre>hsproducts:BatchInputSimplePublicObjectBatchInput payload = {inputs: []};<br><br>// Add updated product information to the payload<br>payload.inputs.push(line);</pre><p>The updated product data (line) is added to the payload, which is a batch input object.</p><p>Finally, the batch update request is made:</p><pre>hsproducts:BatchResponseSimplePublicObject batch_response = check hubSpotProducts-&gt;/batch/update.post(payload);</pre><p>If the update is successful and the response status is &quot;COMPLETE&quot;, the program prints a success message:</p><pre>if batch_response.status == &quot;COMPLETE&quot; {<br>    io:println(&quot;Successfully updated the response.&quot;);<br>}</pre><h4>Full Code of the Use Case</h4><p>Here’s the complete code that fetches products, allows you to interactively update them, and then performs a batch update:</p><pre>import ballerina/io;<br>import ballerina/oauth2;<br>import ballerinax/hubspot.crm.obj.products as hsproducts;<br><br>configurable string clientId = ?;<br>configurable string clientSecret = ?;<br>configurable string refreshToken = ?;<br><br>function updateProductField(string fieldName, string? currentValue) returns string? {<br>    if currentValue is string {<br>        io:println(fieldName, &quot;: &quot;, currentValue);<br>        io:println(&quot;Does this &quot;, fieldName, &quot; need to change? (Y|N)&quot;);<br><br>        if io:readln() == &quot;Y&quot; {<br>            io:println(&quot;Enter new &quot;, fieldName, &quot;:&quot;);<br>            return io:readln();<br>        }<br>    }<br>    return currentValue; // Return the original value if no update is needed<br>}<br><br>public function main() returns error? {<br>    hsproducts:OAuth2RefreshTokenGrantConfig auth = {<br>        clientId,<br>        clientSecret,<br>        refreshToken,<br>        credentialBearer: oauth2:POST_BODY_BEARER<br>    };<br><br>    hsproducts:Client hubSpotProducts = check new ({auth});<br><br>    hsproducts:BatchInputSimplePublicObjectBatchInput payload = {inputs: []};<br><br>    hsproducts:CollectionResponseSimplePublicObjectWithAssociationsForwardPaging productsResponse = check hubSpotProducts-&gt;/;<br><br>    foreach hsproducts:SimplePublicObjectWithAssociations product in productsResponse.results {<br>        io:println(product.properties);<br><br>        hsproducts:SimplePublicObjectBatchInput line = {id: product.id, properties: {}};<br><br>        string? name = product.properties.get(&quot;name&quot;);<br>        line.properties[&quot;name&quot;] = check updateProductField(&quot;Product name&quot;, name);<br><br>        string? price = product.properties.get(&quot;price&quot;);<br>        line.properties[&quot;price&quot;] = check updateProductField(&quot;Product price&quot;, price);<br><br>        string? description = product.properties.get(&quot;description&quot;);<br>        line.properties[&quot;description&quot;] = check updateProductField(&quot;Product description&quot;, description);<br><br>        payload.inputs.push(line);<br>    }<br><br>    hsproducts:BatchResponseSimplePublicObject batchResponse = check hubSpotProducts-&gt;/batch/update.post(payload);<br><br>    if batchResponse.status == &quot;COMPLETE&quot; {<br>        io:println(&quot;Successfully updated the response.&quot;);<br>    }<br>}</pre><h3>Check out the Code and Documentation</h3><ul><li><a href="https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.products"><strong>GitHub Repository</strong></a>: View the source code</li><li><a href="https://central.ballerina.io/ballerinax/hubspot.crm.obj.products/1.0.0"><strong>Documentation</strong></a>: Learn more about integration and usage</li></ul><h3>Conclusion</h3><p>With Ballerina’s HubSpot CRM Object Products Connector, managing and updating your product library becomes much simpler. By leveraging the API’s powerful features, you can efficiently interact with HubSpot, allowing for quick updates, retrievals, and batch processing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ba3b2dd9620" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cracking password hashes using John the Ripper]]></title>
            <link>https://medium.com/@dinithi.adithya/cracking-password-hashes-using-john-the-ripper-0b3d9595df23?source=rss-629377abc8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b3d9595df23</guid>
            <dc:creator><![CDATA[Dinithi Liyanage]]></dc:creator>
            <pubDate>Fri, 16 Aug 2024 10:34:40 GMT</pubDate>
            <atom:updated>2024-08-16T10:34:40.996Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>In the digital world, passwords are like the keys to your front door, guarding your personal treasures — be it your email, bank account, or social media. But unlike physical keys, passwords are often stored as cryptographic hashes, making them unreadable by anyone who doesn’t have the original password. It sounds secure, right? But what if someone could crack those hashes and gain unauthorized access to your data?</p><p>Enter password cracking — the dark art of deciphering those cryptographic locks. With the right tools and techniques, hackers can turn those unreadable hashes back into plaintext passwords, giving them access to your most sensitive information. Among the many tools available, John the Ripper (JTR) stands out as a powerful, versatile weapon in a hacker’s arsenal.</p><p>John the Ripper supports a wide array of encryption technologies and works across Windows, Mac, and Unix systems. One of its standout features is its ability to automatically detect common encryption formats, making it incredibly user-friendly for those in the know. But what makes JTR truly powerful are its three main modes of attack:</p><ol><li><strong>Single Mode</strong>: The sniper approach — targeted, precise, and efficient.</li><li><strong>Wordlist Mode</strong>: The dictionary attack — leveraging common passwords to break into systems.</li><li><strong>Incremental Mode</strong>: The brute force attack — trying every possible combination until the password gives way.</li></ol><p>Let’s crack open these modes and see how they work.</p><h3><strong>Single Crack Mode</strong></h3><p>Imagine you have a good guess at what someone’s password might be, based on what you know about them. Maybe it’s their username, dog’s name, or their favorite song. Single Crack Mode takes this idea and runs with it, generating variations of a given string to create a set of potential passwords.</p><p>For instance, if you know someone often uses their pet’s name, you could use Single Crack Mode to test variations like “Fluffy123” or “Fluffy!@#”.</p><p>Here’s how you do it:</p><p><strong><em>john — single — format=&lt;hash_type&gt; &lt;filename&gt;<br> </em></strong><br>The — format flag specifies the hash type, and the — single (-si) flag indicates the use of Single Crack Mode.</p><p>Lets try this mode. First to generate a hash of a password, we can use the command:</p><p><strong><em>echo -n ‘&lt;password&gt;’| &lt;hash_type&gt;</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*TNKjKtwRiIC_HewbWGc8JA.png" /><figcaption>Generating hashed password</figcaption></figure><p>Then we have to create a txt file with the clue(which can be the username or favorite team or pet’s name) and the hashed password.<br><strong><em>echo ‘&lt;username&gt;:&lt;hashed_password&gt;’&gt;&gt; &lt;filename&gt;</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*go9oOkiNrj1kbqt9-p1TSA.png" /><figcaption>Creating a txt file with hashes</figcaption></figure><p>Finally run JTR in the single mode on the generated txt file as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*7beKUtFn1V5W6cQhtRnS0A.png" /><figcaption>Single crack mode</figcaption></figure><h3>Wordlist Mode (Dictionary Mode)</h3><p>In Wordlist Mode, JTR uses a list of passwords, generating hashes in real-time and comparing them with the target password hash. To launch a dictionary attack, you’d run:</p><p><strong><em>john — wordlist=&lt;path_to_wordlist&gt; — format=&lt;hash_type&gt; &lt;filename&gt;</em></strong></p><p>For this example, we use the well known Rockyou wordlist located at /usr/share/wordlists/rockyou.txt with the following command:</p><p><strong><em>john — wordlist=rockyou.txt — format=raw-sha1 Dictionary_crack.txt</em></strong></p><p><strong>*NOTE</strong> — Here we have copied the Rockyou wordlist to the current working directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*n_n4jZPAw74xhSNCBnVW-Q.png" /><figcaption>Dictionary mode example</figcaption></figure><p>It’s like flipping through a book of possible passwords until you find the right one.</p><h3><strong>Incremental Mode</strong></h3><p>Incremental Mode is John the Ripper’s all-out assault. In Incremental Mode, JTR tries all possible character combinations until it cracks the password. This mode can take a lot of time, especially for complex passwords, but it’s incredibly thorough. To launch an incremental attack, use:</p><p><strong><em>john — incremental — format=&lt;hash_type&gt; &lt;filename&gt;</em></strong></p><p>Additionally we can use the<strong><em>--incremental-charcount=N</em></strong> flag, where N is a positive integer, is for setting the maximum number of digits in the password.</p><p>For example, <br><strong><em>john — incremental — format=raw-sha1 Inc_crack.txt</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yAPUsv5BTdJRI02bw1lyww.png" /><figcaption>Incremental crack mode</figcaption></figure><h3>Cracking with Masking</h3><p>Sometimes, you need more control over your cracking attempts. That’s where masking comes in. With masking, you can target specific patterns, like all lowercase passwords, or passwords that start with a capital letter and end with a number. It’s a way to crack smarter, not harder.</p><p>A mask may consist of:</p><ul><li><strong>Static</strong> letters.</li><li><strong>Ranges</strong> in <strong>[aouei]</strong> or <strong>[a-z]</strong> syntax. Or both, <strong>[0–9abcdef]</strong> is the same as <strong>[0–9a-f]</strong>.</li><li><strong>?l</strong> lower-case ASCII letters</li><li><strong>?u</strong> upper-case ASCII letters</li><li><strong>?d</strong> digits</li><li><strong>?s</strong> specials (all printable ASCII characters not in <strong>?l</strong>, <strong>?u</strong> or <strong>?d</strong>)</li><li><strong>?a</strong> full ‘printable’ ASCII.</li><li><strong>?B</strong> all 8-bit (0x80–0xff)</li><li><strong>?b</strong> all (0x01–0xff) (the NULL character is currently not supported by core).</li><li><strong>?h</strong> lower-case HEX digits (0–9, a-f)</li><li><strong>?H</strong> upper-case HEX digits (0–9, A-F)</li></ul><p>Additionally we can use the <strong><em>max-len </em></strong>and<strong><em> min-len</em></strong> options to reduce the number of password comparisons.</p><p>The <strong>-max-len=N</strong> option will truncate the mask so no words longer than <strong>N</strong> are produced.</p><p>The <strong>-min-len=N</strong> option will skip generation of words shorter than <strong>N</strong>.</p><p>To get a better idea on using masks, let’s look in to some examples.</p><ul><li><strong>“mask=?l -min-len=3 -max-len=6” </strong>checks all lowercase passwords with length 3 to 6.</li><li><strong>“mask=pw?d”</strong> checks all 3 character length passwords which start with “pw” and end with a digit.</li><li><strong>“mask=?u[A-Za-z0–9][A-Za-z0–9][A-Za-z0–9][A-Za-z0–9]?d” </strong>checks all<strong> s</strong>ix-character length alphanumeric passwords starting with an uppercase initial letter and ending with a digit.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*Fxnk3CC75_PuZnjz0S2wRQ.png" /><figcaption>Cracking with masks</figcaption></figure><h3>Cracking ZIP Files</h3><p>Passwords aren’t just used to protect logins — they’re also used to protect files, like ZIP archives. John the Ripper can crack these too, thanks to a utility called zip2john.</p><p>To crack a password-protected ZIP file, first extract the hash:</p><p><strong><em>zip2john file.zip &gt; zip.hashes</em></strong></p><p>Then, use JTR to crack the hash:</p><p><strong><em>john zip.hashes</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*J4vikglA80NlpCl_NUnYMA.png" /><figcaption>Password protected zip file crack</figcaption></figure><h3>Cracking Linux Passwords</h3><p>Linux stores password data in ‘<strong>/etc/passwd’</strong> (user information) and ‘<strong>/etc/shadow’</strong> (password hashes). Using the unshadow utility bundled with JTR, we can combine these files for cracking.</p><p>Lets consider an example. First, create two new users with weak passwords using the following commands:</p><p><strong><em>sudo useradd &lt;username&gt;</em></strong></p><p><strong><em>sudo passwd &lt;username&gt; &lt;password&gt;</em></strong></p><p>Then, combine the 2 password hashes and saved them to a new file (i.e. linux.txt in this example) using:</p><p><strong><em>sudo unshadow /etc/passwd /etc/shadow &gt; linux.txt</em></strong></p><p>To extract the last two users and to save them in a new file:</p><p><strong><em>tail -n 2 linux.txt &gt; Linux_crack.txt</em></strong></p><p>Finally, crack the hashes with JTR, specifying the crypt format:</p><p><strong>*NOTE</strong> — Kali Linux’s John the Ripper doesn’t readily detect the hash type of Linux which is crypt. If you omit the --format flag below, John won’t crack anything at all.</p><p><strong><em>john — format=crypt Linux_crack.txt</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*8BkuYn4mBSnhRpBeAirzxQ.png" /><figcaption>Linux password crack</figcaption></figure><h3>Conclusion</h3><p>Password cracking can be shockingly easy — especially when passwords are weak. To stay ahead of attackers, you need to enforce strong password policies, use salting, employ password managers, adopt multi-factor authentication, and raise awareness about the risks.</p><p>Remember, security is only as strong as your weakest link. By understanding how tools like John the Ripper work, you can better protect your data and keep those digital doors locked tight.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b3d9595df23" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>