Category: Uncategorized

WSDL:
https://EpicServer/Interconnect-REL-EDI/wcf/Epic.Security.GeneratedServices/PersonnelManagement.svc?wsdl

REQUEST:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Epic-com:Security.2014.Services.PersonnelManagement" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:urn1="urn:Epic-com:Security.2012.Services.PersonnelManagement">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:CreateUser>
                  <urn:UserInternalID>*</urn:UserInternalID>
                  <urn:Name>Hall, Nicholas</urn:Name>
                  <urn:ContactDate>T</urn:ContactDate>
                  <urn:ContactComment>Initial Entry</urn:ContactComment>
                  <urn:SystemLoginID>12345</urn:SystemLoginID>
                  <urn:IsActive>0</urn:IsActive>             
                  <urn:UserDictionaryPath>\\Serverfiles\User_Dictionaries\123456Ddictionary.tlx</urn:UserDictionaryPath>

         <urn:LinkedTemplatesConfig>
            <urn:AppliedTemplateID>
               <urn1:ID>T154682</urn1:ID>
               <urn1:Type>external</urn1:Type>
            </urn:AppliedTemplateID>
            <urn:AvailableLinkableTemplates>
               <urn:AvailableTemplateSetup>
                  <urn:LinkedTemplateID>
                     <urn1:ID>T14613</urn1:ID>
                     <urn1:Type>external</urn1:Type>
                  </urn:LinkedTemplateID>
               </urn:AvailableTemplateSetup>
            </urn:AvailableLinkableTemplates>
            <urn:DefaultTemplateID>
               <urn1:ID>T164164</urn1:ID>
               <urn1:Type>external</urn1:Type>
            </urn:DefaultTemplateID>
         </urn:LinkedTemplatesConfig>


                  <urn:UserSubtemplateIDs>           
                        <urn1:IndexedRecordIn>
                              <urn1:Identifier>
                                    <urn1:ID>T00022</urn1:ID>
                                    <urn1:Type>external</urn1:Type>
                              </urn1:Identifier>
                              <urn1:Index>1</urn1:Index>
                        </urn1:IndexedRecordIn>
                 </urn:UserSubtemplateIDs>


                 <urn:CustomUserDictionaries>
                        <urn1:IndexedString>
                              <urn1:Index>1</urn1:Index>
                              <urn1:Value>\\serverfiles\User_Dictionaries\12345Ddictionary.tlx</urn1:Value>
                        </urn1:IndexedString>
                 </urn:CustomUserDictionaries>

      </urn:CreateUser>
   </soapenv:Body>
</soapenv:Envelope>

RESPONSE:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <CreateUserResponse xmlns="urn:Epic-com:Security.2014.Services.PersonnelManagement">
         <CreateUserResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <Messages xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
               <a:string/>
               <a:string/>
               <a:string>User name automatically formatted to HALL, NICHOLAS</a:string>
            </Messages>
            <UserIDs xmlns:a="urn:Epic-com:Security.2012.Services.PersonnelManagement">
               <a:IDType>
                  <a:ID>12131</a:ID>
                  <a:Type>External</a:Type>
               </a:IDType>
               <a:IDType>
                  <a:ID>12131</a:ID>
                  <a:Type>Internal</a:Type>
               </a:IDType>
               <a:IDType>
                  <a:ID>HALL, NICHOLAS</a:ID>
                  <a:Type>Name</a:Type>
               </a:IDType>
               <a:IDType>
                  <a:ID>12345</a:ID>
                  <a:Type>SystemLogin</a:Type>
               </a:IDType>
            </UserIDs>
         </CreateUserResult>
      </CreateUserResponse>
   </s:Body>
</s:Envelope>

REQUEST:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Epic-com:Security.2014.Services.PersonnelManagement">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:ViewUser>
         <urn:UserID>12345</urn:UserID>
         <urn:UserIDType>SystemLogin</urn:UserIDType>
      </urn:ViewUser>
   </soapenv:Body>
</soapenv:Envelope>

RESPONSE:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <ViewUserResponse xmlns="urn:Epic-com:Security.2014.Services.PersonnelManagement">
         <ViewUserResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <AuthenticationConfigurationID xmlns:a="urn:Epic-com:Security.2012.Services.PersonnelManagement"/>
            <BlockStatus xmlns:a="urn:Epic-com:Security.2012.Services.PersonnelManagement">
               <a:Comment/>
               <a:IsBlocked>false</a:IsBlocked>
               <a:Reason/>
            </BlockStatus>
            <CategoryReportGrouper1 xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
            <CategoryReportGrouper2 xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
            <CategoryReportGrouper3 xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
            <CategoryReportGrouper4 xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
            <CategoryReportGrouper5 xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
            <CategoryReportGrouper6 xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
            <ContactComment>Initial Entry</ContactComment>
            <CustomUserDictionaries xmlns:a="urn:Epic-com:Security.2012.Services.PersonnelManagement">
               <a:IndexedString>
                  <a:Index>1</a:Index>
                  <a:Value>\\Serverfiles\User_Dictionaries\12345Ddictionary.tlx</a:Value>
               </a:IndexedString>
            </CustomUserDictionaries>
            <DefaultLoginDepartmentID xmlns:a="urn:Epic-com:Security.2012.Services.PersonnelManagement"/>
            <EmployeeDemographics/>
            <EndDate i:nil="true"/>
            <ExternalIdentifiers xmlns:a="urn:Epic-com:Security.2012.Services.PersonnelManagement"/>
            <InBasketClassifications xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
            <IsActive>false</IsActive>
            <IsPasswordChangeRequired>false</IsPasswordChangeRequired>
            <LDAPOverrideID/>
            <LinkedProviderID xmlns:a="urn:Epic-com:Security.2012.Services.PersonnelManagement"/>
            <LinkedTemplatesConfig>
               <AppliedTemplateID xmlns:a="urn:Epic-com:Security.2012.Services.PersonnelManagement">
                 ......
               </AppliedTemplateID>
               <AvailableLinkableTemplates>
                  <AvailableTemplateSetupOut>
                     <EndDate/>
                     ......
                     <LoginTypes xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
                     <StartDate/>
                  </AvailableTemplateSetupOut>
               </AvailableLinkableTemplates>
               <DefaultTemplateID xmlns:a="urn:Epic-com:Security.2012.Services.PersonnelManagement">
                  .....
               </DefaultTemplateID>
            </LinkedTemplatesConfig>
            <Name>Nicholas Hall</Name>
            <Notes/>
            <PrimaryManager xmlns:a="urn:Epic-com:Security.2012.Services.PersonnelManagement"/>
            <ProviderAtLoginOption/>
            <ReportGrouper1/>
            <ReportGrouper2/>
            <ReportGrouper3/>
            <Sex/>
            <StartDate i:nil="true"/>
            <UserAlias/>
            <UserComplexName>
               ....
            </UserComplexName>
            ....
            <UsersManagers xmlns:a="urn:Epic-com:Security.2012.Services.PersonnelManagement"/>
         </ViewUserResult>
      </ViewUserResponse>
   </s:Body>
</s:Envelope>

Yesterday, I ended up giving a 90-minute talk in the Certified Ethical Hacker course and found that my colleagues required a little bit from brushing up on the network foundation. In the course of the hour and a half, I noted the following bullet points.

TOPIC: OSI Layers and ARP Poisoning

