<?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: Charles Tison</title>
    <description>The latest articles on DEV Community by Charles Tison (@ctison).</description>
    <link>https://dev.to/ctison</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%2F439704%2Fbf75801b-17c7-4f3a-a266-a174e77eaed0.png</url>
      <title>DEV Community: Charles Tison</title>
      <link>https://dev.to/ctison</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ctison"/>
    <language>en</language>
    <item>
      <title>VSCode Remote Containers</title>
      <dc:creator>Charles Tison</dc:creator>
      <pubDate>Wed, 09 Sep 2020 17:57:18 +0000</pubDate>
      <link>https://dev.to/ctison/vscode-remote-containers-5740</link>
      <guid>https://dev.to/ctison/vscode-remote-containers-5740</guid>
      <description>&lt;p&gt;Docker images are very useful because they are lightweight environments defined as code (&lt;a href="https://docs.docker.com/engine/reference/builder/"&gt;Dockerfiles&lt;/a&gt;) where developers can set up the necessary tools and dependencies their softwares need to run. Then, other developers can simply download the docker images and run them on their desktop without the initial burden of setting up dependencies and understanding how things wire up at first.&lt;/p&gt;

&lt;p&gt;The primary use case of containers is to ship software to production, where a container orchestrator such as Kubernetes manages the lifecycle of containers (e.g. scaling containers on load).&lt;/p&gt;

&lt;p&gt;The secondary use case of containers is in the process of developing and testing applications. The developers use derived images from production where they add the necessary tooling to develop and test their applications. It's huge because it reduces the environment frictions between developers and cloud environments: they share a similar environment and therefore they can easily share operational development processes as well (DevOps).&lt;/p&gt;

&lt;p&gt;If you already have some experience with containers, you know that they are lightweight virtual machines accessible from your terminal. So to develop in a container, we can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mount a repository in a container and open that repository locally in VSCode and run commands from a terminal connected to the container (e.g. to build, to trigger git hooks).&lt;/li&gt;
&lt;li&gt;Connect VSCode to a container so that it can directly access the container filesystem.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Connecting VSCode to a container has many advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access the entire container's file system from VSCode.&lt;/li&gt;
&lt;li&gt;All dependencies and VSCode's integrations are installed in the container.&lt;/li&gt;
&lt;li&gt;Avoid bind mounting (aka. sharing) folders between your host and the container, which is a high-performance improvement when Docker is running in a Linux virtual machine (e.g. macOS, Windows) and when using tools with a lot of inputs/outputs (I/O) such as &lt;strong&gt;npm&lt;/strong&gt; 🚜.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;

&lt;p&gt;Let's start by installing the VSCode extension named &lt;strong&gt;VSCode Remote - Containers&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.docker.com/products/docker-desktop"&gt;Docker for Desktop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/"&gt;VSCode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers"&gt;Remote Containers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Run a container
&lt;/h2&gt;

&lt;p&gt;Once Docker is running, let's run a container with the following configuration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Created from &lt;a href="https://hub.docker.com/_/alpine"&gt;alpine&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The container is named &lt;strong&gt;work&lt;/strong&gt; and is in foreground mode (-it).&lt;/li&gt;
&lt;li&gt;The current working directory is bind mounted inside the container at &lt;strong&gt;/work&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; work &lt;span class="nt"&gt;--hostname&lt;/span&gt; work &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$PWD&lt;/span&gt;&lt;span class="s2"&gt;:/work"&lt;/span&gt; &lt;span class="nt"&gt;--workdir&lt;/span&gt; /work &lt;span class="se"&gt;\&lt;/span&gt;
  alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running the last command, a shell prompt should appear, meaning you're now inside a container. You can run commands like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;uname -a&lt;/strong&gt; to display system information&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ps aux&lt;/strong&gt; to view processes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;mount&lt;/strong&gt; to reveal mounted filesystem&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;nslookup -type=a host.docker.internal&lt;/strong&gt; to &lt;a href="https://docs.docker.com/docker-for-mac/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host"&gt;resolves the host&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Connect VSCode to a container
