#include <AutoItConstants.au3> ;AdlibEnable(‘GetWindows’, 500); checks function ever 500 milliseconds… 250 is default ;#include
;Local $Test = StringSplit(GetWindows(1), Chr(01))
;_ArrayDisplay($Test, ‘array’) ;Local $Timer = TimerInit()
;While 1
; If TimerDiff($Timer) / 1000 >= .5 Then
; MsgBox(0, “”, GetWindows())
; $Timer = TimerInit(); start timer over
; EndIf
; Sleep(100)
;WEnd
Func _dbg($sMsg)
If @Compiled Then
DllCall(“kernel32.dll”, “none”, “OutputDebugString”, “str”, $sMsg)
Else
ConsoleWrite($sMsg & @CRLF)
EndIf
EndFunc Func GetWindows($ChangeToArray = ‘0’); call it with a 1 if you want an array
Local $List = WinList()
Local $ReturnWindows
Local $Seperator
If $ChangeToArray = 0 Then
$Seperator = @LF
Else
$Seperator = Chr(01)
EndIf
For $i = 1 to $List[0][0]
If BitAND(WinGetState($List[$i][1]), 2) And $List[$i][0] <> ” Then
$ReturnWindows = $ReturnWindows & $List[$i][0] & $Seperator
EndIf
Next ;_dbg(Ubound($ReturnWindows)) If $ChangeToArray = 0 Then
Return StringTrimRight($ReturnWindows, 1); just to show you how it works
Else
Return StringTrimRight($ReturnWindows, 1);<< Return it as an array
EndIf
EndFunc $list = ProcessList()
for $i = 1 to $list[0][0]
;_dbg($list[$i][0]);
;msgbox(0, $list[$i][0], $list[$i][0])
next _dbg(” -=-=-=-=-=-=-=-=- Getting Windows -=-=-=-=-=-=-=-=- “) ;_dbg(GetWindows(0)) $windowlist = StringSplit ( GetWindows(1), Chr(01) ) _dbg(Ubound($windowlist)) for $i = 1 to Ubound($windowlist) -1
;_dbg($windowlist[$i])
If StringInStr($windowlist[$i], “Google Chrome”) > 0 Then
_dbg($windowlist[$i])
WinSetOnTop($windowlist[$i], “”, $WINDOWS_ONTOP)
EndIf
next ;Example() Func Example()
; Retrieve the handle of the active window.
Local $hWnd = WinGetHandle(“Reboot required”)
WinSetState ( $hWnd, “”, @SW_HIDE )
EndFunc ;==>Example

install Python 3.6.2 and Git Add “C:\Users\User\AppData\Local\Programs\Python\Python36” to your path and remove any Windows Store Path’s as needed to prevent Windows store from popping up while executing python commandline execute python get-pip.py from command line -> https://bootstrap.pypa.io/get-pip.py dir into a new folder. Know that using the latest version of python can cause issues with TensorFlow

C:\Users{username}\AppData\Local\Programs\Python\Python36\projects git clone https://github,com/sjvasquez/handwriting-synthesis.git
cd handwriting-synthesis
python -m pip install svgwrite python -m pip install matplotlib python -m pip install scipy python -m pip install pandas python -m pip install sklearn python -m pip install rnn python -m pip install tensorflow==1.11.0 python demo.py

pip install –trusted-host=storage.googleapis.com –trusted-host pypi.org –trusted-host files.pythonhosted.org numpy svgwrite matplotlib scipy pandas sklearn rnn https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.11.0-py3-none-any.whl

Files will drop in Img folder as SVG’s.

doskey /History 
pip install pipdeptree
https://github.com/sjvasquez/handwriting-synthesis/blob/7df857ac88122bd6957d591efb6eaa5e0c320bcc/run.py
Remove-Variable * -ErrorAction SilentlyContinue; Remove-Module *; $error.Clear(); Clear-Host #This will Break the Webcall scripts
#https://stackoverflow.com/questions/47542628/cannot-convert-argument-second-time-in-powershell
#https://www.slipstick.com/developer/change-programmatic-access-options/

#$proxy = New-WebServiceProxy -uri "http://localhost:8080/API.asmx?WSDL" -namespace "com.api" -class "MyProxyClass"
#$proxy = New-WebServiceProxy -uri "http://localhost:8080/API.asmx?WSDL" -namespace "MyPortal" -class "MyProxyClass"




# load the required .NET types
Add-Type -AssemblyName 'Microsoft.Office.Interop.Outlook'

$GCalenderItems = $null  #Makes global Car
$End = (Get-Date).AddDays(14).ToShortDateString()
$Start = (Get-Date).AddDays(-14).ToShortDateString()

