0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Windowsシステムコールの追跡

Posted at

はじめに

本件、下記記事の延長戦です。

Windowsのstdout/stderrの不可解な動き

Windowsでのシステムコール追跡方法

発想は「Linuxでのstraceみたいなツールないのかな」です。

よく紹介されるのは SysInternalsProcess Monitor

但しこれは、ファイルやレジストリを含む低レベルのイベントを捕捉するのは容易だけど、Win32APIなどの高位システムコールをそのまま追跡できるわけではない。

もうちょっとなんかツールないのか、という話。

"API Monitor" の確認と試用

某チャットAIで問い合わせてみました。
API Monitor というツールがあるそうで、、

ためしに ダウンロードセクション のPortableパッケージのURLを取得して、 VirusTotal に見てもらおう。。。

image.png

全部 Clean とはいかないか、、

いちおう心配なので、とりあえず仮想環境に投入してみましょうか。。

ダウンロードしたPortableパッケージのZIPを解凍して実行します。

image.png

image.png

起動したら、まず「API Filter」のセクションで捕捉したい関数名にチェックを入れる。
とりあえず、ミドルウエアが「おそらく」使っているであろう CreateProcessACreateProcessW をマーク。

image.png

起動中のプロセスにアタッチ(監視開始)する場合は、「Running Processes」のセクションから選択できるようです。(最初はsleepかけてる間にアタッチしてました)

image.png

ただ起動してすぐ終わっちゃうようなやつだと難しいので、プロセスの起動そのものを追加することもできそうです。

image.png

実行して、無事捕捉できると「Summary」のセクションに出力されるので選択します。

image.png

「Parameters」のセクションに詳細が出て、ポインタの参照先も確認できます。

image.png

その他

サイトの「tutorials」セクションには、いろんな使い方が紹介されているようです。

おまけ

いちおうscoop bucket作成してみました。

但し、さすがにお客様環境を含む業務環境に入れるのはお勧めできないです。。

自分で責任のとれる、閉じた環境での利用を推奨します。

api-monitor.json
{
  "version": "v2r13",
  "description": "API Monitor is a free software that lets you monitor and control API calls made by applications and services.",
  "homepage": "http://www.rohitab.com/apimonitor",
  "url": "http://www.rohitab.com/download/api-monitor-v2r13-x86-x64.zip",
  "hash": "d045e45f523a6c0c7a2a8e06831f4b2d705fb84f4995791b5a70b28424a49d2b",
  "architecture": {
    "64bit": {
      "bin": [["apimonitor-x64.exe", "apimonitor"]],
      "shortcuts": [["apimonitor-x64.exe", "API Monitor"]]
    },
    "32bit": {
      "bin": [["apimonitor-x86.exe", "apimonitor"]],
      "shortcuts": [["apimonitor-x86.exe", "API Monitor"]]
    }
  },
  "extract_dir": "API Monitor (rohitab.com)"
}

ライセンス等の記載も無く、FAQを読む限りでは Rohitab Batra さんという個人の方の製品のようです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?