&lt;/h2&gt;

&lt;p&gt;Now that we have a container running, we can use VSCode to connect to it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Command Palette&lt;/strong&gt; (F1)&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Remote-Containers: Attach to Running Container...&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select the name of the container (e.g. &lt;strong&gt;work&lt;/strong&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;VSCode should open a new window with a progress bar showing the installation progress of its server inside the container. Once finished, that's it! We can now edit files inside our container with VSCode 🚀.&lt;/p&gt;

&lt;h2&gt;
  
  
  Share development environments
&lt;/h2&gt;

&lt;p&gt;We saw how to manually spawn a Docker container and connect to it through VSCode. But VSCode Remote Containers goes a bit further by allowing us to describe what container(s) should be created and connected to in a file named &lt;strong&gt;.devcontainer.json&lt;/strong&gt;.&lt;br&gt;
For example, to automate our previous example, create a folder named &lt;strong&gt;gruntapp&lt;/strong&gt; with a file in it named &lt;strong&gt;.devcontainer.json&lt;/strong&gt; with the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"image"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ubuntu"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"extensions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"mutantdino.resourcemonitor"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When opening the folder containing this file with VSCode, you should see a notification asking you whether or not to start developing in a container with the detected devcontainer file. Clicking &lt;strong&gt;Reopen in Container&lt;/strong&gt; will create a container from &lt;strong&gt;ubuntu&lt;/strong&gt; and mount the folder at &lt;strong&gt;/workspaces/gruntapp&lt;/strong&gt;.&lt;br&gt;
As a security measure, you should review a devcontainer file because it can run anything on your machine.&lt;/p&gt;
&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;We saw how VSCode containerize itself by installing its server into a container, while the frontend is on the host. It's a powerful tool to reduce developer frictions like dependencies management. This kind of practice will probably democratize and become a standard in the next decade 🔮.&lt;/p&gt;

&lt;p&gt;Note that VSCode Remote Containers works with &lt;a href="https://docs.docker.com/compose/"&gt;docker compose&lt;/a&gt; as well!&lt;/p&gt;

&lt;p&gt;Happy coding 🤓&lt;/p&gt;
&lt;h2&gt;
  
  
  Useful tips and tricks
&lt;/h2&gt;
&lt;h2&gt;
  
  
  Docker volumes
&lt;/h2&gt;

&lt;p&gt;We did both bind-mounting a repository to a container and connecting VSCode to the container. To gain performance improvements, you can instead put your code in the container (e.g. git clone, docker cp), or you can put your code in a Docker volume to persist your code across changing containers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker volume create example &lt;span class="c"&gt;# create a volume named example&lt;/span&gt;
&lt;span class="c"&gt;# run a container with the volume named example mounted at /example&lt;/span&gt;
docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; example:/example &lt;span class="nt"&gt;-w&lt;/span&gt; /example alpine 
&lt;span class="c"&gt;# Inside the container, you can run `mount` to see the volume&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'¯\_(ツ)_/¯'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; x.txt
&lt;span class="nb"&gt;exit&lt;/span&gt;
&lt;span class="c"&gt;# Start a ubuntu container&lt;/span&gt;
docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; example:/example &lt;span class="nt"&gt;-w&lt;/span&gt; /example ubuntu
&lt;span class="nb"&gt;cat &lt;/span&gt;x.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  VSCode CLI
&lt;/h3&gt;

&lt;p&gt;You can use &lt;strong&gt;code&lt;/strong&gt; to open files from a terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;code file.txt
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;EDITOR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'code -w'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Setting VSCode as your shell editor is useful when using commands such as &lt;strong&gt;git commit&lt;/strong&gt; and &lt;strong&gt;kubectl edit&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Docker performances
&lt;/h3&gt;

&lt;p&gt;Go to Docker preferences to allocate more CPU and RAM to your Docker VM.&lt;br&gt;
On macOS, you can use the &lt;a href="https://docs.docker.com/docker-for-mac/osxfs-caching/"&gt;delegated&lt;/a&gt; option to improve bind mount performances.&lt;/p&gt;

&lt;h3&gt;
  
  
  Access host from a docker container
&lt;/h3&gt;

&lt;p&gt;Docker for Desktop resolves by default &lt;a href="https://docs.docker.com/docker-for-mac/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host"&gt;host.docker.internal&lt;/a&gt; to your host from inside a container. It means you can access a network service running on your host from a container. It also resolves &lt;em&gt;kubernetes.docker.internal&lt;/em&gt; if you enabled Kubernetes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Useful Links
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/docs/remote/containers"&gt;VSCode Remote Containers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/docs/remote/devcontainerjson-reference"&gt;.devcontainer.json&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/microsoft/vscode"&gt;https://github.com/microsoft/vscode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/engine/reference/builder/"&gt;Dockerfile&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/compose/compose-file/"&gt;Docker Compose&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>vscode</category>
      <category>docker</category>
      <category>devops</category>
    </item>
    <item>
      <title>Crack with VSCode Hex Editor</title>
      <dc:creator>Charles Tison</dc:creator>
      <pubDate>Mon, 07 Sep 2020 16:45:17 +0000</pubDate>
      <link>https://dev.to/ctison/crack-executables-with-vscode-hex-editor-5gdf</link>
      <guid>https://dev.to/ctison/crack-executables-with-vscode-hex-editor-5gdf</guid>
      <description>&lt;p&gt;Have you ever wondered how hackers bypass proprietary applications to do what they want? Like not asking for a license.&lt;/p&gt;

&lt;p&gt;In this post, we will see how to crack a simple executable on Linux or macOS (not tested on Windows but it probably works as well).&lt;/p&gt;

&lt;h1&gt;
  
  
  Install
&lt;/h1&gt;

&lt;p&gt;We will need VSCode and its extension: &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.hexeditor"&gt;Hex Editor&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Next, we need a C compiler, like GCC or Clang.&lt;/p&gt;

&lt;h1&gt;
  
  
  Compile
&lt;/h1&gt;

&lt;p&gt;To learn the process of cracking, we will see how to crack a very simple C program. Put the following in a &lt;strong&gt;main.c&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&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="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"OK&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"KO&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&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="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"i = 0&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&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;Then compile with &lt;code&gt;gcc main.c -o a.out&lt;/code&gt;. An &lt;strong&gt;a.out&lt;/strong&gt; executable is produced by the compiler. We will directly modify &lt;strong&gt;a.out&lt;/strong&gt; to do what we want it to do like if we do not have the source code.&lt;/p&gt;

&lt;h1&gt;
  
  
  Challenge #1
&lt;/h1&gt;

&lt;p&gt;Our first challenge is to make the executable print:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ./a.out
OK
i = 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But right now, it prints:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ./a.out
KO
i = 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To modify a program, we need to know which are the instructions executed by the CPU so that we can rewrite them as needed. We disassemble our executable by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;objdump &lt;span class="nt"&gt;-M&lt;/span&gt; intel &lt;span class="nt"&gt;-j&lt;/span&gt; .text &lt;span class="nt"&gt;--disassemble&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;main ./a.out &lt;span class="c"&gt;# on Linux&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;objdump &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-x86-asm-syntax&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;intel ./a.out &lt;span class="c"&gt;# on macOS&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Linux with a x86_64 CPU, I have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a.out:     file format elf64-x86-64


Disassembly of section .text:

0000000000001135 &amp;lt;main&amp;gt;:
    1135:       55                      push   rbp
    1136:       48 89 e5                mov    rbp,rsp
    1139:       48 83 ec 10             sub    rsp,0x10
    113d:       c7 45 fc 00 00 00 00    mov    DWORD PTR [rbp-0x4],0x0
    1144:       83 7d fc 00             cmp    DWORD PTR [rbp-0x4],0x0
    1148:       74 0e                   je     1158 &amp;lt;main+0x23&amp;gt;
    114a:       48 8d 3d b3 0e 00 00    lea    rdi,[rip+0xeb3]        # 2004 &amp;lt;_IO_stdin_used+0x4&amp;gt;
    1151:       e8 da fe ff ff          call   1030 &amp;lt;puts@plt&amp;gt;
    1156:       eb 0c                   jmp    1164 &amp;lt;main+0x2f&amp;gt;
    1158:       48 8d 3d a8 0e 00 00    lea    rdi,[rip+0xea8]        # 2007 &amp;lt;_IO_stdin_used+0x7&amp;gt;
    115f:       e8 cc fe ff ff          call   1030 &amp;lt;puts@plt&amp;gt;
    1164:       83 7d fc 00             cmp    DWORD PTR [rbp-0x4],0x0
    1168:       75 0c                   jne    1176 &amp;lt;main+0x41&amp;gt;
    116a:       48 8d 3d 99 0e 00 00    lea    rdi,[rip+0xe99]        # 200a &amp;lt;_IO_stdin_used+0xa&amp;gt;
    1171:       e8 ba fe ff ff          call   1030 &amp;lt;puts@plt&amp;gt;
    1176:       b8 00 00 00 00          mov    eax,0x0
    117b:       c9                      leave  
    117c:       c3                      ret    
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wow that's cryptic. Yes this is assembler (ASM). If you ever thought Javascript is hard, well, your brain is probably melting right now but that's ok, we just need to know 3 things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first column is the starting address of the instruction in the file.&lt;/li&gt;
&lt;li&gt;The third column is the ASM instruction name and the fourth column is its argument(s).&lt;/li&gt;
&lt;li&gt;The second column is the corresponding byte code of the instruction and its argument(s) if any.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are 3 instructions useful to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;jmp&lt;/strong&gt; instruction is encoded as &lt;strong&gt;eb&lt;/strong&gt; and basically jumps to an address in memory. &lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;je&lt;/strong&gt; instruction (&lt;strong&gt;74&lt;/strong&gt;) is &lt;strong&gt;jump if equal&lt;/strong&gt; and is like the &lt;code&gt;if (...)&lt;/code&gt; in C.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;jne&lt;/strong&gt; instruction (&lt;strong&gt;75&lt;/strong&gt;) is &lt;strong&gt;jump if not equal&lt;/strong&gt; and is like the &lt;code&gt;if (!...)&lt;/code&gt; in C.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Always remember that numbers can vary from one CPU to another. I'm on an x86_64 and you're probably on an x86 CPU as well but there are other architectures like ARMv6. Each architecture can have a more or less different instruction set.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Note that corresponding instructions may not be encoded by the same numbers on your computer because it depends on your CPU model.&lt;/p&gt;

&lt;p&gt;Guess what. To solve this challenge, we just need to modify the first &lt;strong&gt;je&lt;/strong&gt; instruction at address &lt;strong&gt;1148&lt;/strong&gt; with either:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;jmp&lt;/strong&gt; instruction&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;jne&lt;/strong&gt; instruction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Open &lt;strong&gt;a.out&lt;/strong&gt; with &lt;strong&gt;Hex Editor&lt;/strong&gt; extension and search for &lt;strong&gt;74 0e&lt;/strong&gt; at address &lt;strong&gt;1148&lt;/strong&gt;. Remember, all numbers I present to you may be different for you so get them from your outputs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9NN-ox15--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/199vuje46d2zf99pgsnw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9NN-ox15--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/199vuje46d2zf99pgsnw.png" alt="VSCode Hex Editor" width="880" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now change the instruction &lt;strong&gt;je&lt;/strong&gt; to &lt;strong&gt;jmp&lt;/strong&gt;:&lt;/p&gt;

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

&lt;p&gt;Save and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;./a.out
OK
i &lt;span class="o"&gt;=&lt;/span&gt; 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Well done, you solved your first cracking challenge!&lt;br&gt;
If you liked it, you can try harder challenges on platforms like &lt;a href="https://www.root-me.org/?lang=en"&gt;root-me.org&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Or you can try to solve my next challenge by yourself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;./a.out
OK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.felixcloutier.com/x86/"&gt;https://www.felixcloutier.com/x86/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In another post, I will cover higher-level tools to ease the process of cracking like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/radareorg/cutter"&gt;Cutter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/radareorg/radare2"&gt;Radare&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/NationalSecurityAgency/ghidra"&gt;Ghidra&lt;/a&gt; (integrated in Cutter)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy cracking 🛠&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>security</category>
      <category>assembler</category>
      <category>crack</category>
    </item>
    <item>
      <title>Firefox Containers</title>
      <dc:creator>Charles Tison</dc:creator>
      <pubDate>Sun, 06 Sep 2020 15:42:33 +0000</pubDate>
      <link>https://dev.to/ctison/containerize-your-web-navigation-with-firefox-4h2c</link>
      <guid>https://dev.to/ctison/containerize-your-web-navigation-with-firefox-4h2c</guid>
      <description>&lt;p&gt;Firefox containers are a way to navigate the web from multiple browsing sessions in a single window. They unlock functionalities like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authenticate with multiple accounts on a website (e.g. Facebook).&lt;/li&gt;
&lt;li&gt;Perform search queries (e.g. Google) in clean states where previous searches don't influence other searches.&lt;/li&gt;
&lt;li&gt;Prevent potentials CSRF attacks and other types of vulnerabilities because your credentials are segregated by containers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To unlock these functionalities, we will use &lt;strong&gt;Multi-Account Containers&lt;/strong&gt; which is a Firefox extension that allows us to use tabs in different browsing sessions, called containers, where data are isolated from one another. Let's go!&lt;/p&gt;

&lt;h1&gt;
  
  
  Containers
&lt;/h1&gt;

&lt;p&gt;The first step is to install &lt;strong&gt;Multi-Account Containers&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/" rel="noopener noreferrer"&gt;https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once installed, click on &lt;strong&gt;Multi-Account Containers&lt;/strong&gt; icon on the top right.&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%2Fwjc659wk4u3aqkjm5sah.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%2Fwjc659wk4u3aqkjm5sah.png" alt="Multi-Account Containers menu"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A menu should appear with preexisting containers. When clicking on one of them, a new tab opens, and you should see two things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A thin colored border on the bottom of your tab.&lt;/li&gt;
&lt;li&gt;The name and icon of your container in the right of the search bar.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnhiw5u5chi0wfz5ienmw.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%2Fnhiw5u5chi0wfz5ienmw.png" alt="Containerized tab"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Those two things mean you're browsing in a container. You can assert that it is true by authenticating to Facebook in one container and check that you're not authenticated in another.&lt;/p&gt;

&lt;p&gt;You're now able to browse websites with multiple identities 🦾🚀🔥!&lt;/p&gt;

&lt;p&gt;But there is more.&lt;/p&gt;

&lt;h1&gt;
  
  
  Temporary Containers
&lt;/h1&gt;

&lt;p&gt;Browsing in multiple containers allows you to browse websites with multiple identities, which is fantastic. But we could use this technology moreover by automatically spawning and dropping containers while navigating the web, thus increasing our security and privacy. Think about a new container every time you want to interact with servers on the internet.&lt;/p&gt;

&lt;p&gt;To do this, install &lt;strong&gt;Temporary Containers&lt;/strong&gt; from:&lt;br&gt;
&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/temporary-containers/" rel="noopener noreferrer"&gt;https://addons.mozilla.org/en-US/firefox/addon/temporary-containers/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By default, &lt;strong&gt;Temporary Containers&lt;/strong&gt; is in a passive mode and opens a new container when clicked. This new container is temporary and will be deleted (along with the data it contains) when no longer used by a tab for a certain amount of time (15 minutes by default).&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%2Fd2frv12r7jmrc346ic7s.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%2Fd2frv12r7jmrc346ic7s.png" alt="Containerized tab"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Temporary Containers&lt;/strong&gt; has a lot of options to configure to enjoy its power, and thankfully, it supports exporting and importing configurations, so you can download mine from &lt;a href="https://raw.githubusercontent.com/ctison/config/master/firefox/temporary-containers/preferences.json" rel="noopener noreferrer"&gt;temporary-containers-preferences.json&lt;/a&gt; and install it seamlessly. You can then go to &lt;strong&gt;Temporary Containers&lt;/strong&gt; import settings by right-clicking on it, then:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Manage Extension &amp;gt; ... &amp;gt; Preferences &amp;gt; Export/Import&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F56dwb6blfefpud82a1pt.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%2F56dwb6blfefpud82a1pt.png" alt="Temporary Containers' preferences link"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9p0y2ttus9b808lthn5s.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%2F9p0y2ttus9b808lthn5s.png" alt="Temporary Containers' import/export menu"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my configuration, &lt;strong&gt;Temporary Containers&lt;/strong&gt; will create a temporary container in the following cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You navigate in a newly opened tab.&lt;/li&gt;
&lt;li&gt;You navigate to an URL that has a different domain or subdomain from the current one. For example, going from &lt;a href="https://google.com" rel="noopener noreferrer"&gt;google.com&lt;/a&gt; to &lt;a href="https://facebook.com" rel="noopener noreferrer"&gt;facebook.com&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Permanent Containers
&lt;/h1&gt;

&lt;p&gt;Now that we have temporary containers spawning by default, we have to learn how to bypass them because sometimes we need to share data between websites. For example, some websites propose to authenticate via a third party account like &lt;a href="https://google.com" rel="noopener noreferrer"&gt;google.com&lt;/a&gt; or &lt;a href="https://linkedin.com" rel="noopener noreferrer"&gt;linkedin.com&lt;/a&gt;, but navigating from &lt;a href="https://example.org" rel="noopener noreferrer"&gt;example.org&lt;/a&gt; to &lt;a href="https://google.com" rel="noopener noreferrer"&gt;google.com&lt;/a&gt; would create another temporary container isolated from the previous. So we need to create permanent containers, where cross-domains navigation doesn't spawn distinct containers, and which are not automatically deleted.&lt;/p&gt;

&lt;p&gt;So let's create a container with &lt;strong&gt;Multi-Account Containers&lt;/strong&gt; named, for example, &lt;em&gt;Google&lt;/em&gt;. Once done, click on &lt;strong&gt;Temporary Containers&lt;/strong&gt; and make a container "permanent" by selecting its name in &lt;strong&gt;Exclude Permanent Containers&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwrx1tqyhvd8kqaqxfryc.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%2Fwrx1tqyhvd8kqaqxfryc.png" alt="Temporary Containers's exclude permanent containers menu"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, anything you do in this container will persist, and cross-domains navigation will not spawn new containers.&lt;/p&gt;

&lt;h1&gt;
  
  
  Tips
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Open a new tab in the same container by pressing &lt;strong&gt;Alt+X&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Right-click on a tab or a link to see containers related options.&lt;/li&gt;
&lt;li&gt;Long click on the &lt;strong&gt;Create tab&lt;/strong&gt; button to open a new tab in a specific container.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuxbkv4x55hzubbevyaqq.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%2Fuxbkv4x55hzubbevyaqq.png" alt="Create a containerized tab's menu"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;That's it! You are now completely undetectable... 🤨&lt;br&gt;
Maybe not entirely, but still, we made some progress 🐥.&lt;/p&gt;

&lt;p&gt;Note that this style of navigation may introduce irritating website behaviors that require some knowledge to neutralize. Don't worry; I will talk about these measures in the next post. In the meantime, you can reset &lt;strong&gt;Temporary Containers&lt;/strong&gt; settings by going to &lt;strong&gt;Advanced &amp;gt; General &amp;gt; Reset Storage&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The next post of this series will talk about how to block and bypass annoying content from the web with some of the following extensions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;uBlock Origin&lt;/li&gt;
&lt;li&gt;Stylus&lt;/li&gt;
&lt;li&gt;Greasemonkey&lt;/li&gt;
&lt;li&gt;Cookie Quick Manager&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy browsing 😀👀&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>productivity</category>
      <category>privacy</category>
      <category>firefox</category>
    </item>
  </channel>
</rss>
