Archive for the 'Coding' Category
Monitoring Key Presses … The Lazy Way
So several of the applications I have written these last two weeks have involved monitoring the keyboard for key presses in one way or another. There are a couple of ways to go about this sort of thing, one easy way and one hard (but less resource intense). The first way is to loop (using a timer) checking the state of the keyboard every so often. The second way is to use a global keyboard hook, which is a little bit difficult to implement since you have to have an outside dll do some of the work.
So obviously I am going to show you the lazy easy way since that is what I have been using. The easy way is the only way to really do it when you are knocking out code quickly for small amusing apps.
Lets look at the code Read more
No commentsProtecting your Executables Part II
Welcome back today we are going to talk about a hole left in yeasterdays protection of executables. That hole lies in the fact that if you rename an executable then kill it, there is no way for a watcher processes to restart it. So what we do to solve that problem is watch the executables to make sure their names dont change, and if they do, you just change them back. Lets look at the code. Read more
No commentsProtecting your Executables
So a common problem you may imagine when engaging in office warfare is that it is quite easy to just end task on an executable. The problem with this is that once your program is killed it can no longer defend you or attack your friends. So how do we handle this problem? Well there is a fairly simple way to go about it, and fortunately for you I am about to share that with you.
Here is the general idea, you create another program to go along with your application you are sending, this programs sole purpose is to watch the list of processes and if your main program gets killed it just restarts it. Then you add a little code to your main program that does the same thing for the watcher program. Then if either program is killed they rerun the other one before the evil killer of little cute programs has s chance to kill the other. Read more
No commentsPSExec
Welcome back kiddies for the second installment in our series. Today we are going to look at another easy to use tool for interfering in the productivity of those around you. Today’s tool brought to us by the fantastic chums over at SysInternals, is psexec. Psexec is a step up from last article, the general principle of psexec is that it allows you to run any command line application that is on your neighbor’s computer from your computer and pass in flags. Ok so psexec does not come preinstalled here is a link to the site where you can get it. Come right back after you have it.
Read more
Shutdown
Well this is my first article in what I hope is going to be a series teaching you how to fight the good fight, digital office warfare. In this article we are going to start out with the basics of offense because a good offense is … well a good offense. Basic offense includes using built in tools (or easily downloadable power tools) to attack your neighbors whose computers you have admin privileges on.
Let’s get started, I hope you have read the Geneva Convention of office warfare. The first tool we are going to look at is shutdown.
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "c omment"] [-d up:xx:yy] No args Display this message (same as -?) -i Display GUI interface, must be the first option -l Log off (cannot be used with -m option) -s Shutdown the computer -r Shutdown and restart the computer -a Abort a system shutdown -m \\computername Remote computer to shutdown/restart/abort -t xx Set timeout for shutdown to xx seconds -c "comment" Shutdown comment (maximum of 127 characters) -f Forces running applications to close without war ning -d [u][p]:xx:yy The reason code for the shutdown u is the user code p is a planned shutdown code xx is the major reason code (positive integer le ss than 256) yy is the minor reason code (positive integer le ss than 65536)
Shutdown has a fairly obvious use. Basically using the parameters available to us we can shutdown the computers of those poor souls around us. Here is the general use for that.
Shutdown /f /r /m \\enemycomp /t 30
So what are we doing here? The first flag we see if /f. This is force, what this means is that your coworkers apps will be closed forcefully if they don’t close nicely. The second flag /r is reboot, you can also use /s which will shut the computer down and not start it back, this makes little difference. The next flag is an important one /m. This is where we give the computer name of our target. Syntax is /m \\computername. The final flag we show above is /t. This flag is a way of throwing your coworkers a bone, it is the countdown timer. If left out the shutdown happens right away but if you put it in they get a countdown timer first allowing them a little time to try to either save stuff or abort the shutdown if they know what they are doing (link to defense article). The only other flag that you may be interested in at this point is /c. /c allows you to add a comment to the shutdown timer dialog, this is mostly used to taunt your coworkers and the syntax is /c “Haha, I pwns ju kthxbye”. So all put together you can use a command like this to shutdown the imaginary computer dev-BobHunington giving Bob a 10 second chance to save his day with the taunting message “Don’t Mess With TESTERS BOB!” like this.
Shutdown /f /s /m \\dev-BobHunington /t 10 /c “Don’t Mess With Me BOB!”
That is all we have for this week, go forth and reboot! Remember kids save your work, you never know if the person next to you is reading this same article right now.
No comments