Things to note on the layers and ARPing.

Yesterday’s talk was the foundation of all Packet spoofing. Once I get my source code ready I’ll send you a copy.

Issues with Electricity / Electromagnetism
1: What is sent may not be received. *Addressed in layer 4 of the OSI if needed
2: What is sent in a specific order may not be received in the order (This is due to us wanting more speed/Larger bandwidth) *Addressed in layer 4 of the OSI if needed
3: What is received may not be from who you think it is. *Addressed in layer 5 of the OSI if needed

Additional features programmers normally want that is assessed in the OSI Model. Is the connection Alive or Broken? Save Money in Infrastructure. Computers to remember previous clients/connections A message orientated protocol vs. a Stream orientated.

Layer1: Physical, Keep the voltage HIGH so you don’t have to send someone out on horseback
Layer2: Addressing so you save cost on infrastructure instead of running multiple lines to the same physical location
Layer3: Routing, To fix issues broadcasting to the whole world and flooding bandwidth.
Layer4: Depending on your choice of Protocol you can resolve Data being sent in a specific order, and also if it even gets there
Layer5: Computer do not remember who they are connected to when the connection is closed, This is normally resolved at this layer along with AUTHENTICATION
Layer6: At this layer, you create your Message delimiter
Layer7: At this layer, you present the outcome to the end user.

ARP: Address Resolution Protocol Send a Normal reply packet to the Victim and replace your IP with the one you would like to highjack. ARP always act’s on the latest packet, so send it to the victim every second. To prevent dropped connections, ARP the other side as well to shut it up!

DHCP: Victim Broadcast on the network for an IP. How do you hack this protocol: BEAT THE ROUTER TO THE PUNCH AND REPLY BACK BEFORE THE ROUTER DOES!

DNS: Arp Poison the Router to intercept the reply back to the victim and update the IP inside the packet to point to where you want the victim to go OR Gain access to the router, Update the DHCP Settings so that there is a Static IP pointing to your DNS Server.

TCP Spoofing without/with ARPING / Layer 2/3 MITM(Man in the Middle) tricks: Can a TCP packet be spoofed? Yes, IF you know the SEQ number from the client in the middle of the transaction (Requires ARP poisoning or Port spanning/mirroring to figure this out, if not GOOD LUCK!) Expect the client may reply back to the correct host and a RST packet will soon follow, The most you can get in is one packet before the connect is disturbed. This is normally around 1460-1550 bytes of data.

What about a spoofing a Net new connection using someone else’s IP address on the network just at the TCP level? No, This is due to the Syn, Syn Ack, Ack handshake that cannot be intercepted at this level and a RST packet will shortly follow, in nature that provides a minor amount of security for TCP indirectly. At this point, ARP poison the host and create a net new TCP connection from there.

Spoof UDP just at layer 4?: Yes, You can spoof this completely to say the data is coming from another client.

Grab a copy of Workday Powershell API here at GitHub and place it in your “Program Files\WindowsPowerShell\Modules” folder.

Remove-Variable * -ErrorAction SilentlyContinue; Remove-Module *; $error.Clear(); Clear-Host

function WriteXmlToScreen ([xml]$xml)
{
    $StringWriter = New-Object System.IO.StringWriter;
    $XmlWriter = New-Object System.Xml.XmlTextWriter $StringWriter;
    $XmlWriter.Formatting = "indented";
    $xml.WriteTo($XmlWriter);
    $XmlWriter.Flush();
    $StringWriter.Flush();
    Write-Output $StringWriter.ToString();
}

function Get-XPath($n) {
  if ( $n.GetType().Name -ne 'XmlDocument' ) {
    "{0}/{1}" -f (Get-XPath $n.ParentNode), $n.Name
  }
}

$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
Push-Location $dir

$user = 'ISU_INT001_Provisioning'
$SecretPassword = 'Pazzsw0rdGoezHere'

$pair = "$($user):$($SecretPassword)"

$where = 'https://services1.myworkday.com/ccx/service/customreport1/[YOUR TENANT]/ISU_INT001_Provisioning/RPT_INT001_Provisioning_Active_Workers_Data_Outbound?format=simplexml'

$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))

$basicAuthValue = "Basic $encodedCreds"

$Headers = @{
    Authorization = $basicAuthValue
}

[xml]$myxml = Invoke-WebRequest -Uri $where -Headers $Headers

WriteXmlToScreen $myxml

[string]$CreatePipedFile = ""
[string]$ModifyPipedFile = ""

#$nodes = $myxml.SelectNodes('//*')
$nodes = $myxml.SelectNodes('//*')
foreach ($node in $nodes) {
    #if ($node.Name -ne "wd:Report_Data" -AND $node.name -ne "wd:Report_Entry")
    if ($node.Name -ne "wd:Report_Data")
    {
        if ($node.name -eq "wd:Report_Entry")
        {
            <#
            Write-Host "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
            Write-Host "Name: " $node.Name 
            Write-Host "Worker:" $node.Worker
            Write-Host "Worker_Type:" $node.Worker_Type
            switch($node.Worker_Type.ToLower())
            {
                "yes"   { $_ = "y" }
                "employee"     {$Worker_Type = "EMP"}
                "contingent worker"     { $Worker_Type = "CONT" }
                default { "You entered No." }
            }
            Write-Host "Emp_ID:" $node.Emp_ID
            Write-Host "Dep-Cd:" $node.Dep_Cd
            Write-Host "Dep_Name:" $node.Dep_Name
            Write-Host "Position_ID:" $node.Position_ID
            Write-Host "Position_Title:" $node.Position_Title
            Write-Host "L_Name:" $node.L_Name
            Write-Host "M_Name:" $node.M_Name
            Write-Host "F_Name:" $node.F_Name
            Write-Host "Entity:" $node.Entity
            Write-Host "Manager_ID:" $node.Manager_ID
            Write-Host "Director_ID:" $node.Director_ID
            Write-Host "Perf_Name:" $node.Pref_Name
            Write-Host "Leaving:" $node.LV_St_dt
            Write-Host "Return:" $node.Est_Ret_frm_leave
            Write-Host "Active:" $node.Active
            Write-Host "SSN: ***-**-****"
            Write-Host "Hire_Date:" $node.Hire_Date
            Write-Host "WorkEmail:" $node.WorkEmail
            Write-Host "`n"
            #>
            #Fix Date without '-'
            #Add leave dates to be added, fix 'AC' value
            #FT10 FT08 etc etc
            #Append hire date to end
            [datetime]$HireDate = $node.Hire_Date
            [datetime]$HireCompDate = $node.Hir_Comp_Dttm

            if (($HireDate -gt (Get-Date) -and $HireDate -lt (Get-Date).AddDays(14)) -or ($HireCompDate -lt (Get-Date).AddDays(1) -and $HireCompDate -gt (Get-Date).AddDays(-14))) #Testing for Newhire / Create
            {

                if ([string]::IsNullOrEmpty($node.WorkEmail))
                {
                    $PipedFile += "BLANK!"
                }
                $CreatePipedFile += "!CREATE_USER|" + $node.Emp_ID + "|" + $node.Dep_Cd + "|" + $node.Position_ID + "|" + $node.F_Name + "|" + $node.M_Name + "|" + $node.L_Name + "|" + $node.Entity + "|" + $node.Director_ID + "|" + $node.Dep_Name + "|" + $node.Position_title + "|" + ($node.Hire_Date -replace '-','') + "|" + ($node.SSN -replace '-','') + "|" + $node.Emp_Type + "|" + $node.WorkEmail + "|" + $node.Worker_Type +"`r`n" #$Worker_Type
            }
            ElseIf ($HireDate -gt (Get-Date).AddDays(14))
            {
                Write-Host "User is in the future!" $node.Emp_ID " - " $HireDate
            }
            else
            {
                if ([string]::IsNullOrEmpty($node.WorkEmail))
                {
                    $PipedFile += "BLANK!"
                }
                $ModifyPipedFile += "!MODIFY_USER|" + $node.Emp_ID + "|" + $node.Dep_Cd + "|" + $node.Dep_Name + "|" + $node.Position_ID + "|" + $node.Position_title + "|" + $node.L_Name + "|" + $node.M_Name + "|" + $node.F_Name + "|" + $node.Entity + "|" + $node.Director_ID + "|" + $node.Pref_Name + "|" + ($node.LV_St_dt -replace '-','') +"|" + ($node.Est_Ret_frm_leave -replace '-','') + "|AC|" + ($node.SSN -replace '-','') + "|" + ($node.Hire_Date -replace '-','') + "|" + $node.Emp_Type + "|" + $node.WorkEmail + "|" + $node.Worker_Type +"`r`n"
            }
            #" =-=-=-=-= " $node.InnerText " | "
        }

        #Get-XPath($node)
        #$sid = $node.attributes['wd:Worker'].value
        #$dispName = $node.attributes['wd:Emp_ID'].value
        #$obj = new-object psobject -prop @{SID=$sid;DISPNAME=$dispName}
        #$objs += $obj
    }
}
#$objs