Function Get-OutlookCalendar
{
    # access Outlook object model
    $outlook = New-Object -ComObject outlook.application

    # connect to the appropriate location
    $namespace = $outlook.GetNameSpace('MAPI')
    $Calendar = [Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderCalendar


    $Filter = "[MessageClass]='IPM.Appointment' and [IsRecurring] = '$False' AND [Start] > '$Start' AND [Start] < '$End'" # AND [End] < '$End'" #AND [Start] > '$Start' AND [End] < '$End'"


    $CalenderItems = $namespace.getDefaultFolder($Calendar).Items.Restrict($Filter)
    $CalenderItems | Select-Object -Property Start, Subject
    write-host "There are $($CalenderItems.Count) calendar entries. Fetching between $($start) and $($end)"    

    #write-host "There are $($CalenderItems.Items.Count) calendar entries. Fetching between $($start) and $($end)"    
    #$folder
    #$CalenderItems | Select-Object -Property Start, End, Categories, Subject, IsRecurring, Organizer
    #$folder | gm

    return $CalenderItems
    #$dataToReturn = $folder.Items.Restrict($Filter) # | Select-Object -Property Start, End, Categories, Subject, IsRecurring, Organizer
    $folder.items | Select-Object -Property Start, Categories, Subject, IsRecurring, Organizer
    $data = $folder.items | Select-Object -Property Start, Categories, Subject, IsRecurring, Organizer
    $data | Where-Object ($_.Subject -ne "!@#!#!$") 
    $cal = $data | Where-Object ($_Subject -CContains "paceart")
    write-host "Completed"
}

$GCalenderItems = Get-OutlookCalendar

function add-appointment(){
<#
.SYNOPSIS
Creates and appointment in outlook
.DESCRIPTION
Creates an appointment in outlook in the default calendar folder
.PARAMETER TimeDate
Time and Date of the appointment. Multiple formats are accepted. Please use the one common to your region. It will create the appointment for today if no date is specified. 
.PARAMETER Location 
The message to be send.
.PARAMETER ReminderMinutesBeforeStart
Sets when to send reminder for appointment. Default is 15 minutes. 1440 minutes are in a day and 10080 minutes in a week. Set it to 0 for no reminders.
.PARAMETER Subject
The subject of the appointment.
.EXAMPLE
add-appointment -TimeDate "1/4/2015 4:30 pm" -Subject "Little Mermaid" -location "Cameo Theater" -ReminderMinutesBeforeStart 0
This example adds a appointment on 1/4/2015 at 4:30 PM with subject Little mermaid and no reminder.  
.NOTES
Requires Windows PowerShell v2 or later and Microsoft Office Outlook 2010 or later.
Outlook cannot be running when running this script.Some versions of Outlook will not close the session. Please go to taskbar and close manually in that case.  
#>
[CmdletBinding()]
param (
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
$TimeDate, 
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
$Subject ,
$location,
[int]$ReminderMinutesBeforeStart = "15"
)
    $AppointmentTime = get-date $Timedate
    #Check whether Outlook is installed
    if (-not (Test-Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE")) {
    Write-Warning "Outlook is not installed. You need to install Outlook 2010 or later to use this Script."
    break
    }

    #Check if Outlook is running. 
    $OutlookState = Get-Process | Where-Object {$_.Name -eq "outlook"}
    if ($OutlookState) 
    {
        Write-Warning "Outlook is running. Please close outlook to run this script"
        break
    }
    $outlook = new-object -com Outlook.Application
    $calendar = $outlook.Session.GetDefaultFolder(9) # == olFolderCalendar 
    $appt = $calendar.Items.Add(1) # == olAppointmentItem 
    $appt.Start = [datetime]$AppointmentTime
    $appt.Subject = $subject
    $appt.Location = $location
    $appt.ReminderSet = $true
    $appt.ReminderMinutesBeforeStart =$ReminderMinutesBeforeStart
    $appt.Save() 
    $outlook.Quit() 
}



if ( !(Test-Path variable:proxy) )
{
    $proxy = New-WebServiceProxy -uri "https://MyPortal/API.asmx?WSDL" -namespace "MyPortal" -UseDefaultCredential
    #$proxy = New-WebServiceProxy -uri "http://localhost:8080/API.asmx" -namespace "MyPortal" -UseDefaultCredential
}


function AdvanceSearch-appointment(){
    $Outlook = New-Object -ComObject Outlook.Application  
    Unregister-Event *
    Register-ObjectEvent -InputObject $Outlook -EventName "AdvancedSearchComplete" -Action {
        Write-Host "ADVANCED SEARCH COMPLETE" $Args.Scope "Results: " $Args.Results

        if ($Args.Results) {  
            foreach ($result in $Args.Results) {
                write-host "=================================================="
                write-host $result.Subject
                write-host $result.ReceivedTime
                write-host $result.SenderName
                write-host "=================================================="
            }
        }
    }
    #$olFolders = “Microsoft.Office.Interop.Outlook.OlDefaultFolders” -as [type]
    $olFolders = [Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderCalendar
    $NameSpace = $Outlook.GetNameSpace(“MAPI”)
    #$Scope = $NameSpace.getDefaultFolder($olFolders::olFolderCalendar) #'Inbox'
    $Scope =  'Inbox' #$NameSpace.getDefaultFolder($olFolders) #'Inbox' #'Calendar'
    $Emails = $Outlook.AdvancedSearch( $Scope, "", $true ) #urn:schemas:calendar:subject != '%'
    #$Emails
}

$person = New-Object "MyPortal.ThePerson";
$person.FirstName = "Frederick";
$person.LastName = "DebYouSee";


$Command = New-Object "MyPortal.SystemChange";
$Command = $proxy.Jira_QueryAllOpenChangeControlsThisWeek(50);

$ol = New-Object -ComObject Outlook.Application;
$meeting = $ol.CreateItem('olAppointmentItem');
$calendar = $ol.Session.GetDefaultFolder(9) # == olFolderCalendar 
:nextCalendarItem foreach($file in $Command)
{



    [string]$MyTitle = " CC" + $file.Ticket + ": " + $file.summary;

    Write-Host $MyTitle; #$file.Ticket.ToString().Trim() ": " $file.summary.ToString().Trim();

    #$GCalenderItems | Select-Object -Property Start, Subject
    foreach ($result in $GCalenderItems) 
    {
        if ($result.Subject -like $MyTitle)
        {
            write-host "=================================================="
            write-host $result.Start
            write-host $result.End
            write-host $result.Subject
            write-host "=================================================="
            continue nextCalendarItem;
        }
    }

    Write-Host $file.PlannedStartDate;
    Write-Host $file.PlannedEndDate;



    $meeting.Subject = "$MyTitle";

    $meeting.Body = $file.description;
    $meeting.Categories = "ChangeControlReminder";
    $meeting.Location = 'Change Control Reminder';
    $meeting.ReminderSet = $true;
    $meeting.Importance = 1;
    $meeting.MeetingStatus = [Microsoft.Office.Interop.Outlook.OlMeetingStatus]::olMeeting
    #$meeting.Recipients.Add('mjones@contoso.net')
    $meeting.ReminderMinutesBeforeStart = 15 

    $StartDate = [DateTime]::Parse($file.PlannedStartDate, [System.Globalization.CultureInfo]::InvariantCulture); #$file.PlannedStartDate#DateTime.Parse() #System.Globalization.CultureInfo.InvariantCulture
    $EndDate = [DateTime]::Parse($file.PlannedEndDate, [System.Globalization.CultureInfo]::InvariantCulture); #$file.PlannedStartDate#DateTime.Parse() #System.Globalization.CultureInfo.InvariantCulture
    $duration = $EndDate - $StartDate

    $meeting.Start = $StartDate
    if ($duration.TotalHours -gt 8)
    {
        $meeting.Duration = 30
    }
    else
    {
        $meeting.Duration = $duration.TotalMinutes
    }
    #$meeting.Send()


    $appt = $calendar.Items.Add(1) # == olAppointmentItem 
    $appt.Start = $StartDate;

    if ($duration.TotalHours -gt 8)
    {
        $appt.Duration = 30
    }
    else
    {
        $appt.Duration = $duration.TotalMinutes
    }

    $appt.Subject = "$MyTitle";
    $appt.Body = $file.description;
    $appt.Location = $location;
    $appt.Categories = "ChangeControlReminder";
    $appt.Location = 'Change Control Reminder';
    $appt | gm
    $appt.ReminderSet = $false;
    $appt.Importance = 1;
    $appt.BusyStatus = [Microsoft.Office.Interop.Outlook.OlBusyStatus]::olFree;
    $appt.ReminderMinutesBeforeStart = $ReminderMinutesBeforeStart;
    $appt.Save();
}

#Invoke-Expression $Command;

#$proxy.Dispose(); #You must dispose of the proxy IN YOUR SCRIPT, powershell will not do it for you!
#!/usr/bin/php -q
    <?php

    //Creates a check for HTTP and HTTPS services. Also creates a SSL cert check.
    //Every host is scanned for the ports listed below, and if an web service is found, a service check is created for it.

    $database_folder = "/etc/nagios/scripts/auto_generate_database/"; //Folder of the SQLLite databases to use for host lookup.

    $outputfile = "autoconfig_Custom-services.cfg";
    #$outputfile = "/etc/nagios/conf.d/auto_generated/autoconfig_http-services.cfg";

    $check_http = "/etc/nagios/plugins/check_http"; //Location of Nagios check_http command. This command does all the work and the config is bases on what this command returns.

    $servicehttps_ports_array = array("443","8443","9443","18200","18201","18202","18203","18204","18205","18206","18207","18208","18209","18210");// array of ports for SSL/TLS checks. Also creates a cert check for each ones of these.
    $servicehttp_ports_array = array("80","8080","8888");// array of ports for normal HTTP checks
    $httpcodes = "200,301,302,403,404"; //HTTP codes that are OK

    //////////////////////////// MAIN  //////////////////////////// 

    #var_dump($argv);
    #exit();

    include_once("/etc/nagios/scripts/lib/check_for_custom_config_lib.php"); //Load check for custom config library.
    $servicegroups_array = array();// Servicegroup array
    $servicehttp_array = array();// http service array
    $servicehttps_array = array();// https service array

    //Open the database with a list of servers.
    $dbh  = new PDO("sqlite:$database_folder/servers.sqlite3") or die("cannot open the database");

    //Build the arrays
    foreach($servicehttps_ports_array as $port) {
        $servicehttps_array["$port"] = array();
    }
    foreach($servicehttp_ports_array as $port) {
        $servicehttp_array["$port"] = array();
    }




    $stmt = $dbh->query("SELECT * FROM servers;");
    $debug_count = 0;

    if($argc>1)
    {
        echo "Pinging $argv[1]       \r\n";
        //ping to see if the host is up.
        exec("ping -c 1 $argv[1]", $null, $result);
        if (!($result == 0)){ continue;}
        echo "Checking $argv[1] with ISPortal      \r";
        $Output = NagiosServiceCheck($argv[1]);
        echo $Output;
        $fh= fopen($argv[1],'w');
        fwrite($fh, $Output);
        fclose($fh);
    }
    else
    {
        //Loop over the list of servers.
        foreach ($stmt as $row) {

            $host = $row["hostname"];
            $ip = $row["ip"];
            echo "Pinging $host       \r\n";
            //ping to see if the host is up.
            exec("ping -c 1 $ip", $null, $result);
            if (!($result == 0)){ continue;}

            echo "Checking $host with ISPortal      \r";

            #httpChecks($host,$ip); //Check for HTTP and HTTPS ports

            $Output = NagiosServiceCheck($host);

            echo $Output;

            $fh= fopen($host,'w');
            fwrite($fh, $Output);
            fclose($fh);

            $debug_count++;
        #    if ($debug_count > 50) {break 1;} //Stop after X servers for testing
        }
    }

    exit();




    function ServiceCheck($ServiceName) {
        switch ($i) 
        {
            case 0:
                echo "i equals 0";
                break;
            case 1:
                echo "i equals 1";
                break;
            case 2:
                echo "i equals 2";
                break;
        }
    }

    function NagiosServiceCheck($host) 
    {
        try
        {
            #$client = new SoapClient("https://IsPortal/API.asmx?WSDL", array('login' => "EID@FQDN.COM", 'password' => "MyPasswordGoesHere", 'user_agent' => 'PHPSoapClient'));
            $client = new SoapClient("https://IsPortal/API.asmx?WSDL", array('user_agent' => 'PHPSoapClient', 'cache_wsdl' => WSDL_CACHE_NONE));
            #var_dump($client->__getFunctions());
            #$result = $client->HelloWorld()->HelloWorldResult;
            #$result = $client->Testing_HelloWorld()->Testing_HelloWorldResult;
            #$result = $client->Nagios_GenerateCustomServices($host, "true")->Nagios_GenerateCustomServicesResult;
            #$result = $client->__soapCall(Nagios_GenerateCustomServices, 'Hostname' => '$host', 'MustBeSetToAutomatic', => 'True')->Nagios_GenerateCustomServicesResult;
            #$result = $client->Nagios_GenerateCustomServices(new SoapParam('Hostname', $Hostname), new SoapParam("True", $MustBeSetToAutomatic))->Nagios_GenerateCustomServicesResult;
            #$result = $client->Nagios_GenerateCustomServices(array('parameters' => $params))->Nagios_GenerateCustomServicesResult;
            $params = array('Hostname' => $host, 'MustBeSetToAutomatic' => 'True');
            $result = $client->__soapCall('Nagios_GenerateCustomServices', array('parameters' => $params))->Nagios_GenerateCustomServicesResult;
            #echo $result;
            return $result;
        }
        catch (Exception $e)
        {
            echo 'caught execption: ', $e->getMessage(), "\n";
        }
    }

    function httpChecks($host,$ip) {

            global $httpcodes,$check_http,$servicehttp_array,$servicehttps_array,$servicehttps_ports_array,$servicehttp_ports_array;

            //Check for an active HTTP service on an array of ports.
            foreach($servicehttp_ports_array as $port) {

                ///Check for an active HTTP service on an array of ports.
                $output_array = array();
                exec ($check_http." -p $port -H $ip --expect=$httpcodes -t 2", $output_array); //Use the Nagios check_http to probe the ports.
                if( preg_match("/HTTP OK:/",$output_array[0]) ) {
                    echo "HTTP $port found for $host                         \n";
                    array_push($servicehttp_array["$port"], $host); //dump found host and port into array
                    //var_dump($servicehttps_array);
                }
            }


            //Check for an active HTTPS service on an array of ports.
            foreach($servicehttps_ports_array as $port) {

                $output_array = array();
                exec ($check_http." -p $port -H $ip -S --expect=$httpcodes -t 2", $output_array); //Use the Nagios check_http to probe the ports.
                if( preg_match("/HTTP OK:/",$output_array[0]) ) {
                    echo "HTTPS $port found for $host                         \n";
                    array_push($servicehttps_array["$port"], $host); //dump found host and port into array
                    //var_dump($servicehttps_array);
                }
            }
    }

    function generateServiceGroups($servicegroups_array) {

        //Create a service group for each new service monitored.
        $output_group = "";
        $servicegroups_array = array_unique($servicegroups_array);

        foreach($servicegroups_array as $name) {

            echo "servicegroup:$name\n";
            $output_group .= "define servicegroup{\n";
            $output_group .= "      servicegroup_name       $name\n";
            $output_group .= "      alias\n";
            $output_group .= "}\n";
        }
        return($output_group);
    }



    function generateServiceHTTP($servicehttp_array,$servicehttp_ports_array){

        $service_list = "";
        $service = "";
        global $servicegroups_array,$httpcodes;

        //loop over each port.
        foreach($servicehttp_ports_array as $port) {


            $service_list = "";

            if (count($servicehttp_array[$port]) > 0) {
                //loop over the array
                foreach($servicehttp_array[$port] as $host) {

                    //skip if there is a custom config.
                    if (checkForCustomConfig($host,"HTTP $port")) {
                    continue;
                    }

                    //Put additional check here.

                    //Service is good, add it to the list.
                    $service_list .= $host . ",";

                }

                $service_list=substr_replace($service_list,"",-1); //remove ending comma

                $service .="define service{\n";
                $service .="        use                             generic-service\n";
                $service .="        host_name                       $service_list\n";
                $service .="        service_description             HTTP $port\n";
                $service .="        check_command                   check_web! --expect=$httpcodes -p $port -w 8 -c 9\n";
                $service .="        check_interval                  5\n";
                $service .="        flap_detection_enabled          0\n";
                $service .="        retry_interval                  1\n";
                $service .="        notifications_enabled           0\n";
                $service .="        servicegroups                   http-checks-$port\n";
                $service .="        contact_groups                  OpsSysadmin\n";
                $service .="        notes                           HTTP $port Website checks\n";
                $service .="}\n";

                array_push($servicegroups_array,"http-checks-$port");

            }
        }

        return($service);

    }




    function generateServiceHTTPS($servicehttps_array,$servicehttps_ports_array){

        $service_list = "";
        $service = "";
        global $servicegroups_array,$httpcodes;;

        //loop over each port.
        foreach($servicehttps_ports_array as $port) {
            $service_list = "";

            if (count($servicehttps_array[$port]) > 0) {
                //loop over the array
                foreach($servicehttps_array[$port] as $host) {

                    //skip if there is a custom config.
                    if (checkForCustomConfig($host,"HTTPS $port")) {
                    continue;
                    }

                    //Put additional check here.

                    //Service is good, add it to the list.
                    $service_list .= $host . ",";

                }

                $service_list=substr_replace($service_list,"",-1); //remove ending comma

                $service .="define service{\n";
                $service .="        use                             generic-service\n";
                $service .="        host_name                       $service_list\n";
                $service .="        service_description             HTTPS $port\n";
                $service .="        check_command                   check_web! --expect=$httpcodes -p $port -w 8 -c 9 --ssl\n";
                $service .="        check_interval                  5\n";
                $service .="        flap_detection_enabled          0\n";
                $service .="        retry_interval                  1\n";
                $service .="        notifications_enabled           0\n";
                $service .="        servicegroups                   https-checks-$port\n";
                $service .="        contact_groups                  OpsSysadmin\n";
                $service .="        notes                           HTTPS $port Website checks\n";
                $service .="}\n";
                array_push($servicegroups_array,"https-checks-$port");




            }
        }

        return($service);

    }

    function generateServiceHTTPSCert($servicehttps_array,$servicehttps_ports_array){

        $service_list = "";
        $service = "";
        global $servicegroups_array,$httpcodes;

        //loop over each port.
        foreach($servicehttps_ports_array as $port) {


            $service_list = "";

            if (count($servicehttps_array[$port]) > 0) {
                //loop over the array
                foreach($servicehttps_array[$port] as $host) {

                    //skip if there is a custom config.
                    if (checkForCustomConfig($host,"HTTPS $port SSL Cert Expiration")) {
                    continue;
                    }

                    //Put additional check here.

                    //Service is good, add it to the list.
                    $service_list .= $host . ",";

                }

                $service_list=substr_replace($service_list,"",-1); //remove ending comma

                $service .="define service{\n";
                $service .="        use                             generic-service\n";
                $service .="        host_name                       $service_list\n";
                $service .="        service_description             HTTPS $port SSL Cert Expiration\n";
                $service .="        check_command                   check_web!--expect=$httpcodes -p $port -w 8 -c 9 --ssl -C 20\n";
                $service .="        check_interval                  5\n";
                $service .="        flap_detection_enabled          0\n";
                $service .="        retry_interval                  1\n";
                $service .="        notifications_enabled           0\n";
                $service .="        servicegroups                   https-cert-checks-$port\n";
                $service .="        contact_groups                  OpsSysadmin\n";
                $service .="        notes                           HTTPS $port SSL Cert Expiration checks\n";
                $service .="}\n";
                array_push($servicegroups_array,"https-cert-checks-$port");



            }
        }

        return($service);

    }


    //------------------------------End of script. Functions below -------------------------

VB.NET

 <WebMethod()>
    Public Function Nagios_GenerateCustomServices(ByVal Hostname As String, ByVal MustBeSetToAutomatic As Boolean)
        Dim ReturnedArray As ArrayList
        If MustBeSetToAutomatic Then
            ReturnedArray = MyModule.DetectServerServices(Hostname, ServiceProcess.ServiceStartMode.Automatic)
        Else
            ReturnedArray = MyModule.DetectServerServices(Hostname, -1)
        End If

        Dim Host As String = "define host{
  use         linux-server
  host_name   " & Hostname & "
  alias       " & Hostname & "
  address     " & System.Net.Dns.GetHostByName(Hostname).AddressList(0).ToString & "
  notes       Ex. vBlock - VCE PowerPath
  hostgroups  Ex. vBlock_linux_appliance
    }
"

        Dim Data As String = Nothing

        Data = Host

        If MustBeSetToAutomatic Then

            For I = 0 To ReturnedArray.Count - 1

                If (ReturnedArray(I).ToString.StartsWith("!")) Then
                    Continue For
                End If

                Data &= "define service{
        use                             generic-service
        host_name                       " & Hostname & "
        service_description             " & ReturnedArray(I).ToString.Replace("\(", "(").Replace("\)", ")") & "
        check_command                   CheckServiceSNMP!" & ReturnedArray(I) & "
        check_interval                  60
        retry_interval                  1
        notification_interval           60
        contact_groups                  nicholas
        event_handler                   start_service!start_" & ReturnedArray(I) & "
        max_check_attempts              2
        notifications_enabled           1
}
" 'root@Hostname[Nagios]:/usr/lib64/nagios/plugins# ./check_SNMP_service_displayname_emc MySnmpCommunity IsPortal "Power"
            Next

        Else



            For I = 0 To ReturnedArray.Count - 1
                If Not (ReturnedArray(I).ToString.StartsWith("!")) Then
                    Continue For
                End If

                Data &= "define service{
        use                             generic-service
        host_name                       " & Hostname & "
        service_description             " & ReturnedArray(I).ToString.Substring(1).Replace("\(", "(").Replace("\)", ")") & "
        check_command                   CheckServiceSNMP!" & ReturnedArray(I) & "
        check_interval                  60
        retry_interval                  1
        notification_interval           60
        contact_groups                  TheGrouup
        event_handler                   start_service!start_" & ReturnedArray(I) & "
        max_check_attempts              2
        notifications_enabled           1
}
"
            Next
        End If

        Return Data

    End Function
