<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Blog on My Portfolio</title>
    <link>https://kazuf3.nicheapplab.com/categories/blog/</link>
    <description>Recent content in Blog on My Portfolio</description>
    <image>
      <title>My Portfolio</title>
      <url>https://kazuf3.nicheapplab.com/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E</url>
      <link>https://kazuf3.nicheapplab.com/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E</link>
    </image>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 25 Aug 2023 10:40:22 -0700</lastBuildDate>
    <atom:link href="https://kazuf3.nicheapplab.com/categories/blog/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Improving Security Posture With Wazuh</title>
      <link>https://kazuf3.nicheapplab.com/posts/improving-security-posture-with-wazuh/</link>
      <pubDate>Sat, 12 Aug 2023 09:36:19 -0700</pubDate>
      <guid>https://kazuf3.nicheapplab.com/posts/improving-security-posture-with-wazuh/</guid>
      <description>&lt;p&gt;This post is continued from previous entry, &lt;a href=&#34;https://kazuf3.nicheapplab.com/posts/zero-cost-home-security/&#34;&gt;Zero Cost Home Cybersecurity with
WSL2 and Wazuh&lt;/a&gt;.
We have installed Wazuh service on WSL2 and its agent on Windows.
Now we are able to see various suggestions from the scan result.&lt;/p&gt;
&lt;h2 id=&#34;where-we-are&#34;&gt;Where we are&lt;/h2&gt;
&lt;p&gt;First, we want to know where we are. NIST Cybersecurity Framework defines
following 5 steps to improve security posture. We want to address each steps
with the activity with Wazuh.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Zero Cost Home Cybersecurity with WSL2 and Wazuh</title>
      <link>https://kazuf3.nicheapplab.com/posts/zero-cost-home-security/</link>
      <pubDate>Fri, 11 Aug 2023 10:01:43 -0700</pubDate>
      <guid>https://kazuf3.nicheapplab.com/posts/zero-cost-home-security/</guid>
      <description>&lt;p&gt;There are many cybersecurity solutions for home usage in combination with
endpoint security and network intrusion detection or prevention systems. Some of
them are software packages such as McAfee and others may be provided by your
ISP, such as Xfinity xFi Advanced Security which comes with ISP-specific
hardware. However, it is unclear to the end users what they do, and sometimes
pricy.&lt;/p&gt;
&lt;p&gt;It is also common to network enthusiasts to set up a white-box approach with
plenty of hardware equipment for a home cybersecurity stack. For example, there
are many YouTube videos about how to set up a router to mirror all the traffic
into IDS in a virtual machine, so that all network traffic can be monitored.
However, in my humble opinion, hosting a VM that can monitor all the network
traffic in and out is a very much luxury for most people.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CTFLearn RSABeginner</title>
      <link>https://kazuf3.nicheapplab.com/posts/ctflearn-rsabeginner/</link>
      <pubDate>Fri, 25 Aug 2023 10:40:22 -0700</pubDate>
      <guid>https://kazuf3.nicheapplab.com/posts/ctflearn-rsabeginner/</guid>
      <description>&lt;p&gt;Solve RSA decoding problems when &lt;code&gt;e&lt;/code&gt; is small enough.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ctflearn.com/challenge/119&#34;&gt;Problem link | RSA Beginner&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;compute-factor-q-and-p&#34;&gt;Compute factor $q$ and $p$&lt;/h2&gt;
&lt;p&gt;In order to decode RSA, we need to compute $p$ and $q$ as factor of $n$.
Generally, it requires a lot of computating but we have a good resource: stored
factor list.&lt;/p&gt;
&lt;p&gt;Pip package &lt;code&gt;factordb-python&lt;/code&gt; is useful:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;import factordb.factordb import FactorDB