Pop-Location

Write-Host $CreatePipedFile
Write-Host $ModifyPipedFile

$CreatePipedFile | Set-Content 'C:\RecentHires.txt'
$ModifyPipedFile | Set-Content 'C:\BeenHereAwhile.txt'

So last night, I wanted to see if I could create three TX’s out of the Wemos D1. I was able to accomplish this using the TX/RX swapped to D7/D8, Pin D4 for UART1_TX_BK and USB-COM using TX (After swap is RTS / GPIO1). and Voila! Done. Something to note, With this change I then made my Runtime UART baud at 57600, Anything higher requires the chip to be accurate to a split of a MicroSecond which is difficult when as tiny as you can get us os_delay_us(1) which is a full MicroSecond thus jacking up the timing, at 57600 each bit is sent around 17.3US so being .3 off isn’t too bad compared to being off by .3 when only have 8US sleep time between bits, The error adds up at the end of the 8 bits that can really jack with your result.

Softuart.h

#ifndef SoftUART_APP_H
#define SoftUART_APP_H

static inline u8 chbit(u8 data, u8 bit)
{
    if ((data & bit) != 0)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

void sendUART(int GPIO, int command[], int sizeofcmd, long baud) //Did not work
{
    int i=0;
    int ii=0;
    system_soft_wdt_feed();

    for (i=0; i<sizeofcmd; i++)
    {
        gpio_output_set(0, (1 << 2), (1 << 2), 0);
        os_delay_us(7);
        for(ii = 0; ii < 8; ii ++ )
        {

            if (chbit(command[i],1<<ii))
            {
                gpio_output_set((1 << 2), 0, (1 << 2), 0);              
                //GPIO_OUTPUT_SET((1 << GPIO), chbit('T',1<<i));
                //os_printf("on");
            }           
            else
            {
                gpio_output_set(0, (1 << 2), (1 << 2), 0);
                //GPIO_OUTPUT_SET((1 << GPIO), chbit('T',1<<i));
                //os_printf("off");
            }
            os_delay_us(7);
        }
        gpio_output_set((1 << 2), 0, (1 << 2), 0);
        //os_delay_us(4);
        //system_soft_wdt_feed();
    }
    //os_printf("\r\nSignal sent\r\n");
}

static int soft_uart_putchar_c(int GPIO, unsigned bit_time, char data)
{
    unsigned i;
    unsigned start_time = 0x7FFFFFFF & system_get_time();

    //Start Bit
    gpio_output_set(0, (1 << GPIO), 0, 0); //LOW
    for(i = 0; i <= 8; i ++ )
    {
        while ((0x7FFFFFFF & system_get_time()) < (start_time + (bit_time*(i+1))))
        {
            //If system timer overflow, escape from while loop
            if ((0x7FFFFFFF & system_get_time()) < start_time){break;}
        }
        GPIO_OUTPUT_SET(GPIO_ID_PIN(GPIO), chbit(data,1<<i)); //if GPIO_OUTPUT_SET is all capped it's calling the Macro, if not it's calling a different api
    }

    // Stop bit
    while ((0x7FFFFFFF & system_get_time()) < (start_time + (bit_time*9)))
    {
        //If system timer overflow, escape from while loop
        if ((0x7FFFFFFF & system_get_time()) < start_time){break;}
    }
    gpio_output_set((1 << GPIO), 0, 0, 0);
    // Delay after byte, for new sync
    os_delay_us(bit_time*6);
    return 1;
}

void convert2hex(char buffer[], int length)
{
    int i=0;
    char itoabuffer[4];

    int s=0;
    for(; s < length; ++s )
    {
        if ((buffer[s] < 32) || (buffer[s] > 126))
        {
            os_printf("\\x");
            os_sprintf(itoabuffer, "%X", buffer[s]);            
            for(i=0; i < strlen(itoabuffer); ++i )
            {
                os_printf("%c", itoabuffer[i]);
            }
        }
        else
        {
            os_printf("%c", buffer[s]);
        }
    }
}

//You can call this with the following line to redirect PrintF after a UART Swap
//os_install_putc1((void *)USBRTS_BAUD57600_write_char); //Redirect OS_PRINTF to UART1, our debug port
LOCAL void ICACHE_FLASH_ATTR USBRTS_BAUD57600_write_char(char c)
{
    const unsigned bit_time = (1000000 / 57600);
    if (c == '\n')
    {
        soft_uart_putchar_c(1, bit_time, '\r');
        soft_uart_putchar_c(1, bit_time, '\n');
    }
    else if (c == '\r')
    {
    }
    else
    {
        soft_uart_putchar_c(1, bit_time, c);
    }
}

LOCAL void ICACHE_FLASH_ATTR USBRTS_BAUD57600_write_charToHex(char c)
{
    int i=0;
    char itoabuffer[4];
    if (((c < 32) || (c > 126)) && ((c != 10) && (c != 13)))
    {
        //os_printf("\\x");
        USBRTS_BAUD57600_write_char('\\');
        USBRTS_BAUD57600_write_char('x');
        os_sprintf(itoabuffer, "%X", c);            
        for(i=0; i < strlen(itoabuffer); ++i )
        {
            //os_printf("%c", itoabuffer[i]);
            USBRTS_BAUD57600_write_char(itoabuffer[i]);
        }
    }
    else
    {
        //os_printf("%c", c);
        USBRTS_BAUD57600_write_char(c);
    }
}

int softuart_write(int GPIO, const char* data, unsigned len, long baudrate )
{
    //const unsigned baudrate = 57600; //Highest I've been able to go is 57600 Baud, 115200 misses some but 74880 misses alot
    const unsigned bit_time = (1000000 / baudrate);

    gpio_output_set((1 << GPIO), 0, 0, 0); //High
    os_delay_us(bit_time*8);
    int s=0;
    for(; s < len; ++s )
    {
        soft_uart_putchar_c(GPIO, bit_time, data[ s ]);
    }
    return 0;
}
#endif

main.c

//https://www.mikrocontroller.net/attachment/263828/The-ESP8266-Book-August-2015.pdf
#include "ets_sys.h"
#include "osapi.h"
#include "gpio.h"
#include "os_type.h"
#include "ip_addr.h"
#include "mem.h"
#include "user_interface.h"
#include "lwip/stats.h"
#include "espconn.h"

#include "c_types.h" ////ONE WIRE

#include "../library/uart.h" //Copy these from your Driver Lib to your local folder
#include "../library/gpio16.h" //Copy these from your Driver Lib to your local folder

#include "../library/softuart.h"
#include "../library/common.h"

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

#define user_procTaskPrio        0
#define user_procTaskQueueLen    1
os_event_t user_procTaskQueue[user_procTaskQueueLen];

void uart0_tx_buffer(uint8 *buf, uint16 len);

char rxbuff[31];
char rxindex = 0;

void UartReceive(char ByteReceived)
{
    os_printf("[%s] Got UART Callback!\r\n", __func__);
    os_printf("Byte Recevied: %c\r\n", ByteReceived);

    rxbuff[rxindex++] = ByteReceived;
    if (rxindex == sizeof(rxbuff)) 
    {
        rxindex = 0;
    }
    else
    {
        os_printf("%d != %d\r\n", rxindex, sizeof(rxbuff));
    }
    os_printf("Buffer: %s\r\n", rxbuff);

    hex_printf(rxbuff,rxindex);
    return;
}

void ICACHE_FLASH_ATTR sdk_init_done_cb(void) 
{ 
    os_printf("[%s] initializing ESP8266!\n", __func__);
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_GPIO1); //Set GPIO1(TX) as a manual GPIO Pin
    gpio_output_set((1 << 1), 0, (1 << 1), 0); //Set Pin as an OUT and Set it High
    while(true)
    {
        os_printf("test");
        uart0_tx_buffer("page 1\xff\xff\xff", 9); //This is our Prod Port
        uart1_tx_buffer("page 2\xff\xff\xff", 9); //This is our Debug Port
        softuart_write(1, "This is a test\r\n", 17, 57600); //This is our USB-COM Port
        delay_second();
        delay_second();
    }
}

