CN109445875A - 基于powershell和wmi的开机启动方法 - Google Patents

基于powershell和wmi的开机启动方法 Download PDF

Info

Publication number
CN109445875A
CN109445875A CN201811361527.1A CN201811361527A CN109445875A CN 109445875 A CN109445875 A CN 109445875A CN 201811361527 A CN201811361527 A CN 201811361527A CN 109445875 A CN109445875 A CN 109445875A
Authority
CN
China
Prior art keywords
event
filter
wmi
consumer
powershell
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811361527.1A
Other languages
English (en)
Inventor
张加林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN201811361527.1A priority Critical patent/CN109445875A/zh
Publication of CN109445875A publication Critical patent/CN109445875A/zh
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44568Immediately runnable code
    • G06F9/44578Preparing or optimising for loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

本发明公开了一种基于POWERSHELL和WMI的无文件开机启动方法,包括如下步骤:通过WQL语言构造事件查询语句,并根据构造的事件查询语句构造过滤器进行时间过滤,然后构造一个消费者响应此事件,最后注册从过滤器到消费者的绑定器。本发明直接利用了Windows系统服务,在事件发生时,通过事件查询语句查询得到,并通过绑定器直接触发软件启动。本发明设计开发了一种基于POWERSHELL和WMI的随机启动方式,不修改文件系统,不修改注册表项,有效提高了用户体验。

Description

基于POWERSHELL和WMI的开机启动方法
技术领域
本发明涉及一种开机启动方法,具体涉及一种基于POWERSHELL和WMI的无文件开机启动方法。
背景技术
目前Windows操作系统中,程序随机启动的技术常用的有下面几种:
将文件放置到启动文件夹
修改注册表项
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Run
这两种随机启动方式,一种需要对文件系统进行修改,一种需要对注册表进行修改,对系统的侵入性较强,可能会对系统的稳定性和安全性造成一定的影响。
发明内容
本发明的目的在于提供一种新型的无需通过修改文件系统或修改注册表的方式实现随机启动,方便实用,侵入性低的基于POWERSHELL和WMI的无文件开机启动方法。
本发明的主要思路是根据Windows操作系统和CIM,WMI文档,WMI支持WQL进行事件查询,据此构造一个过滤器进行事件过滤,然后构造一个消费者响应此事件,最后注册从过滤器到消费者的绑定器。
本发明具体是这样实现的:
基于POWERSHELL和WMI的无文件开机启动方法,包括如下步骤:
步骤1
构造事件查询语句,查询语句的语言为WQL,语法为WQL的语法,此处以查询时间事件为例:
该条语句将会查询每次分钟为0,秒为0的事件,具体实施中可以查询时间事件,进程事件,内存事件,启动事件等等。
步骤2
构造过滤器,根据上一步的事件查询语句构造过滤器,语法为:
步骤3
构造消费者,此处以ActiveScriptEventConsumer消费者类型为例子,该类消费者在被调用时执行一段特定脚本。
其中scriptblock可根据需求随意更改。
步骤4
绑定过滤器和消费者
本发明直接利用了Windows系统服务,在事件发生时,Windows系统检查过滤器,如该事件通过该过滤器,则调用绑定到该过滤器的消费者代码,执行消费者定义的代码,触发软件启动。本发明设计开发了一种基于POWERSHELL和WMI的随机启动方式,不修改文件系统,不修改注册表项,有效提高了用户体验。
附图说明
图1为本发明的流程结构示意图;
具体实施方式
根据需求修改下面脚本中的query,scriptblock,filter name,consumer name,针对windows7及以上系统,调用powershell执行脚本即可。
本发明较好的解决了无文件开机启动的无侵入问题。
尽管这里参照本发明的解释性实施例对本发明进行了描述,上述实施例仅为本发明较佳的实施方式,本发明的实施方式并不受上述实施例的限制,应该理解,本领域技术人员可以设计出很多其他的修改和实施方式,这些修改和实施方式将落在本申请公开的原则范围和精神之内。

Claims (6)

