http://www.wl500g.info/showthread.php?t=15575
Since the existing automounter supports only hard disks to be mounted - i needed a solution for automatically mounting cd filesystems.
So the solution is to cross compile automount and to include autofs4 & /proc support into the kernel.
If you want to try it follow these steps:
0. download these files: http://www.moszi.net/dev/automount/automount.tar.gz
1. insmod autofs4.o
2. ln -s /proc/mounts /etc/mtab (this will only work if you recompiled your kernel with /proc support)
3. copy the necessary files to their places
4. edit your /opt/etc/auto.misc file
5. start /opt/etc/init/S97autofs
Enjoy
When I bought this router I really did not realize that it will open a whole new world to me ...
For a long time I wanted a NAS (Network Attached Storage) device so I can keep my files in a centralized way, but the price of these devices always was so high that it kept me away from buying one ...
So when I've found out that this router has 2 USB ports and that a custom firmware can be installed on it to support additional services I decided immediately that I'll buy one of these small wonders :) ... On the very first day I've installed Oleg's custom firmware and started digging into the firmware. It comes with a balanced set of features, it has telnet, ssh, ftp, samba, and other goodies that you might need. So it was perfect.
However over the years the loss of several hard disks - which obviously resulted in quite a few times loosing my precious data - convinced me that I simply need a RAID set to protect my data.
As the custom firmware does not support RAID sets I downloaded Oleg's sources for the firmware and rebuilt it adding a few other things that i found necessary ;)
This way i have:
* RAID1 support in the router (and have 2 hard disks linked in one array)
* CD/DVD support
* automount support
* wtmp support (to have historical track of logins)
Other stuff on the router:
* there is a cool script which periodically checks for brute force attacks and denies the source IP of accessing the router anymore.
* there is a torrent client with web based UI
* lighttp with php support can be installed on it, and can be used to stream all your music (using with Winamp + Bento skin's browser works like a charm!)
* there is mini-sendmail to send notifications to yourself anywhere you are ..
Hardware 'upgrades':
I've opened the box and installed a card reading into it and plugged a 4GByte microdrive so I will have a persistent 'hard disk' in the router - and in the next couple of days I will install 128MB of memory (instead of having only 32M ...). { I will keep you posted about this ;) }
Bottomline: if you need a stable and really good router, by this one.
http://wl500g.info/showthread.php?t=15550
Hi Everybody,
I'm using Oleg's 1.9.2.7-10 firmware for 3 months now (on a WL500gp) - thanks Oleg - and it is really great, it works just perfectly !
Since I do not have a desktop PC at my home - I only use a notebook - I really wanted to create a redundant way for storage and because I'm using Xbox for media playing I wanted an external DVD reader to be attached to my router so I can access all my DVD's through samba from my xbox.
To achieve this I recompiled Oleg's firmware to include SCSI emulation for IDE/ATAPI CDROM & to include RAID support in the kernel. If you don't want to recompile the kernel yourself these are the steps to achieve both functionalities:
CD-ROM:
1. insmod cdrom.o
2. insmod isofs.o
3. insmod sr_mod.o
(it might be that the order is not this one, I'm writing this from my head)
at this time your cd device will appear under /dev/scsi/...
RAID1:
1. insmod md.o
2. insmod raid1.o
after this you can create your RAID1 soft array using mdadm. LVM is not needed.
Note1: Because the 2.4 kernel contains a bug in md.c you need to replace this file with the correct one (this is described here: http://wl500g.info/showthread.php?p=100925 and it works perfectly when you recompile the kernel)
If you need help with this, just contact me.
PS. (offtopic) I've a USB hub with 6 USB ports attached to one of the USB ports on the router. This has 2 hard disks linked in a RAID1 array + the DVD reader. This works as intended - no special drivers were needed to support this.
The second USB port on the router has attached a 6 in 1 card reader with a 4GByte CF Microdrive. This works as a charm as well
http://wl500g.info/showthread.php?t=15552
These days I've spent some time figuring out the structure of the firmware sources - here are my finding on how to recompile it:
1. Since I use Vista, I downloaded an Ubuntu image for vmware player - i did all the firmware compilation in this virtual machine
2. downloaded the asus firmware, oleg's firmware additions and the uclibc toolchain. these are the items you need to recompile the firmware.
3. I've made a nice script that uncompresses all these packages, applies Oleg's patches on the firmware, and applies some additional minor changes to the source tree.
You can download this package from this location: http://www.moszi.net/dev/download/wl500g-source.tar.gz
The script you should run is : createBaseFirmwareSources from the binaries folder. (cd to this folder, otherwise it will not run correctly)
Also please note, that my own patches are located in the patches folder. Currently only 3 minor changes:
1. correcting the raid1 CRC bug (md.c)
2. wide character support in uClibc
3. Makefile for oleg's patches in order to allow wtmp usage in dropbear (i didn't succeed with this one yet)
Have fun, if you need help, contact me.
These days I was playing around with powershell - and it proved itself quite useful. I already have several backup scripts, defragment & anti-virus check script on my server. So on top of all this coolness :) this is very cool indeed as well:
| XML |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<html>
<body>
<table>
<tr><td>ID</td></tr>
<% get-process | foreach { %>
<tr>
<td><%=$_.ID%></td>
<td><%=$_.ProcessName%></td>
</tr>
<% } %>
</table>
</body>
</html>
|
Take a look at this link: http://blogs.msdn.com/powershell/archive/2008/07/18/powershell-asp-too-cool.aspx
If you've ever wondered how could you list all your usernames and passwords that are set on the 'Directory Security' tab on each website's properties (in inetmgr) then this small C# code snippet would be for you ..
Just a note: so far it seems that this code snippet works only on Windows Server 2003 - i have no ideea why doesn't it work on XP / Vista as well (don't care actually :) - i needed it for win 2003)...
| C# |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
static void Main(string{} args)
{
DirectoryEntry iisBase = new DirectoryEntry("IIS://localhost/W3SVC");
PrintUserNameAndPass(iisBase);
}
private static void PrintUserNameAndPass(DirectoryEntry iisChild)
{
String userName = null;
String password = null;
if (iisChild.Properties{"AnonymousUserName"} != null)
{
userName = iisChild.Properties{"AnonymousUserName"}.Value as String;
}
if (iisChild.Properties{"AnonymousUserPass"} != null)
{
password = iisChild.Properties{"AnonymousUserPass"}.Value as String;
}
if (userName != null && password != null)
{
if (!userNames.Contains(userName))
{
byte{} passwordChars = ASCIIEncoding.ASCII.GetBytes(password);
Console.WriteLine(String.Format("{0}\t{1}", userName,
System.Convert.ToBase64String(passwordChars)));
userNames.Add(userName);
}
}
foreach (DirectoryEntry newChild in iisChild.Children)
{
PrintUserNameAndPass(newChild);
}
iisChild.Dispose();
}
|
Update: Actually I've found out that the exception on Windows Vista was caused by the lack of IIS6 compatibility module. So I've just had to install this compatibility module from Windows features and everything works as expected.
| C# |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
namespace ConsoleApplication1
{
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
public class ConsoleApplication1
{
protected const int PJL_PORT = 9100;
protected static string message = "Ready";
public static int Main(string{} args)
{
if (!ParseArgs(args))
{
return -1;
}
IPEndPoint ipEndPoint;
ipEndPoint = new IPEndPoint(Dns.Resolve(args{0}).AddressList{0}, PJL_PORT);
Socket socket;
socket = new Socket(
AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp
);
socket.Connect(ipEndPoint);
byte{} sendData;
string sendString;
sendString = String.Format(
"\x1B%-12345X@PJL RDYMSG DISPLAY = \"{0}\"\r\n\x1B%-12345X\r\n",
message
);
sendData = Encoding.ASCII.GetBytes(sendString);
socket.Send(sendData, sendData.Length, 0);
socket.Close();
return 0;
}
protected static bool ParseArgs(string{} args)
{
if (args.Length != 2)
{
Console.WriteLine("set printername and message");
return false;
}
if (args{1}.Length > 16)
{
Console.WriteLine("Message must be <= 16 characters");
return false;
}
message = args{1};
return true;
}
}
}
|
Forrás: http://vortexhunter.blogspot.com/2008/06/c-hp-laserjet-fun-fun-fun.html
| C# |
1
2
3
4
5
6
7
8
9
10
|
if (!s_inited)
{
lock (s_initLock)
{
if (!s_inited)
{
s_inited = true;
}
}
}
|
Yet another simple logrotate script. If you hate the original one, just use this one ;)
Download file: logrotate.zip
If you have an open 22 port (SSH) on your machine, and you are interested in blocking all the IP addresses that try to bruteforce your password then this script is for you ;) .
As I really don't like using custom ports for any service if there is an other solution, I had to come up with this solution instead. In addition to this script there is also private/public key authentication turned on for dropbear (the ssh server for wl500gp) - however it's annoying seeing lots of invalid connections in auth.log :) .
How to use it:
The script should be started from crontab, and runs for at most 5 seconds for small authentication log files, so i start this script in each 15 minutes ;) .
You should change the path for all the files used in this script to match your system - then everything should work as expected.
you have questions - shoot me ;)
Download files: bruteForce.zip
The files included in the zip contain the ip addresses that tried to brute force my system. Keep the list if you want ;)
Recently I've bought an Asus WL500GP router. Just very quickly the list of it's features:
[*]
there are custom linux based firmares available for it [*]
has 2 usb ports (supports USB hub, external hard drives, web cameras, card readers, usb sound cards) [*]
high quality design ;)
 (i've opened my router and added a small 4GByte microdrive so it has a permanent harddisk attached. WARNING: this voids its warranty !!!)
It has a really wide package support, and can be used as a real NAS with multiple harddisks.
Anyways - stay tuned: I'm going to publish a few tutorials on how to do stuff with the router ;)
I have a Vista Home Premium edition running on a Toshiba 300-11V laptop with 2G memory + a Core 2 Duo 1.8GHz CPU. I would say that it's acceptable. Not fast, but acceptable; which is all right because i always knew it requires more resources that Windows XP.
However these days I started playing around with a couple of USB pen drives to see if it really helps in Vista's performance if you plug in one of those...
First of all I was really surprised to see that a bunch of the usb flash cards were not fast enough for Vista. There is a good article on Wikipedia (http://en.wikipedia.org/wiki/ReadyBoost) which explains what kind of speed characteristics must the flash drive meet.
So finally after testing a couple of these usb flash drives and an SD memory card too I've decided to go for a 4GB SD flash card as my laptop has a built in SD card reader ...  It was a bit expensive - i might have as well bought a 1GB DDRAM module for the laptop, however I think that the performance gain with the ReadyBoost technology using the 4GB flash can be much higher then with the additional 1GB memory ...
A final word on how this whole stuff works: Windows needs files and data. These files and data when you have several programs in memory are paged to the pagefile obviously. Now the trick is that when Vista needs some items from the pagefile that were previously cached on the flash drive it will read them from the flash drive. Simple. The same is happening with some DLLs that are used frequently in the operating system - they are cached on the flash drive.
The reason why this can work is that a flash memory can be much faster on random memory access than a hard disk. I mean when you load 2 files simultanously from your hard drive the disk's head will move from one place to the other and the whole read operation will be damn sloooow - this is where Vista's ReadyBoost technology kicks in and ensures that the data is read more quickly from the flash drive if already cached ...
While I have to admit that using this memory card the performance gain in my case it's not that extreme - it is still visible, and I'm really happy I can now use my built-in SD memory card reader which until now was empty :) ...
Windows Vista Home Premium does have a built in remote desktop. You can see it by starting a remote assistance session ... It's the same thing. Now the question is whether it is possible to start the service somehow to use this built-in functionality for accessing your PC remotely every time withouth starting remote assistance.
The answer is YES. It is possible. And this zip file is the answer: termsrv.zip.
Warning: I've downloaded this zip file from an other page (http://portal.tonychan.org/Default.aspx?tabid=58&EntryID=123) and I'm not responsible for any kind of loss that eventually might happen if you are using this zip file.
These days I was so excited about IPSec that I really had to find out how the encryption and authentication works :) ... Actually this is a very usefull feature as it prevents anybody who is not authenticated to access a service on your server - and this is done on the level of the IP protocol. That is the hacker won't be allowed to run a brute force attack on your RDP protocoll because he won't actually be able to communicate with the RDP server unless he is previously authenticated. So let me explain how this works...
As I said IPSec enables authentication and encryption. The first step - the authentication can be done in 3 different ways: using a certificate issued by a trusted certification authority, using active directory or using a passphrase. I've decided to choose the certificate-based-authentication as i don't have active directory and the passphrase seems to easy for me to crack with an network sniffer :) ...
Let me show you the way this certificate based authentication works:
First of all the server is configured to trust only clients that have a special certificate issued by a certificate authority - this means that the server does trusts a range of computers not only one, but actually every computer that has a certificate issued by the configured Certificate Authority ( probably not everybody will by certificates from verisign, comodo or godaddy :) so be aware that if you issue your own certificates that you have to explicitely trust the certificate authority both on the client and the server ).
That said, just be sure that:
1. the special type of IPSec ceritifacte is requested from the certification authority
2. the certificate authority is trusted on each machine
What we have to understand is that on every client that participates on secure IP communication an IPSec policy has to be created and activated. It's not enough just to get the certificate on the client machine - we need to create an IPSec policy on the client as well and we have to activate this policy otherwise IPSec won't be used...
Now on the other hand we can enable encryption on the authenticated traffic. If we have a telnet server which is well known by it's unsafe way of sending clear text username & password over the network - we can encrypt this traffic and nobody will ever be able to see your sensitive information ...
So here are 2 screenshots of the relevant IPSec configuration windows, check them out, and there is an MSDN article as well which explains in detail how to configure IPSec with a certificate: http://support.microsoft.com/kb/253498