f = FactorDB(n)
f.connect()
factors = f.get_factor_list()
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;compute-d&#34;&gt;Compute $d$&lt;/h2&gt;
&lt;p&gt;$d$ is defined using $\phi$:&lt;/p&gt;</description>
    </item>
    <item>
      <title>CTFLearn Substitution Cipher</title>
      <link>https://kazuf3.nicheapplab.com/posts/ctflearn-substitution-cipher/</link>
      <pubDate>Thu, 24 Aug 2023 01:38:00 -0700</pubDate>
      <guid>https://kazuf3.nicheapplab.com/posts/ctflearn-substitution-cipher/</guid>
      <description>&lt;p&gt;A problem to solve substitution cipher, which as &lt;em&gt;Dancing Man&lt;/em&gt; by Sir Authur Conan Doyle.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ctflearn.com/challenge/238&#34;&gt;Problem link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The given encrypted text is:&lt;/p&gt;
&lt;p&gt;MIT YSAU OL OYGFSBDGRTKFEKBHMGCALSOQTMIOL. UTFTKAMTR ZB DAKQGX EIAOF GY MIT COQOHTROA HAUT GF EASXOF AFR IGZZTL. ZT CTKT SGFU, MIT YSACL GF A 2005 HKTLTFM MODTL MIAF LMADOFA GK A CTTQSB LWFRAB, RTETDZTK 21, 1989 1990, MIT RKTC TROMGKL CAL WHKGGMTR TXTKB CGKSR EAF ZT YGWFR MIT EGFMOFWTR MG CGKQ AM A YAOMIYWS KTHSOTL CITKT IGZZTL, LMBST AOD EASXOF, AMMAEQ ZGMI LORTL MG DAKQL, &amp;ldquo;CIAM RG EGFMKGSSOFU AF AEMWAS ZGAKR ZGVTL OF MIT HKTHAKTFML FADT, OL ODHWSLOXT KADHAUTL OF CIOEI ASCABL KTYTKTFETL MIT HALLCGKR, CIOEI DGFTB, AFR MITB IAR SOMMST YKGFM BAKR IOL YKWLMKAMTR EGSGK WFOJWT AZOSOMB COMI AFR OFROLHTFLAMT YGK MTAEI GMITK LMWROTL, AKT ACAKRL ZARUTL, HWZSOLITR ZTYGKT CTSS AL A YOKT UKGLL HSAFL CTKT GKOUOFASSB EIAKAEMTKL OF MIT LMKOH MG CIOEI LTTD MG OM CITF MTDHTKTR OF AFR IASSGCOFU MITB&amp;rsquo;KT LODHSB RKACOFU OF UOXTL GF&amp;rdquo; HKOFEOHAS LHOMMST ROLMGKM, KTARTKL EGDOEL AKT WLT, CAMMTKLGF MGGQ MCG 16-DGFMIL AYMTK KTLOLMAQTL A DGKT EKTAM RTAS MG EASXOF GYMTF IGZZTL MG ARDOML &amp;ldquo;LSODB, &amp;ldquo;ZWM OM&amp;rsquo;L FADTR A FOUIM GWM LIT OL HGOFM GY FGM LTTF IGZZTL MIT ZGGQL AM MIAM O KTDAOFOFU ZGGQ IADLMTK IWTB AKT AHHTAKAFET: RTETDZTK 6, 1995 DGD&amp;rsquo;L YKADTL GY EASXOF UOXTF A CAUGF, LGDTMODTL MIAM LG OM&amp;rsquo;L YAMITKT&amp;rsquo;L YADOSB FG EAFETSSAMOGFLIOH CAL HKTLTFML YKGD FGXTDZTK 21, 1985 SALM AHHTAK AZLTFET OF AFGMITKCOLT OM IAHHB MG KWF OM YGK MIOL RAR AL &amp;ldquo;A SOMMST MG MGSTKAMT EASXOF&amp;rsquo;L YADOSB RKACF ASDGLM EGDDTFRTR WH ZTOFU HTGHST OFLMAFET, UTM DAKKOTR ZB A RAFET EASXOF&amp;rsquo;L GWMSAFROLOFU MIT FTCLHAHTK GK MAZSGOR FTCLHAHTK ZWLOFTLL LIGC OL GF!&amp;rdquo; AFR LHKOFML GY EIOSRKTF&amp;rsquo;L RAR&amp;rsquo;L YKWLMKAMTR ZB MWKF IWDGK, CAL HWZSOE ROASGU MITKT&amp;rsquo;L FGM DWEI AL &amp;ldquo;&amp;lsquo;94 DGRTKFOLD&amp;rdquo; CAMMTKLGF IAL RTSOUIML GY YAFMALB SOYT CAMMTKLGF LABL LTKXTL AL AF AKMOLML OL RTLMKWEMOGF ZWLOFTLL, LHAETYAKTK GY MIT GHHGKMWFOMOTL BGW ZGMI A MGHOE YGK IOL IGDT MGFUWT-OF-EITTQ HGHWSAK MIAM OM CAL &amp;ldquo;IGF&amp;rdquo; AFR JWAKMTK HAUT DGKT LHAEOGWL EAFETSSAMOGF MIT HAOK AKT ESTAKSB OF HLBEIOE MKAFLDGUKOYOTK&amp;rsquo;L &amp;ldquo;NAH&amp;rdquo; LGWFR TYYTEM BGW MIOFQTK CAMMTKLGF ASLG UKTC OFEKTROZST LHAET ZWBL OF EGDDGFSB CIOST GMITKCOLT OM&amp;rsquo;L FADT OL FGMAZST LMGKBSOFT UAXT MIT GHHGKMWFOMOTL BGW EAFETSSAMOGF MIT &amp;ldquo;EASXOF GYYTK MG DAQT IOD OFEGKKTEM AFLCTKL CAMMTK AKMCGKQ GMITK GYMTF CIOEI OL TXORTFM MG GMITK LMKOH OL MG MITOK WLT GY KWSTL MIAM LIGCF GF LAFROYTK, CIG WLTL A EKGCJWOSS ZT LTTF &amp;ldquo;USWTR&amp;rdquo; MG MIT GFSB HTKL AFR IOL YAMITK LWHHGKM OL SWFEISOFT UAXT MITLT MIOF A BTAK OF DWSMODAMTKOAS AFR GZMAOF GF LAFMALB, IOL WLT, CAMMTKL ROASGUWT OL AF &amp;ldquo;AKMOLM&amp;rsquo;L LMAMWL AL &amp;ldquo;A ROD XOTC OF MIT TLLTFMOASSB MG DAQT IOD LTTD MG OFESWRTR MIAM EASXOF OL AF GRR ROASGUWT DGLM GY MIT ESWZ IAL TVHKTLLOGF GWMLORT AXAOSAZST MG&lt;/p&gt;</description>
    </item>
    <item>
      <title>CTFLearn Leak Me</title>
      <link>https://kazuf3.nicheapplab.com/posts/ctflearn-leak-me/</link>
      <pubDate>Tue, 22 Aug 2023 16:00:42 -0700</pubDate>
      <guid>https://kazuf3.nicheapplab.com/posts/ctflearn-leak-me/</guid>
      <description>&lt;p&gt;A problem to exploit the stack with format string attack.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ctflearn.com/challenge/1221&#34;&gt;Problem link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When I access the program, it&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;prompts a question&lt;/li&gt;
