Download: Keystroke Logging and Screenshot Gathering (Lookout)


Please read Against my better judgment, I decided to post this project on basic keylogging and screenshot techniques. There are a few legitimate cases where these techniques are needed and it is hard to find information or people willing to help as the immediate malicious red flag goes up.

If you are looking for a ready-made keylogger, this probably isn’t for you. While this project will teach you the techniques, provide some source code and produce a working keylogging application, it will not allow remote sending of the output. I have done this to mitigate the possibility of malicous abuse. Sure it can be added, but if you know how to add that functionality, then you are probably already more advanced than this tutorial anyway 🙂

This is my disclaimer. I’m not responsible for your mis-use or abuse of this code, or other shenanigans this code may find itself involved in while in your possession. It is to be used for educational and personal use only. If you like it, feel free to donate a couple bucks. [paypal-donation]

The goal here is to produce an application that can “stealthily” (I’ll elaborate in a minute) capture keyboard strokes and optionally, screenshots of the user’s desktop.

“stealthily” in this instance will merely mean minimizing the application and not showing it in the Taskbar. No other stealthing capability will be taught in this tutorial. If you need more stealth for a legitimate reason, message me.

Download LookoutDownload the Project Files Download LookoutDownload Setup Files

Please read This was created with Visual Studio 2008 Professional on a Windows 7 Professional box.

Here is a screenshot of what we’ll be achieving (I’ve dubbed it “Lookout”):

Screenshot of Lookout

I’ve gotten a lot of requests for this kind of thing from concerned parents that are looking for a “Nanny” type program to monitor their children or their computers’ usage. If you would like a commercial version of this application with additional features, please contact me.

Tutorial: 2 Column CSS With Equal Height DIVs


Here’s a quick post, not so much a tutorial, on something I find myself needing quite frequently these days. You need a 2 column css layout, but you need both columns’ heights to stay the same height regardless of which column has the longer content in it.

The fix: DynamicDrive’s pre-made layout:
2 column css image

See a DEMO of this layout

The HTML Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Dynamic Drive: CSS Fixed Layout #2.2- (Fixed-Fixed)</title>
<style type="text/css">

body{
margin:0;
padding:0;
line-height: 1.5em;
}

b{font-size: 110%;}
em{color: red;}

#maincontainer{
width: 840px; /*Width of main container*/
margin: 0 auto; /*Center container on page*/
}

#topsection{
background: #EAEAEA;
height: 90px; /*Height of top section*/
}

#topsection h1{
margin: 0;
padding-top: 15px;
}

#contentwrapper{
float: left;
width: 100%;
}

#contentcolumn{
margin-right: 200px; /*Set right margin to RightColumnWidth*/
}

#rightcolumn{
float: left;
width: 200px; /*Width of right column*/
margin-left: -200px; /*Set left margin to -(RightColumnWidth) */
background: #FDE95E;
}

#footer{
clear: left;
width: 100%;
background: black;
color: #FFF;
text-align: center;
padding: 4px 0;
}

#footer a{
color: #FFFF80;
}

.innertube{
margin: 10px; /*Margins for inner DIV inside each column (to provide padding)*/
margin-top: 0;
}

</style>

