Skip to content

Commit

Permalink
Added "WinPcap Mode", in this mode, Npcap uses all WinPcap names and …
Browse files Browse the repository at this point in the history
…APIs. So any software using WinPcap can use Npcap without change.
  • Loading branch information
hsluoyz committed Dec 29, 2015
1 parent 439f60a commit 717d4cf
Show file tree
Hide file tree
Showing 14 changed files with 1,516 additions and 80 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
*.dll
Debug/
Release/
Debug(WinPcap Mode)/
Release(WinPcap Mode)/
Win7Debug/
Win7Release/
Win7DebugAdmin-onlyMode/
Win7ReleaseAdmin-onlyMode/
sdv/
/installer/win7_above/x86/
/installer/win7_above/x64/
/installer/win7_above_winpcap/x86/
/installer/win7_above_winpcap/x64/
/packetWin7/Dll/Project/Debug*/
/packetWin7/Dll/Project/Release*/
/packetWin7/Dll/Project/x64/Debug*/
Expand Down
8 changes: 8 additions & 0 deletions installer/Build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ msbuild "..\wpcap\PRJ\wpcap.sln" /t:Build /p:Configuration="Release - No AirPcap

msbuild "..\packetWin7\Dll\Project\Packet.sln" /t:Build /p:Configuration="Release No NetMon and AirPcap" /p:Platform="Win32"
msbuild "..\packetWin7\Dll\Project\Packet.sln" /t:Build /p:Configuration="Release No NetMon and AirPcap" /p:Platform="x64"
msbuild "..\packetWin7\Dll\Project\Packet.sln" /t:Build /p:Configuration="Release No NetMon and AirPcap(WinPcap Mode)" /p:Platform="Win32"
msbuild "..\packetWin7\Dll\Project\Packet.sln" /t:Build /p:Configuration="Release No NetMon and AirPcap(WinPcap Mode)" /p:Platform="x64"

msbuild "..\packetWin7\NPFInstall\NPFInstall.sln" /t:Build /p:Configuration="Release" /p:Platform="Win32"
msbuild "..\packetWin7\NPFInstall\NPFInstall.sln" /t:Build /p:Configuration="Release" /p:Platform="x64"
msbuild "..\packetWin7\NPFInstall\NPFInstall.sln" /t:Build /p:Configuration="Release(WinPcap Mode)" /p:Platform="Win32"
msbuild "..\packetWin7\NPFInstall\NPFInstall.sln" /t:Build /p:Configuration="Release(WinPcap Mode)" /p:Platform="x64"

msbuild "..\packetWin7\Helper\NPcapHelper.sln" /t:Build /p:Configuration="Release" /p:Platform="Win32"
msbuild "..\packetWin7\Helper\NPcapHelper.sln" /t:Build /p:Configuration="Release" /p:Platform="x64"
Expand All @@ -19,6 +23,10 @@ msbuild "..\packetWin7\Helper\NPcapHelper.sln" /t:Build /p:Configuration="Releas
:: Use VS2013's MSBuild to build npcap.sys
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"