void ICACHE_FLASH_ATTR SetupUART(void)
{
    //Careful when the callback is triggered that it does not kick off any premature events like sending network packets before the network is connected, thus crashing your app
    uart_init(BIT_RATE_57600, BIT_RATE_57600, &UartReceive); //This only seems to be kicked off via the COM-USB onboard, Not the TX/RX port
    system_set_os_print(1); //Turns os_PrintF Log Printing On or Off
    //We use UART swap because the RXpin is always High from external outputs causing issues when loading new firmware.
    //Keep in mind uart swap only swaps the RTS and CTS of the same UART to the RX and TX of the same UART, NOT UART1 to UART0
    //"UART0 swap. Use MTCK as UART0 Rx, MTDO as UART0 Tx, so ROM log will not output from this new UART0. MTDO (U0RTS) and MTCK (U0CTS) also need to be used as UART0 in hardware
    system_uart_swap(); //http://smallbits.marshall-tribe.net/blog/2016/11/13/esp8266-quiet-uart - Makes D7 RX (MTCK) and D8 TX (MTDO)

    //Pick here where you want PrintF to output
//os_install_putc1((void *)uart1_write_char); //Redirect OS_PRINTF to UART1 (D4)
//os_install_putc1((void *)USBRTS_BAUD57600_write_char); //Redirect OS_PRINTF to USBCOMM, our debug port
os_install_putc1((void *)USBRTS_BAUD57600_write_charToHex); //Redirect OS_PRINTF to USBCOMM, our debug port Plus converting nonreadable to hex
}

void ICACHE_FLASH_ATTR user_init()
{
    SetupUART();

    system_init_done_cb(sdk_init_done_cb);

    wifi_set_opmode(0);
    wifi_set_sleep_type( NONE_SLEEP_T );

    ETS_GPIO_INTR_DISABLE();// Disable gpio interrupts
    gpio_init();    

    SetAllGPIOPinsAsOutput();

    /* Need to fix this to display value    */
    uint32 VDDADCByte[4] = {0};
    spi_flash_read(0x3fc06b, (uint32 *)&VDDADCByte, 1); //Read pads the other 3 bytes with FF

    os_printf("\r\n\r\nStarting ESP8266 OTA!\r\nSDK version:%s\r\nLoaded from: %02x\r\nVdd33_Const: %02x\r\n", system_get_sdk_version(), system_get_userbin_addr(), (VDDADCByte[0] & 0xff));

    //Turn off LED, We cannot touch this pin as this is our debug pin D4/GPIO2
    //PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
    //gpio_output_set((1 << 2), 0, 0, 0);

    //Start os task
    system_init_done_cb(sdk_init_done_cb);
    //system_os_task(loop, user_procTaskPrio, user_procTaskQueue, user_procTaskQueueLen); //Task to Signal for later
}

uart.h

/*
 * ESPRSSIF MIT License
 *
 * Copyright (c) 2016 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
 *
 * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
 * it is free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
 * to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or
 * substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 */

#ifndef UART_APP_H
#define UART_APP_H

#include "uart_register.h"
#include "eagle_soc.h" //~/esp-open-sdk/xtensa-lx106-elf/sysroot/usr/include <-- pulled from here
#include "c_types.h"
#include "pin_mux_register.h"
//#include "task.h"
#define recvTaskPrio        0
#define recvTaskQueueLen    64

#define UART_BUFF_EN  0   //use uart buffer  , FOR UART0
#define UART_SELFTEST  0  //set 1:enable the loop test demo for uart buffer, FOR UART0

#define UART_HW_RTS   0   //set 1: enable uart hw flow control RTS, PIN MTDO, FOR UART0
#define UART_HW_CTS  0    //set1: enable uart hw flow contrl CTS , PIN MTCK, FOR UART0

#define UART0   0
#define UART1   1

//calc bit 0..5 for  UART_CONF0 register
#define CALC_UARTMODE(data_bits,parity,stop_bits) \
    (((parity == NONE_BITS) ? 0x0 : (UART_PARITY_EN | (parity & UART_PARITY))) | \
    ((stop_bits & UART_STOP_BIT_NUM) << UART_STOP_BIT_NUM_S) | \
    ((data_bits & UART_BIT_NUM) << UART_BIT_NUM_S))
//get data_bits from UART_CONF0 register
#define GETUART_DATABITS(uartmode) ((uartmode >> UART_BIT_NUM_S) & UART_BIT_NUM)
//get stop_bits from UART_CONF0 register
#define GETUART_STOPBITS(uartmode) ((uartmode >> UART_STOP_BIT_NUM_S) & UART_STOP_BIT_NUM)
//get parity from UART_CONF0 register
#define GETUART_PARITYMODE(uartmode) ((uartmode & UART_PARITY_EN) ? uartmode & UART_PARITY : NONE_BITS)


