Sunday, April 26, 2009

Conficker News Update - PLEASE READ!!

Conficker Virus Starts to Attack PCs, Experts Say

A malicious software program known as Conficker that many feared would wreak havoc on April 1 is slowly being activated, weeks after being dismissed as a false alarm, security experts said.

BOSTON - A malicious software program known as Conficker that many feared would wreak havoc on April 1 is slowly being activated, weeks after being dismissed as a false alarm, security experts said.

Conficker, also known as Downadup or Kido, is quietly turning an unknown number of personal computers into servers of e-mail spam, they added.

The worm started spreading late last year, infecting millions of computers and turning them into "slaves" that respond to commands sent from a remote server that effectively controls an army of computers known as a botnet.

Its unidentified creators started using those machines for criminal purposes in recent weeks by loading more malicious software onto a small percentage of computers under their control, said Vincent Weafer, a vice president with Symantec Security Response, the research arm of the world's largest security software maker, Symantec Corp.

Conficker installs a second virus, known as Waledac, that sends out e-mail spam without knowledge of the PC's owner, along with a fake anti-spyware program, Weafer said.

The Waledac virus recruits the PCs into a second botnet that has existed for several years and specializes in distributing e-mail spam.

Conficker also carries a third virus that warns users their PCs are infected and offers them a fake anti-virus program, Spyware Protect 2009 for $49.95, according to Russian-based security researcher Kaspersky Lab. If they buy it, their credit card information is stolen and the virus downloads even more malicious software.

Weafer said that while he believes the number of infected machines that have become active is relatively small, he expects a consistent stream of attacks to follow, with other types of malware distributed by Conficker's authors.

"Expect this to be long-term, slowly changing," he said of the worm. "It's not going to be fast, aggressive."

Researchers feared the network controlled by the Conficker worm might be deployed on April 1 for the first time since the worm surfaced last year because it was programed to increase communication attempts from that date.

The security industry formed a task force to fight the worm, bringing widespread attention that experts said probably scared off the criminals who command the slave computers.

That task force thwarted the worm partially by using the Internet's traffic control system to block access to servers that control the slave computers.

Viruses that turn PCs into slaves exploit weaknesses in Microsoft's Windows operating system. The Conficker worm is especially tricky because it can evade corporate firewalls by passing from an infected machine onto a USB memory stick, then onto another PC.

The Conficker botnet is one of many such networks controlled by syndicates that authorities believe are based in eastern Europe, southeast Asia, China and Latin America.

© Thomson Reuters 2008. All rights reserved. Users may download and print extracts of content from this website for their own personal and non-commercial use only. Republication or redistribution of Reuters content, including by framing or similar means, is expressly prohibited without the prior written consent of Reuters. Reuters and the Reuters sphere logo are registered trademarks or trademarks of the Reuters group of companies around the world.

Tuesday, April 14, 2009

XP: Mainstream Support Ends Today, Entended Support till 8 April 2014

Microsoft has ended the mainstream support for XP and now started the extended support for the OS until 8 April 2014, about 5 years from now.
Mainstream support which was normally ended 5 years everytime any of its product been released seems not really work for XP. MS finally took 8 years to end the support.  Besides the lag of Vista release, too relying on the XP by corporate and personal users was 2 main factors contributing to this longer support. The 'too relying on XP' factor doesn't seem to stop even until windows 7 being released.  MS will enable users who buy the PC with preinstalled windows 7 to downgrade to XP.
See how big the XP influence!
For those buying new PC and still wondering to go for Vista and XP. Again, it's up to you to choose. If you still  don't trust Vista, it's okay to go for XP. Remember, the extended support is still there. Once your install genuine XP, you still can get any security updates from MS (until April 2014 - quite long enough for a PC) . However, while giving free security updates, you now need to pay certain amount to get non-security hotfix ... it's just fine for me.
Support providedMainstream support
Extended support
Paid support (per-incident, per hour, and others)xx
Security update supportxx
Non-security hotfix supportxRequires extended hotfix agreement, purchased within 90 days of mainstream support ending.
No-charge incident supportx 
Warranty claimsx 
Design changes and feature requestsx 
Product-specific information that is available by using the online Microsoft Knowledge Basexx
Product-specific information that is available by using the Support site at Microsoft Help and Support to find answers to technical questionsxx
P/S - Whether or not MS extended the support, I now enjoy working with Vista despite of all bad perceptions I received earlier. :-)

Sunday, March 22, 2009

What's hot this month

