Skip to content

Windows Installation

x90" * 365 edited this page Jan 14, 2016 · 28 revisions

These instructions are for Windows XP => Windows 7 using Python 2.7 (though other versions should work too)

Thanks to louppen for the great starting point!

  1. Download and install MinGW | MingGW Precompiled Binaries (Recommended)
    • Warning: PyDasm errors when compiling because MinGW32 removed support for -mno-cygwin! See Bug Report for details. Workaround options:
      • [Easiest] Use a newer version of Python, like 2.7.9. Python 2.7.10 seems to have other issues though.
      • Implement the workaround described in step 8 for building pydasm.
      • Use pre-packaged repo catalogs and an old MinGW version like MinGW Compilier v20101030 [dead link].
      • Use a prepackaged MinGW setup with workarounds like gccwinbinaries
  • On the MingGW Installation Manager select:
    • mingw32-base - Base Package
    • mingw32-gcc-g++ - C++ Compiler
    • mingw32-gcc-objc - Objective-C Compiler
  1. Install Python 2.7.9 Python 2.7.9 x86 | Python 2.7.9 x64

  2. Install Git | Git - Latest | [Git - XP SP2 x86] (http://msysgit.googlecode.com/files/Git-1.7.4-preview20110204.exe)
    (Optional) TortoiseGit | TortoiseGit - Latest | TortoiseGit - XP SP2 x86 |

  3. Update $PATH to include Python27, MinGW\bin, and Git\cmd KB article

    SET PATH=%PATH%;C:\Python27;C:\MinGW\bin;C:\Program Files\Git\cmd

  4. Checkout pydbg

     C:\sulley_build>git clone https://github.com/Fitblip/pydbg.git
     Cloning into 'pydbg'...
     remote: Counting objects: 17, done.
     remote: Compressing objects: 100% (12/12), done.
     remote: Total 17 (delta 4), reused 17 (delta 4)
     Unpacking objects: 100% (17/17), done.
    
  5. Build pydbg

     C:\sulley_build\pydbg>python setup.py install
     running install
     running build
     running build_py
     creating build
     creating build\lib
     creating build\lib\pydbg
     ...snip...
     running install_egg_info
     Removing C:\python27\Lib\site-packages\pydbg-0.0.0-py2.7.egg-info
     Writing C:\python27\Lib\site-packages\pydbg-0.0.0-py2.7.egg-info
    
  6. Download libdasm

  7. Build the extension and install it

    Note: Beware that gcc version 4.7.x removed support for -mno-cygwin, which will be a problem in some versions of Python. See http://stackoverflow.com/q/6034390/333353 and https://gist.github.com/4466320 for a fix. Python 2.7.8 is known to work out of the box without a patch.

     C:\sulley_build\libdisasm\pydasm>python setup.py build_ext -c mingw32
     running build_ext
     building 'pydasm' extension
     ...snip...  
    
     C:\sulley_build\libdisasm\pydasm>python setup.py install
     running install
     running build
     running build_ext
     running install_lib
     copying build\lib.win32-2.7\pydasm.pyd -> C:\python27\Lib\site-packages
     running install_egg_info
     Writing C:\python27\Lib\site-packages\pydasm-1.5-py2.7.egg-info
    
  8. Checkout Sulley

     C:\sulley_build>git clone https://github.com/OpenRCE/sulley.git
     Cloning into 'sulley'...
     remote: Counting objects: 148, done.
     remote: Compressing objects: 100% (91/91), done.
     remote: Total 148 (delta 53), reused 146 (delta 51)
     Receiving objects: 100% (148/148), 267.03 KiB, done.
     Resolving deltas: 100% (53/53), done.
    
  9. Make sure process_monitor.py works (no import errors)

     C:\sulley_build\sulley>python process_monitor.py
     ERR> USAGE: process_monitor.py
         <-c|--crash_bin FILENAME> filename to serialize crash bin class to
         [-p|--proc_name NAME]     process name to search for and attach to
         [-i|--ignore_pid PID]     ignore this PID when searching for the target process
         [-l|--log_level LEVEL]    log level (default 1), increase for more verbosity
         [--port PORT]             TCP port to bind this agent to
    
  10. Download PCapy

  11. Download WinPcap Dev Kit (I put mine in C:\sulley_build\WpdPack)

  12. Build PCapy (pointing to WinPcap's include and lib directories) and install it

    C:\sulley_build\pcapy-0.10.5>python setup.py build_ext -c mingw32 -I "C:\sulley_build\WpdPack\Include" -L "C:\sulley_build\WpdPack\Lib"
    running build_ext
    building 'pcapy' extension
    creating build
    creating build\temp.win32-2.7
    creating build\temp.win32-2.7\Release
    creating build\temp.win32-2.7\Release\win32
    ...snip...
    C:\sulley_build\pcapy-0.10.5>python setup.py install
    running install
    running build
    running build_ext
    running install_lib
    copying build\lib.win32-2.7\pcapy.pyd -> C:\python27\Lib\site-packages
    running install_data
    creating C:\python27\share
    creating C:\python27\share\doc
    creating C:\python27\share\doc\pcapy
    copying README -> C:\python27\share\doc\pcapy
    copying LICENSE -> C:\python27\share\doc\pcapy
    copying pcapy.html -> C:\python27\share\doc\pcapy
    running install_egg_info
    Writing C:\python27\Lib\site-packages\pcapy-0.10.5-py2.7.egg-info
    

IF YOU ARE EXPERIENCING ISSUES BUILDING PCAPY:

  • You may need to install setuptools
  • You may also need to install MinGw's g++ package since pcapy is compiling c++ code. Without you will get Errors about: "No such file or directory"
  • You may need to modify pcapy's setup.py with the locations of WpdPack Include and Lib directories from "c:\devel\oss\wpdpack\Include" to "C:\sulley_build\WpdPack\Include" (or wherever you placed yours)
  • After running setup.py build_ext -c mingw32, if you get an error saying "gcc: error: file not found" you may need to copy "C:\mingw32\lib\libw2_32.a" to "C:\sulley_build\WpdPack\Lib"
  • If you still receive an error saying "gcc: error: unrecognized command line option '-mno-cygwin'", open "C:\Python27\Lib\distutils\cygwincompiler.py" and change the line that says "no_cygwin = ' -mno-cygwin'" to "no_cygwin = ''". It should be line 323
  • Lastly, if you receive the error "g++: error: unrecognized command line option '--output-lib'", open "C:\Python27\Lib\distutils\cygwincompiler.py" and comment out the line that says "extra_preargs.extend(["--output-lib", lib_file])". Should be line 225
  1. Install WinPcap

  2. Download Impacket

  3. Install Impacket

    C:\sulley_build\Impacket-0.9.6.0>python setup.py install
    running install
    running build
    running build_py
    creating build
    creating build\lib
    creating build\lib\impacket
    copying impacket\ImpactDecoder.py -> build\lib\impacket
    copying impacket\ImpactPacket.py -> build\lib\impacket
    copying impacket\nmb.py -> build\lib\impacket
    copying impacket\ntlm.py -> build\lib\impacket
    copying impacket\smb.py -> build\lib\impacket
    copying impacket\structure.py -> build\lib\impacket
    copying impacket\uuid.py -> build\lib\impacket
    copying impacket\__init__.py -> build\lib\impacket
    creating build\lib\impacket\dcerpc
    ...snip...
    
  4. Check to make sure network_monitor.py works

    C:\sulley_build\sulley>python network_monitor.py
    ERR> USAGE: network_monitor.py
        <-d|--device DEVICE #>    device to sniff on (see list below)
        [-f|--filter PCAP FILTER] BPF filter string
        [-P|--log_path PATH]      log directory to store pcaps to
        [-l|--log_level LEVEL]    log level (default 1), increase for more verbosity
    
        [--port PORT]             TCP port to bind this agent to
    
    Network Device List:
        [0] \Device\NPF_GenericDialupAdapter
        [1] {CF0B388B-8DF5-4BC4-8ECF-404F2A1B489C}  10.0.2.64
    
  5. Start fuzzing! :)

Notes for Sulley 2.0

Network monitor requires pcapy, pydot, tornado, and flask. I found this easier to do on Ubuntu. If you know how to install Tornado on Windows, please edit here. :)

  • sudo apt-get install python-pcapy python-pydot python-tornado python-flask
Clone this wiki locally