typedef enum {
    FIVE_BITS = 0x0,
    SIX_BITS = 0x1,
    SEVEN_BITS = 0x2,
    EIGHT_BITS = 0x3
} UartBitsNum4Char;

typedef enum {
    ONE_STOP_BIT             = 0x1,
    ONE_HALF_STOP_BIT        = 0x2,
    TWO_STOP_BIT             = 0x3
} UartStopBitsNum;

typedef enum {
    NONE_BITS = 0x2,
    ODD_BITS   = 1,
    EVEN_BITS = 0
} UartParityMode;

typedef enum {
    STICK_PARITY_DIS   = 0,
    STICK_PARITY_EN    = 1
} UartExistParity;

typedef enum {
    UART_None_Inverse = 0x0,
    UART_Rxd_Inverse = UART_RXD_INV,
    UART_CTS_Inverse = UART_CTS_INV,
    UART_Txd_Inverse = UART_TXD_INV,
    UART_RTS_Inverse = UART_RTS_INV,
} UART_LineLevelInverse;


typedef enum {
    BIT_RATE_300 = 300,
    BIT_RATE_600 = 600,
    BIT_RATE_1200 = 1200,
    BIT_RATE_2400 = 2400,
    BIT_RATE_4800 = 4800,
    BIT_RATE_9600   = 9600,
    BIT_RATE_19200  = 19200,
    BIT_RATE_38400  = 38400,
    BIT_RATE_57600  = 57600,
    BIT_RATE_74880  = 74880,
    BIT_RATE_115200 = 115200,
    BIT_RATE_230400 = 230400,
    BIT_RATE_460800 = 460800,
    BIT_RATE_921600 = 921600,
    BIT_RATE_1843200 = 1843200,
    BIT_RATE_3686400 = 3686400,
} UartBautRate;

typedef enum {
    NONE_CTRL,
    HARDWARE_CTRL,
    XON_XOFF_CTRL
} UartFlowCtrl;

typedef enum {
    USART_HardwareFlowControl_None = 0x0,
    USART_HardwareFlowControl_RTS = 0x1,
    USART_HardwareFlowControl_CTS = 0x2,
    USART_HardwareFlowControl_CTS_RTS = 0x3
} UART_HwFlowCtrl;

typedef enum {
    EMPTY,
    UNDER_WRITE,
    WRITE_OVER
} RcvMsgBuffState;

typedef struct {
    uint32     RcvBuffSize;
    uint8     *pRcvMsgBuff;
    uint8     *pWritePos;
    uint8     *pReadPos;
    uint8      TrigLvl; //JLU: may need to pad
    RcvMsgBuffState  BuffState;
} RcvMsgBuff;

typedef struct {
    uint32   TrxBuffSize;
    uint8   *pTrxBuff;
} TrxMsgBuff;

typedef enum {
    BAUD_RATE_DET,
    WAIT_SYNC_FRM,
    SRCH_MSG_HEAD,
    RCV_MSG_BODY,
    RCV_ESC_CHAR,
} RcvMsgState;

typedef struct {
    UartBautRate         baut_rate;
    UartBitsNum4Char  data_bits;
    UartExistParity      exist_parity;
    UartParityMode      parity;    
    UartStopBitsNum   stop_bits;
    UartFlowCtrl         flow_ctrl;
    RcvMsgBuff          rcv_buff;
    TrxMsgBuff           trx_buff;
    RcvMsgState        rcv_state;
    int                      received;
    int                      buff_uart_no;  //indicate which uart use tx/rx buffer
} UartDevice;

//void uart_init(UartBautRate uart0_br, UartBautRate uart1_br);
void uart_init(UartBautRate uart0_br, UartBautRate uart1_br, void * callback);
void uart0_sendStr(const char *str);


///////////////////////////////////////

 struct UartBuffer{
    uint32     UartBuffSize;
    uint8     *pUartBuff;
    uint8     *pInPos;
    uint8     *pOutPos;
    STATUS  BuffState;
    uint16    Space;  //remanent space of the buffer
    uint8  TcpControl;
    struct  UartBuffer     *  nextBuff;
};

struct UartRxBuff{
    uint32     UartRxBuffSize;
    uint8     *pUartRxBuff;
    uint8     *pWritePos;
    uint8     *pReadPos;
    STATUS RxBuffState;
    uint32    Space;  //remanent space of the buffer
} ;

typedef enum {
    RUN = 0,
    BLOCK = 1,
} TCPState;

//void ICACHE_FLASH_ATTR uart_test_rx();
//STATUS uart_tx_one_char(uint8 uart, uint8 TxChar);
STATUS uart_tx_one_char_no_wait(uint8 uart, uint8 TxChar);
void  uart1_sendStr_no_wait(const char *str);
struct UartBuffer*  Uart_Buf_Init();


#if UART_BUFF_EN
LOCAL void  Uart_Buf_Cpy(struct UartBuffer* pCur, char* pdata , uint16 data_len);
void  uart_buf_free(struct UartBuffer* pBuff);
void  tx_buff_enq(char* pdata, uint16 data_len );
LOCAL void  tx_fifo_insert(struct UartBuffer* pTxBuff, uint8 data_len,  uint8 uart_no);
void  tx_start_uart_buffer(uint8 uart_no);
uint16  rx_buff_deq(char* pdata, uint16 data_len );
void  Uart_rx_buff_enq();
#endif
void  uart_rx_intr_enable(uint8 uart_no);
void  uart_rx_intr_disable(uint8 uart_no);
void uart0_tx_buffer(uint8 *buf, uint16 len);

//==============================================
#define FUNC_UART0_CTS 4
#define FUNC_U0CTS                      4
#define FUNC_U1TXD_BK                   2
#define UART_LINE_INV_MASK  (0x3f<<19)
void UART_SetWordLength(uint8 uart_no, UartBitsNum4Char len);
void UART_SetStopBits(uint8 uart_no, UartStopBitsNum bit_num);
void UART_SetLineInverse(uint8 uart_no, UART_LineLevelInverse inverse_mask);
void UART_SetParity(uint8 uart_no, UartParityMode Parity_mode);
void UART_SetBaudrate(uint8 uart_no,uint32 baud_rate);
void UART_SetFlowCtrl(uint8 uart_no,UART_HwFlowCtrl flow_ctrl,uint8 rx_thresh);
void UART_WaitTxFifoEmpty(uint8 uart_no , uint32 time_out_us); //do not use if tx flow control enabled
void UART_ResetFifo(uint8 uart_no);
void UART_ClearIntrStatus(uint8 uart_no,uint32 clr_mask);
void UART_SetIntrEna(uint8 uart_no,uint32 ena_mask);
void UART_SetPrintPort(uint8 uart_no);
bool UART_CheckOutputFinished(uint8 uart_no, uint32 time_out_us);
//==============================================

#endif




/*
 * File : uart.c
 * This file is part of Espressif's AT+ command set program.
 * Copyright (C) 2013 - 2016, Espressif Systems
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of version 3 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
/*#include "ets_sys.h"
#include "osapi.h"
#include "driver/uart.h"
#include "osapi.h"
#include "driver/uart_register.h"
//#include "ssc.h"
#include "task.h"
*/
// UartDev is defined and initialized in rom code.
extern UartDevice    UartDev;
//extern os_event_t    at_recvTaskQueue[at_recvTaskQueueLen];

LOCAL void uart0_rx_intr_handler(void *para);