iPhone 3.0, Internet Explorer 8 Beta release, Windows 7, IBM deals with Sun and recession related topic are among the hot news that most IT and Computer-related magazines are covered.

1 - iPhone 3.0
I don't like to comment anything on the stuff I can only dream for at this moment..

2- Internet Explorer 8
Is spite of popular claim by Microsoft that the browser is one of the best version ever release. Outsiders are still at doubt whether this browser able to place itself on top, pushing out Mozilla Firefox version 3.5 which will be released sooner.  Being hacked at the first day of Pwn20wn has nothing but to show how vulnerable IE8 is as their previous version was. Luckily, the counterpart mozilla firefox faced same fate. On the other hand, it was surprised to know 'light-weight contender' Google Chrome was the only browser remains unhacked until the end of the first day. As a result, now I'm writing this blog under Chrome. Back to IE8, this version will be made available inside windows 7 and those who hate IE now have chance to remove it from add/remove program list unlike before.

3- Windows 7
This is the first ever operating system which was fully developed  without Bill Gates's final say.  This is also the first OS to be launched after Gates totally off from Microsoft July last year. According to CEO Steve Ballmer, this is really Microsoft team's product compared to the previous product where most of them was the result of Gates's thinking. Initial plan, windows 7 will be shipped 3 years after release of Vista (Vista was released on 2006). However, with the current economic situation, I doubt it will be postponed to the  next year mid.

4- IBM's 7billion deal with Sun
Whatever it is, there must be some advantages and disadvantages if the IBM deal of bought over Sun is closed. Generally, both will gain benefits. Sun will have enough money to run the business without changing any of it's traditional culture on R&D where has helped the technology industry evolved a lot. IBM on the other hand will now have more to be proud off by having more market share and owns quite a number of technology  they need years to develope if not decades.

5 - Recession related topics.
There are a lot of articles, tips and advice of how to survive recession subject to those who has already been laid off from the job to the action CIO should take during the recession time. I would advise everybody regardless of  his/her confortable level with the current job to read some of these stuffs. Who knows, one day your day will come, if not as someone to be laid off, may be as someone to decide who's going to be laid off. Anyway, It works for both.

Wednesday, March 18, 2009

Bypassing Vista for Windows 7

Windows 7 is now released for it's Beta version. I don't know quite well how good it is compared to Vista. Never have time to dirt my hand into it except some information telling by others who've tried it. Many of them admit that the coming version is far better than current Vista especially on handling network and hardware stuff which were according to some was the worst part in Vista.

Some people who's trying windows 7 considered it as best windows
OS since Windows 3.1

Again, I'm not sure how true it is. Wait and see. Some people might ask whether buying the PC with Vista is a right decision right now or wait after Windows 7 being released. Some might suggest to wait. But some said, it's okay to buy now, since Microsoft will provide the upgrade, you'll only have to pay for the upgrade fees and some even hope that Microsoft will give free upgrade to those who do buying since 12 months before the release.(Risky dream?). But for me, if you are not depressed enough and can wait for at least two more quarters of economic pain before shipping, why not?

It is good to always have some good info so that you won't make any costly decision.









Sunday, March 15, 2009

Backup Your Data: Looking for the best solution

Some information written here was based on my working experience and some are the information given by many others on the net. Since servers and networking was not my expertise (at least at the time this article was written), I always welcome any comments and feedbacks from readers.

*******************************************************************

Data is important. Private data is even more. Either personal or commercial. No disputes on this.
When talking about data backup, THREE things are always highly focused on which are:

1- Cost
How expensive is the solution to be implemented.

2 - Reliability and Security
How reliable and secure the data once backup. Any security loop holes which can expose to any malicious attacks? virus? natural disaster? etc

3- Speed
How fast can we backup and restore the data.

Scenario to consider
------------------------
Now, consider we've large amount of sensitive data (200 - 300 Gb) to be periodically backup in a monthly basis. Restore will be done any time, depend on the request. Meaning that, the media must be large enough, the speed must be fast enough for restore process, and should not compromise in security factor. Let we consider solutions below.

1) CD is out of the consideration! Next please ..

2) DVD
Still limited in storage. While the dual layer DVD normally below 10 GB and single layer below 5GB, You still need a lot of pieces to complete your monthly backup.
Result: Reject!


3) Tape Drive
Good storage size. We need 1 to 2 tapes to backup 300Gb. Have to wait at least half to almost whole day to restore 1 tape data. In term of cost, we need USD1000 0r (MYR3000 - MYR4000) to buy the tape drive and 40USD (MYR 200 - RM300) for individual tapes. Not so good at speed and expensive at cost.
Result: Reject

