• Mac下也能用抓包工具Fiddler


    一直以来都是在Windows底下工作,对于抓包工具,自然而然当属Fiddler最最出色。不过Fiddler是在.Net runtime环境下运行的,所以想要在Mac下使用,有些困难。

    在试过了Charles、Rythem、TinyProxy和NProxy这些抓包工具后,我依然苦恼,它们有的需要支付昂贵的费用,有的只支持本机网页请求代理,而有些界面只有文本模式,这让我无法适从。

    直到去年10月份(2016年10月),Telerik官网上悄然地放上了Fiddler的OSX版,这让我欣喜若狂,赶紧来尝试。

    环境安装

    Mono安装

    首先,Mac下需要使用.Net编译后的程序,需要用到跨平台的方案Mono(现阶段微软已推出跨平台的方案.Net Core,不过暂时只支持控制台程序)。安装程序可以从http://www.mono-project.com/download/#download-mac地址下载。

    安装完后,在Terminal里执行以下命令:

    1
    /Library/Frameworks/Mono.framework/Versions/<mono version>/bin/mozroots --import --sync

    此步是为了从Mozilla LXR上下载所有受信任的root证书,存于Mono的证书库里。root证书能用于请求https地址。

    接下来如果想要运行Fiddler,还需要把Mono加入到环境变量中。编辑.bash_profile文件:

    1
    sudo vi ~/.bash_profile

    加入文本:

    1
    2
    export MONO_HOME=/Library/Frameworks/Mono.framework/Versions/5.0.1
    export PATH=$PATH:$MONO_HOME/bin

    保存后重新打开Terminal,Mono环境已装好。

    Fiddler的安装

    从Fiddler官网https://www.telerik.com/download/fiddler下载fiddler-mac.zip的压缩包。解压到非中文字符的路径下。

    Fiddler运行

    打开Terminal,进入到刚才解压的Fiddler路径,执行命令运行:

    1
    sudo mono Fiddler.exe

    是不是跟Windows下的界面一样好看?

    5709266-23b02ca501285e4e.png

     

    如果启动fiddler:sudo mono Fiddler.exe 报错

    WARNING: The Carbon driver has not been ported to 64bits, and very few parts of Windows.Forms will work properly, or at all
    Stacktrace:
    
      at <unknown> <0xffffffff>
      at (wrapper managed-to-native) System.Windows.Forms.XplatUICarbon.CGDisplayBounds (intptr) [0x00002] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at System.Windows.Forms.XplatUICarbon.get_WorkingArea () [0x00005] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at System.Windows.Forms.XplatUICarbon.get_VirtualScreen () [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at System.Windows.Forms.XplatUI.get_VirtualScreen () [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at System.Windows.Forms.Screen..cctor () [0x00034] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0001e] in <4fdc5ed61a074cafb49fa42deb20d521>:0
      at <unknown> <0xffffffff>
      at System.Windows.Forms.Form.get_CreateParams () [0x00157] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at System.Windows.Forms.Control.CreateHandle () [0x0002a] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at System.Windows.Forms.Form.CreateHandle () [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at System.Windows.Forms.Control.CreateControl () [0x00039] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at System.Windows.Forms.Control.SetVisibleCore (bool) [0x0003a] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at System.Windows.Forms.Form.SetVisibleCore (bool) [0x00065] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at System.Windows.Forms.Control.set_Visible (bool) [0x00009] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at System.Windows.Forms.Control.Show () [0x00000] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.Show () [0x00031] in <36fbc38531724d82b10aef6ebafea6e9>:0
      at Fiddler.frmViewer.‹• (string[]) [0x00081] in <09623c708fdb40a483cea147bbea7a7f>:0
      at Fiddler.frmViewer.‡• (string[]) [0x00016] in <09623c708fdb40a483cea147bbea7a7f>:0
      at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) [0x0004e] in <09623c708fdb40a483cea147bbea7a7f>:0
    
    Native stacktrace:
    
        0   mono                                0x000000010a02c3d1 mono_handle_native_crash + 257
        1   mono                                0x000000010a093e86 altstack_handle_and_restore + 70
        2   SkyLight                            0x00007fffaabd4fc2 SLDisplayBounds + 50
        3   ???                                 0x00000001117e038e 0x0 + 4588438414
        4   ???                                 0x000000010a62d486 0x0 + 4469216390
        5   mono                                0x0000000109f865f4 mono_jit_runtime_invoke + 1316
        6   mono                                0x000000010a17e238 do_runtime_invoke + 88
        7   mono                                0x000000010a17a2a4 mono_runtime_class_init_full + 996
        8   mono                                0x0000000109f7fa45 mono_jit_compile_method_inner + 2485
        9   mono                                0x0000000109f82903 mono_jit_compile_method_with_opt + 1379
        10  mono                                0x000000010a02e871 common_call_trampoline + 1217
        11  mono                                0x000000010a02e379 mono_magic_trampoline + 73
        12  ???                                 0x000000010a41839e 0x0 + 4467032990
        13  ???                                 0x000000011148b81b 0x0 + 4584945691
        14  ???                                 0x000000010d8a384f 0x0 + 4522129487
        15  ???                                 0x000000010d8a34c7 0x0 + 4522128583
        16  ???                                 0x000000010a62d043 0x0 + 4469215299
        17  mono                                0x0000000109f865f4 mono_jit_runtime_invoke + 1316
        18  mono                                0x000000010a17e238 do_runtime_invoke + 88
        19  mono                                0x000000010a181849 do_exec_main_checked + 137
        20  mono                                0x0000000109fef32f mono_jit_exec + 287
        21  mono                                0x0000000109ff1b63 mono_main + 9235
        22  mono                                0x0000000109f763ad main + 253
        23  mono                                0x0000000109f762a4 start + 52
    
    Debug info from gdb:
    
    (lldb) command source -s 0 '/tmp/mono-gdb-commands.Cli6iM'
    Executing commands in '/tmp/mono-gdb-commands.Cli6iM'.
    (lldb) process attach --pid 1326
    warning: (x86_64) /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/4.5/mscorlib.dll.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
    warning: (x86_64) 
    .
    .
    .
    .
    .
    =================================================================
    Got a SIGSEGV while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries 
    used by your application.
    =================================================================
    
    Process 1326 detached
    (lldb) quit
    [1]    1326 abort      mono Fiddler.exe

    解決方案:切换32bit-mono启动fiddler

    sudo mono --arch=32 Fiddler.exe
  • 相关阅读:
    对话框中设置静态文本框字体及颜色
    UVA 10250 The Other Two Trees(几何)
    UVA 113 Power of Cryptography(数学)
    VC++设置半透明界面
    UVA 10474 Where is the Marble?
    UVA 123 Searching Quickly(分离单词)
    为对话框在标题栏和任务栏关联图标
    UVA 152 Tree's a Crowd
    UVA 156 Ananagrams
    UVA 299 Train Swapping(冒泡排序)
  • 原文地址:https://www.cnblogs.com/liugp/p/10372089.html
Copyright © 2020-2023  润新知