/******************************************************************************
 * FunctionName : uart_config
 * Description  : Internal used function
 *                UART0 used for data TX/RX, RX buffer size is 0x100, interrupt enabled
 *                UART1 just used for debug output
 * Parameters   : uart_no, use UART0 or UART1 defined ahead
 * Returns      : NONE
*******************************************************************************/
LOCAL void ICACHE_FLASH_ATTR uart_config(uint8 uart_no, void * callback(uint8))
{
    os_printf("uart_config:%d", uart_no);
    if (uart_no == UART0)
    {
        /* UART0 */
        ETS_UART_INTR_ATTACH(uart0_rx_intr_handler,  callback);
        PIN_PULLUP_DIS(PERIPHS_IO_MUX_U0TXD_U);
        PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD);
        //Enable RxD pin
        PIN_PULLUP_EN(PERIPHS_IO_MUX_U0RXD_U);
        PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD);        
        //PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_U0RTS); //We don't use RTS
    }
    else
    {
        PIN_PULLUP_DIS(PERIPHS_IO_MUX_GPIO2_U);
        PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_BK); //D4 used for Debug out.
        PIN_PULLUP_EN(PERIPHS_IO_MUX_GPIO2_U);
    }

    uart_div_modify(uart_no, UART_CLK_FREQ / (UartDev.baut_rate));

    WRITE_PERI_REG(UART_CONF0(uart_no), CALC_UARTMODE(EIGHT_BITS, NONE_BITS, ONE_STOP_BIT));

    //clear rx and tx fifo,not ready
    SET_PERI_REG_MASK(UART_CONF0(uart_no), UART_RXFIFO_RST | UART_TXFIFO_RST);
    CLEAR_PERI_REG_MASK(UART_CONF0(uart_no), UART_RXFIFO_RST | UART_TXFIFO_RST);

    WRITE_PERI_REG(UART_CONF1(uart_no), ((UartDev.rcv_buff.TrigLvl & UART_RXFIFO_FULL_THRHD) << UART_RXFIFO_FULL_THRHD_S));

    //clear all interrupt
    WRITE_PERI_REG(UART_INT_CLR(uart_no), 0xffff);
    //enable rx_interrupt
    SET_PERI_REG_MASK(UART_INT_ENA(uart_no), UART_RXFIFO_FULL_INT_ENA);
}

/******************************************************************************
 * FunctionName : uart1_tx_one_char
 * Description  : Internal used function
 *                Use uart1 interface to transfer one char
 * Parameters   : uint8 TxChar - character to tx
 * Returns      : OK
*******************************************************************************/
LOCAL STATUS uart_tx_one_char(uint8 uart, uint8 TxChar)
{
    while (true)
    {
      uint32 fifo_cnt = READ_PERI_REG(UART_STATUS(uart)) & (UART_TXFIFO_CNT<<UART_TXFIFO_CNT_S);
      if ((fifo_cnt >> UART_TXFIFO_CNT_S & UART_TXFIFO_CNT) < 126) {
        break;
      }
    }

    WRITE_PERI_REG(UART_FIFO(uart) , TxChar);
    return OK;
}

/******************************************************************************
 * FunctionName : uart1_write_char
 * Description  : Internal used function
 *                Do some special deal while tx char is '\r' or '\n'
 * Parameters   : char c - character to tx
 * Returns      : NONE
*******************************************************************************/
LOCAL void ICACHE_FLASH_ATTR uart1_write_char(char c)
{
  if (c == '\n')
  {
    uart_tx_one_char(UART1, '\r');
    uart_tx_one_char(UART1, '\n');
  }
  else if (c == '\r')
  {
  }
  else
  {
    uart_tx_one_char(UART1, c);
  }
}
/******************************************************************************
 * FunctionName : uart0_tx_buffer
 * Description  : use uart0 to transfer buffer
 * Parameters   : uint8 *buf - point to send buffer
 *                uint16 len - buffer len
 * Returns      :
*******************************************************************************/
void ICACHE_FLASH_ATTR uart0_tx_buffer(uint8 *buf, uint16 len)
{
  uint16 i;

  for (i = 0; i < len; i++)
  {
    uart_tx_one_char(UART0, buf[i]);
  }
}

/******************************************************************************
 * FunctionName : uart0_tx_buffer
 * Description  : use uart0 to transfer buffer
 * Parameters   : uint8 *buf - point to send buffer
 *                uint16 len - buffer len
 * Returns      :
*******************************************************************************/
void ICACHE_FLASH_ATTR uart1_tx_buffer(uint8 *buf, uint16 len)
{
  uint16 i;

  for (i = 0; i < len; i++)
  {
    uart_tx_one_char(UART1, buf[i]);
  }
}

/******************************************************************************
 * FunctionName : uart0_sendStr
 * Description  : use uart0 to transfer buffer
 * Parameters   : uint8 *buf - point to send buffer
 *                uint16 len - buffer len
 * Returns      :
*******************************************************************************/
void ICACHE_FLASH_ATTR uart0_sendStr(const char *str)
{
    while(*str)
    {
        uart_tx_one_char(UART0, *str++);
    }
}

/******************************************************************************
 * FunctionName : uart0_rx_intr_handler
 * Description  : Internal used function
 *                UART0 interrupt handler, add self handle code inside
 * Parameters   : void *para - point to ETS_UART_INTR_ATTACH's arg
 * Returns      : NONE
*******************************************************************************/
typedef void (*UARTFunctionCallback)(char ByteReceived);
UARTFunctionCallback UARTCallback;

LOCAL void uart0_rx_intr_handler(void * para)
{
    char RcvChar[0];

    //If I remove pRXbuff my program crashes, This may be due to not enough stackspace
    RcvMsgBuff *pRxBuff = (RcvMsgBuff *)para; //This is now a Callback pointer

    if (UART_RXFIFO_FULL_INT_ST != (READ_PERI_REG(UART_INT_ST(UART0)) & UART_RXFIFO_FULL_INT_ST)) {
        return;
    }

    WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_FULL_INT_CLR);

    while (READ_PERI_REG(UART_STATUS(UART0)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S)) 
    {
        ETS_UART_INTR_DISABLE();
        RcvChar[0] = READ_PERI_REG(UART_FIFO(UART0)) & 0xFF;        
        /* you can add your handle code below.*/

        UARTCallback = para;
        UARTCallback(RcvChar[0]);
        /*
        gpio_output_set((1 << 2), 0, 0, 0);
        uart0_tx_buffer(RcvChar, 1);
        if (RcvChar[0] == '\n') 
        {
            gpio_output_set(0, (1 << 2), 0, 0);
            uart0_sendStr("\r\nGot enter N\r\n");
        }
        if (RcvChar[0] == '\r') 
        {
            gpio_output_set(0, (1 << 2), 0, 0);
            uart0_sendStr("\r\nGot enter R\r\n");
        }
        */
         // Clear pending FIFO interrupts
        WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_TOUT_INT_CLR | UART_RXFIFO_FULL_INT_ST);
        ETS_UART_INTR_ENABLE();
    }
}