4) External Hard Disk
The speed is much better than tape. A bit slower than internal. Not so costly compared to it ability. Not much security holes since you won't expose it to the network. However, it doesn't allow multiple accesses. One single client or server can access it in a time. Therefore not suit for server backup where the data is normaly shared by multiple users. Fortunately, this already satisfed above requirements.
Result: Just nice.

5) Storage Area Network (SAN)
Unlike the previous. This is more as architecture technology then a media technology. A single dedicated server is required plus few storage nodes will be connected to the network in order to implement the technology. Due to it highly advance technology, it is seldom used by personal and small company. The main benefit that a SAN network brings a company is speed with data transfer plus the ability to connect large data networks that span thousands of miles- and the devices on that network can still communicate effectively. By organizing these devices on a data device-only network, faster data transfers can occur. Very helpful to system administrator since it can backup data from multiple sources at any time.
Do we really need this?

Result: Acceptable for multiple access and highly scalable solution.


6) Network Attached Storage Server (NAS)
A NAS server is essentially a server that is set aside strictly for distributing files to other servers, and client computers. Instead of doing any processing, this server only act as a storage to other servers or clients therefore reducing risk of file corruption and most OS-related issues and very good at speed. Standard servers typically run server-class Operating Systems, which can become corrupted, or otherwise damaged. NAS, however, store their Operating System on flash memory which can only be overwritten in an upgrade. Due to that, it is normally more expensive. Moreover, this is not end stage of backup due to the physical disaster which can be potentially crashed the whole storage and leave no single data once occurs. That's why technology such as clustering and RAID should be implemented as well. (Wikipedia: It should be noted that NAS is effectively a server in itself, with all major components of a typical PC – a CPU, motherboard, RAM, etc. – and its reliability is a function of how well it is designed internally. A NAS without redundant data access paths, redundant controllers, redundant power supplies, is probably less reliable than Direct Attached Storage (DAS) )

Finally, In most cases, you'll still need to do backup for this server and bring us back to the original question "where and how to backup the data?"

Result: Acceptable for data storage not a data backup. Full Stop.

Besides these solutions, there are other solution we can implement.

7) Optical Jukebox.
From Wikipedia: Optical Jukebox is a robotic data storage device that can automatically load and unload optical discs, such as Compact Disc, DVD, Ultra Density Optical or Blu-ray disc and can provide terabytes of tertiary storage. Jukebox capacities have greatly increased with the release of the 50GB dual layer Blu-ray (BD) format, with a road-map to increase to eight layers and 200GB per disc. The current format allows 35TB of storage from a single 700 disc jukebox.

I might miss out some advantages or disadvantages at every single data backup solution I disucssed in this article. However, this overview might give you some introductory concept and idea on the data backup solution which might help you deciding the best solution and most importantly BEST AFFORDABLE SOLUTION as most people might concern.

Monday, January 12, 2009

FTP using VB.NET

It was not my initial intention to share how to code FTP library. Initially, I thought .NET has already supplied complete library for ftp. However, I got a big "NOT!".

While you are able to do download and upload files via FTP using System.Net.FtpWebRequest -creating, renaming and deleting folder was not so straight forward. You still have to go back to the basic ftp command such as MKD, RNFR, RMD, etc.

I finally came across a library that did this library in C# codes .

This library will enable you to do few important actions such as:
1 - Connect to FTP server (for sure!)
2 - upload file
3 - download file
4 - delete remote file
4 - create remote folder
5 - delete remote folder
6 - rename remote folder
7 - list down all the files in the remote path
8 - get remote file size

All these functions should be enough to develop one powerful FTP client.

I've spent couple of hours to translate this code into VB.NET and done some modifications to make this library works for me, then this is the result. (quite a long code)

**********************************************************************************


Imports System
Imports System.Net
Imports System.IO
Imports System.Text
Imports System.Net.Sockets

