by nolovelust
31. March 2011 13:19
Microsoft.Web.Administration Namespace is wonderful! With couple of hours work I have managed to build a request monitor to watch who requesting what and how long it takes to serve. If you aren't bothered with the code below just download this requests.zip (38.69 kb) file and put it on a classic .net 4 application pool with and id that has administrator privileges. You won't be able to read system data if you use IUSR or apppool identity.
web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation debug="false" targetFramework="4.0">
<assemblies>
<add assembly="Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="Microsoft.Web.Management, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
</configuration>
requests.aspx.cs
using System;
using Microsoft.Web.Administration;
using System.Text;
using System.Linq;
public partial class _requests : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
manager = new ServerManager();
int filtered = Convert.ToInt32(Request.QueryString["filter"]);
StringBuilder sb = new StringBuilder();
foreach (WorkerProcess proc in manager.WorkerProcesses)
{
RequestCollection rc = proc.GetRequests(0);
var selected = from r in rc
select r;
if (filtered>0)
{
selected = from r in rc
where r.SiteId == filtered
select r;
}
foreach (Request r in selected)
{
sb.AppendFormat("<tr><td><a href=\"?filter={8}\">{8}</a></td><td>{0}</td><td>{1}</td><td>{2}</td><td><img src=\"http://mobilust.net/onlines/iptoflag.aspx?ip={3}\" alt=\"{3}\" /> {3}</td><td>{4} ({5}s)</td><td>{6}</td><td>{7}</td></tr>", r.HostName, Server.HtmlEncode(r.Url), r.Verb, r.ClientIPAddr, r.PipelineState, TimeSpan.FromMilliseconds(r.TimeInState).TotalSeconds, r.CurrentModule, TimeSpan.FromMilliseconds(r.TimeElapsed).TotalSeconds, r.SiteId);
RequestCount++;
}
}
RequestList = sb.ToString();
}
protected int RequestCount
{
get;
set;
}
protected string RequestList
{
get;
set;
}
protected ServerManager manager
{
get;
set;
}
}
requests.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="requests.aspx.cs" Inherits="_requests" %><!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">
<head>
<title>Requests</title>
<script type="text/javascript" src="assets/jquery-latest.js"></script>
<script type="text/javascript" src="assets/jquery.tablesorter.min.js"></script>
<link href="assets/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function () {
sortTable();
});
function sortTable()
{
$("table").tablesorter({
sortList: [[0, 0]]
});
}
</script>
</head>
<body id="requestpage">
<div class="header">
<div class="left"><h1>Total <%=manager.WorkerProcesses.Count%> Worker Processes, <%=RequestCount %> requests</h1></div>
<div class="right"><h1><a href="requests.aspx">Reset</a> <a href="">Refresh</a></h1></div>
<div class="clear"></div>
</div>
<table cellspacing="1" class="tablesorter" id="requestlist">
<thead><tr><th> </th><th>Host Name </th><th>Url </th><th>Method </th><th>Client </th><th>State </th><th>Module Name </th><th>Time (s) </th></tr></thead>
<tbody><%=RequestList%></tbody>
</table>
</body>
</html>
You can download zip file above if you want javascript enabled sorting of the requests table.
Have look at the end result below. Keepin mind that Country flags is not part of this sample but you can get the code for that from here

by nolovelust
27. March 2011 13:35
I've had this problem. There are many suggestions there but none of them helped. After couple of hours I realised that problem was my network cards drivers. Drivers that came with windows was from 2009. After installing new drivers everything worked just fine. So, if you have such problem, just download latest drivers for your network card and you should be good to go!
by nolovelust
24. March 2011 15:44
As IPv4 blocks deplated, their value started to increase.
IGP reporting that Nortel, in bankruptcy, sells IPv4 address block for $7.5 million. 666,624 IPv4's sold to $11.25 per ip. It is quite hight when you think about buying 4 blocks of RIPE IP costs around 3-4 Euros.
by nolovelust
23. March 2011 09:17
"The CLOUD"! Computing on the "The Cloud"!
I'm sure you all heard and use services like Dropbox, Google Apps etc. daily.
I am against it. Not the actual computing power but handing my personal or business data to a company (regardless how big they are).
History of hacks, break-ins, security breaches keeps my gut feeling about the cloud quite alive!
Here is another one fo those, PHP Fog was hacked and taken down. Reason? Well, read and decide...
This failover server should have been taken offline a long time ago. It was a relic that I had built as a proof of concept. We were replacing it, but I should have just taken it down until we had the replacement. Unfortunately and stupidly, I had an old copy of the site code on that server which had our PHP Fog system passwords that I also stupidly had not deleted or changed. This was really naive and irresponsible of me. The old code-base, all our proprietary intellectual property, was posted for around 5 minutes to twitter.
Human error!
by nolovelust
22. March 2011 09:07
The Register reporting
that hackers have accessed php.net and source repository of PHP via vulnerable wiki site at wiki.php.net.
After compromising wiki.php.net hackers stole passwords for php.net and have accessed to the PHP source code. It is unknown at the moment if they were able to implement backdoors or malicious code in to PHP source code.