Wednesday, January 5, 2011

How to ping a list of machines using vbscript?

Sometimes you may come across the need of checking a number of machines are connected to network or not. There is an easy way to do it through vbscript.

To accomplish this you need two files. Create a text file named “MachineList.txt” and list all the machine names or ip addresses in the list as shown below

192.168.1.2

192.168.1.3

192.168.1.4

192.168.1.5

192.168.1.6

Test1

test2

Then copy the below vbscript in a notepad file and save it as “pinglist.vbs”. Double click on the “pinglist.vbs”. You will get the results in another text file named “updated.txt” on the same folder.

On Error Resume Next

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Set Fso = CreateObject("Scripting.FileSystemObject")

Set shell = CreateObject("WScript.Shell")

Set InputFile = fso.OpenTextFile("MachineList.Txt")

Set outputFile = fso.openTextFile("updated.Txt", ForAppending, True)

outputFile.writeline "Date : " & Date

Do While Not (InputFile.atEndOfStream)

HostName = InputFile.ReadLine

Set WshShell = WScript.CreateObject("WScript.Shell")

Ping = WshShell.Run("ping -n 1 " & HostName, 0, True)

Select Case Ping

Case 0

outputFile.writeline HostName & " Connected"

Case 1

outputFile.writeline HostName & " Not Connected"

End Select

Loop

Tuesday, January 4, 2011

Nessus and Nmap Cheatsheet


How Trojans Differ from Viruses and Worms?

Trojan horses differ from computer viruses and worms because they do not replicate. A computer virus is a program that replicates by infecting programs and requires some form of user action to propagate. A worm, however, may or may not infect programs and often does not require any explicit user intervention to replicate. Worms typically replicate and spread much faster than computer viruses.

Trojan horse programs can be roughly divided into those that are deployed by modifying source code and those that are deployed by manually infecting the host executable in much the same way that an executable is infected with a virus. The former deployment method assumes that the Trojan author has the luxury of modifying the original source code to contain the Trojan horse program and that the Trojan author can then compile and deploy the apparently innocent program. This option is not always possible, and so malware authors sometimes resort to modifying preexisting binary executables. The programs that are modified in this way are typically popular programs that are subsequently made available for download or operating system programs that reside on a machine that is under attack.

How Cookies can be a threat?

Cookies could be used to store session IDs. There are two types of cookies: persistent and nonpersistent. A persistent cookie is stored on the client's hard drive, and an attacker who has access to the client machine can easily access the cookie. A nonpersistent cookie is stored in memory and is more difficult to access.
With the help of special programs called sniffers, cookies can also pulled off the wire as they travel between the client and the server. Another attack is to guess a cookie. An attacker can visit an e-commerce site numerous times and get an idea of session IDs and cookie values. If the attacker successfully guesses a cookies, he or she can impersonate a valid user and gain access to the users account.
To make the guessing of cookies difficult, session IDs must be unique long numbers. If a session ID is serially incremented or if it follows a specific time pattern, an attacker can generate an identifier that coincides with the identifiers of a current user.