Jump to content

Need help with a loop that scans for processes


Peter221
 Share

Recommended Posts

Hey,

i would like to check for some debuggers in my script but it's not working.. 

here is the script

while True
      If ProcessExists("Wireshark.exe") = True then
      call ("_exit")
      EndIf
   WEnd

   while True
      If ProcessExists("ollydbg.exe") = True then
      call ("_exit")
      EndIf
   WEnd
   while True
      If ProcessExists("idaq.exe") = True then
      call ("_exit")
      EndIf
   WEnd
   while True
      If ProcessExists("fiddler.exe") = True then
      call ("_exit")
      EndIf
   WEnd
   while 
      If ProcessExists("spyxx.exe") = True then
      call ("_exit")
      EndIf
   WEnd
   while True
      If ProcessExists("devenv.exe") = True then
      call ("_exit")
      EndIf
   WEnd
   while True
      If ProcessExists("wpe.exe") = True then
      call ("_exit")
      EndIf
   WEnd
   while True
      If ProcessExists("wpepro.exe") = True then
      call ("_exit")
      EndIf
   WEnd
   while True
      If ProcessExists("wpepro.net.exe") = True then
      call ("_exit")
      EndIf
   WEnd
   while True
      If ProcessExists("ProcessHacker.exe") = True then
      call ("_exit")
      EndIf
   WEnd

Can anyone help me?

 

Link to comment
Share on other sites

Welcome to AutoIt and the forum!

What do you mean by "not working"?

Can you please describe what you try to achieve with your script? Most of the time there are multiple ways to get what you want.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

Welcome to AutoIt and the forum!

What do you mean by "not working"?

Can you please describe what you try to achieve with your script? Most of the time there are multiple ways to get what you want.

 

The AutoIt Script is not working when i add the Debugger check.. It says /ErrorStdOut.. I think its a stack overflow but i don't know how to fix it.

Edited by Peter221
Link to comment
Share on other sites

>"F:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "W:*** Source Code********* ***Stable-Sicherheitskopie-Sicherheitskopie-obfuscated.au3"    
 
>Process failed to respond; forcing abrupt termination...
>Exit code: 1    Time: 6.875
Link to comment
Share on other sites

Peter221,

ProcessExists("something") is never going to equal "True" so you are stuck in the while...wend loop.

You get stuck at the first while...wend loop where the program is not running.

 

Try it this way...

local $aProcesses = [ _
                    "Wireshark.exe", _
                    "ollydbg.exe", _
                    "idaq.exe", _
                    "fiddler.exe", _
                    "spyxx.exe", _
                    "devenv.exe", _
                    "wpe.exe", _
                    "wpepro.exe", _
                    "wpepro.net.exe", _
                    "ProcessHacker.exe" _
                    ]

for $1 = 0 to UBound($aProcesses) - 1
    if processexists($aProcesses[$1]) then _exit()
next

ConsoleWrite('No Debuggers running!' & @CRLF)

func _exit()
    ConsoleWrite('Exiting due to debugger = ' & $aProcesses[$1] & @CRLF)
    Exit
endfunc

kylomas

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

Peter221,

You always need to provide as much information as possible for us to help you.

This includes the full script (not just a part) so we can reproduce the problem; error messages, console output; the AutoIt version you run; the OS version plus bitness etc.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

Peter221,

ProcessExists("something") is never going to equal "True" so you are stuck in the while...wend loop.

You never exit the while...wend loop if one of the debuggers is not running...

 

Try it this way...

local $aProcesses = [ _
                    "Wireshark.exe", _
                    "ollydbg.exe", _
                    "idaq.exe", _
                    "fiddler.exe", _
                    "spyxx.exe", _
                    "devenv.exe", _
                    "wpe.exe", _
                    "wpepro.exe", _
                    "wpepro.net.exe", _
                    "ProcessHacker.exe" _
                    ]

for $1 = 0 to UBound($aProcesses) - 1
    if processexists($aProcesses[$1]) then _exit()
next

ConsoleWrite('No Debuggers running!' & @CRLF)

func _exit()
    ConsoleWrite('Exiting due to debugger = ' & $aProcesses[$1] & @CRLF)
    Exit
endfunc

kylomas

Working fine but only when i open the Debugger before i start the Program.When i start the Program first and then the Debugger the Program runs nevertheless further. When i bind it into a loop i get the same error:

 

>"F:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "W:****** Source Code*********Stable-Sicherheitskopie-Sicherheitskopie.au3"    
>Exit code: 0    Time: 0.6043
Edited by Peter221
Link to comment
Share on other sites

Can you please tell us why you need to check for debuggers before and while running a program?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

Can you please tell us why you need to check for debuggers before and while running a program?

Its a programm that connects to a website and checks a user and their password after this step its downloading 2 files from a webspace. With Fiddler your can edit the Windows Hosts file to a local database and make a echo "True" php to skip the login.. 

Link to comment
Share on other sites

  • Moderators

Peter221,

 

Its a programm that connects to a website and checks a user and their password

Care to explain just what you are doing here? And if you have the username and password why do you want to skip the login? It all sounds very fishy to me. :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Sounds like you are trying to circumvent a Web sites login.  Will wait for a moderator to weigh in.

 

Peter221,

 

Care to explain just what you are doing here? And if you have the username and password why do you want to skip the login? It all sounds very fishy to me. :huh:

M23

WTF Guys? 

I will block this programm in my programm..

 