Public Class Form1
    Dim NewLetter As Char
    Dim MyWebRequest As New Net.WebClient()
    Dim Extention As String = ".cfm"
    Dim FileLen As Integer = 0
    Dim SleepTime As Integer = 1000

    Const WebSite As String = "http://MyWebsite.com/"

    Private Sub ExplorePath(ByVal RequestString As String, Optional ByVal LastAscii As Integer = 0)
        Application.DoEvents()

        Dim Data As Byte() = Nothing
        Dim NumberOfFilesFound As Integer = 0
        Dim DataLength As Integer = 0
        NumberOfFilesFound = 0

        Debug.WriteLine("Trying: " & WebSite & RequestString & "<" & Extention)

        Try
            If LastAscii = 0 Then
                Data = MyWebRequest.DownloadData(WebSite & RequestString & "<" & Extention)
            Else
                Data = MyWebRequest.DownloadData(WebSite & RequestString & Chr(LastAscii) & "<" & Extention)
            End If
            If DataLength <> Data.Length Then
                If LastAscii = 0 Then
                    ListBox1.Items.Add(RequestString & "<" & Extention)
                Else
                    ListBox1.Items.Add(RequestString & Chr(LastAscii) & "<" & Extention)
                    Try
                        MyWebRequest.DownloadData(WebSite & RequestString & Chr(LastAscii) & Extention)
                        ListBox1.Items.Add("--[" & RequestString & Chr(LastAscii) & Extention & "]--")
                    Catch ex As Exception

                    End Try
                    ExplorePath(RequestString & ChrW(LastAscii), 48)
                End If
            End If

        Catch ex As Exception
            DataLength = 0
        End Try


        Select Case LastAscii
            Case 0
                LastAscii = 48
            Case 58
                LastAscii = 65 'A
            Case 91
                LastAscii = 48 'Zero
                Return
            Case Else
                LastAscii += 1
        End Select

        Threading.Thread.Sleep(SleepTime)
        ExplorePath(RequestString, LastAscii)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'THIS CAN DOS THE SYSTEM
        'Add a Sleep Command
        'Exit Sub
        Dim MyThread(25) As Threading.Thread
        Dim MyThreadClass(25) As ThreadClassAction
        If TextBox2.Text = "" Then
            For i = 0 To 25
                MyThreadClass(i) = New ThreadClassAction
                MyThreadClass(i).CallBack = Me
                MyThread(i) = New Threading.Thread(AddressOf MyThreadClass(i).Launch)
                MyThread(i).Name = Chr(Asc("A") + i)
                MyThread(i).IsBackground = True
                MyThread(i).Start()
            Next
        Else
            Extention = TextBox1.Text
            ExplorePath(TextBox2.Text)
            MsgBox("Done!")
        End If


    End Sub
