[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[问题求助] VBS调用第三方程序实现截屏/屏幕截图

本帖最后由 pcl_test 于 2017-1-7 12:07 编辑

这代码是什么语言?
我已经知道如何截图了,但仍不知道如何区域截图。也不知道如何裁图,明明调整全屏截图的画布大小就可以达到区域截图的目的。
找到了如下代码,甚至不知道原文出自哪里。
  1. data = "4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000C00000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000450E6EDA016F0089016F0089016F0089016F0189006F008963701389026F0089E9700B89006F008952696368016F008900000000000000000000000000000000504500004C01010017E773460000000000000000E0000F010B01060000000000000400000000000080110000001000000010000000004000001000000002000004000000000000000400000000000000002000000002000000000000020000000000100000100000000010000010000000000000100000000000000000000000F012000028000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000080000000000000000000000000000000000000000000000000000002E646174610000003A030000001000000004000000020000000000000000000000000000400000C0000000000000000000000000000000000000000000000000000000000000000020130000000000004D657373616765426F784100476574436F6D6D616E644C696E6541006B657962645F6576656E74004578697450726F6365737300467265654C696272617279004C6F61644C6962726172794100000000757365723332000053637265656E4361746368204279205368696C7978000000B3C9B9A6BDABD7A5CDBCB1A3B4E6B5BDCFB5CDB3BCF4CCF9B0E5000000000000000000000000000083EC0C535556578B7C24208B473C03C78138504500000F858E0000008B48788B44392003CF03C7894C2418C7442420000000008B491885C9894C2414766C8B6C2424894424248A4D008BD181E2FF00000089542410EB048B5424108B008BCD8D343833C08A062BC275248A55002BF584D274178A51014133C08BDA8A040E81E3FF0000002BC374E7EB0485C074268B4C24208B4424248B5424144183C0043BCA894C24208944242472AD5F5E5D33C05B83C40CC38B4424188B5424208B48248B401C8D0C5133D2668B14398D0C908B043903C75F5E5D5B83C40CC39090909090558BEC81EC48010000535657B906000000BE781040008D7DBCF3A566A5A4B905000000BE601040008D7DD8A158104000F3A5668B0D5C1040008A155E10400066A58945F466894DF88855FAC745FC0000000064A1180000008945FC8B45FC68481040008B48308B510C8B420C8B088B118B721856E8A7FEFFFF683C104000568BF8E89AFEFFFF6830104000568945FCE88CFEFFFF83C4188945F08D45F450FFD78BD8682410400053E873FEFFFF8B3D0010400083C4086A006A006A006A2CFFD76A006A026A006A2CFFD7681410400056E84BFEFFFF8BD0B94000000033C08DBDB9FEFFFFC685B8FEFFFF0083C408F3AB66ABAAFFD28BF883C9FF33C08D95B8FEFFFFF2AEF7D12BF98BC18BF78BFAC1E902F3A58BC833C083E103F3A48DBDB8FEFFFF83C9FFF2AEF7D1498A8C0DB7FEFFFF80F973742180F953741C680810400053E8DAFDFFFF83C4088D4DD88D55BC6A4051526A00FFD053FF55FC6A00FF55F05F5E5B8BE55DC39090909090909090901813000000000000000000002E1300000010000000000000000000000000000000000000000000002013000000000000AA026B657962645F6576656E74005553455233322E646C6C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
  2. TargetFileName = "C:/mp.exe"
  3. With CreateObject("ADODB.Stream"):.Type = 1:.Open:.Write StrToByte(data):.SaveToFile TargetFileName, 2:.Close:End With
  4. WScript.CreateObject("WScript.Shell").Run TargetFileName & " /s"
  5. MsgBox "当前屏幕图象已经拷贝到系统剪贴板", 64, "信息"
  6. Function StrToByte(str)
  7.         Set xmldoc = CreateObject("Microsoft.XMLDOM")
  8.         xmldoc.loadXML "<?xml version=""1.0""?>"
  9.         Set pic = xmldoc.createElement("pic")
  10.         pic.dataType = "bin.hex"
  11.         pic.nodeTypedValue = str
  12.         StrToByte = pic.nodeTypedValue
  13. End Function
复制代码
这个方法很厉害呀,先用这什么语言写个软件,再把其二进制代码输到VBS,让VBS创建该程序并调用之。
本代码将生成用途为全屏截图的exe文件。想知道这exe是用什么代码写的。
1

评分人数

    • CrLf: StrToByte技术 + 1
您好

本帖最后由 pcl_test 于 2017-4-30 19:48 编辑

vbs+c#.net
  1. '发送prtsc键+剪贴板获取图片,期间将清除剪贴板内容
  2. Set objShell = CreateObject("Wscript.Shell")
  3. Set fso = CreateObject("Scripting.FileSystemObject")
  4. currentpath = fso.GetFolder(".").Path '设置图片保存路径,默认为当前文件夹
  5. Set tmp = fso.GetSpecialFolder(2)
  6. Set systemroot = fso.GetSpecialFolder(0)
  7. net = systemroot&"\Microsoft.NET\Framework"
  8. If not fso.FileExists(tmp&"\$PrtSc.cs") Then
  9.     Call CreateCs
  10.     Set SubFolders = fso.GetFolder(net).SubFolders
  11.     For Each Folder In SubFolders
  12.         If fso.FileExists(Folder&"\csc.exe") Then
  13.             cscpath = Folder&"\csc.exe"
  14.             Exit For
  15.         End If
  16.     Next
  17.     If cscpath = "" Then
  18.         Msgbox "未安装Microsoft .NET Framework 2.0及以上组件或是相关程序缺失!"
  19.         Wscript.Quit
  20.     Else
  21.         '调用csc.exe编译cs文件
  22.         objShell.Run cscpath&" /out:"""&tmp&"\$PrtSc.exe"" """&tmp&"\$PrtSc.cs""", 0, True
  23.     End If
  24. End If
  25. fso.DeleteFile tmp&"\$PrtSc.cs"
  26. DO  '自行修改截屏条件
  27.     i = i + 1
  28.     objShell.Run tmp&"\$PrtSc.exe", 0, True
  29.     Wscript.Sleep 1000    '设置截屏时间间隔(毫秒)
  30. Loop Until i = 5   '设置截屏张数
  31. Function CreateCs
  32.     'C# codes,调用系统API实现截屏
  33.     Set cs = fso.CreateTextFile(tmp&"\$PrtSc.cs", True)
  34.     cs.Write _
  35.     "using System;using System.Drawing;using System.Drawing.Imaging;" & vbCrLf & _
  36.     "using System.Windows.Forms;using System.Runtime.InteropServices;" & vbCrLf & _
  37.     "public class Prtsc{" & vbCrLf & _
  38.     "   [DllImport(""user32.dll"")]" & vbCrLf & _
  39.     "   public static extern void keybd_event(byte bVk,byte bScan,uint dwFlags,IntPtr dwExtraInfo);" & vbCrLf & _
  40.     "   [STAThread]" & vbCrLf & _
  41.     "   public static void Main(){" & vbCrLf & _
  42.     "      keybd_event((byte)0x2c, 0, 0x0, IntPtr.Zero);" & vbCrLf & _
  43.     "      keybd_event((byte)0x2c, 0, 0x2, IntPtr.Zero);" & vbCrLf & _
  44.     "      string dt = System.DateTime.Now.ToString(""yyyyMMddHHmmssfff"");" & vbCrLf & _
  45.     "      IDataObject data = Clipboard.GetDataObject();" & vbCrLf & _
  46.     "      if (data.GetDataPresent(DataFormats.Bitmap)){" & vbCrLf & _
  47.     "         Image img = (Image)data.GetData(DataFormats.Bitmap,true);" & vbCrLf & _
  48.     "         img.Save("""&replace(currentpath,"\","\\")&"\\""+dt+"".bmp"", ImageFormat.Bmp);" & vbCrLf & _
  49.     "}}}"
  50. End Function
复制代码
  1. '参考http://www.bathome.net/redirect.php?goto=findpost&pid=78571&ptid=11646
  2. '期间不影响剪贴板内容
  3. Set objShell = CreateObject("Wscript.Shell")
  4. Set fso = CreateObject("Scripting.FileSystemObject")
  5. currentpath = fso.GetFolder(".").Path '设置图片保存路径,默认为当前文件夹
  6. Set tmp = fso.GetSpecialFolder(2)
  7. Set systemroot = fso.GetSpecialFolder(0)
  8. net = systemroot&"\Microsoft.NET\Framework"
  9. If not fso.FileExists(tmp&"\$PrtSc.cs") Then
  10.     Call CreateCs
  11.     Set SubFolders = fso.GetFolder(net).SubFolders
  12.     For Each Folder In SubFolders
  13.         If fso.FileExists(Folder&"\csc.exe") Then
  14.             cscpath = Folder&"\csc.exe"
  15.             Exit For
  16.         End If
  17.     Next
  18.     If cscpath = "" Then
  19.         Msgbox "未安装Microsoft .NET Framework 2.0及以上组件或是相关程序缺失!"
  20.         Wscript.Quit
  21.     Else
  22.         '调用csc.exe编译cs文件
  23.         objShell.Run cscpath&" /out:"""&tmp&"\$PrtSc.exe"" """&tmp&"\$PrtSc.cs""", 0, True
  24.     End If
  25. End If
  26. fso.DeleteFile tmp&"\$PrtSc.cs"
  27. DO  '自行修改截屏条件
  28.     i = i + 1
  29.     objShell.Run tmp&"\$PrtSc.exe", 0, True
  30.     Wscript.Sleep 1000    '设置截屏时间间隔(毫秒)
  31. Loop Until i = 5   '设置截屏张数
  32. Function CreateCs
  33.     Set cs = fso.CreateTextFile(tmp&"\$PrtSc.cs", True)
  34.     cs.Write _
  35.     "using System;using System.Drawing;using System.Drawing.Imaging;using System.Windows.Forms;" & vbCrLf & _
  36.     "public class Prtsc{" & vbCrLf & _
  37.     "   public static void Main(){" & vbCrLf & _
  38.     "       Image img = new Bitmap(Screen.AllScreens[0].Bounds.Width, Screen.AllScreens[0].Bounds.Height);" & vbCrLf & _
  39.     "       Graphics g = Graphics.FromImage(img);" & vbCrLf & _
  40.     "       g.CopyFromScreen(new Point(0, 0), new Point(0, 0), Screen.AllScreens[0].Bounds.Size);" & vbCrLf & _
  41.     "       string dt = System.DateTime.Now.ToString(""yyyyMMddHHmmssfff"");" & vbCrLf & _
  42.     "       img.Save("""&replace(currentpath,"\","\\")&"\\""+dt+"".bmp"", ImageFormat.Bmp);" & vbCrLf & _
  43.     "}}"
  44. End Function
复制代码
3

评分人数

TOP

回复 13# yu2n


    是啊,js 真是越用越爱用,除了老版本 EMACScript 有些功能上的欠缺,其他方面还是非常有意思的

TOP

回复 11# CrLf

用 VBS 写了个跟你类似的编码程序,体积较大。
解码程序还在琢磨,话说用 JS 也太简洁了吧。
  1. Function CompressionText(ByVal Text)
  2.   Const MinLen = 4
  3.   If Len(Text) <= MinLen Then
  4.     CompressionText = Text
  5.     Exit Function
  6.   End If
  7.   Dim arr(), i, str
  8.   ReDim Preserve arr(1, 0)
  9.   arr(0, 0) = Mid(Text, 1, 1)
  10.   arr(1, 0) = 1
  11.   For i = 2 To Len(Text)
  12.     If Mid(Text, i - 1, 1) = Mid(Text, i, 1) Then
  13.       arr(1, UBound(arr, 2)) = arr(1, UBound(arr, 2)) + 1
  14.     Else
  15.       ReDim Preserve arr(1, UBound(arr, 2) + 1)
  16.       arr(0, UBound(arr, 2)) = Mid(Text, i, 1)
  17.       arr(1, UBound(arr, 2)) = 1
  18.     End If
  19.   Next
  20.   For i = 0 To UBound(arr, 2)
  21.     If arr(1, i) >= MinLen Then
  22.       str = str & arr(0, i) & "[" & arr(1, i) & "]"
  23.     Else
  24.       str = str & String(arr(1, i), arr(0, i))
  25.     End If
  26.   Next
  27.   CompressionText = str
  28. End Function
复制代码
『千江有水千江月』千江有水,月映千江;万里无云,万里青天。    http://yu2n.qiniudn.com/

TOP

回复 5# Demon


   
回复 7# 523066680


   
回复 8# Spring


   
回复 10# yu2n


   
兄弟们求支援,折腾一天了,搞不定:http://www.bathome.net/viewthread.php?tid=37472

TOP

简单压缩下:
  1. var TextBase64_encode = "TVqQA{2}MA{4}EA{4}/{2}8A{2}LgA{9}QA{1b}sA{5}4fug4AtAnNIbgBTM"+
  2. "0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJA"+
  3. "{9}BdXG3BGT0Dkhk9A5IZPQOSlyIQkh49A5LlHRGSGD0DklJpY2gZPQOSA{a"+
  4. "}BQRQA{2}TAECACGz/EgA{a}OA{2}DwELAQUMA{2}IA{4}CA{9}BA{5}QA{4"+
  5. "}IA{5}BA{4}QA{5}gA{2}BA{a}EA{b}wA{5}gA{8}IA{6}BA{3}BA{6}EA{3"+
  6. "}EA{8}BA{f}BAgA{3}8A{34}IA{3}EA{10}C50ZXh0A{4}IA{6}QA{5}gA{4"+
  7. "}IA{i}CA{3}GAucmRhdGEA{2}JIA{5}IA{5}IA{4}EA{i}BA{3}BA{b}BqAG"+
  8. "oAagBqLOgHA{4}agDoBgA{3}P8lC{2}BA{2}P8lACBA{hu}HYgA{8}XCA{8}"+
  9. "BUIA{d}BqIA{3}C{2}A{3}EwgA{d}IQgA{4}IA{t}B2IA{8}FwgA{8}YAJrZ"+
  10. "XliZF9ldmVudAB1c2VyMzIuZGxsA{2}CA{2}EV4aXRQcm9jZXNzAGtlcm5lb"+
  11. "DMyLmRsbA{dn}"
  12. var TextBase64 = decode(TextBase64_encode)
  13. WScript.Echo(TextBase64)
  14. var BinaryFile = "PrtSc.EXE"  
  15. var adSaveCreateOverWrite = 2
  16. var adTypeBinary          = 1
  17. var objStream = WScript.CreateObject("ADODB.Stream")  
  18. var objXML = WScript.CreateObject("MSXml2.DOMDocument")
  19. var objDocElem = objXML.createElement("Base64Data")
  20. objDocElem.dataType = "bin.base64"
  21. objDocElem.text = TextBase64
  22. objStream.Type = adTypeBinary
  23. objStream.Open()
  24. objStream.Write(objDocElem.nodeTypedValue)
  25. objStream.SaveToFile(BinaryFile, adSaveCreateOverWrite)
  26. var objXML = null
  27. var objDocElem = null
  28. var objStream = null
  29. WScript.CreateObject("WScript.Shell").Run(BinaryFile, 0, true)
  30. WScript.Echo("截图已复制到剪贴板。")
  31. function decode(str){
  32. return str.replace(/(.)\{(\w+)\}/g,function($0,$1,$2){return (new Array(parseInt($2,36)+1)).join($1)})
  33. }
  34. function encode(str){
  35. return str.replace(/(.)\1+/g,function($0,$1){return $1+'{'+$0.length.toString(36)+'}'})
  36. }
复制代码
1

评分人数

    • yu2n: 感谢分享技术 + 1

TOP

请问各位有没有好的字符串压缩代码,分享一下。

我准备把上面的代码压缩一下,连续的字符太多了,完全可以压缩很多啊。
『千江有水千江月』千江有水,月映千江;万里无云,万里青天。    http://yu2n.qiniudn.com/

TOP

带证书的命令行截图程序难找。本论坛有个不报毒的,编码之后如下:
  1. Dim TextBase64
  2. TextBase64 = "TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" & _
  3.   "AAAAAAAAsAAAA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AAAAAAAAA" & _
  29.   "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" & _
  30.   "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  31. Const BinaryFile = "PrtSc.EXE"  
  32. Const adSaveCreateOverWrite = 2
  33. Const adTypeBinary          = 1
  34. Dim objXML
  35. Dim objDocElem
  36. Dim objStream
  37. Set objStream = CreateObject("ADODB.Stream")  
  38. Set objXML = CreateObject("MSXml2.DOMDocument")
  39. Set objDocElem = objXML.createElement("Base64Data")
  40. objDocElem.DataType = "bin.base64"
  41. objDocElem.text = TextBase64
  42. objStream.Type = adTypeBinary
  43. objStream.Open()
  44. objStream.Write objDocElem.NodeTypedValue
  45. objStream.SaveToFile BinaryFile, adSaveCreateOverWrite
  46. Set objXML = Nothing
  47. Set objDocElem = Nothing
  48. Set objStream = Nothing
  49. CreateObject("WScript.Shell").Run BinaryFile, 0, True
  50. Msgbox "截图已复制到剪贴板。", vbSystemModal+vbInformation, WScript.ScriptName
复制代码
PrtSc.EXE 来源:
[其他] 发送PrtSc键的工具(1.5KB)——可截屏(弥补vbs之SendKeys缺憾)
http://www.bathome.net/thread-2254-1-1.html
『千江有水千江月』千江有水,月映千江;万里无云,万里青天。    http://yu2n.qiniudn.com/

TOP

本帖最后由 Spring 于 2015-9-26 23:33 编辑

EXE需要的是代码签名证书,得去有权限的颁发机构(国内的比如天威诚信)申请,基本都是要收钱的(一年期大概几千块),一般会给你一个 pfx 格式的文件并告诉你密码,然后你自己使用签名工具可视化操作就可以完成签名了。

当然,要在自己电脑上随便玩玩,可以自己生成一个证书,导入到受信任的区域,用这个给程序签名就可以了

我把这些操作写到一个批处理里面:
MakeCertAndSign.bat
  1. @echo off
  2. REM 几个时间戳服务器
  3. REM http://timestamp.verisign.com/scripts/timstamp.dll
  4. REM http://timestamp.globalsign.com/scripts/timstamp.dll
  5. REM http://timestamp.wosign.com/timestamp
  6. :Default
  7. set fn=我叫叶良辰
  8. set CN=Spring
  9. set O=Bathome
  10. set C=CN
  11. set EMAIL=Sprint@bathome.net
  12. set b=10/25/2007
  13. set e=10/24/2048
  14. :Customize
  15. set /p fn=生成的证书文件名(例如 "%fn%"):
  16. set /p CN=签名人(例如 "%CN%"):
  17. set /p O=组织(例如 "%O%"):
  18. set /p C=国家(例如 "%C%"):
  19. set /p EMAIL=电子邮件(例如 "%EMAIL%"):
  20. set /p b=证书生效日(例如 "%b%"):
  21. set /p e=证书失效日(例如 "%e%"):
  22. :MakeCert
  23. makecert -n "CN=%CN%,O=%O%,C=%CN%,EMAIL=%EMAIL%" -r -b %b% -e %e% -sv %fn%.pvk %fn%.cer
  24. cert2spc %fn%.cer %fn%.spc
  25. if %errorlevel% neq 0 goto :Exception
  26. :SignWizard
  27. echo 已经生成名为 %fn% 的证书,按任意键启动签名工具进行签名。
  28. pause>nul
  29. start /w signtool signwizard
  30. echo 完成。
  31. pause>nul
  32. goto :EOF
  33. :Exception
  34. echo 操作失败。
  35. pause>nul
复制代码
下面是一个签好的VBS代码,保存为文件之后,你可以在属性里面看到数字签名标签
SignedScripts.vbs
  1. data = "4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000C00000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000450E6EDA016F0089016F0089016F0089016F0189006F008963701389026F0089E9700B89006F008952696368016F008900000000000000000000000000000000504500004C01010017E773460000000000000000E0000F010B01060000000000000400000000000080110000001000000010000000004000001000000002000004000000000000000400000000000000002000000002000000000000020000000000100000100000000010000010000000000000100000000000000000000000F012000028000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000080000000000000000000000000000000000000000000000000000002E646174610000003A030000001000000004000000020000000000000000000000000000400000C0000000000000000000000000000000000000000000000000000000000000000020130000000000004D657373616765426F784100476574436F6D6D616E644C696E6541006B657962645F6576656E74004578697450726F6365737300467265654C696272617279004C6F61644C6962726172794100000000757365723332000053637265656E4361746368204279205368696C7978000000B3C9B9A6BDABD7A5CDBCB1A3B4E6B5BDCFB5CDB3BCF4CCF9B0E5000000000000000000000000000083EC0C535556578B7C24208B473C03C78138504500000F858E0000008B48788B44392003CF03C7894C2418C7442420000000008B491885C9894C2414766C8B6C2424894424248A4D008BD181E2FF00000089542410EB048B5424108B008BCD8D343833C08A062BC275248A55002BF584D274178A51014133C08BDA8A040E81E3FF0000002BC374E7EB0485C074268B4C24208B4424248B5424144183C0043BCA894C24208944242472AD5F5E5D33C05B83C40CC38B4424188B5424208B48248B401C8D0C5133D2668B14398D0C908B043903C75F5E5D5B83C40CC39090909090558BEC81EC48010000535657B906000000BE781040008D7DBCF3A566A5A4B905000000BE601040008D7DD8A158104000F3A5668B0D5C1040008A155E10400066A58945F466894DF88855FAC745FC0000000064A1180000008945FC8B45FC68481040008B48308B510C8B420C8B088B118B721856E8A7FEFFFF683C104000568BF8E89AFEFFFF6830104000568945FCE88CFEFFFF83C4188945F08D45F450FFD78BD8682410400053E873FEFFFF8B3D0010400083C4086A006A006A006A2CFFD76A006A026A006A2CFFD7681410400056E84BFEFFFF8BD0B94000000033C08DBDB9FEFFFFC685B8FEFFFF0083C408F3AB66ABAAFFD28BF883C9FF33C08D95B8FEFFFFF2AEF7D12BF98BC18BF78BFAC1E902F3A58BC833C083E103F3A48DBDB8FEFFFF83C9FFF2AEF7D1498A8C0DB7FEFFFF80F973742180F953741C680810400053E8DAFDFFFF83C4088D4DD88D55BC6A4051526A00FFD053FF55FC6A00FF55F05F5E5B8BE55DC39090909090909090901813000000000000000000002E1300000010000000000000000000000000000000000000000000002013000000000000AA026B657962645F6576656E74005553455233322E646C6C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
  2. TargetFileName = "C:/mp.exe"
  3. With CreateObject("ADODB.Stream"):.Type = 1:.Open:.Write StrToByte(data):.SaveToFile TargetFileName, 2:.Close:End With
  4. WScript.CreateObject("WScript.Shell").Run TargetFileName & " /s"
  5. MsgBox "当前屏幕图象已经拷贝到系统剪贴板", 64, "信息"
  6. Function StrToByte(str)
  7.         Set xmldoc = CreateObject("Microsoft.XMLDOM")
  8.         xmldoc.loadXML "<?xml version=""1.0""?>"
  9.         Set pic = xmldoc.createElement("pic")
  10.         pic.dataType = "bin.hex"
  11.         pic.nodeTypedValue = str
  12.         StrToByte = pic.nodeTypedValue
  13. End Function
  14. '' SIG '' Begin signature block
  15. '' SIG '' MIIPmwYJKoZIhvcNAQcCoIIPjDCCD4gCAQExCzAJBgUr
  16. '' SIG '' DgMCGgUAMGcGCisGAQQBgjcCAQSgWTBXMDIGCisGAQQB
  17. '' SIG '' gjcCAR4wJAIBAQQQTvApFpkntU2P5azhDxfrqwIBAAIB
  18. '' SIG '' AAIBAAIBAAIBADAhMAkGBSsOAwIaBQAEFNB8VayJLLSu
  19. '' SIG '' aiDUtrXu9+7q0dunoIILYDCCAsMwggIsoAMCAQICECHb
  20. '' SIG '' HzAXbjq+QBSkSzJbvaIwDQYJKoZIhvcNAQEEBQAwVzEh
  21. '' SIG '' MB8GCSqGSIb3DQEJARYSU3ByaW50QGJhdGhvbWUubmV0
  22. '' SIG '' MQ8wDQYDVQQGEwZTcHJpbmcxEDAOBgNVBAoTB0JhdGhv
  23. '' SIG '' bWUxDzANBgNVBAMTBlNwcmluZzAeFw0wNzEwMjQxNjAw
  24. '' SIG '' MDBaFw00ODEwMjMxNjAwMDBaMFcxITAfBgkqhkiG9w0B
  25. '' SIG '' CQEWElNwcmludEBiYXRob21lLm5ldDEPMA0GA1UEBhMG
  26. '' SIG '' U3ByaW5nMRAwDgYDVQQKEwdCYXRob21lMQ8wDQYDVQQD
  27. '' SIG '' EwZTcHJpbmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
  28. '' SIG '' AoGBALlFbL+nnsFBX25kqG/rVjo9D3PpFMpSFxa2Mdjo
  29. '' SIG '' CEkWANSv5cgFNaokdjCLg+SPn9utbKEOCFtTcClHKNHA
  30. '' SIG '' qSjzRqY2k3nkCsbhvHx9hcaW/yKAA2C1JaDfCBf0Ytar
  31. '' SIG '' hUoSdBaH5MNrB/a9qEqn31CIZoMnZS2nQDnkjsjZyHm/
  32. '' SIG '' AgMBAAGjgY8wgYwwgYkGA1UdAQSBgTB/gBDzQaOC8p6I
  33. '' SIG '' 07s1POSSrWy+oVkwVzEhMB8GCSqGSIb3DQEJARYSU3By
  34. '' SIG '' aW50QGJhdGhvbWUubmV0MQ8wDQYDVQQGEwZTcHJpbmcx
  35. '' SIG '' EDAOBgNVBAoTB0JhdGhvbWUxDzANBgNVBAMTBlNwcmlu
  36. '' SIG '' Z4IQIdsfMBduOr5AFKRLMlu9ojANBgkqhkiG9w0BAQQF
  37. '' SIG '' AAOBgQCI8WGuSuHj13e74vVdxtR01lBvzdSdvL0KRsda
  38. '' SIG '' wmf6psNcF2pEJvs1QsjDtzKoipOjIDEuizm8kB8X67kB
  39. '' SIG '' yp/upBCx+0G8QlkdyQQIkx8GdSs25UV1unV6Um7hBvW8
  40. '' SIG '' BAaUH9cSGB0CSOSkiVfCw191BreacCZbG/2j1FOdATgg
  41. '' SIG '' fDCCA+4wggNXoAMCAQICEH6T6/t8xk5Z6kuad9QG/Dsw
  42. '' SIG '' DQYJKoZIhvcNAQEFBQAwgYsxCzAJBgNVBAYTAlpBMRUw
  43. '' SIG '' EwYDVQQIEwxXZXN0ZXJuIENhcGUxFDASBgNVBAcTC0R1
  44. '' SIG '' cmJhbnZpbGxlMQ8wDQYDVQQKEwZUaGF3dGUxHTAbBgNV
  45. '' SIG '' BAsTFFRoYXd0ZSBDZXJ0aWZpY2F0aW9uMR8wHQYDVQQD
  46. '' SIG '' ExZUaGF3dGUgVGltZXN0YW1waW5nIENBMB4XDTEyMTIy
  47. '' SIG '' MTAwMDAwMFoXDTIwMTIzMDIzNTk1OVowXjELMAkGA1UE
  48. '' SIG '' BhMCVVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0
  49. '' SIG '' aW9uMTAwLgYDVQQDEydTeW1hbnRlYyBUaW1lIFN0YW1w
  50. '' SIG '' aW5nIFNlcnZpY2VzIENBIC0gRzIwggEiMA0GCSqGSIb3
  51. '' SIG '' DQEBAQUAA4IBDwAwggEKAoIBAQCxrLNJVEuXHBIK2CV5
  52. '' SIG '' kSJXKm/cuCbEQ3Nrwr8uUFr7FMJ2jkMBJUO0oeJF9Oi3
  53. '' SIG '' e8N0zCLXtJQAAvdN7b+0t0Qka81fRTvRRM5DEnMXgotp
  54. '' SIG '' tCvLmR6schsmTXEfsTHd+1FhAlOmqvVJLAV4RaUvic7n
  55. '' SIG '' mef+jOJXPz3GktxK+Hsz5HkK+/B1iEGc/8UDUZmq12yf
  56. '' SIG '' k2mHZSmDhcJgFMTIyTsU2sCB8B8NdN6SIqvK9/t0fCfm
  57. '' SIG '' 90obf6fDni2uiuqm5qonFn1h95hxEbziUKFL5V365Q6n
  58. '' SIG '' LJ+qZSDT2JboyHylTkhE/xniRAeSC9dohIBdanhkRc1g
  59. '' SIG '' Rn5UwRN8xXnxycFxAgMBAAGjgfowgfcwHQYDVR0OBBYE
  60. '' SIG '' FF+a9W5czMx0mtTdfe8/2+xMgC7dMDIGCCsGAQUFBwEB
  61. '' SIG '' BCYwJDAiBggrBgEFBQcwAYYWaHR0cDovL29jc3AudGhh
  62. '' SIG '' d3RlLmNvbTASBgNVHRMBAf8ECDAGAQH/AgEAMD8GA1Ud
  63. '' SIG '' HwQ4MDYwNKAyoDCGLmh0dHA6Ly9jcmwudGhhd3RlLmNv
  64. '' SIG '' bS9UaGF3dGVUaW1lc3RhbXBpbmdDQS5jcmwwEwYDVR0l
  65. '' SIG '' BAwwCgYIKwYBBQUHAwgwDgYDVR0PAQH/BAQDAgEGMCgG
  66. '' SIG '' A1UdEQQhMB+kHTAbMRkwFwYDVQQDExBUaW1lU3RhbXAt
  67. '' SIG '' MjA0OC0xMA0GCSqGSIb3DQEBBQUAA4GBAAMJm495739Z
  68. '' SIG '' MKrvaLX64wkdu0+CBl03X6ZSnxaN6hySCURu9W3rWHww
  69. '' SIG '' 6PlpjSNzCxJvR6muORH4KrGbsBrDjutZlgCtzgxNstAx
  70. '' SIG '' pghcKnr84nodV0yoZRjpeUBiJZZux8c3aoMhCI5B6t3Z
  71. '' SIG '' Vz8dd0mHKhYGXqY4aiISo1EZg362MIIEozCCA4ugAwIB
  72. '' SIG '' AgIQDs/0OMj+vzVuBNhqmBsaUDANBgkqhkiG9w0BAQUF
  73. '' SIG '' ADBeMQswCQYDVQQGEwJVUzEdMBsGA1UEChMUU3ltYW50
  74. '' SIG '' ZWMgQ29ycG9yYXRpb24xMDAuBgNVBAMTJ1N5bWFudGVj
  75. '' SIG '' IFRpbWUgU3RhbXBpbmcgU2VydmljZXMgQ0EgLSBHMjAe
  76. '' SIG '' Fw0xMjEwMTgwMDAwMDBaFw0yMDEyMjkyMzU5NTlaMGIx
  77. '' SIG '' CzAJBgNVBAYTAlVTMR0wGwYDVQQKExRTeW1hbnRlYyBD
  78. '' SIG '' b3Jwb3JhdGlvbjE0MDIGA1UEAxMrU3ltYW50ZWMgVGlt
  79. '' SIG '' ZSBTdGFtcGluZyBTZXJ2aWNlcyBTaWduZXIgLSBHNDCC
  80. '' SIG '' ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKJj
  81. '' SIG '' CzlEuLsjp0RJuw7/ofBhClOTsJjbrSwPSsVu/4Y8U1UP
  82. '' SIG '' Fc4EPyv9qZaW2b5heQtbyUyGduXgQ0sile7CK0PBn9ho
  83. '' SIG '' tI5AT+6FOLkRxSPyZFjwFTJvTlehroikAtcqHs1L4d1j
  84. '' SIG '' 1ReJMluwXplaqJ0oUA4X7pbbYTtFUR3PElYLkkf8q672
  85. '' SIG '' Zj1HrHBy55LnX80QucSDZJQZvSWA4ejSIqXQugJ6oXeT
  86. '' SIG '' W2XD7hd0vEGGKtwITIySjJEtnndEH2jWqHR32w5bMotW
  87. '' SIG '' izO92WPISZ06xcXqMwvS8aMb9Iu+2bNXizveBKd6IrIk
  88. '' SIG '' ri7HcMW+ToMmCPsLvalPmQjhEChyqs0CAwEAAaOCAVcw
  89. '' SIG '' ggFTMAwGA1UdEwEB/wQCMAAwFgYDVR0lAQH/BAwwCgYI
  90. '' SIG '' KwYBBQUHAwgwDgYDVR0PAQH/BAQDAgeAMHMGCCsGAQUF
  91. '' SIG '' BwEBBGcwZTAqBggrBgEFBQcwAYYeaHR0cDovL3RzLW9j
  92. '' SIG '' c3Aud3Muc3ltYW50ZWMuY29tMDcGCCsGAQUFBzAChito
  93. '' SIG '' dHRwOi8vdHMtYWlhLndzLnN5bWFudGVjLmNvbS90c3Mt
  94. '' SIG '' Y2EtZzIuY2VyMDwGA1UdHwQ1MDMwMaAvoC2GK2h0dHA6
  95. '' SIG '' Ly90cy1jcmwud3Muc3ltYW50ZWMuY29tL3Rzcy1jYS1n
  96. '' SIG '' Mi5jcmwwKAYDVR0RBCEwH6QdMBsxGTAXBgNVBAMTEFRp
  97. '' SIG '' bWVTdGFtcC0yMDQ4LTIwHQYDVR0OBBYEFEbGaaMOShQe
  98. '' SIG '' 1UzaUmMXP142vA3mMB8GA1UdIwQYMBaAFF+a9W5czMx0
  99. '' SIG '' mtTdfe8/2+xMgC7dMA0GCSqGSIb3DQEBBQUAA4IBAQB4
  100. '' SIG '' O7SRKgBM8I9iMDd4o4QnB28Yst4l3KDUlAOqhk4ln5pA
  101. '' SIG '' AxzdzuN5yyFoBtq2MrRtv/QsJmMz5ElkbQ3mw2cO9wWk
  102. '' SIG '' NWx8iRbG6bLfsundIMZxD82VdNy2XN69Nx9DeOZ4tc0o
  103. '' SIG '' BCCjqvFLxIgpkQ6A0RH83Vx2bk9eDkVGQW4NsOo4mrE6
  104. '' SIG '' 2glxEPwcebSAe6xp9P2ctgwWK/F/Wwk9m1viFsoTgW0A
  105. '' SIG '' LjgNqCmPLOGy9FqpAa8VnCwvSRvbIrvD/niUUcOGsYKI
  106. '' SIG '' XfA9tFGheTMrLnu53CAJE3Hrahlbz+ilMFcsiUk/uc9/
  107. '' SIG '' yb8+ImhjU5q9aXSsxR08f5Lgw7wc2AR1MYIDpzCCA6MC
  108. '' SIG '' AQEwazBXMSEwHwYJKoZIhvcNAQkBFhJTcHJpbnRAYmF0
  109. '' SIG '' aG9tZS5uZXQxDzANBgNVBAYTBlNwcmluZzEQMA4GA1UE
  110. '' SIG '' ChMHQmF0aG9tZTEPMA0GA1UEAxMGU3ByaW5nAhAh2x8w
  111. '' SIG '' F246vkAUpEsyW72iMAkGBSsOAwIaBQCggYQwGQYJKoZI
  112. '' SIG '' hvcNAQkDMQwGCisGAQQBgjcCAQQwIwYJKoZIhvcNAQkE
  113. '' SIG '' MRYEFCT/9PSYTVdlHBOAuf/4H6RfXR2pMEIGCisGAQQB
  114. '' SIG '' gjcCAQwxNDAyoBSAEgBDAGUAcgB0ACAAVABlAHMAdKEa
  115. '' SIG '' gBhodHRwOi8vd3d3LmJhdGhvbWUubmV0LyAwDQYJKoZI
  116. '' SIG '' hvcNAQEBBQAEgYCdTMfxHXE4yy187HHnrT4Lc/op8w5c
  117. '' SIG '' Bii5a0FnGtDDsidfhu3VBNVP73oIR6QTaKq1W00gBvzH
  118. '' SIG '' GbsCZYgyr9z/bQUTg8VyahQ76hizdcDcvLeL+7nWOg42
  119. '' SIG '' 17r43WiSUJJFGp31F6WsOzhZVtMjZm+ZwzSOtQ0nI4Ji
  120. '' SIG '' gSg354/jfKGCAgswggIHBgkqhkiG9w0BCQYxggH4MIIB
  121. '' SIG '' 9AIBATByMF4xCzAJBgNVBAYTAlVTMR0wGwYDVQQKExRT
  122. '' SIG '' eW1hbnRlYyBDb3Jwb3JhdGlvbjEwMC4GA1UEAxMnU3lt
  123. '' SIG '' YW50ZWMgVGltZSBTdGFtcGluZyBTZXJ2aWNlcyBDQSAt
  124. '' SIG '' IEcyAhAOz/Q4yP6/NW4E2GqYGxpQMAkGBSsOAwIaBQCg
  125. '' SIG '' XTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqG
  126. '' SIG '' SIb3DQEJBTEPFw0xNTA5MjYxNDUxMzZaMCMGCSqGSIb3
  127. '' SIG '' DQEJBDEWBBSfFSA3toLhkAM2hWyAv8fnMEzaazANBgkq
  128. '' SIG '' hkiG9w0BAQEFAASCAQBK9z2UKKizDBqpR9JAeh/PhXRL
  129. '' SIG '' OSxrqnLpmtJ8wbXTqffeV51fu12Nmaxq5Nv5j6ifGVoq
  130. '' SIG '' xQ/nwKcoXA0FVEQCrULXb9q2p0xh8NjbZ6ubn33Gnh/U
  131. '' SIG '' ozmiEDt5eeA3QjL1xtIE6Ek+LQ8y9Kxa5w/6D1ItOrNf
  132. '' SIG '' W5jyB+kXFs1dYH5Gr5CrzXrJEIPPnBv0z3ApgeDkpF8E
  133. '' SIG '' aNWEIKxOdfH3CoacZgNLd3rXQnfjba2hFmg8emQwqCsT
  134. '' SIG '' raAldgvAtTT/jUDsupzHetCwV7KbipxC4tr8Kjrd58vr
  135. '' SIG '' Bl7M6F9fIzHTt47y/SCxd+A7l+bD7gVXYI0NzPipg7Uq
  136. '' SIG '' 6uRDOvd1
  137. '' SIG '' End signature block
复制代码
(代码末尾有一个空行,是必须的。编辑几次帖子都不行,给吃掉了,手动加上把。。。)
http://www.ungeiliable.com/transhcan/MakeCertAndSign.zip
2

评分人数

    • 9zhmke: 开眼界了技术 + 1
    • CrLf: 我叫叶良辰技术 + 1

TOP

本帖最后由 523066680 于 2015-9-26 21:05 编辑

好像是数字签名
http://blog.csdn.net/itjobtxq/article/details/9986795

数字签名好像和公钥加密有关

TOP

怎么编带证书的?
Demon 发表于 2015-9-25 23:50



    同问

TOP

编个带证书的EXE吧,这个报毒,而且看到 "C:/mp.exe" 这样的就不舒服。
yu2n 发表于 2015-9-25 22:34



怎么编带证书的?

TOP

编个带证书的EXE吧,这个报毒,而且看到 "C:/mp.exe" 这样的就不舒服。
『千江有水千江月』千江有水,月映千江;万里无云,万里青天。    http://yu2n.qiniudn.com/

TOP

这 1.5KB 的体积很像是 tcc 编译的,如果是的话那就是 c 语言了

TOP

不觉得有什么厉害的

TOP

返回列表