Jump to content

Scripting Help: Auto Shut Down Immediately When There Is A Mouse Movement Or Keyboard Keypress


Recommended Posts

  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

the monitoroff(2) may contain a clue...

I thought it would too, especially with the function being:

Func MonitorOff($s)
    DllCall($dll, "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", $SC_MonitorPower, "int", $Power_Off)
    Sleep($s)
EndFunc

But you never can tell with some people....

Link to comment
Share on other sites

I'm assuming your BitTorrent P2P file sharing client is efficient with using the bandwidth available, especially out of business hours.

How are you going to programmatically turn off the hard drive light and disk seek activity to stop alerting any passerby in the dead of night that something unusual is happening on that PC?

Why not create a screen saver that looks like a defrag utility or something else related to PC maintenance and just tell everybody it is still under testing and not to touch your PC while it is running?

I'm assuming you download files to take offsite - does your company have a policy in regards to that too?

What if one of the now common worms or trojans uses the torrent software to infest your network overnight - they will come hunting and track you down to find the source.

The RIAA is aggressively and deliberately infesting the P2P networks with poison files and garbage and tracking copyright infringement offenders of late. Will you know before too late that one of the files you shared has been recorded by a bounty hunter used by the RIAA and the first your company knows about it is a visit from the legal people or a DMCA takedown notice for your company's ISP? How will you explain that your Internet has been cut off to your boss, and does he know how to spell DMCA?

Is the risk of loss of your job worth the money you are saving by not upgrading your Internet speed at home?

...just wondering...

Link to comment
Share on other sites

My two cents.

Don't bother.

Use your p2p at home.

Work is not the place for it.

There's a reason why my job blocks off everthing but a few select ports from both incoming AND outgoing traffic.

Remember: All traffic is monitored and logged. Maybe not by your boss, maybe not by your IT Department, but the ISP can and WILL. Especially if given a good reason to (like being served a DMCA notice).

Just .... don't.

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

Thank you for all the responses. I do agree that it is very dangerous. however, I am not doing it everyday as what everyone might think but just once in a while when I have a movie that I really want to download. I will be careful of it.

By the way, regarding the Moniter off timing - I cannot seem to increase the length of time the moniter is shutoff no matter what I edit - Any experts around?

Link to comment
Share on other sites

Thank you for all the responses. I do agree that it is very dangerous. however, I am not doing it everyday as what everyone might think but just once in a while when I have a movie that I really want to download. I will be careful of it.

By the way, regarding the Moniter off timing - I cannot seem to increase the length of time the moniter is shutoff no matter what I edit - Any experts around?

dude, change the (2) in the monitoroff(2) to a bigger number
Link to comment
Share on other sites

Tried it but it does not seem to work :) Wonder what is wrong - I see that the function call (2) seems to only be linked to the sleep($s) function which increase the wait time after the moniter is switched off.

DllCall($dll, "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", $SC_MonitorPower, "int", $Power_Off)

This seems to be the one that I should be changing but they all seem to be variables.

Link to comment
Share on other sites

@cameronsdad,

Changing the sleep time did not work for me. My monitor will go off with a mouse move (as expected) but then comes right back on all by itself. Increasing the sleep time in both places did not help:

MonitorOff(200000)

@tradertt,

Try this:

HotKeySet("^!+m", "Monitor_On")

BlockInput(1)

Const $WM_SYSCommand = 274, $SC_MonitorPower = 61808, $Power_On = -1, $Power_Off = 2
$HWND = WinGetHandle(WinGetTitle("", ""))

$dll = DllOpen("user32.dll")

While 1
    DllCall($dll, "int", "SendMessage", _
            "hwnd", $HWND, "int", $WM_SYSCommand, _
            "int", $SC_MonitorPower, "int", $Power_Off)
    Sleep(5)
WEnd

Func Monitor_On()
    Do
        Sleep(100)
    Until ProcessClose............... <<<<< P2P app goes here

    DllCall($dll, "int", "SendMessage", _
            "hwnd", $HWND, "int", $WM_SYSCommand, _
            "int", $SC_MonitorPower, "int", $Power_On)
    DllClose($dll)
    Exit
EndFunc;==>Monitor_On

1) start your bandwidth stealing P2P

2) start the script above

3) turn off monitor at the power switch

4) go home

5) come to back to work (if still employed)

6) turn on monitor at the power switch

7) press ctrl-alt-del (you will see nothing)

8) press esc (you will see nothing)

9) press crtl-alt-shift-m (the script should end)

I have no idea how good this is for the monitor.

Edit: Other users can turn on the monitor at the power switch, move the mouse, press any key... they will get nothing - dead screen. You have to know steps 7, 8 and 9.