<script type="text/javascript">
/*** Temporary text filler function. Remove when deploying template. ***/
var gibberish=["This is just some filler text", "Welcome to Dynamic Drive CSS Library", "Demo content nothing to read here"]
function filltext(words){
for (var i=0; i<words; i++)
document.write(gibberish&#91;Math.floor(Math.random()*3)&#93;+" ")
}
</script>

</head>
<body>
<div id="maincontainer">

<div id="topsection"><div class="innertube"><h1>CSS Fixed Layout #2.2- (Fixed-Fixed)</h1></div></div>

<div id="contentwrapper">
<div id="contentcolumn">
<div class="innertube"><b>Content Column: <em>Fixed</em></b> <script type="text/javascript">filltext(45)</script></div>
</div>
</div>

<div id="rightcolumn">
<div class="innertube"><b>Right Column: <em>200px</em></b> <script type="text/javascript">filltext(15)</script></div>

</div>

<div id="footer"><a href="http://www.dynamicdrive.com/style/">Dynamic Drive CSS Library</a></div>

</div>
</body>
</html>

Now we need to download the necessary Javascript file to make it stretch.

This is a generic “CSS Equal Columns Height” script that will dynamically set the participating columns’ heights to that of the tallest column’s height, creating a uniform columns height layout. Use this script on any of our CSS Layouts for example. It’s a matter of plug and play! To use this script, just insert this line of code into the HEAD section of your CSS layout page:

<script src="equalcolumns.js" type="text/javascript"></script>

As you can see, it references the external .js file “equalcolumns.js“, which you should download (right click and select “Save As”) and then upload to your own site.

It’s a really simple way to get a good-working 2 column layout that fixes the equal height div problem. I know it relies on javascript, so browsers that have it disabled will not see the effect, but there are other fixes for those cases as well.

Detecting eSATA drive in Windows 7


Just got back from the store with your shiny new external hard drive, or you just tackled the UPS guy to rip open your brand new backup solution… you plug it in to your awesome Windows 7 box and!….

nada…

If you’re like me, it probably doesn’t detect your drive and you start cursing at your cat, flailing wildly and vowing to never buy another *insert manufacturer here*’s product again!
well calm down.. I have the solution!

If you don’t like to read, here is the entire project available for download:

Download Drive Detect for Windows 7Download the Project Files Download Drive Detect for Windows 7Download Setup Files

If you want to see how it works, here you go:
I knew I was going to need to utilize the Windows API to be able to interact with Device Manager, so, being not so API-inclined, I turned to my friends over on www.vbforums.com where Chris128 so graciously provided the API declarations and test code.
First, open a new project and add a new Class file to the project. Name it “WindowsApi.vb”.
In it will be the following API code:

Public Class WindowsApi
System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)
 _
 Public Structure SP_DEVINFO_DATA
 Public cbSize As UInt32
 Public ClassGuid As Guid
 Public DevInst As UInt32
 Public Reserved As IntPtr
 End Structure

 Public Const CM_LOCATE_DEVNODE_NORMAL As UInt64 = 0
 Public Const CR_SUCCESS As Integer = 0
 Public Const CM_REENUMERATE_NORMAL As UInt64 = 0

System.Runtime.InteropServices.DllImportAttribute(Cfgmgr32.dll,
EntryPoint:=CM_Reenumerate_DevNode) _

 Public Shared Function CM_Reenumerate_DevNode(ByVal dnDevInst As
UInt32, ByVal ulFlags As UInt64) As Integer
 End Function

 System.Runtime.InteropServices.DllImportAttribute(Cfgmgr32.dll,
EntryPoint:=CM_Locate_DevNode) _

 Public Shared Function CM_Locate_DevNode(ByRef PdnDevInst As UInt32,
ByVal pDeviceID As Integer, ByVal ulFlags As UInt64) As Integer
 End Function
End Class

I have added a button that lets me launch “My Computer” once it’s found, merely for convenience sake.

Here is a screenshot of the small UI that I came up with:

Drive Detect Screenshot

Get creative with it! I know this was a very annoying issue for myself, and if it’s a bug in Windows 7, hopefully it will be patched soon. But until that day comes, hopefully this will relieve a bit of the frustration!

Comments welcome.

CSS Lightview Style Popup


Before I begin, I want to be perfectly clear that this is NOT my creation. I am merely improving upon the code provided by its creator at www.sohtanaka.com

So.. if you’re reading this, you probably got here in the hopes of finding out how to make it do multiple popups on the same page. I struggled with posting this on the author’s site, I believe due to length of text in the comment box, so I thought I would post it here instead.

(Author: please let me know if you would like me to remove this post)

DEMO PAGE: Multiple Popups Per Page

No changes are needed to the existing CSS code:

