硬件统计用的相关的使用

此文章以用于系统架设的备用知识点!!

AutoIT相关的代码:(生成openscript.exe)

#RequireAdmin
#include <ACN_NET.au3>
#include <Constants.au3>
Local $p = Run(@ComSpec & " /c wmic bios get serialnumber","",@SW_HIDE, 15)
Local $line
Local $templine
ProcessWaitClose($p)
While 1
$templine = StdoutRead($p)
If @error Then ExitLoop
$line = StringStripWS($templine,4)
Wend
$handle = Run("D:ComputerzComputerZ_CN.exe","D:Computerz")
WinSetTrans($handle,"",10)
ClipPut("")
WinWaitActive ("鲁大师")
AutoItSetOption("WinTitleMatchMode", 4)
Opt("MouseCoordMode", 2)
MouseClick("left",122,62,1,0)
;MouseMove(807,192)
Local $test
While $test == ""
    WinWaitActive ("鲁大师")
    Sleep(500)
    MouseClick("left",807,192,1,10)    
$test =    ClipGet()
Wend
;MsgBox(0, "剪贴板内容:", $line)
WinKill("鲁大师")
ClipPut("计算机名:" & @ComputerName & @CRLF & "IP:" &@IPAddress1 & @CRLF &"MAC:"&_API_Get_NetworkAdapterMAC (@IPAddress1)& @CRLF & $line & $test )
DirRemove("D:Computerz",1)

 BAT脚本复制并使用lsrunase.exe提权调用,如没调用成功转为vbs触发UCA手动输入密码提权(-.-密码你们随便破解!0.0)

@ECHO OFF
mode con cols=40 lines=10
copy D:ComputerzAutoitopenscript.exe %temp% "D:ComputerzAutoitlsrunase.exe" /user:administrator /password:zEsj2PoZrLWD1Q== /domain: /command:"%temp%openscript.exe" /runpath:c: tasklist | find /i "openscript.exe"&&echo 存在 ||%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit @ECHO OFF set TempFile_Name=%SystemRoot%System32BatTestUACin_SysRt%Random%.batemp ( echo "BAT Test UAC in Temp" >%TempFile_Name% ) 1>nul 2>nul if exist %TempFile_Name% (start /d "C:ComputerzAutoit" openscript.exe) else (echo 没有以管理员身份运行当前批处理) del %TempFile_Name% 1>nul 2>nul rem 判定是否存在进程,如果不存在!调过

然后所有文件放在D:Computerz目录下然后全部封装打包为7Z格式,然后再使用7zSfxTool工具进得解压脚本

路径:D:Computerz  ,完全静态 运行程序设定为:Autoitstrat.bat ,其它的图标!(不改图标巨丑0.0)

Html上传代码相关,

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>target-div</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
    <!-- 1. Define some markup -->
   <Script Language="JavaScript">
var content = clipboardData.getData("Text");
if (content!=null) {
  document.write("<br><span>");
  document.write(content);
  document.write("</span>");}
else {
  document.write('<center>剪贴板中没有文本。<br><br>');
}
</Script>
</body>
</html>

以下为附加的知识,httml剪粘板的写入clipboard,(其它使用Flash,可能部分兼容性差,推荐使用这个)

https://files.cnblogs.com/files/praybb/clipboard.js-master.zip

 C#管理员运行

有一条case需要测试non-admin用户下运行软件产生的event信息。 由于Automation的大job是在admin用户下运行的,因此需要切换到non-admin用户,而这无论是在WTT中还是.NET中切换用户都是比较困难的。

因此需要采用run as的策略,也就是在当前的admin用户下,通过code来使得所测软件在non-admin用户下运行。
下面这段代码实现了在指定的用户下运行某程序。可以从config文件中读取指定的用户。
注意:指定用户的密码不能为空,否则会有异常抛出。

 public static bool LauchMontanaBrt(string inUserName,string inPassWord)
        {
            try
            {
                Process MBRTProcess = new Process();
                MBRTProcess.StartInfo.UserName = inUserName;
                string strPWD = inPassWord;
                SecureString password = new SecureString();
                foreach (char c in strPWD.ToCharArray())
                {
                    password.AppendChar(c);
                }
                MBRTProcess.StartInfo.Password = password;
                MBRTProcess.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;
                MBRTProcess.StartInfo.FileName = "xxx.exe";
                MBRTProcess.StartInfo.Arguments = "/run /wu";
                MBRTProcess.StartInfo.UseShellExecute = false;
                MBRTProcess.Start();
                return true;
            }
            catch(Exception error)
            {
                Console.writeline(error.Message);
                return false;
            }
        }
原文地址:https://www.cnblogs.com/praybb/p/8092797.html