msbuild "..\packetWin7\npf\npcap.sln" /t:Build /p:Configuration="Win7 Release" /p:Platform="Win32"
msbuild "..\packetWin7\npf\npcap.sln" /t:Build /p:Configuration="Win7 Release" /p:Platform="x64"
msbuild "..\packetWin7\npf\npcap.sln" /t:Build /p:Configuration="Win7 Release Admin-only Mode" /p:Platform="Win32"
msbuild "..\packetWin7\npf\npcap.sln" /t:Build /p:Configuration="Win7 Release Admin-only Mode" /p:Platform="x64"
msbuild "..\packetWin7\npf\npf.sln" /t:Build /p:Configuration="Win7 Release" /p:Platform="Win32"
msbuild "..\packetWin7\npf\npf.sln" /t:Build /p:Configuration="Win7 Release" /p:Platform="x64"
msbuild "..\packetWin7\npf\npf.sln" /t:Build /p:Configuration="Win7 Release Admin-only Mode" /p:Platform="Win32"
Expand Down
63 changes: 63 additions & 0 deletions installer/Deploy_WinPcap.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Copy Npcap driver files
xcopy /Y "..\packetWin7\npf\Win7Release\npf Package\npf.cat" .\win7_above_winpcap\x86
xcopy /Y "..\packetWin7\npf\Win7Release\npf Package\npf.inf" .\win7_above_winpcap\x86
xcopy /Y "..\packetWin7\npf\Win7Release\npf Package\npf.sys" .\win7_above_winpcap\x86
xcopy /Y "..\packetWin7\npf\x64\Win7Release\npf Package\npf.cat" .\win7_above_winpcap\x64
xcopy /Y "..\packetWin7\npf\x64\Win7Release\npf Package\npf.inf" .\win7_above_winpcap\x64
xcopy /Y "..\packetWin7\npf\x64\Win7Release\npf Package\npf.sys" .\win7_above_winpcap\x64
xcopy /Y "..\packetWin7\npf\Win7ReleaseAdmin-onlyMode\npf Package\npf.cat" .\win7_above_winpcap\x86\admin_only
xcopy /Y "..\packetWin7\npf\Win7ReleaseAdmin-onlyMode\npf Package\npf.inf" .\win7_above_winpcap\x86\admin_only
xcopy /Y "..\packetWin7\npf\Win7ReleaseAdmin-onlyMode\npf Package\npf.sys" .\win7_above_winpcap\x86\admin_only
xcopy /Y "..\packetWin7\npf\x64\Win7ReleaseAdmin-onlyMode\npf Package\npf.cat" .\win7_above_winpcap\x64\admin_only
xcopy /Y "..\packetWin7\npf\x64\Win7ReleaseAdmin-onlyMode\npf Package\npf.inf" .\win7_above_winpcap\x64\admin_only
xcopy /Y "..\packetWin7\npf\x64\Win7ReleaseAdmin-onlyMode\npf Package\npf.sys" .\win7_above_winpcap\x64\admin_only

:: Copy Packet.dll
xcopy /Y "..\packetWin7\Dll\Project\Release No NetMon and AirPcap(WinPcap Mode)\Packet.dll" .\win7_above_winpcap\x86
xcopy /Y "..\packetWin7\Dll\Project\x64\Release No NetMon and AirPcap(WinPcap Mode)\Packet.dll" .\win7_above_winpcap\x64

:: Copy NPFInstall.exe
xcopy /Y "..\packetWin7\NPFInstall\Release(WinPcap Mode)\NPFInstall.exe" .\win7_above_winpcap\x86
xcopy /Y "..\packetWin7\NPFInstall\x64\Release(WinPcap Mode)\NPFInstall.exe" .\win7_above_winpcap\x64

:: Copy NPcapHelper.exe
xcopy /Y "..\packetWin7\Helper\release\NPcapHelper.exe" .\win7_above_winpcap\x86\admin_only
xcopy /Y "..\packetWin7\Helper\x64\release\NPcapHelper.exe" .\win7_above_winpcap\x64\admin_only

:: Npcap uses the original WinPcap wpcap.dll with exactly the same code, we just changed the version number.
:: Copy wpcap.dll
xcopy /Y "..\wpcap\PRJ\Release No AirPcap\x86\wpcap.dll" .
xcopy /Y "..\wpcap\PRJ\Release No AirPcap\x64\wpcap.dll" .\x64

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: First need to add "signtool.exe" to PATH, then put the cert file (e.g. C:\xxx.pfx) to environment variable %NPF_CERT_PATH%,
:: put the private key string (e.g. 123456) to environment variable %NPF_SIGN_PK%

:: Sign Packet.dll
signtool sign /f %NPF_CERT_PATH% /p %NPF_SIGN_PK% .\win7_above_winpcap\x86\Packet.dll
signtool sign /f %NPF_CERT_PATH% /p %NPF_SIGN_PK% .\win7_above_winpcap\x64\Packet.dll

:: Sign NPFInstall.exe
signtool sign /f %NPF_CERT_PATH% /p %NPF_SIGN_PK% .\win7_above_winpcap\x86\NPFInstall.exe
signtool sign /f %NPF_CERT_PATH% /p %NPF_SIGN_PK% .\win7_above_winpcap\x64\NPFInstall.exe

:: Sign NPcapHelper.exe
signtool sign /f %NPF_CERT_PATH% /p %NPF_SIGN_PK% .\win7_above_winpcap\x86\admin_only\NPcapHelper.exe
signtool sign /f %NPF_CERT_PATH% /p %NPF_SIGN_PK% .\win7_above_winpcap\x64\admin_only\NPcapHelper.exe

