"HK" Daily use C # process to write a small virus

Source: Internet
Author: User
Tags try catch

As we all know, process can start and shut down the processes on the computer, the namespace is located in System.Diagnostics, this tutorial is the use of the GetProcesses and kill method to achieve.

One, coding work

First we create a console project (as long as C # is possible)

To keep this blog short, I've streamlined the code

Next we need to use foreach to cycle through the processes in the computer.

foreach (var in Process.getprocesses ())

To avoid killing yourself halfway, you need to skip yourself and use its ProcessName property (Systemkill can change it yourself)

if " Systemkill ")

Some processes do not kill, so you need to put a try catch on him before using the Kill method, like this

foreach (var in  process.getprocesses ()) {                try{                    if" Systemkill " )                         P.kill ();                 } Catch  { }            }

This will show a small box where we can change the project type to the Windows window app

There are still some stubborn system processes that cannot be killed, and this requires the highest level of authority (highestavailable)

Change the requestedExecutionLevel entry under the App.manifest file

If this file is not available in the project properties > Security > Enable ClickOnce, wait for the file to appear before you close ClickOnce.

Second, the compilation test

Video: Https://gitee.com/TwilightLemon/Updata/raw/master/cc.mp4

Distressed Computer 1 ms

Finally, attach source code a Https://github.com/TwilightLemon/SystemKill

I hope you have a lot of attention to me Oh!

"HK" Daily use C # process to write a small virus

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.