Blog/traffic spam

This past week I’ve been checking my Firestats, and noticed that I was getting a lot of traffic for two of my articles about VB6. Unfortunately, all the traffic has been from one IP address, 64.22.107.90, and it’s all through the same Google search term of ‘vb6 protection’. A quick Google shows that I’m not alone in noticing the garbage traffic. Some sites apparently lack any sort of spam filter, or don’t bother to clean up the spam, as you can find some sites with multiple posts from different people using the same IP. Sure, people on the Internet don’t always have the same IP, but the fact that the comments that are posted tend to have nothing to do with the actual content.

Fortunately, I have Akismet protecting my site, so I didn’t get any of the comments added to my posts, but as I stated above, not everybody appears to be as lucky. With that said, I did all I could do, which was send an e-mail to the abuse e-mail for the IP’s provider, GNAX.net. With any luck, they’ll actually try and resolve the issue instead of just hoping or waiting for it to go away.

I’m curious what ISPs due when they get enough complaints regarding spam or malware traffic? Being the ResNet Coordinator at BGSU, when we get complaints we tend to block it (if it’s a large enough issue) but then we also try and get out there to take a look at the computer to get it cleaned up. I’m already operating under the assumption that the computer at that IP is actually infected with something that is making it send out the spam.

  • Does the ISP simply cut the connection and send them a letter or phone call stating why? I doubt it, as they are a paying customer, but I also don’t see this happening as then what’s to stop the customer from canceling the service and going elsewhere? All that does is change the IP that the spam is coming from.
  • Assuming they block access and tell the consumer that it’s been done, does the ISP then tell the consumer what they saw, traffic-wise, coming from the computer? This could help the consumer in trying to contact someone to get it resolved, but I’m guessing that this is something that isn’t done either.

So it goes. All-in-all, it just comes down to it being a regular day on the Interwebternets.

Comments

VB6 code for setting startup mode of services in XP or Vista

Here is some VB6 code to set the startup mode of a service in either Windows XP or Vista. Here is the code for disabling a service:

Private Function DisableService(strServiceName)
  Dim ErrorArray(24)
  Dim strComputer As String
  Dim oInstance

  ErrorArray(1) = "The request is not supported."
  ErrorArray(2) = "The user did not have the necessary access."
  ErrorArray(3) = "The service cannot be stopped because other services that are running are dependent on it."
  ErrorArray(4) = "The requested control code is not valid, or it is unacceptable to the service."
  ErrorArray(5) = "The requested control code cannot be sent to the service because the state of the service."
  ErrorArray(6) = "The service has not been started."
  ErrorArray(7) = "The service did not respond to the stop request in a timely fashion."
  ErrorArray(8) = "Unknown failure when stopping the service."
  ErrorArray(9) = "The directory path to the service executable was not found."
  ErrorArray(10) = "The service is already stopped"
  ErrorArray(11) = "The service database is locked."
  ErrorArray(12) = "A dependency which this service relies on has been removed from the system."
  ErrorArray(13) = "The service failed to find the service needed from a dependent service."
  ErrorArray(14) = "The service has been disabled from the system."
  ErrorArray(15) = "The service does not have the correct authentication to run on the system."
  ErrorArray(16) = "This service is being removed from the system."
  ErrorArray(17) = "There is no execution thread for the service."
  ErrorArray(18) = "There are circular dependencies when stopping the service."
  ErrorArray(19) = "There is a service running under the same name."
  ErrorArray(20) = "There are invalid characters in the name of the service."
  ErrorArray(21) = "Invalid parameters have been passed to the service."
  ErrorArray(22) = "The account, which this service is to run under is either invalid or lacks the permissions to run the service."
  ErrorArray(23) = "The service exists in the database of services available from the system."
  ErrorArray(24) = "The service is currently paused in the system."

  strComputer = "."
  Set oInstance = GetObject("winmgmts:{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2:Win32_Service.Name=" & Chr(34) & strServiceName & Chr(34))
  Set oMethod = oInstance.Methods_("ChangeStartMode")
  Set oInParam = oMethod.inParameters.SpawnInstance_()
  oInParam.StartMode = "Disabled"
  Set oOutParam = oInstance.ExecMethod_("ChangeStartMode", oInParam)
  If oOutParam.returnValue <> 0 Then
    MsgBox "Change of startup mode of " & oInstance.DisplayName & " to disable failed.  Reason: " & ErrorArray(oOutParam.returnValue)
  End If
End Function

Currently, the code is written as two different functions, DisableService and ManualService, with the code only being different on two lines, one functional and one for a message box, so technically it could be combined into one function, which accepts two strings: the service name and what to do. However, on my installation of VB6, it doesn’t want to call the function with parenthesis, which looks wrong and, well, I don’t trust it as a result. This could technically be a standard for VB6, but I’ve seen plenty of other code samples online that use parenthesis around functions accepting multiple parameters, so it could just be an issue with my machine, or me just not understanding VB6. Anyway, the chunk of code that would change would be:


  oInParam.StartMode = strSomeValue

and


  MsgBox "Change of startup mode of " & oInstance.DisplayName & " to " & strSomeValue & " failed.  Reason: " & ErrorArray(oOutParam.returnValue)

The value of strSomeValue could be any of the following:

  • Boot
  • System
  • Automatic
  • Manual
  • Disabled

With that said, if you had two functions, DisableService and ManualService, one way to call them could be:

