7 Commits

Author SHA1 Message Date
es3n1n
0c9be5724f chore: bump to 1.5.0 2025-11-23 19:06:47 +01:00
es3n1n
a46fdf49ab fix(task-scheduler): properly delete defendnot task on --disable
Co-authored-by: Alessandro Bellia <casildaserrano@yahoo.it>
2025-11-23 18:59:20 +01:00
Arsenii es3n1n
2d0badd5cb docs: update readme 2025-10-17 13:23:33 +02:00
Arsenii es3n1n
2d34fcca9e Merge pull request #39 from es3n1n/bump-1-4-0 2025-07-13 04:22:13 +02:00
es3n1n
77fdc18545 chore: bump to 1.4.0 2025-07-13 04:20:55 +02:00
Arsenii es3n1n
50cceeab75 Merge pull request #38 from es3n1n/fix-callconv 2025-07-13 04:19:20 +02:00
es3n1n
5e4a32c819 fix(com): ensure com calling convention is __stdcall 2025-07-13 04:16:40 +02:00
5 changed files with 42 additions and 45 deletions

View File

@@ -1,11 +1,9 @@
# defendnot # defendnot
<img src="https://i.imgur.com/F9gWA92.png" align="right" width="50%"/>
An even funnier way to disable windows defender. An even funnier way to disable windows defender.
Defendnot is a successor of [no-defender](https://github.com/es3n1n/no-defender).
![](https://i.imgur.com/F9gWA92.png)
> [!CAUTION] > [!CAUTION]
> **Permitted Use Notice**: > **Permitted Use Notice**:
> >
@@ -17,7 +15,7 @@ Defendnot is a successor of [no-defender](https://github.com/es3n1n/no-defender)
## Installation ## Installation
> [!TIP] > [!WARNING]
> You may need to temporarily disable realtime and tamper protection before proceeding, otherwise defender will block `defendnot` binaries due to the `VirTool:Win64/Defnot.A` detection. > You may need to temporarily disable realtime and tamper protection before proceeding, otherwise defender will block `defendnot` binaries due to the `VirTool:Win64/Defnot.A` detection.
### One-liner ### One-liner
@@ -33,14 +31,11 @@ irm https://dnot.sh/ | iex
# Example 3: Without allocating console # Example 3: Without allocating console
& ([ScriptBlock]::Create((irm https://dnot.sh/))) --silent & ([ScriptBlock]::Create((irm https://dnot.sh/))) --silent
# Example 4: Run once, without allocating console
& ([ScriptBlock]::Create((irm https://dnot.sh/))) --silent --disable-autorun
``` ```
> [!NOTE]
> As seen in examples 2 and 3, you can pass the commandline arguments to the installer script and it will forward them to `defendnot-loader`. For reference what commandline arguments are allowed, see the `Usage` section below.
> [!NOTE]
> You can also directly use the 'longer' version of installer script url, which is `https://raw.githubusercontent.com/es3n1n/defendnot/refs/heads/master/install.ps1`
### Manual ### Manual
Download the [latest](https://github.com/es3n1n/defendnot/releases/latest) release, extract it somewhere and launch `defendnot-loader`. Download the [latest](https://github.com/es3n1n/defendnot/releases/latest) release, extract it somewhere and launch `defendnot-loader`.
@@ -71,13 +66,13 @@ The initial implementation of [no-defender](https://github.com/es3n1n/no-defende
## Limitations ## Limitations
- **Needs to stay on disk:** - **Needs to stay on disk:**
To keep the AV registration persistent after reboot, `defendnot` adds itself to autorun. That means the binaries have to remain on your system for the Defender "disable" to stick. (Yeah, I wish it were more elegant too.) To keep the AV registration persistent after reboot, `defendnot` adds itself to autorun. That means the binaries have to remain on your system for the Defender "disable" to stick.
- **No support for Windows Server:** - **No support for Windows Server:**
The Windows Security Center (WSC) service doesnt exist on Windows Server editions, so `defendnot` *wont* work there. See [#17](https://github.com/es3n1n/defendnot/issues/17). The Windows Security Center (WSC) service doesn't exist on Windows Server editions, so `defendnot` *won't* work there. See [#17](https://github.com/es3n1n/defendnot/issues/17).
- **Defender Detection:** - **Defender Detection:**
Not surprisingly, Windows Defender really doesnt like `defendnot` and will flag or remove it as `VirTool:Win64/Defnot.A`. Youll need to (temporarily) disable Defenders real-time and tamper protection to install. Windows Defender really doesn't like `defendnot` and will flag or remove it as `VirTool:Win64/Defnot.A`. You'll need to (temporarily) disable Defender's real-time and tamper protection to install.
## Legitimate Use Cases ## Legitimate Use Cases

View File

@@ -9,6 +9,8 @@
#include <source_location> #include <source_location>
#include <stdexcept> #include <stdexcept>
#define COM_CALLCONV __stdcall
namespace com { namespace com {
inline HRESULT checked(HRESULT result, const std::source_location loc = std::source_location::current()) { inline HRESULT checked(HRESULT result, const std::source_location loc = std::source_location::current()) {
if (result == 0) { if (result == 0) {
@@ -94,11 +96,11 @@ namespace com {
static constexpr GUID kIID = IID; static constexpr GUID kIID = IID;
private: private:
virtual HRESULT QueryInterface() = 0; virtual HRESULT COM_CALLCONV QueryInterface() = 0;
virtual std::uint32_t AddRef() = 0; virtual std::uint32_t COM_CALLCONV AddRef() = 0;
public: public:
virtual std::uint32_t Release() = 0; virtual std::uint32_t COM_CALLCONV Release() = 0;
}; };
template <typename Ty> template <typename Ty>

View File

@@ -5,7 +5,7 @@
namespace strings { namespace strings {
constexpr std::string_view kProjectName = "defendnot"; constexpr std::string_view kProjectName = "defendnot";
constexpr std::string_view kRepoUrl = "https://github.com/es3n1n/defendnot"; constexpr std::string_view kRepoUrl = "https://github.com/es3n1n/defendnot";
constexpr std::string_view kVersion = "1.3.0"; constexpr std::string_view kVersion = "1.5.0";
constexpr std::string_view kDefaultAVName = "dnot.sh"; constexpr std::string_view kDefaultAVName = "dnot.sh";

View File

@@ -42,19 +42,19 @@ namespace loader {
return false; return false;
} }
hr = service->Connect(VARIANT{}, VARIANT{}, VARIANT{}, VARIANT{}); hr = service->Connect(variant_t{}, variant_t{}, variant_t{}, variant_t{});
if (FAILED(hr)) { if (FAILED(hr)) {
return false; return false;
} }
com::Ptr<ITaskFolder> root_folder; com::Ptr<ITaskFolder> root_folder;
hr = service->GetFolder(BSTR(L"\\"), root_folder.ref_to_ptr()); hr = service->GetFolder(bstr_t(L"\\"), root_folder.ref_to_ptr());
if (FAILED(hr)) { if (FAILED(hr)) {
return false; return false;
} }
/// Cleanup our task, we will recreate it in the callback if needed /// Cleanup our task, we will recreate it in the callback if needed
root_folder->DeleteTask(BSTR(kTaskName.data()), 0); root_folder->DeleteTask(bstr_t(kTaskName.data()), 0);
return callback(service.get(), root_folder.get()); return callback(service.get(), root_folder.get());
} }
} // namespace } // namespace

View File

@@ -40,33 +40,33 @@ namespace defendnot {
class IWscAVStatus4 : public com::IBaseObject<detail::CLSID_WscIsv, detail::IID_IWscAVStatus4> { class IWscAVStatus4 : public com::IBaseObject<detail::CLSID_WscIsv, detail::IID_IWscAVStatus4> {
public: public:
virtual HRESULT Register(BSTR path_to_signed_product_exe, BSTR display_name, std::uint32_t, std::uint32_t) = 0; virtual HRESULT COM_CALLCONV Register(BSTR path_to_signed_product_exe, BSTR display_name, std::uint32_t, std::uint32_t) = 0;
virtual HRESULT Unregister() = 0; virtual HRESULT COM_CALLCONV Unregister() = 0;
virtual HRESULT UpdateStatus(WSCSecurityProductState state, BOOL unk) = 0; virtual HRESULT COM_CALLCONV UpdateStatus(WSCSecurityProductState state, BOOL unk) = 0;
virtual HRESULT InitiateOfflineCleaning(std::uint16_t*, std::uint16_t*) = 0; virtual HRESULT COM_CALLCONV InitiateOfflineCleaning(std::uint16_t*, std::uint16_t*) = 0;
virtual HRESULT NotifyUserForNearExpiration(std::uint32_t) = 0; virtual HRESULT COM_CALLCONV NotifyUserForNearExpiration(std::uint32_t) = 0;
virtual HRESULT MakeDefaultProductRequest() = 0; virtual HRESULT COM_CALLCONV MakeDefaultProductRequest() = 0;
virtual HRESULT IsDefaultProductEnforced(std::uint32_t* result) = 0; virtual HRESULT COM_CALLCONV IsDefaultProductEnforced(std::uint32_t* result) = 0;
virtual HRESULT UpdateScanSubstatus(WSCSecurityProductSubStatus status) = 0; virtual HRESULT COM_CALLCONV UpdateScanSubstatus(WSCSecurityProductSubStatus status) = 0;
virtual HRESULT UpdateSettingsSubstatus(WSCSecurityProductSubStatus status) = 0; virtual HRESULT COM_CALLCONV UpdateSettingsSubstatus(WSCSecurityProductSubStatus status) = 0;
virtual HRESULT UpdateProtectionUpdateSubstatus(WSCSecurityProductSubStatus status) = 0; virtual HRESULT COM_CALLCONV UpdateProtectionUpdateSubstatus(WSCSecurityProductSubStatus status) = 0;
virtual HRESULT RegisterAV(std::uint16_t*, std::uint16_t*, std::uint32_t, std::uint32_t) = 0; virtual HRESULT COM_CALLCONV RegisterAV(std::uint16_t*, std::uint16_t*, std::uint32_t, std::uint32_t) = 0;
virtual HRESULT UnregisterAV() = 0; virtual HRESULT COM_CALLCONV UnregisterAV() = 0;
virtual HRESULT UpdateStatusAV(WSCSecurityProductState state, BOOL unk) = 0; virtual HRESULT COM_CALLCONV UpdateStatusAV(WSCSecurityProductState state, BOOL unk) = 0;
virtual HRESULT InitiateOfflineCleaningAV(std::uint16_t*, std::uint16_t*) = 0; virtual HRESULT COM_CALLCONV InitiateOfflineCleaningAV(std::uint16_t*, std::uint16_t*) = 0;
virtual HRESULT NotifyUserForNearExpirationAV(std::uint32_t) = 0; virtual HRESULT COM_CALLCONV NotifyUserForNearExpirationAV(std::uint32_t) = 0;
virtual HRESULT RegisterFW(std::uint16_t*, std::uint16_t*, std::uint32_t, std::uint32_t) = 0; virtual HRESULT COM_CALLCONV RegisterFW(std::uint16_t*, std::uint16_t*, std::uint32_t, std::uint32_t) = 0;
virtual HRESULT UnregisterFW() = 0; virtual HRESULT COM_CALLCONV UnregisterFW() = 0;
virtual HRESULT UpdateStatusFW(WSCSecurityProductState state) = 0; virtual HRESULT COM_CALLCONV UpdateStatusFW(WSCSecurityProductState state) = 0;
virtual HRESULT RegisterAS(std::uint16_t*, std::uint16_t*, std::uint32_t, std::uint32_t) = 0; virtual HRESULT COM_CALLCONV RegisterAS(std::uint16_t*, std::uint16_t*, std::uint32_t, std::uint32_t) = 0;
virtual HRESULT UnregisterAS() = 0; virtual HRESULT COM_CALLCONV UnregisterAS() = 0;
virtual HRESULT UpdateStatusAS(WSCSecurityProductState state, BOOL unk) = 0; virtual HRESULT COM_CALLCONV UpdateStatusAS(WSCSecurityProductState state, BOOL unk) = 0;
}; };
class IWscASStatus : public com::IBaseObject<detail::CLSID_WscIsv, detail::IID_IWscASStatus> { class IWscASStatus : public com::IBaseObject<detail::CLSID_WscIsv, detail::IID_IWscASStatus> {
public: public:
virtual HRESULT Register(BSTR path_to_signed_product_exe, BSTR display_name, std::uint32_t, std::uint32_t) = 0; virtual HRESULT COM_CALLCONV Register(BSTR path_to_signed_product_exe, BSTR display_name, std::uint32_t, std::uint32_t) = 0;
virtual HRESULT Unregister() = 0; virtual HRESULT COM_CALLCONV Unregister() = 0;
virtual HRESULT UpdateStatus(WSCSecurityProductState state, BOOL unk) = 0; virtual HRESULT COM_CALLCONV UpdateStatus(WSCSecurityProductState state, BOOL unk) = 0;
}; };
} // namespace defendnot } // namespace defendnot