func _DebuggerCheck()
local $aProcesses = [ _
                    "Wireshark.exe", _
                    "ollydbg.exe", _
                    "idaq.exe", _
                    "fiddler.exe", _
                    "spyxx.exe", _
                    "devenv.exe", _
                    "wpe.exe", _
                    "wpepro.exe", _
                    "wpepro.net.exe", _
                    "ProcessHacker.exe" _
                    ]
 
for $1 = 0 to UBound($aProcesses) - 1
    if processexists($aProcesses[$1]) then _exit()
next
EndFunc
Edited by Peter221
Link to comment
Share on other sites

  • Moderators

Peter221,

Things become clearer - fiddler.exe is a process you wish to block because it can bypass a login. Do I take it that your basic script is the one passing the username/password to a website to download some files and you do not want these intercepted? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Peter221,

Things become clearer - fiddler.exe is a process you wish to block because it can bypass a login. Do I take it that your basic script is the one passing the username/password to a website to download some files and you do not want these intercepted? :huh:

M23

 

I dont want that people find out our Webserver through the Launcher.

 

Func _getInformation()
$VersionsInfo = "*********dl=1"
$newVersion = "0.0"

$Ini = InetGet($VersionsInfo,@TempDir & "\news.ini") ;download news.ini

If $Ini = 0 Then ;was the download of version.ini successful?
      GUICtrlSetData($Label3, "ERROR: The news Server is currently offline.")
   Else
      $newVersion = IniRead (@TempDir & "\news.ini","Version","Version","") ;reads the new version out of news.ini
      GUICtrlSetData($Label3, $newVersion)
   EndIf
EndFunc

Func _getFiles()
$VersionOne = "h*********"
$VersionTwo = "h*********"

$IniOne = InetGet($VersionOne,@ScriptDir & "\*********") ;download script1
$IniTwo = InetGet($VersionTwo,@ScriptDir & "\*********") ;download script2

If $IniOne = 0 Then ;was the download of version.ini successful?
   MsgBox(0,"ERROR","Update Server is down")
EndIf

If $IniTwo = 0 Then ;was the download of version.ini successful?
   MsgBox(0,"ERROR","Update Server is down")
EndIf
EndFunc
Func validateacc($username, $password)
    $myid = ($hardwareid)
    $ac = "username="
    $pw = "&password="
    $hwid = "&HWID="
    $windowsname = "&Windowsname="
    $http = ObjCreate("winhttp.winhttprequest.5.1")
    $http.open("POST", "*********", False)
    $http.setrequestheader("Content-Type", "application/x-www-form-urlencoded")
    $http.send($ac & $username & $pw & $password & $hwid & $myid & $windowsname & $windowsnames)
    $received = $http.responsetext
    $http.close()
    Return $received
EndFunc
Link to comment
Share on other sites

  • Moderators

Peter221,

Understood. :)

M23

P.S. And I have lifted your "new member" 10 post limit - we have already used up most of them! :D

Edited by Melba23
Fixed BB tags

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Peter221,

I am assuming that you want to check for the running processes iteratively.  The following construct does just that.  You will need to integrate it into your code.

; array of process to monitor
local $aProcesses = [ _
                    "Wireshark.exe", _
                    "ollydbg.exe", _
                    "idaq.exe", _
                    "fiddler.exe", _
                    "spyxx.exe", _
                    "devenv.exe", _
                    "wpe.exe", _
                    "wpepro.exe", _
                    "wpepro.net.exe", _
                    "ProcessHacker.exe" _
                    ]
; switch set in adlib / monitored in main loop
local $bDBG = false

; check for debugger every second
adlibregister('_chkdbg',1000)

main()

func main()
    while 1
        ;
        ; going along doing whatever the main loop is doing
        ;
        if $bDBG Then
            ;
            ; oh oh, found a debugger, do something, possible just kill it
            ;
            $bDBG = false   ; reset switch for next iteration
        EndIf

        sleep(1000)
    wend

endfunc

; adlib routine / sets DBG switch at first instance of a debugger and returns
func _chkdbg()

    for $1 = 0 to UBound($aProcesses) - 1
        if processexists($aProcesses[$1]) then
            $bDBG = True
            Return
        endif
    next

endfunc

func _exit()
    Exit
endfunc
Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

 

Peter221,

I am assuming that you want to check for the running processes iteratively.  The following construct does just that.  You will need to integrate it into your code.

; array of process to monitor
local $aProcesses = [ _
                    "Wireshark.exe", _
                    "ollydbg.exe", _
                    "idaq.exe", _
                    "fiddler.exe", _
                    "spyxx.exe", _
                    "devenv.exe", _
                    "wpe.exe", _
                    "wpepro.exe", _
                    "wpepro.net.exe", _
                    "ProcessHacker.exe" _
                    ]
; switch set in adlib / monitored in main loop
local $bDBG = false

; check for debugger every second
adlibregister('_chkdbg',1000)

main()

func main()
    while 1
        ;
        ; going along doing whatever the main loop is doing
        ;
        if $bDBG Then
            ;
            ; oh oh, found a debugger, do something, possible just kill it
            ;
            $bDBG = false   ; reset switch for next iteration
        EndIf

        sleep(1000)
    wend

endfunc

; adlib routine / sets DBG switch at first instance of a debugger and returns
func _chkdbg()

    for $1 = 0 to UBound($aProcesses) - 1
        if processexists($aProcesses[$1]) then
            $bDBG = True
            Return
        endif
    next

endfunc

func _exit()
    Exit
endfunc

 

Working fine... Awesome man. Thanks!!  :thumbsup:  :thumbsup:  :thumbsup:  :thumbsup:

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...