Private Sub SetServices()
    On Error Resume Next
    ' Computer Browser
    DisableService ("Browser")

    ' Messenger
    DisableService ("Messenger")

    ' NetMeeting Remote Desktop Sharing
    DisableService ("mnmsrvc")

    ' Remote Access Auto Connection Manager"
    DisableService ("RasAuto")

    ' Remote Desktop Help Session Manager
    DisableService ("RDSessMgr")

    ' Remote Registry
    DisableService ("RemoteRegistry")

    ' Server
    DisableService ("lanmanserver")

    ' SSDP Discovery
    DisableService ("SSDPSRV")

    ' Telnet
    DisableService ("TlntSvr")

    ' Universal Plug and Play Device Host
    DisableService ("upnphost")

    ' Volume Shadow Copy
    ManualService ("VSS")

    ' Windows Image Acquisiton
    ManualService ("stisvc")

    MsgBox "Computer services have been analyzed and configured."
End Sub

To find out how to call a service, just open the Services window, my personal favorite method is Start->Run->services.msc, and just double-click on a given service. You’ll want to call a service via its service name, which, in Windows XP, is the first item on the General tab. At the moment, I’m not sure what the display looks like on Windows Vista, but I believe it to be very close to the same. If all else fails, you can also easily find a list of Windows services by searching the web, and the site will typically have suggested settings for each one and common uses.

Comments

VB6 and the scroll wheel

Since VB6 came out before the advent of the scroll wheel, the VB6 IDE doesn’t know what to do with it, so it ignores it. This is always a problem when I try and code in VB6.

The reason I code in 6 instead of .net is because I don’t want to deal with the fact that the user might need the .NET Framework installed on their computer. I care about that because the code I make is for students to use on their computers to help get them ready for connecting to the BGSU network, and I’m sure the moment I make the students need to have the .NET Framework installed, that some ugly malware will come out that exploits some part of it, and I’m left with a bunch of student computers going ape-shit with malware traffic.

All that aside, a quick Google search did bring up the Microsoft KB article 837910, which gives the resolution to this issue. It’s amazing how much you become reliant on something as simple as a scroll wheel, and that you get frustrated when it doesn’t work. But that’s how you fix it, so if you need that, great. If not, just keep it in mind, as you may need it sometime.

Initially I had come across the link via a post on Unhandled Exceptions. They claimed that the MS article didn’t point to an existing file, but that issue has apparently been fixed since they posted about it back in May of ’05. And that’s the way it goes when you link to something.

Comments

Set Windows Firewall in Windows XP or Vista

Over a year ago, I wrote a VB6 program for configuring students’ machines on the network at BGSU; something they could run before they got here to make sure some basic settings were already configured. Previously, I have posted VB6 code for configuring Windows Automatic Updates, which, of course, sets the Automatic Updates for Windows. I was looking at this code to see what I was going to have to do to get it to work in Windows Vista, but I first decided to run it and see what would happen. Lo and behold, it worked as it was supposed to, which was a surprise.


Private Sub SetFirewall()
    On Error Resume Next
    Dim objFwMgr
    Dim objProfile

    Set objFwMgr = CreateObject("HNetCfg.FwMgr")
    If Err <> 0 Then
        MsgBox "Unable to access Windows Firewall."
    Else
        ' Get the current profile for the local firewall policy.
        Set objProfile = objFwMgr.LocalPolicy.CurrentProfile

        'Verify that the Firewall is enabled. If it isn't, then enable it.
        If objProfile.FirewallEnabled = False Then
            MsgBox "Windows Firewall has been detected as being disabled." & vbCrLf & "It will be enabled with Exceptions Allowed"
            objProfile.FirewallEnabled = True
            profile.ExceptionsNotAllowed = False
        End If
    End If
End Sub

Comments

VB6 code for setting Automatic Updates in Windows XP with Service Pack 2

Now, I know the currently this post will not interest my two known visitors, but this was part of a program to configure student’s computer that I made for work. In the next week or so I will be adding code samples for setting other network configuration items. Maybe one day I will add an exe or something.


Private Sub SetAutoUpdate()
    On Error Resume Next
    Dim strAUOptions As String
    Set WshShell = CreateObject("WScript.Shell")
    strAUOptions = WshShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\AUOptions")

    If strAUOptions <> "4" Then
        MsgBox "Automatic Updates has been detected as not being set to Automatic (the recommended setting)." & vbCrLf & "It will be set to download updates everyday at 6:00 AM."

        ' Create the keys that need to be written and then
        ' write the values into the keys

        ' Set download/install type to 4, which is automatically
        WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\", "AUOptions"
        WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\AUOptions", "00000004", "REG_DWORD"

        'WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\", "NoAutoUpdate"
        'WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\NoAutoUpdate", "00000000", "REG_DWORD"

        ' Set day to download/install to 'Everyday'
        WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\", "ScheduledInstallDay"
        WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\ScheduledInstallDay", "00000000", "REG_DWORD"

        ' Set time to download/install to 5:00 AM
        WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\", "ScheduledInstallTime"
        WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\ScheduledInstallTime", "00000006", "REG_DWORD"

        ' Reboot after installing if someone is logged in
        WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\", "NoAutoRebootWithLoggedOnUsers"
        WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\NoAutoRebootWithLoggedOnUsers", "00000001", "REG_DWORD"

        ' Set number of hours to check for updates if no connection to 14 hours
        WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\", "RescheduleWaitTime"
        WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RescheduleWaitTime", "00000014", "REG_DWORD"
    End If
End Sub

3/12/07 Update: I recently tried this code on a installation of Windows Vista, and everything appeared to work.

Comments