npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@p2k0/anti-debugger

v0.1.1

Published

一个防止调试的JavaScript的小工具

Downloads

3

Readme

@p2k0/anti-debugger

提供了一种简单粗暴且有效的方法来防止调试器对你的 JavaScript 代码进行调试。如果你需要增强你的代码的安全性,那么可以考虑使用该类。

注意事项

  • 只能作为一种基本的安全措施,并不能保证绝对的安全性。
  • 在某些情况下,可能会发生某些防调试技术失效的情况。

安装

npm

npm install @p2k0/anti-debugger -S

yarn

yarn add @p2k0/anti-debugger -S

pnpm

pnpm add @p2k0/anti-debugger -S

使用方法

在你的项目中导入 @p2k0/anti-debugger,然后创建一个实例,并将配置对象作为参数传递。配置对象包含三个可选属性,默认都为 false

  • keyboard(可选):如果设置为 true,则禁用 F12Ctrl+Shift+I 快捷键。
  • debugger(可选):如果设置为 true,则通过 debugger; 语句打开调试器。
  • console(可选):如果设置为 true,则禁用控制台输出。

示例

import AntiDebugger from "@p2k0/anti-debugger";

const antiDebugger = new AntiDebugger({
  keyboard: true,
  debugger: true,
  console: true
});
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script type="module">
      import AntiDebugger from "./anti-debugger/index.es.js";

      new AntiDebugger({
        keyboard: true,
        debugger: true,
        console: true
      });
    </script>
  </body>
</html>
<!DOCTYPE html>
<html>
<html lang="en">
  <meta charset="UTF-8">
  <title>Using @p2k0/anti-debugger with AMD</title>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
  <script>
    require.config({
      paths: {
        "@p2k0/anti-debugger": "path/to/@p2k0/anti-debugger"
      }
    });
  </script>
  <script>
    define(["@p2k0/anti-debugger"], function(AntiDebugger) {
       new AntiDebugger({
        keyboard: true,
        debugger: true,
        console: true
      });
    });
  </script>

</head>
<body></body>
</html>