If the LINQ runtime just thrown an exception similar to this one to your face :) then you should know that you just forgot to set a primary key in your table.
Also don't forget to update your data class in the .net project model as well ;) as the table's definition has changed.
I was wondering how to save small bitmaps programmatically of websites so I can show a gallery of these web pages on an ASP.Net page.
Obviously the first step in achieving it is to use a webbrowser control in .NET and to navigate to the specified webpage. The second step would be to copy the image from the web browser's window to our own Bitmap using the BitBlt WinAPI method and the last step would be to save this bitmap somewhere on the file system or maybe a database.
So let's see the method which captures the content of a web browser window and saves it to a Bitmap object:
| C# |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
private Bitmap CaptureBrowserImage(WebBrowser browser)
{
Bitmap resultBitmap = new Bitmap(browser.Width, browser.Height);
Graphics g = Graphics.FromImage(resultBitmap);
IntPtr hdcSrc = GetWindowDC(browser.Handle);
IntPtr hdcDest = g.GetHdc();
BitBlt(hdcDest, 0, 0, browser.Width, browser.Height, hdcSrc, 0, 0,
(uint)TernaryRasterOperations.SRCCOPY);
g.ReleaseHdc(hdcDest);
ReleaseDC(browser.Handle, hdcSrc);
return resultBitmap;
}
|
It might also be possible to use the StretchBlt WinAPI method to generate a smaller image, but I just wanted to save the image as it is - later on I will be able to generate thumbnails out of the saved images if I want to.
(big thanks to András for the ideea and help on using BitBlt)
Well, it's about time ! I think it was really just a question of time that this step is made and the fact that this step is going to be taken with the release of VS2008 it's just pure marketing :)
Anyways, it's really great to have it :) ! Imagine stepping into StringBuilder's own methods or stepping through the LosFormatter class in Visual Studio :) !!
Some say that now it's the end of Lutz Roeder's Reflector but I actually consider Reflector better then the MSDN Help files - in quick finding functionality in .NET ...
Source: Scott Guthrie's blog
|