lt;style type=quot;text/cssquot;gt;
body {
	height: 100%;
	margin: 0;
	padding: 0;
	font: normal 12px Verdana, Arial, Helvetica, sans-serif;
	background: #555;
	position: relative;
}
h1, h2, h3 {
	font-weight: normal;
}
h1 {
	font-size: 2em;
}
img {
	border: none;
}
#hideshow {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
}
#fade {
	background: #000; 
	position: fixed; 
	width: 100%;
	height: 100%;
	filter:alpha(opacity=80);
	opacity: .80;
	-ms-filter: quot;progid:DXImageTransform.Microsoft.Alpha(Opacity=80)quot;; /*--IE 8 Transparency--*/
	left: 0;
	z-index: 10;
}
.popup_block {
	background: #ddd;
	padding: 10px 20px;
	border: 10px solid #fff;
	float: left;
	width: 480px;
	position: fixed;
	top: 20%;
	left: 50%;
	margin: 0 0 0 -250px;
	z-index: 100;

}
.popup_block .popup {
	float: left;
	width: 100%;
	background: #fff;
	margin: 10px 0;
	padding: 10px 0;
	border: 1px solid #bbb;
}
.popup h3 {
	margin: 0 0 20px;
	padding: 5px 10px;
	border-bottom: 1px solid #bbb;
	font-size: 1.5em;
	font-weight: normal;
}
.popup p {
	padding: 5px 10px;
	margin: 5px 0;
}
.popup img.cntrl {
	position: absolute;
	right: -20px;
	top: -20px;
}

/*--Making IE6 Understand Fixed Positioning--*/

*html #fade {
	position: absolute;
	top:expression(eval(document.compatMode 
	document.compatMode=='CSS1Compat') ?
	documentElement.scrollTop : document.body.scrollTop);
}

*html .popup_block {
	position: absolute;
	top:expression(eval(document.compatMode 
	document.compatMode=='CSS1Compat') ?
	documentElement.scrollTop
	+((documentElement.clientHeight-this.clientHeight)/2)
	: document.body.scrollTop
	+((document.body.clientHeight-this.clientHeight)/2));
	
	left:expression(eval(document.compatMode 
	document.compatMode=='CSS1Compat') ?
	documentElement.scrollLeft 
	+ (document.body.clientWidth /2 ) 
	: document.body.scrollLeft 
	+ (document.body.offsetWidth /2 ));
}

/*--IE 6 PNG Fix--*/

img{ behavior: url(iepngfix.htc) }

lt;/stylegt;

The changes needed for the HTML links are shown below. You will need a different “chunk” of this code for each hyperlink you want to open a popup with, but with a different id number for each one. This example shows 2 “chunks” of code which is enough for 2 different popups. You may need to edit the path to the close button image as well:

!--POPUP--
div id=hideshow style=visibility:hidden; 
	div id=1 style=visibility:hidden;
		div id=fade/div
		div class=popup_block
			div class=popup
			a href=javascript:hideDiv(1)
			img src=icon_close.png class=cntrl title=Close //a
			h3Popup number 1/h3
			pTest/p
			/div
		/div
	/div
/div

div id=hideshow style=visibility:hidden; 
	div id=2 style=visibility:hidden;
		div id=fade/div
		div class=popup_block
			div class=popup
			a href=javascript:hideDiv(2)
			img src=icon_close.png class=cntrl title=Close //a
			h3Popup number 2/h3
			pTest/p
			/div
		/div
	/div
/div
!--END POPUP--

The last bit you need to change is to the javascript portion, which is minimal. You will include the id argument in the function declaration:

!--SCRIPT TO MAKE IT DO THE DIRTY WORK--
script language=javascript type='text/javascript' 
function hideDiv(id) {
if (document.getElementById(id)) { // DOM3 = IE5, NS6
document.getElementById(id).style.visibility = 'hidden';
}
else {
if (document.layers) { // Netscape 4
document.getElementById(id).visibility = 'hidden';
}
else { // IE 4
document.all.getElementById(id).style.visibility = 'hidden';
}
}
}

function showDiv(id) {
if (document.getElementById(id)) { // DOM3 = IE5, NS6
document.getElementById(id).style.visibility = 'visible';
}
else {
if (document.layers) { // Netscape 4
document.getElementById(id).visibility = 'visible';
}
else { // IE 4
document.all.getElementById(id).style.visibility = 'visible';
}
}
}
/script
!--END DIRTY WORK--

That’s all there is to it! Really a great example of a CSS popup window that is highly customizable and is multi-browser friendly. Again, I want to thank the author for sharing this code to the masses and I will oblige at any requests to remove this post.