:: Sign wpcap.dll
signtool sign /f %NPF_CERT_PATH% /p %NPF_SIGN_PK% .\wpcap.dll
signtool sign /f %NPF_CERT_PATH% /p %NPF_SIGN_PK% .\x64\wpcap.dll

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: First need to add "makensis.exe" to PATH
:: Generate installer
"C:\Program Files (x86)\NSIS\makensis.exe" .\NPcap-for-nmap.nsi

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Sign npcap-nmap-0.01.exe
signtool sign /f %NPF_CERT_PATH% /p %NPF_SIGN_PK% .\npcap-nmap-0.01.exe

pause
12 changes: 12 additions & 0 deletions packetWin7/Dll/Project/Packet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Packet", "Packet.vcproj", "
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug No NetMon and AirPcap(WinPcap Mode)|Win32 = Debug No NetMon and AirPcap(WinPcap Mode)|Win32
Debug No NetMon and AirPcap(WinPcap Mode)|x64 = Debug No NetMon and AirPcap(WinPcap Mode)|x64
Debug No NetMon and AirPcap|Win32 = Debug No NetMon and AirPcap|Win32
Debug No NetMon and AirPcap|x64 = Debug No NetMon and AirPcap|x64
Debug No NetMon|Win32 = Debug No NetMon|Win32
Expand All @@ -15,6 +17,8 @@ Global
Debug|x64 = Debug|x64
Release LOG_TO_FILE|Win32 = Release LOG_TO_FILE|Win32
Release LOG_TO_FILE|x64 = Release LOG_TO_FILE|x64
Release No NetMon and AirPcap(WinPcap Mode)|Win32 = Release No NetMon and AirPcap(WinPcap Mode)|Win32
Release No NetMon and AirPcap(WinPcap Mode)|x64 = Release No NetMon and AirPcap(WinPcap Mode)|x64
Release No NetMon and AirPcap|Win32 = Release No NetMon and AirPcap|Win32
Release No NetMon and AirPcap|x64 = Release No NetMon and AirPcap|x64
Release No NetMon LOG_TO_FILE|Win32 = Release No NetMon LOG_TO_FILE|Win32
Expand All @@ -29,6 +33,10 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Debug No NetMon and AirPcap(WinPcap Mode)|Win32.ActiveCfg = Debug No NetMon and AirPcap(WinPcap Mode)|Win32
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Debug No NetMon and AirPcap(WinPcap Mode)|Win32.Build.0 = Debug No NetMon and AirPcap(WinPcap Mode)|Win32
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Debug No NetMon and AirPcap(WinPcap Mode)|x64.ActiveCfg = Debug No NetMon and AirPcap(WinPcap Mode)|x64
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Debug No NetMon and AirPcap(WinPcap Mode)|x64.Build.0 = Debug No NetMon and AirPcap(WinPcap Mode)|x64
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Debug No NetMon and AirPcap|Win32.ActiveCfg = Debug No NetMon and AirPcap|Win32
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Debug No NetMon and AirPcap|Win32.Build.0 = Debug No NetMon and AirPcap|Win32
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Debug No NetMon and AirPcap|x64.ActiveCfg = Debug No NetMon and AirPcap|x64
Expand All @@ -45,6 +53,10 @@ Global
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Release LOG_TO_FILE|Win32.ActiveCfg = Release LOG_TO_FILE|Win32
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Release LOG_TO_FILE|Win32.Build.0 = Release LOG_TO_FILE|Win32
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Release LOG_TO_FILE|x64.ActiveCfg = Release LOG_TO_FILE|Win32
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Release No NetMon and AirPcap(WinPcap Mode)|Win32.ActiveCfg = Release No NetMon and AirPcap(WinPcap Mode)|Win32
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Release No NetMon and AirPcap(WinPcap Mode)|Win32.Build.0 = Release No NetMon and AirPcap(WinPcap Mode)|Win32
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Release No NetMon and AirPcap(WinPcap Mode)|x64.ActiveCfg = Release No NetMon and AirPcap(WinPcap Mode)|x64
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Release No NetMon and AirPcap(WinPcap Mode)|x64.Build.0 = Release No NetMon and AirPcap(WinPcap Mode)|x64
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Release No NetMon and AirPcap|Win32.ActiveCfg = Release No NetMon and AirPcap|Win32
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Release No NetMon and AirPcap|Win32.Build.0 = Release No NetMon and AirPcap|Win32
{17D62EEB-EABF-4D94-B1FF-BCDAAFA7DA52}.Release No NetMon and AirPcap|x64.ActiveCfg = Release No NetMon and AirPcap|x64
Expand Down
Loading

0 comments on commit 717d4cf

Please sign in to comment.