<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Chihiro Hasegawa</title>
    <description>The latest articles on Forem by Chihiro Hasegawa (@alicemacs).</description>
    <link>https://forem.com/alicemacs</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F308746%2Ff2502eb4-bb1e-484b-88b4-1944da5c51f8.jpg</url>
      <title>Forem: Chihiro Hasegawa</title>
      <link>https://forem.com/alicemacs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/alicemacs"/>
    <language>en</language>
    <item>
      <title>pedumper: A new tool for dumping PE files</title>
      <dc:creator>Chihiro Hasegawa</dc:creator>
      <pubDate>Wed, 14 Dec 2022 22:21:11 +0000</pubDate>
      <link>https://forem.com/alicemacs/pedumper-a-new-tool-for-dumping-pe-files-294o</link>
      <guid>https://forem.com/alicemacs/pedumper-a-new-tool-for-dumping-pe-files-294o</guid>
      <description>&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;I have published a new tool for dumping PE files in the target memory on Windows🎉&lt;br&gt;
The tool name is &lt;code&gt;pedumper&lt;/code&gt;. Here is a link for the tool.&lt;br&gt;
&lt;a href="https://github.com/owlinux1000/pedumper" rel="noopener noreferrer"&gt;https://github.com/owlinux1000/pedumper&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;You can easily install &lt;code&gt;pedumper&lt;/code&gt; by &lt;code&gt;pip&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;pedumper
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to use
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;pedumper&lt;/code&gt; is a very simple interface as follows. You have to pass an argument which is a PID of the target process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feruisv2m91zvx5a58ryj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feruisv2m91zvx5a58ryj.png" alt="how to use" width="739" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the tool can find a valid PE file, the file is saved on the disk. The filename is used by the memory address.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create &lt;code&gt;pedumper&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;When I create this tool, I have to learn &lt;strong&gt;two&lt;/strong&gt; things.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;code&gt;ctypes&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;ctypes&lt;/code&gt; is a standard library of python. To use this library, we can execute Win32 API on Python like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;read_process_memory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hProcess&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;offset&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ctypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;c_size_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;buf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ctypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_string_buffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ctypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;windll&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;kernel32&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ReadProcessMemory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;ctypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cast&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hProcess&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ctypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;c_void_p&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="n"&gt;ctypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cast&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;offset&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ctypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;c_void_p&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="n"&gt;ctypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cast&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;buf&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ctypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;c_wchar_p&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Memory Basic Information of Windows
&lt;/h3&gt;

&lt;p&gt;On Windows, a memory of the process is defined by &lt;code&gt;MEMORY_BASIC_INFORMAION&lt;/code&gt; structure. Here is a definition from Microsoft Official document. I have learned some fileds of the structure through implementing &lt;code&gt;pedumper&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;typedef&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nc"&gt;_MEMORY_BASIC_INFORMATION&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;PVOID&lt;/span&gt;  &lt;span class="n"&gt;BaseAddress&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;PVOID&lt;/span&gt;  &lt;span class="n"&gt;AllocationBase&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;DWORD&lt;/span&gt;  &lt;span class="n"&gt;AllocationProtect&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;WORD&lt;/span&gt;   &lt;span class="n"&gt;PartitionId&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;SIZE_T&lt;/span&gt; &lt;span class="n"&gt;RegionSize&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;DWORD&lt;/span&gt;  &lt;span class="n"&gt;State&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;DWORD&lt;/span&gt;  &lt;span class="n"&gt;Protect&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;DWORD&lt;/span&gt;  &lt;span class="n"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;MEMORY_BASIC_INFORMATION&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;PMEMORY_BASIC_INFORMATION&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I introduced &lt;code&gt;pedumper&lt;/code&gt; created by myself. If you are interested in the tool, please use it and tell me feedback😄&lt;/p&gt;

</description>
      <category>forensics</category>
      <category>python</category>
      <category>security</category>
    </item>
    <item>
      <title>A new tool for recon Office365 users</title>
      <dc:creator>Chihiro Hasegawa</dc:creator>
      <pubDate>Thu, 19 May 2022 12:59:52 +0000</pubDate>
      <link>https://forem.com/alicemacs/a-new-tool-for-recon-office365-users-22el</link>
      <guid>https://forem.com/alicemacs/a-new-tool-for-recon-office365-users-22el</guid>
      <description>&lt;p&gt;A few days ago, I created a tool called &lt;a href="https://github.com/owlinux1000/o365discover" rel="noopener noreferrer"&gt;o365discover&lt;/a&gt; to reconnaissance Office 365 users for &lt;strong&gt;penetration testing&lt;/strong&gt;. Using this tool, you can easily check whether a lot of users exist or not on Office 365. Off course, I know there are some similar and famous tools like &lt;a href="https://github.com/LMGsec/o365creeper" rel="noopener noreferrer"&gt;o365creeper&lt;/a&gt;. However, most of these tools are slow because they does not support parallel execution. Therefore, I have implemented paralell execution by goroutine of golang. However, I'm not familiar with golang. Please feel free to advise me!&lt;/p&gt;

&lt;p&gt;Next, It's time to explain how to use. However, the way to use is very simple. If the given username does not exist, this tool does not display any result. This tool displays only valid usernames.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ o365discover -u valid@example.com
valid@example.com
$ o365discover -u invalid@example.com # nothing
$ o365discover -f emails.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, You can download the binary from this URL&lt;br&gt;
&lt;a href="https://github.com/owlinux1000/o365discover/releases/tag/v1.0.1" rel="noopener noreferrer"&gt;https://github.com/owlinux1000/o365discover/releases/tag/v1.0.1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also you can install with &lt;code&gt;go&lt;/code&gt; command.&lt;br&gt;
&lt;code&gt;go install github.com/owlinux1000/o365discover@latest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Please try it!&lt;/p&gt;

&lt;h2&gt;
  
  
  Note
&lt;/h2&gt;

&lt;p&gt;This tool is offered with no warranty and is to be used at your own risk and discretion.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>pentest</category>
      <category>go</category>
      <category>security</category>
    </item>
  </channel>
</rss>