End Class

Public Class ThreadClass
    Public CallBack As Form
    Public Data As String
    Public Sub AddListItem1()
        Form1.ListBox1.Items.Add(Data)
    End Sub
    Public Sub AddListItem2()
        Form1.ListBox2.Items.Add(Data)
    End Sub
End Class

Public Class ThreadClassAction
    Public CallBack As Form
    Dim MyWebRequest As New Net.WebClient()
    Private Delegate Sub MyDelPtr()
    Public Extention As String = ".cfm"

    Const WebSite As String = "http://MyWebsite.com/"

    Public Sub Launch()
        ExplorePathThread(Threading.Thread.CurrentThread.Name)
    End Sub

    Private Sub ExplorePathThread(ByVal RequestString As String, Optional ByVal LastAscii As Integer = 0)
        Debug.WriteLine("Starting Thread: " & Threading.Thread.CurrentThread.Name)
        Application.DoEvents()
        Dim MyThreadClass As New ThreadClass
        MyThreadClass.CallBack = CallBack
        Dim MyDel1 = New MyDelPtr(AddressOf MyThreadClass.AddListItem1)
        Dim MyDel2 = New MyDelPtr(AddressOf MyThreadClass.AddListItem2)

        Dim Data As Byte() = Nothing
        Dim NumberOfFilesFound As Integer = 0
        Dim DataLength As Integer = 0
        NumberOfFilesFound = 0

        Debug.WriteLine("Trying: " & WebSite & RequestString & "<" & Extention)

        Try
            If LastAscii = 0 Then
                Data = MyWebRequest.DownloadData(WebSite & RequestString & "<" & Extention)
            Else
                Data = MyWebRequest.DownloadData(WebSite & RequestString & Chr(LastAscii) & "<" & Extention)
            End If
            If DataLength <> Data.Length Then
                If LastAscii = 0 Then
                    MyThreadClass.Data = (RequestString & "<" & Extention)
                    CallBack.Invoke(MyDel1)
                Else
                    MyThreadClass.Data = (RequestString & Chr(LastAscii) & "<" & Extention)
                    CallBack.Invoke(MyDel1)
                    Try
                        MyWebRequest.DownloadData(WebSite & RequestString & Chr(LastAscii) & Extention)
                        MyThreadClass.Data = ("--[" & RequestString & Chr(LastAscii) & Extention & "]--")
                        CallBack.Invoke(MyDel2)
                    Catch ex As Exception

                    End Try
                    ExplorePathThread(RequestString & ChrW(LastAscii), 48)
                End If
            End If

        Catch ex As Exception
            DataLength = 0
        End Try


        Select Case LastAscii
            Case 0
                LastAscii = 48
            Case 58
                LastAscii = 65 'A
            Case 91
                LastAscii = 48 'Zero
                Return
            Case Else
                LastAscii += 1
        End Select
        ExplorePathThread(RequestString, LastAscii)
    End Sub