/******************************************************************************
 * FunctionName : uart_init
 * Description  : user interface for init uart
 * Parameters   : UartBautRate uart0_br - uart0 bautrate
 *                UartBautRate uart1_br - uart1 bautrate
 * Returns      : NONE
*******************************************************************************/
void ICACHE_FLASH_ATTR uart_init(UartBautRate uart0_br, UartBautRate uart1_br, void * callback)
{
    // rom use 74880 baut_rate, here reinitialize
    UartDev.baut_rate = uart0_br;
    uart_config(UART0, callback);

    UartDev.baut_rate = uart1_br;
    uart_config(UART1, callback);

    ETS_UART_INTR_ENABLE();

    // install uart1 putc callback
    //system_uart_swap(); //http://smallbits.marshall-tribe.net/blog/2016/11/13/esp8266-quiet-uart
    //PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_BK);
    //os_install_putc1((void *)uart1_write_char);
}

void ICACHE_FLASH_ATTR uart_reattach()
{
    uart_init(BIT_RATE_74880, BIT_RATE_74880, NULL);
//  ETS_UART_INTR_ATTACH(uart_rx_intr_handler_ssc,  &(UartDev.rcv_buff));
//  ETS_UART_INTR_ENABLE();
}

Using the following code I was able to push Firewall settings to multiple machines.

#https://gallery.technet.microsoft.com/scriptcenter/xNetworking-Module-818b3583
Configuration ScriptTest
{
    param
    (
        [string[]] $NodeName = 'Localhost'
    )

    Import-DscResource –ModuleName 'PSDesiredStateConfiguration'
    Node $NodeName
    {
        Script EnableFirewall            
        {            
            # Must return a hashtable with at least one key            
            # named 'Result' of type String            
            GetScript = {            
                Return @{            
                    Result = [string]$(netsh advfirewall show allprofiles)            
                }            
            }            

            # Must return a boolean: $true or $false            
            TestScript = {            
                If ((netsh advfirewall show allprofiles) -like "State*off*") {            
                    Write-Verbose "One or more firewall profiles are off"            
                    Return $false            
                } Else {            
                    Write-Verbose "All firewall profiles are on"            
                    Return $false #return false as well to always run the SetScript on the remote server            
                }            
            }            

            # Returns nothing            
            SetScript = {            
                Write-Verbose "Setting all firewall profiles to on"            
                #netsh advfirewall set allprofiles state on
                Remove-NetFirewallRule -All            
            }            
        }            
    }      

    }
}

Configuration DSCFirewallRule
{
    param
    (
        [string[]] $NodeName = 'Localhost'
    )

    Import-DSCResource -ModuleName xNetworking

    Node $NodeName
    {
        xFirewall Firewall1 
        {
            Access      = 'Block'
            Name        = 'NotePadFirewallRule'
            DisplayName = 'Firewall Rule for Notepad.exe'
            Ensure      = 'Present'
            Profile     = ('Domain', 'Private')
            Direction   = 'OutBound'
            RemotePort  = ('8080', '8081')
            LocalPort   = ('9080', '9081')
            Protocol    = 'TCP'
            Description = 'Firewall Rule for Notepad.exe'
            Service = 'WinRM'
            State = 'Enabled'
        }

        xFirewall Firewall2 
        {
            Access      = 'Allow'
            Name        = 'NotePad++FirewallRule'
            DisplayName = 'Firewall Rule for Notepad++.exe'
            Ensure      = 'Present'
            Profile     = ('Domain', 'Private')
            Direction   = 'OutBound'
            RemotePort  = ('8082', '8084')
            LocalPort   = ('9086', '9085')
            Protocol    = 'TCP'
            Description = 'Firewall Rule for Notepad++.exe'
            Service = 'WinRM'
            State = 'Enabled'
        }

    }

}

#You only need to create checksums for PULL HTTP(s) methods
New-DSCCheckSum –ConfigurationPath .\SimpleMetaConfigurationForPull –OutPath .\ScriptTest -Verbose -Force
New-DSCCheckSum –ConfigurationPath .\SimpleMetaConfigurationForPull –OutPath .\DSCFirewallRule -Verbose -Force
ScriptTest –nodename ‘LocalHost’,‘server1’,’server2’,’server3’ #Creates a folder with that name
DSCFirewallRule –nodename ‘LocalHost’,‘server1’,’server2’,’server3’ #Creates a folder with that name

#Push the configuration to the Target nodes, Comment this out if your just generating the MOF(s) for a pull method.
Start-DscConfiguration -Path .\ScriptTest -Wait -Force -Verbose #Clears Firewall Rules
Start-DscConfiguration -Path .\DSCFirewallRule -Wait -Force -Verbose #Sets them

Now the following script above will create .MOF files that will then Now we have to create a Pull Server. Well have to do it like this for Server 2008R2

Src: https://davewyatt.wordpress.com/2014/06/07/how-to-install-a-dsc-pull-server-on-windows-2008-r2/

Or for Server 2012

configuration CreatePullServer
{
    param
    (
        [string[]]$ComputerName = 'localhost'
    )


Import-DSCResource -ModuleName xPSDesiredStateConfiguration


Node $ComputerName
{
    WindowsFeature DSCServiceFeature
    {
        Ensure = "Present"
        Name   = "DSC-Service"
    }


    xDscWebService PSDSCPullServer
    {
        Ensure = "Present"
        EndpointName = "PSDSCPullServer" 
                Port = 8080 
                PhysicalPath = "$env:SystemDrive\inetpub\wwwroot\PSDSCPullServer" 
                CertificateThumbPrint = "AllowUnencryptedTraffic" 
                ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" 
                ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" 
                State = "Started" 
                DependsOn = "[WindowsFeature]DSCServiceFeature" 
        } 

    xDscWebService PSDSCComplianceServer 
        { 
            Ensure = "Present" 
            EndpointName = "PSDSCComplianceServer" 
            Port = 9080 
            PhysicalPath = "$env:SystemDrive\inetpub\wwwroot\PSDSCComplianceServer" 
            CertificateThumbPrint = "AllowUnencryptedTraffic" 
            State = "Started"
            IsComplianceServer = $true 
            DependsOn = ("[WindowsFeature]DSCServiceFeature", 
                                       "[xDSCWebService]PSDSCPullServer") 
        } 
    } 
}

CreatePullServer

After the pull server is created I also had to make an adjustment to fix a 500 internal error I was getting from the above script on Server 2012 R2 https://stackoverflow.com/questions/24252635/powershell-dsc-pull-server-throws-internal-error-microsoft-isam-esent-interop

Now the last step is to push the configuration to each machine to tell each machine to check in to the web server hosting the MOF configuration files..

