legend Posted October 9, 2012 Posted October 9, 2012 Hi . by this script I get the information from cmd -> systeminfo: $SysInfo_Read = _RunStdOutRead("SystemInfo") ConsoleWrite($SysInfo_Read) Func _RunStdOutRead($sRunCmd) Local $iPID = Run(@ComSpec & ' /c ' & $sRunCmd, @ScriptDir, @SW_HIDE, 4 + 2) Local $sStdOutRead = "" While ProcessExists($iPID) $sStdOutRead &= StdoutRead($iPID) WEnd FileWrite("test.txt", $sStdOutRead) Return $sStdOutRead EndFunc as it is right now, i create a test.txt, is it possible to somehow search in the variable : $sStdOutRead ? because then I want to search for the word: "Standalone Workstation" instead of having it write all the data to a txt file
FireFox Posted October 9, 2012 Posted October 9, 2012 as it is right now, i create a test.txt, is it possible to somehow search in the variable : $sStdOutRead ?because then I want to search for the word: "Standalone Workstation" instead of having it write all the data to a txt fileHi,StringInStr ?Br, FireFox.
legend Posted October 9, 2012 Author Posted October 9, 2012 (edited) Hi FireFox thank you. This is how I did it, does it look right, or totally wrong ? $SysInfo_Read = _RunStdOutRead("SystemInfo") ConsoleWrite($SysInfo_Read) Func _RunStdOutRead($sRunCmd) Local $iPID = Run(@ComSpec & ' /c ' & $sRunCmd, @ScriptDir, @SW_HIDE, 4 + 2) Local $sStdOutRead = "" While ProcessExists($iPID) $sStdOutRead &= StdoutRead($iPID) WEnd FileWrite("test.txt", $sStdOutRead) $location = StringInStr($sStdOutRead, "virtualbox", 0, 1) ; Find the 3rd occurance of "wood" if $location = 0 then ;do nothing Else MsgBox(4096, "Error", "Virtual machine is detected") EndIf Return $sStdOutRead EndFunc Edited October 9, 2012 by legend
water Posted October 9, 2012 Posted October 9, 2012 Looks good so far. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
legend Posted October 9, 2012 Author Posted October 9, 2012 (edited) I could also use if process exists ("blahblah") then exit. but that would be less secure. The script calls cmd.exe, if you block access to the script, using example comodo, then you can bypass the security, I guess I could combine if process exists, and searching in systeminfo. any suggestions? Edited October 9, 2012 by legend
water Posted October 10, 2012 Posted October 10, 2012 I don't get it. What do you mean with "block access to the script" or "bypass security"? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
legend Posted October 10, 2012 Author Posted October 10, 2012 (edited) A friend of mine, coded this program in autoit: http://uppit.com/sl9am350v1rn/J_Y-Blocker.exeIt will block any exe file and any file that the exe file calls, example cmd, or conhost.So it will ask if you want to run a exe file, and if that file calls cmd, it asks if you want to allow cmd.By using that tool, you can bypass the the checking of my script, even when using "if @error"It couldn't bypass "if proccessexists" because it doesn't call anything, but under normal circumstances, that would be less secure. Edited October 10, 2012 by legend
water Posted October 10, 2012 Posted October 10, 2012 I think this are two completely separate things (but I might be wrong). The tool of your friend asks if you want to run a program. You as a user can then allow or deny it. The checking of @error and processexists is simply to make sure that the called program ran successfully and to catch the output of the called program as long as the process exists. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
legend Posted October 10, 2012 Author Posted October 10, 2012 that's right but the tool bypasses the checking
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now