&lt;li&gt;and it takes user input&lt;/li&gt;
&lt;li&gt;then prints the input&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ nc rivit.dev 10003
What is your favorite format tag? some_text
some_text
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The problem comes with the program source code and its binary.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;

int main() {
    setvbuf(stdout, NULL, _IONBF, 0);
    setvbuf(stdin, NULL, _IONBF, 0);

    char flag[64], buffer[64];

    FILE *f = fopen(&amp;#34;./flag.txt&amp;#34;, &amp;#34;rt&amp;#34;);
    if (f == NULL) {
        puts(&amp;#34;No flag.txt found, contact an admin&amp;#34;);
        return 1;
    }

    fgets(flag, 64, f);
    fclose(f);

    printf(&amp;#34;What is your favorite format tag? &amp;#34;);
    fgets(buffer, sizeof(buffer), stdin);
    printf(buffer);

    return 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Since it takes user input and print, it might be a problem for buffer overflow.
Let&amp;rsquo;s examine their addresses with Cutter.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CTFLearn Reykjavik</title>
      <link>https://kazuf3.nicheapplab.com/posts/ctflearn-reykjavik/</link>
      <pubDate>Fri, 18 Aug 2023 14:31:08 -0700</pubDate>
      <guid>https://kazuf3.nicheapplab.com/posts/ctflearn-reykjavik/</guid>
      <description>&lt;p&gt;A standard problem to find the flag by dynamic reverse engineering a x64 ELF binary.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ctflearn.com/challenge/990&#34;&gt;Problem link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With given executable binary, first we want to extract text from it. However,
all possible text from &lt;code&gt;strings&lt;/code&gt; command are false flags.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s examine the bahavior of the program. It prompts the usage.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ ./Reykjavik
Usage: Reykjavik CTFlearn{flag}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;OK, let&amp;rsquo;s give it an another try.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ ./Reykjavik CTFlearn{flag}
Welcome to the CTFlearn Reversing Challenge Reykjavik v2: CTFlearn{flag}
Compile Options: ${CMAKE_CXX_FLAGS} -O0 -fno-stack-protector -mno-sse

Sorry Dude, &amp;#39;CTFlearn{flag}&amp;#39; is not the flag :-(
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;From all the external observation, we can assume the code is something like
following psuedo code.If the original program is structured like this, we can
obtain the flag from the memory when it compares with parameters.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CTFLearn Impossible Equation</title>
      <link>https://kazuf3.nicheapplab.com/posts/ctflearn-impossible-equation/</link>
      <pubDate>Fri, 18 Aug 2023 09:44:48 -0700</pubDate>
      <guid>https://kazuf3.nicheapplab.com/posts/ctflearn-impossible-equation/</guid>
      <description>&lt;p&gt;A problem to exploit the input guard using math.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ctflearn.com/challenge/1234&#34;&gt;Problem link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The problem statement is:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ nc rivit.dev 10011
X * 212103456793011 = 183057226632645
X = ?
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It seems we want to compute the number of x:&lt;/p&gt;
&lt;p&gt;$$ x = \frac{183057226632645}{212103456793011}$$&lt;/p&gt;
&lt;p&gt;If you compute it, it should be something like &lt;code&gt;0.8630563094088945586&lt;/code&gt;. However, it won&amp;rsquo;t give you the flag because x must be an integer. That said we need to overflow.&lt;/p&gt;
&lt;p&gt;$$ 212103456793011x = 183057226632645 \mod{2^{64}} $$&lt;/p&gt;</description>
    </item>
    <item>
      <title>CTFLearn AndhraPradesh</title>
      <link>https://kazuf3.nicheapplab.com/posts/ctflearn-andhrapradesh/</link>
      <pubDate>Thu, 17 Aug 2023 10:04:41 -0700</pubDate>
      <guid>https://kazuf3.nicheapplab.com/posts/ctflearn-andhrapradesh/</guid>
      <description>&lt;p&gt;A problem to reverse engineer and find the correct condition.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ctflearn.com/challenge/1030&#34;&gt;Problem link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this challenge, I have to change the value of &lt;code&gt;con1&lt;/code&gt;&lt;del&gt;&lt;code&gt;con5&lt;/code&gt; in order to pass tests in &lt;code&gt;_start&lt;/code&gt;&lt;/del&gt;&lt;code&gt;test4&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;; Andrha Pradesh Assembler Challenge for CTFLearn
; This challenge focuses on cmp, je and jne

section .data
    welcome db &amp;#34;Hello CTFlearn Andhra Pradesh Assembler Challenge!&amp;#34;,0x0a,0x00
    noflag db &amp;#34;Sorry no flag for you :-(&amp;#34;,0x0a,0x00
    alldone db &amp;#34;All Done!&amp;#34;,0x0a,0x00
    baddata db &amp;#34;Baad Data!&amp;#34;,0x0a,0x00
    congrats db &amp;#34;Congrats!! You found the flag!!&amp;#34;, 0x0a, 0x00
    data    dw 0xbb35,0xbb4c,0xbb3a,0xbb54,0xbb5b,0xbb57,0xbb66,0xbb52,0xbb5d,0xbb30,\
               0xbb5f,0xbb5c,0xbb5b,0xbb66,0xbb57,0xbb56,0xbb57,0xbb5c,0xbb41,0xbb4c,\
               0xbb5b,0xbb54,0xbb6b,0xbb59,0xbb6b,0xbb63

;   ###################################################################
;   Change the values of these five constants to solve the challenge
    con1 db ??? ; C syntax for hex constant
    con2 db ???  ;
    con3 db ???
    con4 db ????h   ; this form for hex constants is popular among assembly language programmers
    con5 db ????h
;   ####################################################################
;   Do not change any code below here

section .bss
    buffer resb 32

section .text
    global _start

_start:
    xor r8, r8      ; init the exit status to 0

    mov rax, 1      ; sys_write system call
    mov rdi, 1      ; stdout (write to screen)
    mov rsi, welcome   ; memory location of string to write
    mov rdx, 51     ; number of characters in string to write
    syscall

    xor rax, rax    ; clear the rax register
    mov al, [con1]  ; move the value of con1 to the low byte of rax
    cmp al, 0xab
    je _test2

    mov r8, 1       ; exit status
    jmp _noflagforyou

_test2:
    xor rax, rax
    mov al, [con2]
    cmp al, 0xcb
    jne _test3

    mov r8, 2       ; exit status
    jmp _noflagforyou

_test3:
    mov r8, 3       ; exit status
    xor rax, rax
    mov al, [con3]
    cmp al, 0x20
    ja  _noflagforyou

    mov r8, 4       ; exit status
    xor rax, rax
    mov al, [con3]
    cmp al, 20h
    jb _noflagforyou

_test4:
    ; https://en.wikibooks.org/wiki/X86_Assembly/X86_Architecture
    mov r8, 5h      ; exit status
    xor rax, rax
    mov al, [con4]
    mov ah, [con5]
    cmp ax, 0baadh
    jne _noflagforyou

    mov r8, 6h      ; exit status
_checkflag:
    xor rdx, rdx    ; clear the rdx register
    xor rcx, rcx    ; init the rcx counter to zero
    xor rbx, rbx    ; clear the rbx register
    mov bl, BYTE [con1]
    add bl, BYTE [con3]
    mov dl, BYTE [con4]
    mov dh, BYTE [con5]

_Loop1:
    xor rax, rax
    mov ax, WORD [data+rcx*2]
    sub ax, dx

    xor rax, rbx

    cmp rax, 32
    jb _baddata
    cmp rax, 126
    ja _baddata

    mov [buffer+rcx], BYTE al
    inc rcx
    cmp rcx, 26
    jb _Loop1
    mov [buffer+rcx], BYTE 0x0a

_printcongrats:
    mov rax, 1      ; sys_write system call
    mov rdi, 1      ; stdout
    mov rsi, congrats ; memory location of string to write
    mov rdx, 32     ; number of characters in string to write
    syscall

_printflag:
    mov rax, 1      ; sys_write system call
    mov rdi, 1      ; stdout
    mov rsi, buffer ; memory location of string to write
    mov rdx, 27     ; number of characters in string to write
    syscall

    mov r8, 0h      ; exit status
    jmp _alldone

_baddata:
    mov rax, 1      ; sys_write system call
    mov rdi, 1      ; stdout
    mov rsi, baddata ; memory location of string to write
    mov rdx, 11     ; number of characters in string to write
    syscall
    jmp _alldone

_noflagforyou:
    mov rax, 1      ; sys_write system call
    mov rdi, 1      ; stdout
    mov rsi, noflag ; memory location of string to write
    mov rdx, 26     ; number of characters in string to write
    syscall

_alldone:
    mov rax, 1      ; sys_write system call
    mov rdi, 1      ; stdout
    mov rsi, alldone ; memory location of string to write
    mov rdx, 10     ; number of characters in string to write
    syscall

_byebye:
    mov rax, 60     ; exit system call
    mov rdi, r8     ; return code saved in register r8
    syscall
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following table shows each conditional instruction work.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CTFLearn Programming a Language</title>
      <link>https://kazuf3.nicheapplab.com/posts/ctflearn-programming-a-language/</link>
      <pubDate>Wed, 16 Aug 2023 15:46:18 -0700</pubDate>
      <guid>https://kazuf3.nicheapplab.com/posts/ctflearn-programming-a-language/</guid>
      <description>&lt;p&gt;A problem to implement a stack machine.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ctflearn.com/challenge/1050&#34;&gt;Problem here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This problem asks to program a stack machine.
My Python3 answer is below. The size of stack is unchecked.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;from collections import deque
import sys

class StackLang:
    def __init__(self):
        self.stack = deque()
        self.stack.append(0)
    def run(self, filename):
        with open(filename, &amp;#39;r&amp;#39;) as file:
            txt = file.read()

        for i in txt:
            if i == &amp;#39;-&amp;#39;:
                self.minus()
            elif i == &amp;#39;+&amp;#39;:
                self.plus()
            elif i == &amp;#39;&amp;gt;&amp;#39;:
                self.gt()
            elif i == &amp;#39;&amp;lt;&amp;#39;:
                self.lt()
            elif i == &amp;#39;@&amp;#39;:
                self.at()
            elif i == &amp;#39;.&amp;#39;:
                self.dot()
            elif i == &amp;#39;€&amp;#39;:
                self.euro()

    def minus(self):
        value = self.stack.pop()
        value = value - 1
        self.stack.append(value)

    def plus(self):
        value = self.stack.pop()
        value = value + 1
        self.stack.append(value)

    def gt(self):
        value = self.stack.popleft()
        self.stack.append(value)

    def lt(self):
        value = self.stack.pop()
        self.stack.appendleft(value)

    def at(self):
        value1 = self.stack.pop()
        value2 = self.stack.pop()
        self.stack.append(value1)
        self.stack.append(value2)

    def dot(self):
        value = self.stack.pop()
        self.stack.append(value)
        self.stack.append(value)

    def euro(self):
        ls = [ chr(i) for i in self.stack]
        print(&amp;#34;&amp;#34;.join(ls))


def main(argv, arc):
    print(argv)
    machine = StackLang()
    machine.run(argv[1])

if __name__ == &amp;#39;__main__&amp;#39;:
    main(sys.argv, len(sys.argv))
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;takeaways&#34;&gt;Takeaways&lt;/h2&gt;
&lt;p&gt;This is an quintessential problem to building a stack machine. First I thought I
should write it in Scala because it would make the code clearer with (1) case
class will comply to the BNF, (2) the parser combinator will help DSL
construction with the separation of instructions and parser.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CTFLearn Tone Dialing</title>
      <link>https://kazuf3.nicheapplab.com/posts/ctflearn-tone-dialing/</link>
      <pubDate>Wed, 16 Aug 2023 10:53:23 -0700</pubDate>
      <guid>https://kazuf3.nicheapplab.com/posts/ctflearn-tone-dialing/</guid>
      <description>&lt;p&gt;A problem that encodes the flag into wave file.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ctflearn.com/challenge/889&#34;&gt;Problem here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This problem consists of two parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Obtain the code from wav file&lt;/li&gt;
&lt;li&gt;Decode&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;obtain-the-code-from-wav-file&#34;&gt;Obtain the code from wav file&lt;/h2&gt;
&lt;p&gt;I used &lt;a href=&#34;https://github.com/ribt/dtmf-decoder&#34;&gt;dtmf-decoder&lt;/a&gt; that extract the tone dialing as decimal.&lt;/p&gt;
&lt;p&gt;I already have Python3 environment and I don&amp;rsquo;t want to mess it up.
I made a modification of its installation.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ git clone https://github.com/ribt/dtmf-decoder.git
$ cd dtmf-decoder/
$ python3 -m pip install -r requirements.txt --upgrade
$ chmod +x dtmf.py
$ cp dtmf.py ~/bin/dtmf
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then I simply run the command and obtain the code.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