End Class

I’ve been on 2.1.0 for quite sometime and decided to take the leap to 3.0.0. After I did I started experiencing intermittent connection issues with my Wifi. Then also creating a snapshot I moved back to 2.1.0 and everything works great again. I also tested 3.0.1 and 3.0.2 and all yield the same issue and rolling back to 2.1.0 everything works. Does this having something to do with the new RF_CAL param added in userland or something else I may be missing from my upgrade? Any help would be amazing as I am currently stuck in the water right now with this specific issue.

As you can see in the first picture that is of my NONOS SDK 2.1.0. In the 2nd is the same exact code running on 2.2.0 and I get the same results and error each time unless I revert back to 2.1.0. It almost seems like when I do my Station_Init something in the new SDK or maybe the way I MAKE the sdk is jacking up the Radio. It seems at runtime the radio gets stuck in an off position or something I am not seeing but the 2.1.0 you see it kick off with “mode: 0 -> 3” and yet you never see that happen in the new versions. It seems like something in the SDK changed the behavior of connecting via Wifi? Futhermore, When I do a custom scan I can see one accesspoint that is on channel 9 but not my default “HHN” network that is on channel 6.

To add, This may be an issue on how I am upgrading my SDK. I use PFalcon’s toolchain and modify the make file to include the other sdk’s then run the following.

make clean-sdk clean-sysroot all Once completed I have to run a few post commands to fix a few things to get my SDK to run.

Fix1: Copy all the ld files located in esp-open-sdk/ESP8266_NONO_SDK-{VER} -> esp-open-sdk/xtensa-lx106-elf/sysroot/usr/lib. I then have to go into the files and update the include locations within the files to correct this. /* get ROM code address */ INCLUDE “../ld/eagle.rom.addr.v6.ld” -> INCLUDE “/eagle.rom.addr.v6.ld”

Fix2:[osboxes@osboxes i2c]$ make fresh xtensa-lx106-elf-gcc -Teagle.app.v6.ld main.o -nostdlib -Wl,–start-group -lmain -lpwm -lnet80211 -lwpa -llwip -lpp -lphy -lc -Wl,–end-group -lgcc -o main /home/osboxes/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: main section .text' will not fit in regioniram1_0_seg’ /home/osboxes/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: region `iram1_0_seg’ overflowed by 956 bytes collect2: error: ld returned 1 exit status make: *** [main] Error 1

To fix this I then have to copy the libgcc.a to and from the location below esp-open-sdk/ESP8266_NONO_SDK-{VER}/lib/ -> esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5