Author’s Website: www.sohtanaka.com

Comments welcome.

Debate: To Ping or Not To Ping?

…that is the question!

An interesting thread over on vbforums.com brought up the topic of using a ping to condition whether or not to continue performing a network task. One argument is that you want to see if there is a viable connection to the remote device before you try to do anything to/with it. The other argument is, why introduce the bandwidth overhead of a ping command when you can just attempt the task and handle the exception if it fails.

Both interesting perspectives, and personally, I am in the boat that says ping first, task next. I can understand both sides though and have posted this for both sides to discuss.

EDIT: Here is a short code snippet to test the pre-ping theory. Code is provided by @dbasnett and is a great example of the time involved with a ping request.

Dim srvrName As String = "mail.foo.bar"
    Dim smtpserver As New Net.Mail.SmtpClient(srvrName)
    Dim mailMessage As System.Net.Mail.MailMessage
    Private Sub foobar()

        'The argument for PING
        Try
            If My.Computer.Network.Ping(srvrName) Then
                smtpserver.Send("hh@df.do", "dfdf@dfdf.com", "jjj", "jdfo")
                MessageBox.Show("Mail sent successfully")
            Else
                MessageBox.Show("Could not ping someaddress")
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
            'Exit Sub
        End Try

        'The opposing view - the one I support
        Try
            smtpserver.Send("hh@df.do", "dfdf@dfdf.com", "jjj", "jdfo")
            MessageBox.Show("Mail sent successfully")
        Catch ex As Exception
            If Not ex.InnerException Is Nothing Then
                MessageBox.Show(ex.InnerException.Message)
            Else
                MessageBox.Show("Failure sending mail")
            End If
            'Exit Sub
        End Try

    End Sub

IRIS Update: Mitsubishi Software Engineers Demo

I’m at work and get a call stating “the Mitsubishi team will be here in 10 minutes, they want to see IRIS.” Before I even had time to make sure it was running properly (you never know right?), the buzzer rings at the front gate.. so much for 10 minutes…

In they walk, a few I have met before, a couple I had not (including the lead software engineer!):
Mr. Hisanori Ogawa – Manager, Security Products, Mitsubishi Digital Electronics America, Imaging Products Division
Mr. Shoichi Sean Suwa -Senior Vice President and General Manager, Mitsubishi Digital Electronics America, Imaging Products

VERY nice people and I could tell they were eager to get a look at this “IRIS” they have been hearing about (Is that a good thing??) I usher them over to my jail cell-sized cubicle where IRIS is running on its own box, and begin to take them through it.

Now, the language barrier was clouding the feedback I was receiving, but I’m told they were very impressed. What was surprising was the features that they were most impressed with. It wasn’t the complex, overly-thought features that they liked, it was the simple stuff like audio and taskbar notifications.

As I handed each of them my business card, I was very proud to have been able to demo IRIS for an audience of that caliber. The project has come such a long way, and continues to grow daily.
Just want to thank those that have contributed to the project (friends at vbforums.com) and those that are using the software as well.

The beer was cold that day my friends.

Got Error 500?

Do you often get an Error 500 when viewing a WordPress post on your site? The answer may lie in your .htaccess file. By simply adding the following line to the root directory’s .htaccess file, you can overcome this frustrating problem:

[codesyntax lang=”php”]
AddType x-mapp-php5 .php
[/codesyntax]

My host is 1and1 and it has worked for me.

Read more about it here.
Error 500 fix!

Award Nomination

Wow! I was honored to receive 2 nominations by my current employer for 2009. It was IRIS that led to the Innovation Award nomination.

Innovation Award

Established: 2004
The Innovation Award was developed in 2004 to honor Partners who strive to create a bright future for H-E-B by driving innovative ideas into action, and continuously contributing to
H-E-B’s present and future growth. One winner will be selected from each area of Store Operations, Administrative Support, and Manufacturing/Warehouse/Transportation.

Innovation Award

Established: 1977
The Spirit of H-E-B Award recognizes hourly Partners who, through their continued support of the H-E-B Bold Promise, are motivated towards making H-E-B the best place to shop and the best place to work!