Edit2: moved ProcessClose ahead of "Monitor on" and made it a loop.

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Const $WM_SYSCommand = 274, $SC_MonitorPower = 61808, $Power_On = -1, $Power_Off = 2
$dll = DllOpen("user32.dll")
opt("TrayIconDebug", 1)
Dim $oldpos[2]
Dim $pos[2]
#include <Misc.au3>
$HWND = WinGetHandle(WinGetTitle("", ""))
HotKeySet("{Esc}", "_Exit")
Dim $s_keys[117] = [116, _
        "01", "02", "04", "05", "06", "08", "09", "0C", "0D", "10", _
        "11", "12", "13", "14", "1B", "20", "21", "22", "23", "24", _
        "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", _
        "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", _
        "41", "42", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", _
        "4D", "4E", "4F", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", _
        "5A", "5B", "5C", "60", "61", "62", "63", "64", "65", "66", _
        "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", "70", _
        "71", "72", "73", "74", "75", "76", "77", "78", "79", "7A", _
        "7B", "7C", "7D", "7E", "7F", "80H", "81H", "82H", "83H", "84H", _
        "85H", "86H", "87H", "90", "91", "A0", "A1", "A2", "A3", "A4", "A5"]
$pos = MouseGetPos()
$start = TimerInit()
While 1
    Sleep(0)
    For $y = 1 To $s_keys[0]
        If _IsPressed ($s_keys[$y], $dll) Then
            MonitorOff(1)
        EndIf
    Next
    $oldpos[0] = $pos[0]
    $oldpos[1] = $pos[1]
    $pos = MouseGetPos()
    if Not ($oldpos[1] = $pos[1] Or $oldpos[0] = $pos[0]) Then
        ProcessClose ( "notepad.exe" )
    EndIf
WEnd
Func MonitorOff($s)
    DllCall($dll, "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", $SC_MonitorPower, "int", $Power_Off)
    Sleep($s)
EndFunc   
Func MonitorOn($s)
    DllCall($dll, "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", $SC_MonitorPower, "int", $Power_On)
    Sleep($s)
EndFunc   
Func _Exit()
    DllClose($dll)
    Exit
EndFunc

Can I incorporate that into the above script where it only holds the moniter off for a certain period of time as the Block Input code stops the script from closing any other programs.

Link to comment
Share on other sites

1) start your bandwidth stealing P2P

2) start the script above

3) turn off monitor at the power switch

4) go home

5) come to back to work (if still employed)

6) turn on monitor at the power switch

7) press ctrl-alt-del (you will see nothing)

8) press esc (you will see nothing)

9) press crtl-alt-shift-m (the script should end)

:) I'm sorry, but this is hilarious!
Link to comment
Share on other sites

...Can I incorporate that into the above script...

I don't know. Can you? :-)

...the Block Input code stops the script from closing any other programs.

I see no reason why it should. The "code above" (by cameronsdad) has this line:

ProcessClose ( "notepad.exe" )

The code I provided also has a ProcessClose line - perhaps not so well placed - try this:

Func Monitor_On()
    Do
        Sleep(100)
    Until ProcessClose............... <<<<< P2P app goes here

    DllCall($dll, "int", "SendMessage", _
            "hwnd", $HWND, "int", $WM_SYSCommand, _
            "int", $SC_MonitorPower, "int", $Power_On)
    DllClose($dll)
    Exit
EndFunc ;==>Monitor_On

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

I like to point one other thing out. Think about this train of thought...

I'm the boss.....

I go to your PC....

I touch the mouse and keyboard, and the PC won't respond.....

I see the HDD light on, so I know it is working.....

I think the PC is broken...

I call support...

They look at the PC by running a background scan...

They find the P2P software, and the strange app....

They find the illegal downloads....

They advise me possible spyware and rootkits could have been installed and our network could have been broken into causing possible damage, data loss, or theft..... :)

They advise me we could be sued for having illegal software like pirated movies..... :)

I now have to deal with the employee that caused this..... :mellow:

Do you want to be you then?

:o

I fix PCs for a living. Time and time again, I have seen users try to get stuff past me, and they get caught. I don't like busting people, and I usually tell them they need to remove the stuff right away. I much rather help a fellow out than hanging them out to dry.

I got busted for having software I shouldn't have. It was a app called browserfresh. It would keep me logged into a web based app, for I hated to keep logging into it if I was inactive for 10 minutes. Only took them 2 weeks to find it. If your company is large, and I do get that impression, it is only a matter of time before you get caught. Not if, but when. Is this worth it to you?

edit: I will get off my boyscout soapbox now...I just hate to see a person get into trouble...

Edited by vollyman
Link to comment
Share on other sites

I like to point one other thing out. Think about this train of thought...

I'm the boss.....

I go to your PC....

I touch the mouse and keyboard, and the PC won't respond.....

I see the HDD light on, so I know it is working.....

I think the PC is broken...

I call support...

They look at the PC by running a background scan...

They find the P2P software, and the strange app....

They find the illegal downloads....

They advise me possible spyware and rootkits could have been installed and our network could have been broken into causing possible damage, data loss, or theft..... :)

They advise me we could be sued for having illegal software like pirated movies..... :)

I now have to deal with the employee that caused this..... :mellow:

[...]

While you're at it, anyone who sees a computer on when it shouldn't be, and can't use the mouse or keyboard to get the monitor back on to turn it off normally, will probably just push the button to power off and then come confront you about it the next day. Won't that be a fun conversation....
Link to comment
Share on other sites

Just a quick note on this.

Your admins can probably tell who was in the building, and at what time, just by looking at the network logs, and stats. a P2P activity is just to easy to monitor.

If your determined on this why not just create your own screensaver? Make it start your P2P, hide it and kill it when the screensaver is ordered get away?

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...