Configuration SimpleMetaConfigurationForPull
{
    param
    (
        [string[]] $NodeName = 'Localhost'
    )
    Node $NodeName
    {
        LocalConfigurationManager
        {
            RefreshMode = “PULL”;
            DownloadManagerName = “WebDownloadManager”;
            RebootNodeIfNeeded = $true;
            RefreshFrequencyMins = 10;
            ConfigurationModeFrequencyMins = 15;
            ConfigurationMode = “ApplyAndAutoCorrect”;
            ConfigurationID = $NodeName
            DownloadManagerCustomData = @{ServerUrl = “http://VM1198:8080/PSDSCPullServer/psdscpullserver.svc”; AllowUnsecureConnection = “TRUE”}
        }
    }
} 
SimpleMetaConfigurationForPull -Output .\SimpleMetaConfigurationForPull –nodename ‘LocalHost’,‘server1’,’server2’,’server3’
New-DSCCheckSum –ConfigurationPath .\SimpleMetaConfigurationForPull –OutPath .\SimpleMetaConfigurationForPull -Verbose -Force
Set-DSCLocalConfigurationManager -Path .\SimpleMetaConfigurationForPull –Verbose

As you can see the machine is checking in every 15 minutes per our script.

So, The Wemos D1 Mini pro is the board I use to program the NONOS SDK right now currently. The downside is it only exposes one UART interface (UART0) and with that comes some minor issues.
1: If you connect an FTDI chip to this port the TX line from the FTDI is always HIGH and will keep the RX Pin on the ESP8266 HIGH and will stop new firmware from being loaded until you physically disconnect the FTDI chip.

2: The Line is not dedicated so sending Debug in on this line may interfere with other external devices connected to this line.

So the first issue is solved by calling system_uart_swap() thus swapping the RX/TX line with D7 and D8 for the RTS CTS lines freeing the TX/RX labeled pins on the Wemos

The 2nd one can use GPIO2 and use UART1 to transmit the data.

LOCAL void ICACHE_FLASH_ATTR uart_config(uint8 uart_no, void * callback(uint8))
{
    os_printf("uart_config:%d", uart_no);
    if (uart_no == UART0)
    {
        /* UART0 */
        ETS_UART_INTR_ATTACH(uart0_rx_intr_handler,  callback);
        PIN_PULLUP_DIS(PERIPHS_IO_MUX_U0TXD_U);
        PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD);
        //Enable RxD pin
        PIN_PULLUP_EN(PERIPHS_IO_MUX_U0RXD_U);
        PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD);        
        //PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_U0RTS); //We don't use RTS
    }
    else
    {
        PIN_PULLUP_DIS(PERIPHS_IO_MUX_GPIO2_U);
        PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_BK); //D4 used for Debug out.
        PIN_PULLUP_EN(PERIPHS_IO_MUX_GPIO2_U);
    }

    uart_div_modify(uart_no, UART_CLK_FREQ / (UartDev.baut_rate));

    WRITE_PERI_REG(UART_CONF0(uart_no), CALC_UARTMODE(EIGHT_BITS, NONE_BITS, ONE_STOP_BIT));

    //clear rx and tx fifo,not ready
    SET_PERI_REG_MASK(UART_CONF0(uart_no), UART_RXFIFO_RST | UART_TXFIFO_RST);
    CLEAR_PERI_REG_MASK(UART_CONF0(uart_no), UART_RXFIFO_RST | UART_TXFIFO_RST);

    WRITE_PERI_REG(UART_CONF1(uart_no), ((UartDev.rcv_buff.TrigLvl & UART_RXFIFO_FULL_THRHD) << UART_RXFIFO_FULL_THRHD_S));

    //clear all interrupt
    WRITE_PERI_REG(UART_INT_CLR(uart_no), 0xffff);
    //enable rx_interrupt
    SET_PERI_REG_MASK(UART_INT_ENA(uart_no), UART_RXFIFO_FULL_INT_ENA);
}

void ICACHE_FLASH_ATTR uart_init(UartBautRate uart0_br, UartBautRate uart1_br, void * callback)
{
    // rom use 74880 baut_rate, here reinitialize
    UartDev.baut_rate = uart0_br;
    uart_config(UART0, callback);

    UartDev.baut_rate = uart1_br;
    uart_config(UART1, callback);

    ETS_UART_INTR_ENABLE();

    // install uart1 putc callback
    //system_uart_swap(); //http://smallbits.marshall-tribe.net/blog/2016/11/13/esp8266-quiet-uart
    //PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_BK);
    //os_install_putc1((void *)uart1_write_char);
}

void ICACHE_FLASH_ATTR sdk_init_done_cb(void) 
{ 
    os_printf("[%s] initializing ESP8266!\n", __func__);
    while(true)
    {
        os_printf("test");
        uart0_tx_buffer("page 1\xff\xff\xff", 9); //This is our Prod Port
        uart1_tx_buffer("page 2\xff\xff\xff", 9); //This is our Debug Port
        delay_second();
        delay_second();
    }
}

void ICACHE_FLASH_ATTR SetupUART(void)
{
    //Careful when the callback is triggered that it does not kick off any premature events like sending network packets before the network is connected, thus crashing your app
    uart_init(BIT_RATE_115200, BIT_RATE_115200, &UartReceive); //This only seems to be kicked off via the COM-USB onboard, Not the TX/RX port
    system_set_os_print(1); //Turns os_PrintF Log Printing On or Off
    //We use UART swap because the RXpin is always High from external outputs causing issues when loading new firmware.
    //Keep in mind uart swap only swaps the RTS and CTS of the same UART to the RX and TX of the same UART, NOT UART1 to UART0
    //"UART0 swap. Use MTCK as UART0 Rx, MTDO as UART0 Tx, so ROM log will not output from this new UART0. MTDO (U0RTS) and MTCK (U0CTS) also need to be used as UART0 in hardware
    system_uart_swap(); //http://smallbits.marshall-tribe.net/blog/2016/11/13/esp8266-quiet-uart - Makes D7 RX (MTCK) and D8 TX (MTDO)
    os_install_putc1((void *)uart1_write_char); //Redirect OS_PRINTF to UART1, our debug port
}

void ICACHE_FLASH_ATTR user_init()
{
    SetupUART();

    system_init_done_cb(sdk_init_done_cb);

    wifi_set_opmode(0);
    wifi_set_sleep_type( NONE_SLEEP_T );

    ETS_GPIO_INTR_DISABLE();// Disable gpio interrupts
    gpio_init();    

    SetAllGPIOPinsAsOutput();

    /* Need to fix this to display value    */
    uint32 VDDADCByte[4] = {0};
    spi_flash_read(0x3fc06b, (uint32 *)&VDDADCByte, 1); //Read pads the other 3 bytes with FF

    os_printf("\r\n\r\nStarting ESP8266 OTA!\r\nSDK version:%s\r\nLoaded from: %02x\r\nVdd33_Const: %02x\r\n", system_get_sdk_version(), system_get_userbin_addr(), (VDDADCByte[0] & 0xff));

    //Turn off LED, We cannot touch this pin as this is our debug pin D4/GPIO2
    //PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
    //gpio_output_set((1 << 2), 0, 0, 0);

    //Start os task
    system_init_done_cb(sdk_init_done_cb);
    //system_os_task(loop, user_procTaskPrio, user_procTaskQueue, user_procTaskQueueLen); //Task to Signal for later
}

First download NUGet from NuGet.org.
Install it for your cordinating version of visual studio

Once installed Launch VS then launch NuGet’s console from within

Run the following line for Framework 4.0 and Above
PM> Install-Package ASTreeView

If your project is targeted to .Net Framework 2.0 or 3.5, please install the legacy package using this line below instead.
PM> Install-Package ASTreeView.Legacy

Once ran add the reference to the project, The path to the DLL looked like this

C:\Users[username]\Documents\Visual Studio 2015\Projects\ASPTreeDragAndDrop\packages\ASTreeView.1.6.0.4\lib\net40

Then after that add the utilities to the toolbox.

Now you can start adding your tree and design your Drag and Drop Functionality.

So once in a while, I get a stingy program that refuses to remove itself from my Add Or Remove Program’s list.

So what I end up doing is jumping into the registry and removing the Key from the uninstall list.
In my case, I ended up having to remove a couple of keys under that list to fully rip it out of AppWiz.

And the final result.