首页 > 解决方案 > 如何解决触发 Chromium 浏览器并使用 node.js Puppeteer 模块执行 Web 自动化时出现 NULL SID 登录的问题?

问题描述

我正在尝试使用 node.js puppeteer 模块进行一些网站自动化(例如:表单填写和提交)。但是,我遇到了一个问题,可能会导致我的本地用户帐户被管理员权限锁定。从事件查看器中,发生 NULL SID 登录(事件 ID)4625,并且本地帐户在此类登录 5 次后被锁定。5次失败后账户锁定的原因是我工作的公司设置的组策略。

我的问题是,为什么在触发 Chromium 浏览器并使用 puppeteer 执行 Web 自动化时会出现 NULL SID 登录尝试?以及如何通过在执行 Web 自动化时不尝试 NULL SID 登录来解决问题?

遇到的问题信息如下:

操作系统:Windows 10 Enterprise LTSC 2019 64 位(Windows 版本 1809)

node.js 版本:14.16.1 LTS 版本

铬版本:91.00.4469.0(64 位)

我的测试程序的源代码:

const puppeteer = require('puppeteer');

async function main() {
    while (true) {
        const browser = await puppeteer.launch({headless: false, defaultViewport: null , args:['--start-maximized', '--ignore-certificate-errors']});
        const pages = await browser.pages();
        const page = pages[0];
        await page.goto('http://www.google.com.hk', {waitUntil: "networkidle0"});
        await page.waitForTimeout(120000);
        await browser.close();
        await sleep(3000);
    }
}

// Function Use: Make the program sleep for milliseconds
// Function Input: milliseconds
async function sleep(ms) {
    return new Promise(resolve=>setTimeout(resolve,ms));
}


main();

我使用具有以下内容的 bat 文件运行程序:

D:
cd "D:\Program Files\Test\JSScript"
node BrowserTest.js
exit

运行程序后,事件查看器中会记录一个事件(ID:4625):

An account failed to log on.

Subject:
    Security ID:        Workstation\admin1
    Account Name:       admin1
    Account Domain:     Workstation
    Logon ID:       0x1BE6964

Logon Type:         2

Account For Which Logon Failed:
    Security ID:        NULL SID
    Account Name:       admin1
    Account Domain:     Workstation

Failure Information:
    Failure Reason:     Unknown user name or bad password.
    Status:         0xC000006D
    Sub Status:     0xC000006A

Process Information:
    Caller Process ID:  0x2d90
    Caller Process Name:    D:\Program Files\Test\JSScript\node_modules\puppeteer\.local-chromium\win64-869685\chrome-win\chrome.exe

Network Information:
    Workstation Name:   Workstation
    Source Network Address: -
    Source Port:        -

Detailed Authentication Information:
    Logon Process:      Advapi  
    Authentication Package: Negotiate
    Transited Services: -
    Package Name (NTLM only):   -
    Key Length:     0

This event is generated when a logon request fails. It is generated on the computer where access was attempted.

The Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.

The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network).

The Process Information fields indicate which account and process on the system requested the logon.

The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.

The authentication information fields provide detailed information about this specific logon request.
    - Transited services indicate which intermediate services have participated in this logon request.
    - Package name indicates which sub-protocol was used among the NTLM protocols.
    - Key length indicates the length of the generated session key. This will be 0 if no session key was requested.

上述事件发生 5 次后,在事件查看器中记录了另一个事件(ID:4740):

A user account was locked out.

Subject:
    Security ID:        SYSTEM
    Account Name:       Workstation$
    Account Domain:     MyCompanyDomain
    Logon ID:       0x3E7

Account That Was Locked Out:
    Security ID:        Workstation\admin1
    Account Name:       admin1

Additional Information:
    Caller Computer Name:   Workstation

我是新来的,如果我错过了什么,我会提供更多信息。

标签: node.jspuppeteer

解决方案


推荐阅读