Public Class FTPClass
Private remoteHost As String, remotePath As String, remoteUser As String, remotePass As String, mes As String
Private remotePort As Integer, bytes As Integer
Private clientSocket As Socket
Private retValue As Integer
Private debug As Boolean
Private logined As Boolean
Private reply As String
Private Shared BLOCK_SIZE As Integer = 512
Private buffer As Byte() = New Byte(BLOCK_SIZE - 1) {}
Private ASCII As Encoding = Encoding.ASCII
Public Sub New()
remoteHost = "192.168.X.XX" 'Please specify correct IP
remotePath = "."
remoteUser = "username"
remotePass =  "password"
remotePort = 21
debug = False
logined = False
End Sub
'''
''' Set the name of the FTP server to connect to.
'''
''' Server name
Public Sub setRemoteHost(ByVal remoteHost As String)
Me.remoteHost = remoteHost
End Sub
'''
''' Return the name of the current FTP server.
'''
''' Server name
Public Function getRemoteHost() As String
Return remoteHost
End Function
'''
''' Set the port number to use for FTP.
'''
''' Port number
Public Sub setRemotePort(ByVal remotePort As Integer)
Me.remotePort = remotePort
End Sub
'''
''' Return the current port number.
'''
''' Current port number
Public Function getRemotePort() As Integer
Return remotePort
End Function
'''
''' Set the remote directory path.
'''
''' The remote directory path
Public Sub setRemotePath(ByVal remotePath As String)
Me.remotePath = remotePath
End Sub
'''
''' Return the current remote directory path.
'''
''' The current remote directory path.
Public Function getRemotePath() As String
Return remotePath
End Function
'''
''' Set the user name to use for logging into the remote server.
'''
''' Username
Public Sub setRemoteUser(ByVal remoteUser As String)
Me.remoteUser = remoteUser
End Sub
'''
''' Set the password to user for logging into the remote server.
'''
''' Password
Public Sub setRemotePass(ByVal remotePass As String)
Me.remotePass = remotePass
End Sub
'''
''' Return a string array containing the remote directory's file list.
'''
'''
'''
Public Function getFileList(ByVal mask As String) As String()
If Not logined Then
login()
End If
Dim cSocket As Socket = createDataSocket()
sendCommand("NLST " & mask)
If Not (retValue = 150 OrElse retValue = 125) Then
Throw New IOException(reply.Substring(4))
End If
mes = ""
While True
Dim bytes As Integer = cSocket.Receive(buffer, buffer.Length, 0)
mes += ASCII.GetString(buffer, 0, bytes)
If bytes < buffer.Length Then
Exit While
End If
End While
Dim seperator As Char() = {ControlChars.Lf}
Dim mess As String() = mes.Split(seperator)
cSocket.Close()
readReply()
If retValue <> 226 Then
Throw New IOException(reply.Substring(4))
End If
Return mess
End Function
'''
''' Return the size of a file.
'''
'''
'''
Public Function getFileSize(ByVal fileName As String) As Long
If Not logined Then
login()
End If
sendCommand("SIZE " & fileName)
Dim size As Long = 0
If retValue = 213 Then
size = Int64.Parse(reply.Substring(4))
Else
Throw New IOException(reply.Substring(4))
End If
Return size
End Function
'''
''' Login to the remote server.
'''
Public Sub login()
clientSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Dim ep As New IPEndPoint(Dns.Resolve(remoteHost).AddressList(0), remotePort)
Try
clientSocket.Connect(ep)
Catch generatedExceptionName As Exception
Throw New IOException("Couldn't connect to remote server")
End Try
readReply()
If retValue <> 220 Then
close()
Throw New IOException(reply.Substring(4))
End If
If debug Then
Console.WriteLine("USER " & remoteUser)
End If
sendCommand("USER " & remoteUser)
If Not (retValue = 331 OrElse retValue = 230) Then
cleanup()
Throw New IOException(reply.Substring(4))
End If
If retValue <> 230 Then
If debug Then
Console.WriteLine("PASS xxx")
End If
sendCommand("PASS " & remotePass)
If Not (retValue = 230 OrElse retValue = 202) Then
cleanup()
Throw New IOException(reply.Substring(4))
End If
End If
logined = True
Console.WriteLine("Connected to " & remoteHost)
chdir(remotePath)
End Sub
'''
''' If the value of mode is true, set binary mode for downloads.
''' Else, set Ascii mode.
'''
'''
Public Sub setBinaryMode(ByVal mode As Boolean)
If mode Then
sendCommand("TYPE I")
Else
sendCommand("TYPE A")
End If
If retValue <> 200 Then
Throw New IOException(reply.Substring(4))
End If
End Sub
'''
''' Download a file to the Assembly's local directory,
''' keeping the same file name.
'''
'''
Public Sub download(ByVal remFileName As String)
download(remFileName, "", False)
End Sub
'''
''' Download a remote file to the Assembly's local directory,
''' keeping the same file name, and set the resume flag.
'''
'''
'''
Public Sub download(ByVal remFileName As String, ByVal [resume] As Boolean)
download(remFileName, "", [resume])
End Sub
'''
''' Download a remote file to a local file name which can include
''' a path. The local file name will be created or overwritten,
''' but the path must exist.
'''
'''
'''
Public Sub download(ByVal remFileName As String, ByVal locFileName As String)
download(remFileName, locFileName, False)
End Sub
'''
''' Download a remote file to a local file name which can include
''' a path, and set the resume flag. The local file name will be
''' created or overwritten, but the path must exist.
'''
'''
'''
'''
Public Sub download(ByVal remFileName As String, ByVal locFileName As String, ByVal [resume] As Boolean)
If Not logined Then
login()
End If
setBinaryMode(True)
Console.WriteLine((("Downloading file " & remFileName & " from ") + remoteHost & "/") + remotePath)
If locFileName.Equals("") Then
locFileName = remFileName
End If
If Not File.Exists(locFileName) Then
Dim st As Stream = File.Create(locFileName)
st.Close()
End If
Dim output As New FileStream(locFileName, FileMode.Open)
Dim cSocket As Socket = createDataSocket()
Dim offset As Long = 0
If [resume] Then
offset = output.Length
If offset > 0 Then
sendCommand("REST " & offset)
If retValue <> 350 Then
'throw new IOException(reply.Substring(4));
'Some servers may not support resuming.
offset = 0
End If
End If
If offset > 0 Then
If debug Then
Console.WriteLine("seeking to " & offset)
End If
Dim npos As Long = output.Seek(offset, SeekOrigin.Begin)
Console.WriteLine("new pos=" & npos)
End If
End If
sendCommand("RETR " & remFileName)
If Not (retValue = 150 OrElse retValue = 125) Then
Throw New IOException(reply.Substring(4))
End If
While True
bytes = cSocket.Receive(buffer, buffer.Length, 0)
output.Write(buffer, 0, bytes)
If bytes <= 0 Then
Exit While
End If
End While
output.Close()
If cSocket.Connected Then
cSocket.Close()
End If
Console.WriteLine("")
readReply()
If Not (retValue = 226 OrElse retValue = 250) Then
Throw New IOException(reply.Substring(4))
End If
End Sub
'''
''' Upload a file.
'''
'''
Public Sub upload(ByVal fileName As String)
upload(fileName, False)
End Sub
'''
''' Upload a file and set the resume flag.
'''
'''
'''
Public Sub upload(ByVal fileName As String, ByVal [resume] As Boolean)
If Not logined Then
login()
End If
Dim cSocket As Socket = createDataSocket()
Dim offset As Long = 0
If [resume] Then
Try
setBinaryMode(True)
offset = getFileSize(fileName)
Catch generatedExceptionName As Exception
offset = 0
End Try
End If
If offset > 0 Then
sendCommand("REST " & offset)
If retValue <> 350 Then
'throw new IOException(reply.Substring(4));
'Remote server may not support resuming.
offset = 0
End If
End If
sendCommand("STOR " & Path.GetFileName(fileName))
If Not (retValue = 125 OrElse retValue = 150) Then
Throw New IOException(reply.Substring(4))
End If
' open input stream to read source file
Dim input As New FileStream(fileName, FileMode.Open)
If offset <> 0 Then
If debug Then
Console.WriteLine("seeking to " & offset)
End If
input.Seek(offset, SeekOrigin.Begin)
End If
Console.WriteLine(("Uploading file " & fileName & " to ") + remotePath)
While (InlineAssignHelper(bytes, input.Read(buffer, 0, buffer.Length))) > 0
cSocket.Send(buffer, bytes, 0)
End While
input.Close()
Console.WriteLine("")
If cSocket.Connected Then
cSocket.Close()
End If
readReply()
If Not (retValue = 226 OrElse retValue = 250) Then
Throw New IOException(reply.Substring(4))
End If
End Sub
'''
''' Delete a file from the remote FTP server.
'''
'''
Public Sub deleteRemoteFile(ByVal fileName As String)
If Not logined Then
login()
End If
sendCommand("DELE " & fileName)
If retValue <> 250 Then
Throw New IOException(reply.Substring(4))
End If
End Sub
'''
''' Rename a file on the remote FTP server.
'''
'''
'''
Public Sub renameRemoteFile(ByVal oldFileName As String, ByVal newFileName As String)
If Not logined Then
login()
End If
sendCommand("RNFR " & oldFileName)
If retValue <> 350 Then
Throw New IOException(reply.Substring(4))
End If
' known problem
' rnto will not take care of existing file.
' i.e. It will overwrite if newFileName exist
sendCommand("RNTO " & newFileName)
If retValue <> 250 Then
Throw New IOException(reply.Substring(4))
End If
End Sub
'''
''' Create a directory on the remote FTP server.
'''
'''
Public Sub mkdir(ByVal dirName As String)
If Not logined Then
login()
End If
sendCommand("MKD " & dirName)
If retValue > 400 Then
Throw New IOException(reply.Substring(4))
End If
End Sub
'''
''' Delete a directory on the remote FTP server.
'''
'''
Public Sub rmdir(ByVal dirName As String)
If Not logined Then
login()
End If
sendCommand("RMD " & dirName)
If retValue <> 250 Then
Throw New IOException(reply.Substring(4))
End If
End Sub
'''
''' Change the current working directory on the remote FTP server.
'''
'''
Public Sub chdir(ByVal dirName As String)
If dirName.Equals(".") Then
Exit Sub
End If
If Not logined Then
login()
End If
sendCommand("CWD " & dirName)
If retValue <> 250 Then
Throw New IOException(reply.Substring(4))
End If
Me.remotePath = dirName
Console.WriteLine("Current directory is " & remotePath)
End Sub
'''
''' Close the FTP connection.
'''
Public Sub close()
If clientSocket IsNot Nothing Then
sendCommand("QUIT")
End If
cleanup()
Console.WriteLine("Closing...")
End Sub
'''
''' Set debug mode.
'''
'''
Public Sub setDebug(ByVal debug As Boolean)
Me.debug = debug
End Sub
Private Sub readReply()
mes = ""
reply = readLine()
retValue = Int32.Parse(reply.Substring(0, 3))
End Sub
Private Sub cleanup()
If clientSocket IsNot Nothing Then
clientSocket.Close()
clientSocket = Nothing
End If
logined = False
End Sub
Private Function readLine() As String
While True
bytes = clientSocket.Receive(buffer, buffer.Length, 0)
mes += ASCII.GetString(buffer, 0, bytes)
If bytes < buffer.Length Then
Exit While
End If
End While
Dim seperator As Char() = {ControlChars.Lf}
Dim mess As String() = mes.Split(seperator)
If mes.Length > 2 Then
mes = mess(mess.Length - 2)
Else
mes = mess(0)
End If
If Not mes.Substring(3, 1).Equals(" ") Then
Return readLine()
End If
If debug Then
For k As Integer = 0 To mess.Length - 2
Console.WriteLine(mess(k))
Next
End If
Return mes
End Function
Private Sub sendCommand(ByVal command As String)
Dim cmdBytes As Byte() = Encoding.ASCII.GetBytes((command & vbCr & vbLf).ToCharArray())
clientSocket.Send(cmdBytes, cmdBytes.Length, 0)
readReply()
End Sub
Private Function createDataSocket() As Socket
sendCommand("PASV")
If retValue <> 227 Then
Throw New IOException(reply.Substring(4))
End If
Dim index1 As Integer = reply.IndexOf("("c)
Dim index2 As Integer = reply.IndexOf(")"c)
Dim ipData As String = reply.Substring(index1 + 1, index2 - index1 - 1)
Dim parts As Integer() = New Integer(5) {}
Dim len As Integer = ipData.Length
Dim partCount As Integer = -1
Dim buf As String = ""
Dim i As Integer = 0
While i < len AndAlso partCount <= 6
Dim ch As Char = [Char].Parse(ipData.Substring(i, 1))
If [Char].IsDigit(ch) Then
buf += ch
ElseIf ch <> ","c Then
Throw New IOException("Malformed PASV reply: " & reply)
End If
If ch = ","c OrElse i + 1 = len Then
Try
parts(System.Math.Max(System.Threading.Interlocked.Increment(partCount), partCount - 1)) = Int32.Parse(buf)
buf = ""
Catch generatedExceptionName As Exception
Throw New IOException("Malformed PASV reply: " & reply)
End Try
End If
i += 1
End While
Dim ipAddress As String = (((CStr(parts(0)) & ".") + CStr(parts(1)) & ".") + CStr(parts(2)) & ".") + CStr(parts(3))
Dim port As Integer = (parts(4) << 8) + parts(5)
Dim s As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Dim ep As New IPEndPoint(Dns.Resolve(ipAddress).AddressList(0), port)
Try
s.Connect(ep)
Catch generatedExceptionName As Exception
Throw New IOException("Can't connect to remote server")
End Try
Return s
End Function
Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, ByVal value As T) As T
target = value
Return value
End Function
End Class

To call this class, you can do like this:

Private Function UploadFile() As Boolean

Dim ft As New FTPClass
Try
ft.setDebug(True)
ft.setRemoteHost("192.168.1.87")
ft.setRemoteUser("user")
ft.setRemotePass("123456")
ft.setRemotePath("Root/")
ft.setRemotePort(21)

ft.login()
Try
ft.chdir("Test")
Catch ex As Exception
Finally
ft.mkdir("Test")
End Try
ft.chdir("Test")

ft.setRemotePath("test.txt")
ft.setBinaryMode(True)
ft.upload("C:\test.txt")

ft.close()
Catch ex As Exception
ft.close()
MsgBox(ex.Message)
Return False
End Try
MsgBox("Upload success!")
Return True
End Function



****













Monday, January 5, 2009

How to totally remove a virus from pendrive

Removing virus from pendrive normally requires 2 steps:

Step 1: Scan the pendrive using Antivirus software.
Step 2: Remove the hidden file autorun.inf

***********************

Step 1: should be handled by the antivirus software. So I won't talk on this. As suggested by some people on the net, you can always refer to below link.

1) Superantispywhere
http://www.superantispyware.com/superant...
it will possible detect and get rid of the Trojan. It gets rid of some of the toughest problems.

2)Smitfraudfix
http://siri.geekstogo.com/SmitfraudFix.p...
this tool should be launched in safemode. To learn how to do that look here
http://www.pchell.com/support/safemode.s...
run this tool and choose to clean. it will get rid of pop-ups trying to sell you fake things

3)Vundofix
http://www.atribune.org/content/view/24/...
this tool gets rid of Vundo trojans and more.
the site shows how to use it.

4)Combofix
http://download.bleepingcomputer.com/sUB...
this is a last resort
Combofix is a general tool that helps the helper cleaning up a Hijackthis log.
It is able to remove some common infections and helps a user detect files that general scanners cannot find. It also lists registry keys such as the key keys, the desktop keys, and other areas where malware hide. The tool has some rootkit detectors too, allowing a helper to see if a rootkit is present on the PCsmi

**********************

2) Step 2: However, you normally have to perform step 2 manually since antivirus will not remove autorun.inf since there is nothing wrong with the file in the first place since the bad thing actually the script written into the file, not the file itself.

Now, follow this steps.

1 - Start windows command prompt. If you use XP, type "cmd" in the Run textbox in Start > Run to start the program.

2 - While in the command prompt, type your pendrive drive letter such as "E:" and press Enter
3 - type attrib -r -h -s autorun.inf
(Now, if you type dir you will able to see the file. I normally, open this file as notepad to see what is actually written inside. Actually, the content here is the script that will automatically execute once you double click your pendrive.)
5 - type del autorun.inf to delete the file permanently.
6 - Eject and Plug in back your pendrive.

Your pendrive should now work fine.

War on Virus

I have a nice 4Gb Kingston USB pendrive that I used to backup most of my data, officially and personally.

If you knew me, I was the person that can hardly put trust on the machine. I never believed that the machines can work long lasting well (correct term?) as we want it to work.
Manufacturer might give you warranty on your hardware but nobody will give warranty on your data. Therefore I always do few levels of backup in order to make sure my things always safe and available. This behaviour is becoming more critical since I'm the one that do backup for the whole company data. If the media A fails, look for media B, if B fails, then look for C and so on. Therefore at the end of the day especially when I take long leave, my mind would be more peaceful. Nothing to worry about. Comes to worst, I won't be so regret cause I knew, I have done many things already to avoid the disaster. Sometimes later, I would like to talk about this in more details.

Back to my pendrive. it's one of the media used by me as backup. But now, I haven't use my pendrive for weeks already. Know why?....yes! it's a virus inside. The virus is now inside my pendrive sitting 'peacefully' and 'happily' with all my critical data. (The data is so critical until it gives me some fears to fix it, what a dillema!!). However, I hope they're all sitting together peacefully until I really get ready to declare war against them. All these few weeks, I don't really have time to look for good weapon which I can use to go against them. I'll find the time and maybe now is the time. Listen here Mr. V! We now declare war on you!

This week also might be a good time for me to do some research on how to avoid viruses from infecting my things especially the pendrive as they are extremely vulnerable and frequently made me sick!

It's my to do list for this week.

Wednesday, December 10, 2008

Art Of War


"Know yourself, know your enemy the victory will be certain. Know heaven, know earth the victory will be complete".

This is a famous quote from this book. Nice to remember. However, the best part is the idea inside is priceless. Some military leaders, corporate leaders, nations leaders, sports coach and even high level mafia read this book. This book has been made compulsory by Japanes company to be read by their young executives. This itself conclude the usefulness of its contents.

After reading this book for the second time (13 chapters, 3 pages or less in every chapter considered very brief BUT the idea inside is extemely rich and compact!) , I'm getting more interested in knowing how actually I can identify the 'enemy' in my life. Maybe I'm not really involved in a war which can give physical destruction to myself. But, each of us actually at war in our daily life. Worse, we're actually at war against one part of ourself, which islam always refer to nafs or hawa'. The evil side of our soul.

This is the enemy that stop us from doing any good thing. Wakeup late, too much eat, less motivated to do good things, procrastinating from doing right thing, stingy, wasting time, hot-tampered are among the army of this enemy.

This is enemy no #1, that every people has to confront continuosly before any other enemy is his life. This book, give me some idea on how to defeat him.

Monday, December 8, 2008

Alert using SMTP

There are so many reasons why people send email but the reasons are not so vary why machines send email. One of the most popular reason is to give an alert of some particular events. As in my case I used to create a vb.net program to send an email to alert me on some events happen in the server I'm currently in charged. For instance, I will be able to know how much free space of the C: drive of the server left at the moment I received the alert. This will help me a lot so that the server won't hang once it reach the maximum size, since I can take some actions long before it happens.

To make your vb.net application to send email is not so hard. Maybe below codes might help.


Public g_EMAIL_SMTP As String = "smtp.bizmail.yahoo.com"
Public g_EMAIL_Port As String = "587"
Public g_EMAIL_Sender As String = "alert@mail.com"
Public g_EMAIL_Desc As String = ""
Public g_EMAIL_User As String = "nasrul@mail.com.my"
Public g_EMAIL_Pwd As String = "abc1234"

Public Function Send_EMAIL(ByVal strEmailaddr As String, ByVal strSubject As String, ByVal strBody As String) As Boolean
Dim oMessage As New MailMessage()

oMessage.Subject = g_EMAIL_Desc + " - " + strSubject
oMessage.Body = strBody + " on " + Now().ToString()
oMessage.IsBodyHtml = False
oMessage.ReplyTo = New MailAddress(g_EMAIL_Sender)
oMessage.From = New MailAddress(g_EMAIL_Sender)
Dim arrRcpt() As String
Dim i As Integer
arrRcpt = Split(strEmailaddr, ",")
For i = 0 To UBound(arrRcpt)
If arrRcpt(i) <> "" Then
oMessage.To.Add(New MailAddress(arrRcpt(i)))
End If
Next
oMessage.Priority = MailPriority.High

Try
Dim client As New SmtpClient(g_EMAIL_SMTP, g_EMAIL_Port)
If g_EMAIL_User.Trim <> "-" And g_EMAIL_Pwd.Trim <> "-" Then
client.Credentials = New Net.NetworkCredential(g_EMAIL_User.Trim, g_EMAIL_Pwd.Trim)

End If
client.Send(oMessage)
Catch ex As Exception

Return False
End Try

Return True
End Function

From anywhere of you codes, you just call this function, and if all the SMTP settings are correct, the email will be successfully sent to the recipient!

If you're going to send an alert email, remember to set the filter, so that the application won't simply send the email which might flood your inbox. As in my case where the apps alert me the server hard drive free space, the email will only be sent once the application notice that the free space left is less than 80 GB.

Dim FreeSpace As String = My.Computer.FileSystem.Drives.Item(0).AvailableFreeSpace.ToString
Dim fspaceInMB As Double = Math.Round((CDbl(FreeSpace) / 1000000), 2)
Dim fspaceInGB As Double = Math.Round((CDbl(FreeSpace) / 1000000000), 2)
Dim strBody As String = ""

fspaceInMB = fspaceInMB - 1000
fspaceInGB = fspaceInGB - 1

If CDbl(fspaceInGB) <>
Send_EMAIL("helangtimuran@gmail.com", "WARNING: Hard disk almost full", "")
End If


In this way, the apps. not only give you an alert but it gives you an alert in an efficient way.