1.一种基于POWERSHELL和WMI的无文件开机启动方法,其特征在于包括如下步骤:
通过WQL语言构造事件查询语句,并根据构造的事件查询语句构造过滤器进行时间过滤,然后构造一个消费者响应此事件,最后注册从过滤器到消费者的绑定器。
2.根据权利要求1所述基于POWERSHELL和WMI的无文件开机启动方法,其特征在于:
所述事件包括:时间事件、进程事件、内存事件、启动事件。
3.根据权利要求2所述基于POWERSHELL和WMI的无文件开机启动方法,其特征在于:
构造的事件查询语句如下:
$query="SELECT*FROM__InstanceModificationEvent WITHIN 60WHERETargetInstance ISA'Win32_LocalTime'AND TargetInstance.Minute=0ANDTargetInstance.Second=0"。
4.根据权利要求3所述基于POWERSHELL和WMI的无文件开机启动方法,其特征在于:
所述过滤器的语法为:
$filter=Set-WmiInstance-Namespace root\subscription-Class__EventFilter-Arguments@{name="filter",EventNameSpace="root\cimv2";QueryLanguage="WQL";Query=$query}。
5.根据权利要求4所述基于POWERSHELL和WMI的无文件开机启动方法,其特征在于:
构造消费者,如下:
$scriptblock=@'
echo"this is consumer script"
'@
$consumer=Set-WmiInstance-Namespace root\subscription-ClassCommandLineEventConsumer-Arguments@{name="consumer";CommandLineTemplate=$scriptblock}
其中scriptblock可根据需求随意更改。
6.根据权利要求5所述基于POWERSHELL和WMI的无文件开机启动方法,其特征在于:
绑定过滤器和消费者,如下:
Set-WmiInstance-Namespace root\subscription-Class__FilterToConsumerBinding-Arguments@{Filter=$filter;Consumer=$consumer}。
CN201811361527.1A 2018-11-15 2018-11-15 基于powershell和wmi的开机启动方法 Pending CN109445875A (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811361527.1A CN109445875A (zh) 2018-11-15 2018-11-15 基于powershell和wmi的开机启动方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811361527.1A CN109445875A (zh) 2018-11-15 2018-11-15 基于powershell和wmi的开机启动方法

Publications (1)

Publication Number Publication Date
CN109445875A true CN109445875A (zh) 2019-03-08

Family

ID=65553745

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811361527.1A Pending CN109445875A (zh) 2018-11-15 2018-11-15 基于powershell和wmi的开机启动方法

Country Status (1)

Country Link
CN (1) CN109445875A (zh)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1609795A (zh) * 2003-10-24 2005-04-27 微软公司 用于计算机平台的编程接口
US7412501B2 (en) * 2000-06-07 2008-08-12 Microsoft Corporation Event consumers for an event management system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7412501B2 (en) * 2000-06-07 2008-08-12 Microsoft Corporation Event consumers for an event management system
CN1609795A (zh) * 2003-10-24 2005-04-27 微软公司 用于计算机平台的编程接口

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MATTHEW DUNWOODY: "Dissecting One of APT29’s Fileless WMI and PowerShell Backdoors (POSHSPY)", 《HTTPS://WWW.FIREEYE.COM/BLOG/THREAT-RESEARCH/2017/03/DISSECTING_ONE_OFAP.HTML》 *
张施展: "基于 WM I技术的计算机自动化管理", 《吉林大学学报》 *

Similar Documents

Publication Publication Date Title
US10817350B2 (en) Method and device for starting external application program in browser
CN111240653B (zh) 接口文档生成方法、装置及可读存储介质
CN105528257B (zh) 一种单进程数据处理方法及装置
CN106648685B (zh) 智能终端系统应用的处理方法、装置及智能终端
CN109831466B (zh) 微服务业务处理方法及nginx服务器
CN104050409B (zh) 一种识别被捆绑软件的方法及其装置
WO2010148812A1 (zh) 一种软件集成方法、安装方法及软件集成装置、安装装置
EP2842033A1 (en) Performing autocomplete of content
CN105446739A (zh) Ui界面设置方法及装置
WO2010024534A3 (ko) 위젯 실행을 위한 사용자 단말기와 스마트 카드 간 연동 시스템 및 그 방법
CN110865824A (zh) 一种基于无障碍服务实现缄默安装的安卓渗透方法和装置
CN105786839A (zh) 一种应用数据获取方法及装置
CN104992083A (zh) 应用程序的代码混淆方法和系统
US20170005965A1 (en) Information sending method and information sending apparatus
CN109445875A (zh) 基于powershell和wmi的开机启动方法
CN108509228B (zh) 加载页面的方法、终端设备及计算机可读存储介质
CN110569076A (zh) 一种基于嵌入浏览器的控制台应用程序并实现插件化的方法
CN111124530B (zh) 浏览器首次渲染时间计算方法、装置、浏览器及存储介质
CN106953730B (zh) 物理隔离网络环境下实现含时间戳的Windows代码签名的安全方法
CN103309710A (zh) 一种vxworks操作系统加载out文件方法及系统
CN110083355B (zh) 一种app页面的处理方法及装置
CN107632884B (zh) 一种浏览器通过中间装置启动外部应用程序的方法
CN108595262B (zh) 数据处理方法及装置
CN104079540A (zh) 应用更新方法、装置及系统、用户设备
Vukotic et al. Introduction to Apache Tomcat 7

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20190308

RJ01 Rejection of invention patent application after publication