I think I may have figured it out.. It appears in SDK 2.2.0 from 2.2.1 seems to have added an RSSI threshold to the Station_Config structure and I think that was filtering out my SSID’s during its scan, During the normal operation, I read back a flash structure and populate the structure with Data but maybe there’s Junk data that lives inside that structure when I try to use it in the NEW sdk and thus filters out my AccessPoint.. maybe due to invalid values in that structure member or that it is indeed valid but my SSID doesn’t mean the RSSI burden of whatever the Junk data was inside.

My sample code of what may have been getting affected by this new change in 2.2.0

#include "esp_sdk_ver.h"
struct station_config stationConfig;
   SpiFlashOpResult ReadResult = spi_flash_read(WifiMemorySpace,(uint32 *)&FlashStationConf,sizeof(FlashStationConf));
   if (ReadResult == SPI_FLASH_RESULT_OK)
   {
      os_printf("[%s][%s][%d] - WifiMemorySpace@0x%x read SUCCESS %s - %s - %d\r\n", __FILE__ ,__func__, __LINE__, WifiMemorySpace, FlashStationConf.ssid, FlashStationConf.password, FlashStationConf.programmed);
   }
   else if(ReadResult == SPI_FLASH_RESULT_ERR)
   {
      os_printf("[%s][%s][%d] - SPI_FLASH_RESULT_ERR", __FILE__ ,__func__, __LINE__);
   }
   else if(ReadResult == SPI_FLASH_RESULT_TIMEOUT)
   {
      os_printf("[%s][%s][%d] - SPI_FLASH_RESULT_TIMEOUT", __FILE__ ,__func__, __LINE__);
   }

   FlashStationConf.ssid[31]=0; //Sets null terminators
   FlashStationConf.password[63]=0; //Sets null terminiators
   if(FlashStationConf.programmed==1)
   {
      #if ESP_SDK_VERSION >= 020200
         os_printf("[%s][%s][%d] - Saved WifiStation Information Found > 2.2.0!!\r\n\tssid: \"%s\"\n\tpw: \"%s\"\r\n)", __FILE__ ,__func__, __LINE__, FlashStationConf.ssid, FlashStationConf.password);
         stationConfig.threshold.authmode = AUTH_WPA_WPA2_PSK; //This is requied or it will not connect to any AP
         stationConfig.threshold.rssi = 84;
      #else
         os_printf("[%s][%s][%d] - Saved WifiStation Information Found!!\r\n\tssid: \"%s\"\n\tpw: \"%s\"\r\n", __FILE__ ,__func__, __LINE__, FlashStationConf.ssid, FlashStationConf.password);
         //os_printf("Curent Config (Station - %s, Password - %s)\n\r", current_config.ssid, current_config.password);
      #endif

      //os_printf("SizeOf(FlashStationConf) = %d\r\n", sizeof(FlashStationConf))
      stationConfig.bssid_set = 0;
      //stationConfig.channel = 0; //no such thing, use wifi_set_channel()
      os_memcpy(&stationConfig.ssid, FlashStationConf.ssid, 32);
      os_memcpy(&stationConfig.password, FlashStationConf.password, 64);
      //This was added recently for faster connections, not sure if this is a good thing yet
      //os_memcpy(&stationConfig.Channel, FlashStationConf.channel, 1);
      //os_memcpy(&stationConfig.ssid_hidden, FlashStationConf.ssid_hidden, 1);
      //os_memcpy(&stationConfig.max_connection, FlashStationConf.max_connection, 1);
      //os_memcpy(&stationConfig.beacon_interval, FlashStationConf.beacon_interval, 2);
      //wifi_station_set_config(&stationConfig);
      wifi_station_set_config_current(&stationConfig);

      if (wifi_station_connect())
      {
         os_printf("[%s][%s][%d] - Attempting to connect to station, starting IP Timer\r\n", __FILE__ ,__func__, __LINE__);
         os_timer_disarm(&network_check_ip_timer); //Timer must be disarmed or may cause a crash. This timer may have been used before being used again
         os_timer_setfn(&network_check_ip_timer, (os_timer_func_t *)network_check_ip, NULL);
         os_timer_arm(&network_check_ip_timer, 10000, 0);
         /*if (myConnectToStronestWifiCallback != NULL)
         {
            myConnectToStronestWifiCallback(); //Need to check if a ValidIP is ready before doing this.
         }
         */
      }
      else
      {
         os_printf("[%s][%s][%d] - Station failed to connect to an open wifi\r\n", __FILE__ ,__func__, __LINE__);
      }
Public Class Form1
    Public WithEvents MyClient As System.Net.WebClient
    Public TotalWorkingThreads As Integer = 0
    Public TotalTags As Integer = 0
    Public gExtractedLinks(50000) As String
    Private Sub SpiderThePageCache(ByVal Webpage As String)
        MyClient = New System.Net.WebClient
        Dim WebpageDocument As String = MyClient.DownloadString(Webpage)
        Dim AhrefIndex As Integer = 0
        Dim ExtractedLink As String
        Dim ExtractedLinks(5000) As String
        Dim Flag As Boolean = False
        While True
            Flag = False
            AhrefIndex = WebpageDocument.IndexOf("a href", AhrefIndex)

            If AhrefIndex = -1 Then Exit While
            If WebpageDocument.Chars(AhrefIndex + 8) = "#" Then
                AhrefIndex += 8
                Continue While
            End If


            ExtractedLink = vbNullString
            For i = (AhrefIndex + 8) To WebpageDocument.Length - 1 ' (AhrefIndex + 25) 
                If WebpageDocument.Chars(i) = Chr(34) Then Exit For
                ExtractedLink &= WebpageDocument.Chars(i)
            Next
            Debug.WriteLine(AhrefIndex & " : " & ExtractedLink)


            For i = 0 To ExtractedLinks.Length
                If ExtractedLinks(i) = ExtractedLink Then
                    Flag = True
                    Exit For
                End If
                If ExtractedLinks(i) = Nothing Then
                    Exit For
                End If
            Next

            If Flag = False Then
                For i = 0 To ExtractedLinks.Length
                    If ExtractedLinks(i) = Nothing Then
                        ExtractedLinks(i) = ExtractedLink
                        Exit For
                    End If
                Next
            End If

            AhrefIndex += 8
        End While
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'SpiderThePage("Http://WebsiteToAudit/")
        Dim SpiderClass = New SpideringThreads
        SpiderClass.CallBack = Me
        SpiderClass.Webpage = "Http://Ikenet"
        Dim T = New Threading.Thread(AddressOf SpiderClass.SpiderMainPageWithThreads)
        T.IsBackground = False
        T.Priority = Threading.ThreadPriority.Highest
        T.Start()
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class

Class SpideringThreads
    Public CallBack As Form1
    Public WithEvents MyClient As System.Net.WebClient
    Delegate Sub MyDelPtr()
    Public Webpage As String


    Enum Marker
        AHref = 1
        AutoComplete = 2
        Three = 3
    End Enum


    Public Sub SpiderMainPageWithThreads()
        MyClient = New System.Net.WebClient
        Dim WebpageDocument As String
        Try
            WebpageDocument = MyClient.DownloadString(Webpage)
        Catch ex As Exception
            'ListBox2.Items.Add(Webpage)
            Dim MyGUIClass = New GUIThreads
            MyGUIClass.Data = Webpage
            CallBack.Invoke(New MyDelPtr(AddressOf MyGUIClass.Listbox2Add)) 'Invoke on main thread
            Exit Sub
        End Try

        If InStr(WebpageDocument, "PASSWORD=", CompareMethod.Text) > 0 Or InStr(WebpageDocument, "developer for debugging", CompareMethod.Text) > 0 Then
            'ListBox1.Items.Add(Webpage)
            Dim MyGUIClass = New GUIThreads
            MyGUIClass.Data = Webpage
            CallBack.Invoke(New MyDelPtr(AddressOf MyGUIClass.Listbox1Add)) 'Invoke on main thread
        End If

        Dim MasterIndex As Integer = 0
        Dim ExtractedLink As String
        Dim Marker1, Marker2 As Integer
        Dim MarkerPath As Marker = 0
        While True
            Marker1 = WebpageDocument.IndexOf("a href=""", MasterIndex)
            Marker2 = WebpageDocument.IndexOf(".autocomplete(", MasterIndex)

            If Marker1 = -1 And Marker2 = -1 Then
                Exit While
            End If

            If Marker1 = -1 Then
                MasterIndex = Marker2
                MarkerPath = Marker.AutoComplete
            ElseIf Marker2 = -1 Then
                MasterIndex = Marker1
                MarkerPath = Marker.AHref
            Else
                If Marker1 > Marker2 And Marker2 <> -1 Then
                    MasterIndex = Marker2
                    MarkerPath = Marker.AutoComplete
                ElseIf Marker2 > Marker1 And Marker1 <> -1 Then
                    MasterIndex = Marker1
                    MarkerPath = Marker.AHref
                End If
            End If

            Dim JumpInteger As Integer = 0
            Select Case MarkerPath
                Case Marker.AHref
                    JumpInteger = 8
                Case Marker.AutoComplete
                    JumpInteger = 15
                Case Marker.Three
                    Debug.WriteLine("Marker 3")
                Case Else
                    Debug.WriteLine("Unknown value")
            End Select

            If WebpageDocument.Chars(MasterIndex + JumpInteger) = "#" Then
                MasterIndex += JumpInteger
                Continue While
            End If

            ExtractedLink = vbNullString

            For i = (MasterIndex + JumpInteger) To WebpageDocument.Length - 1 ' (AhrefIndex + 25) 
                If WebpageDocument.Chars(i) = Chr(34) Then
                    If ExtractedLink = Nothing Then
                        MasterIndex += JumpInteger
                        Continue While
                    End If
                    Exit For
                End If

                ExtractedLink &= WebpageDocument.Chars(i)
            Next
            Debug.WriteLine(MasterIndex & " : " & ExtractedLink)

            If Not ExtractedLink.StartsWith("HTTP", True, Nothing) Then
                ExtractedLink = "Http://Ikenet/" & ExtractedLink
            Else
                If Not ExtractedLink.StartsWith("Http://Ikenet/", True, Nothing) Or Not ExtractedLink.StartsWith("Https://Ikenet/", True, Nothing) Then
                    Debug.WriteLine("NOT IKENET")
                    MasterIndex += 8
                    Continue While
                End If
            End If

            If AddStringToGArray(ExtractedLink) Then
                'SpiderThePage(ExtractedLink)
                Dim MyTotalClass = New GUIThreads
                CallBack.Invoke(New MyDelPtr(AddressOf MyTotalClass.AddWorkingThreads))
                CallBack.Invoke(New MyDelPtr(AddressOf MyTotalClass.AddTotal)) 'Invoke on main thread

                Dim Spider = New SpideringThreads
                Spider.Webpage = ExtractedLink
                Spider.CallBack = CallBack
                Dim T As New Threading.Thread(AddressOf Spider.SpiderNewPageWithThreads)
                T.Start()
            Else
                Debug.WriteLine("Skipped Dubbed: " & ExtractedLink)
            End If

            MasterIndex += JumpInteger
        End While
    End Sub

    Public Sub SpiderNewPageWithThreads()
        MyClient = New System.Net.WebClient
        Dim WebpageDocument As String
        Try
            WebpageDocument = MyClient.DownloadString(Webpage)
        Catch ex As Exception
            'ListBox2.Items.Add(Webpage)
            Dim MyGUIClass = New GUIThreads
            If ex.Message = "The remote server returned an error: (500) Internal Server Error." Then
                MyGUIClass.Data = Webpage
                CallBack.Invoke(New MyDelPtr(AddressOf MyGUIClass.Listbox1Add)) 'Invoke on main thread
                Exit Sub
            End If
            MyGUIClass.Data = Webpage
            CallBack.Invoke(New MyDelPtr(AddressOf MyGUIClass.Listbox2Add)) 'Invoke on main thread
            Exit Sub
        End Try

        If InStr(WebpageDocument, "PASSWORD=", CompareMethod.Text) > 0 Or InStr(WebpageDocument, "developer for debugging", CompareMethod.Text) > 0 Then
            'ListBox1.Items.Add(Webpage)
            Dim MyGUIClass = New GUIThreads
            MyGUIClass.Data = Webpage
            CallBack.Invoke(New MyDelPtr(AddressOf MyGUIClass.Listbox1Add)) 'Invoke on main thread
        End If


        Dim AhrefIndex As Integer = 0
        Dim ExtractedLink As String
        While True
            AhrefIndex = WebpageDocument.IndexOf("a href", AhrefIndex)

            If AhrefIndex = -1 Then Exit While
            If WebpageDocument.Chars(AhrefIndex + 8) = "#" Then
                AhrefIndex += 8
                Continue While
            End If


            ExtractedLink = vbNullString
            For i = (AhrefIndex + 8) To WebpageDocument.Length - 1 ' (AhrefIndex + 25) 
                If WebpageDocument.Chars(i) = Chr(34) Then
                    If ExtractedLink = Nothing Then
                        AhrefIndex += 8
                        Continue While
                    End If
                    Exit For
                End If

                ExtractedLink &= WebpageDocument.Chars(i)
            Next
            Debug.WriteLine(AhrefIndex & " : " & ExtractedLink)

            If Not ExtractedLink.StartsWith("HTTP", True, Nothing) Then
                ExtractedLink = "Http://Ikenet/" & ExtractedLink
            Else
                If Not ExtractedLink.StartsWith("Http://Ikenet/", True, Nothing) Or Not ExtractedLink.StartsWith("Https://Ikenet/", True, Nothing) Then
                    Debug.WriteLine("NOT IKENET")
                    AhrefIndex += 8
                    Continue While
                End If
            End If

            If AddStringToGArray(ExtractedLink) Then
                Dim MyTotalClass = New GUIThreads
                CallBack.Invoke(New MyDelPtr(AddressOf MyTotalClass.AddTotal)) 'Invoke on main thread
                SpiderThePage(ExtractedLink)
            Else
                Debug.WriteLine("Skipped Dubbed: " & ExtractedLink)
            End If

            AhrefIndex += 8
        End While
    End Sub

    Public Sub SpiderThePage(ByVal WebSite As String)
        MyClient = New System.Net.WebClient
        Dim WebSiteDocument As String
        Try
            WebSiteDocument = MyClient.DownloadString(WebSite)
        Catch ex As Exception
            'ListBox2.Items.Add(WebSite)
            Dim MyGUIClass = New GUIThreads
            MyGUIClass.Data = WebSite
            CallBack.Invoke(New MyDelPtr(AddressOf MyGUIClass.Listbox2Add)) 'Invoke on main thread
            Exit Sub
        End Try

        If InStr(WebSiteDocument, "PASSWORD=", CompareMethod.Text) > 0 Or InStr(WebSiteDocument, "developer for debugging", CompareMethod.Text) > 0 Then
            'ListBox1.Items.Add(WebSite)
            Dim MyGUIClass = New GUIThreads
            MyGUIClass.Data = WebSite
            CallBack.Invoke(New MyDelPtr(AddressOf MyGUIClass.Listbox1Add)) 'Invoke on main thread
        End If


        Dim AhrefIndex As Integer = 0
        Dim ExtractedLink As String
        While True
            AhrefIndex = WebSiteDocument.IndexOf("a href", AhrefIndex)

            If AhrefIndex = -1 Then Exit While
            If WebSiteDocument.Chars(AhrefIndex + 8) = "#" Then
                AhrefIndex += 8
                Continue While
            End If


            ExtractedLink = vbNullString
            For i = (AhrefIndex + 8) To WebSiteDocument.Length - 1 ' (AhrefIndex + 25) 
                If WebSiteDocument.Chars(i) = Chr(34) Then
                    If ExtractedLink = Nothing Then
                        AhrefIndex += 8
                        Continue While
                    End If
                    Exit For
                End If

                ExtractedLink &= WebSiteDocument.Chars(i)
            Next
            Debug.WriteLine(AhrefIndex & " : " & ExtractedLink)

            If Not ExtractedLink.StartsWith("HTTP", True, Nothing) Then
                ExtractedLink = WebSite & ExtractedLink
            Else
                If Not ExtractedLink.StartsWith("Http://Ikenet/", True, Nothing) Or Not ExtractedLink.StartsWith("Https://Ikenet/", True, Nothing) Then
                    Debug.WriteLine("NOT IKENET")
                    AhrefIndex += 8
                    Continue While
                End If
            End If

            If AddStringToGArray(ExtractedLink) Then
                Dim MyTotalClass = New GUIThreads
                CallBack.Invoke(New MyDelPtr(AddressOf MyTotalClass.AddTotal)) 'Invoke on main thread
                SpiderThePage(ExtractedLink)
            Else
                Debug.WriteLine("Skipped Dubbed: " & ExtractedLink)
            End If

            AhrefIndex += 8
        End While
    End Sub

    Private Function AddStringToGArray(ByVal Webpage As String) As Boolean
        For i = 0 To CallBack.gExtractedLinks.Length
            If CallBack.gExtractedLinks(i) = Webpage Then
                Return False
                Exit For
            End If
            If CallBack.gExtractedLinks(i) = Nothing Then
                CallBack.gExtractedLinks(i) = Webpage
                Return True
            End If
        Next

        Return True
    End Function
End Class

Class GUIThreads
    Public Data As String
    Public Sub Listbox1Add()
        Form1.ListBox1.Items.Add(Data)
    End Sub

    Public Sub Listbox2Add()
        Form1.ListBox2.Items.Add(Data)
    End Sub

    Public Sub AddTotal()
        Form1.TotalTags += 1
        Form1.Text = "Working Threads : " & Form1.TotalWorkingThreads & "Total Spidered: " & Form1.TotalTags
    End Sub

    Public Sub AddWorkingThreads()
        Form1.TotalWorkingThreads += 1
        Form1.Text = "Working Threads : " & Form1.TotalWorkingThreads & "Total Spidered: " & Form1.TotalTags
    End Sub
End Class
Imports SnmpSharpNet

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        walk()

    End Sub

    Private Sub getone()
        Dim host As String = "MyHostName"
        Dim community As String = "public"
        Dim requestOid() As String
        Dim result As Dictionary(Of Oid, AsnType)
        requestOid = New String() {"1.3.6.1.2.1.1.1.0", "1.3.6.1.2.1.1.2.0"}
        Dim snmp As SimpleSnmp = New SimpleSnmp(host, community)
        If Not snmp.Valid Then
            Console.WriteLine("Invalid hostname/community.")
            Exit Sub
        End If
        result = snmp.Get(SnmpVersion.Ver1, requestOid)
        If result IsNot Nothing Then
            Dim kvp As KeyValuePair(Of Oid, AsnType)
            For Each kvp In result
                Console.WriteLine("{0}: ({1}) {2}", kvp.Key.ToString(),
                                  SnmpConstants.GetTypeName(kvp.Value.Type),
                                  kvp.Value.ToString())
            Next
        Else
            Console.WriteLine("No results received.")
        End If
    End Sub

    Private Sub GetBulk()
        Dim host As String = "MyHostName"
        Dim community As String = "public"
        Dim requestOid() As String
        Dim result As Dictionary(Of Oid, AsnType)
        Dim rootOid As Oid = New Oid("1.3.6.1.2.1.1")
        Dim nextOid As Oid = rootOid
        Dim keepGoing As Boolean = True
        requestOid = New String() {rootOid.ToString()}
        Dim snmp As SimpleSnmp = New SimpleSnmp(host, community)
        If Not snmp.Valid Then
            Console.WriteLine("Invalid hostname/community.")
            Exit Sub
        End If
        While keepGoing
            result = snmp.GetNext(SnmpVersion.Ver1, New String() {nextOid.ToString()})
            If result IsNot Nothing Then
                Dim kvp As KeyValuePair(Of Oid, AsnType)
                For Each kvp In result
                    If rootOid.IsRootOf(kvp.Key) Then
                        Console.WriteLine("{0}: ({1}) {2}", kvp.Key.ToString(),
                                              SnmpConstants.GetTypeName(kvp.Value.Type),
                                              kvp.Value.ToString())
                        nextOid = kvp.Key
                    Else
                        keepGoing = False
                    End If
                Next
            Else
                Console.WriteLine("No results received.")
                keepGoing = False
            End If
        End While
    End Sub

    Private Sub walk()
        Dim host As String = "LocalHost"
        Dim community As String = "public"
        Dim result As Dictionary(Of Oid, AsnType)
        Dim snmp As SimpleSnmp = New SimpleSnmp(host, community)
        If Not snmp.Valid Then
            Console.WriteLine("Invalid hostname/community.")
            Exit Sub
        End If
        result = snmp.Walk(SnmpVersion.Ver2, "1.3.6.1.2.1.1")
        If result IsNot Nothing Then
            Dim kvp As KeyValuePair(Of Oid, AsnType)
            For Each kvp In result
                Console.WriteLine("{0}: ({1}) {2}", kvp.Key.ToString(),
                                  SnmpConstants.GetTypeName(kvp.Value.Type),
                                  kvp.Value.ToString())
            Next
        Else
            Console.WriteLine("No results received.")
        End If
    End Sub

End Class