Unexpected output from where-object - windows

In PowerShell, this command:
Get-NetIPConfiguration | where-object {$_.IPv4Address.IPAddress -match '172.20'}
Is yielding this output:
InterfaceAlias : Wi-Fi
InterfaceIndex : 24
InterfaceDescription : Intel(R) Wi-Fi 6 AX201 160MHz
NetProfile.Name : Identifying...
IPv6Address : 2601:19b:c00:15c3:d80:ee8c:3679:1fe5
1::1
IPv4Address : 172.20.4.93
IPv6DefaultGateway : fe80::be98:dfff:feff:4acd
IPv4DefaultGateway : 172.20.4.1
DNSServer : fe80::be98:dfff:feff:4acd
InterfaceAlias : Local Area Connection 3
InterfaceIndex : 22
InterfaceDescription : TAP-Windows Adapter V9 #3
NetAdapter.Status : Disconnected
Whereas I would only expect to see this output:
InterfaceAlias : Wi-Fi
InterfaceIndex : 24
InterfaceDescription : Intel(R) Wi-Fi 6 AX201 160MHz
NetProfile.Name : Unidentified network
IPv6Address : 2601:19b:c00:15c3:d80:ee8c:3679:1fe5
1::1
IPv4Address : 172.20.4.93
IPv6DefaultGateway : fe80::be98:dfff:feff:4acd
IPv4DefaultGateway : 172.20.4.1
DNSServer : fe80::be98:dfff:feff:4acd
This is the full output from Get-NetIPConfiguration:
InterfaceAlias : VirtualBox Host-Only Network
InterfaceIndex : 11
InterfaceDescription : VirtualBox Host-Only Ethernet Adapter
IPv4Address : 169.254.249.136
IPv6DefaultGateway :
IPv4DefaultGateway :
DNSServer : fec0:0:0:ffff::1
fec0:0:0:ffff::2
fec0:0:0:ffff::3
InterfaceAlias : Local Area Connection
InterfaceIndex : 18
InterfaceDescription : TAP-Windows Adapter V9
NetProfile.Name : somerandomcompany.com
IPv4Address : 10.251.10.13
IPv6DefaultGateway :
IPv4DefaultGateway :
DNSServer : 10.255.0.9
10.255.0.8
InterfaceAlias : Wi-Fi
InterfaceIndex : 24
InterfaceDescription : Intel(R) Wi-Fi 6 AX201 160MHz
NetProfile.Name : PS-118 Guest
IPv6Address : 2601:19b:c00:15c3:d80:ee8c:3679:1fe5
1::1
IPv4Address : 192.168.0.208
IPv6DefaultGateway : fe80::be98:dfff:feff:4acd
IPv4DefaultGateway : 192.168.0.1
DNSServer : fe80::be98:dfff:feff:4acd
fe80::be98:dfff:feff:4acd
192.168.0.1
InterfaceAlias : Bluetooth Network Connection
InterfaceIndex : 9
InterfaceDescription : Bluetooth Device (Personal Area Network)
NetAdapter.Status : Disconnected
InterfaceAlias : Local Area Connection 3
InterfaceIndex : 22
InterfaceDescription : TAP-Windows Adapter V9 #3
NetAdapter.Status : Disconnected
InterfaceAlias : Local Area Connection 2
InterfaceIndex : 27
InterfaceDescription : TAP-Windows Adapter V9 #2
NetAdapter.Status : Disconnected
InterfaceAlias : OpenVPN Wintun
InterfaceIndex : 25
InterfaceDescription : Wintun Userspace Tunnel
NetAdapter.Status : Disconnected
I get the same result with PowerShell 7.2.5 and PowerShell 5.1.19041.1682, on Windows 10
Please let me know if I can provide any other information, and thank you for any help!

Related

Why i can't run c++ code in micropython env esp32

I am following this guide to run my C++ code in micropython environment, the normal/simple C++ code works on my ESP32 board but when i try running big loops it gives an error.
The error:
$ picocom -b 115200 /dev/ttyUSB0
picocom v3.1
port is : /dev/ttyUSB0
flowcontrol : none
baudrate is : 115200
parity is : none
databits are : 8
stopbits are : 1
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
hangup is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv -E
imap is :
omap is :
emap is : crcrlf,delbs,
logfile is : none
initstring : none
exit_after is : not set
exit is : no
Type [C-a] [C-h] to see available commands
Terminal ready
>>> import cppexample
>>> cppexample.cppfunc()
abort() was called at PC 0x402acc26 on core 0
Backtrace:0x400912c6:0x3ffce1c0 0x40091989:0x3ffce1e0 0x400956ae:0x3ffce200 0x402acc26:0x3ffce270 0x40396985:0x3ffce290 0x40396ac5:0x3ffce2b0 0x400d3d73:0x3ffce2d0 0x400d4f53:0x3ffce390 0x402a7d26:0x3ffce3d0 0x402af51d:0x3ffce680 0x402b55f9:0x3ffce6a0 0x402b5726:0x3ffce6c0 0x402b77e1:0x3ffce6e0 0x402af6f0:0x3ffce780 0x402b55f9:0x3ffce7d0 0x402b5622:0x3ffce7f0 0x402e1847:0x3ffce810 0x402e1b99:0x3ffce8a0 0x402c69b0:0x3ffce8e0
ELF file SHA256: fe8de9466e5c428e
Rebooting...
ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4
load:0x3fff0034,len:5572
load:0x40078000,len:12696
load:0x40080400,len:4292
entry 0x40080414
MicroPython v1.16-243-g8c4ba575f-dirty on 2021-09-20; ESP32 module with ESP32
Type "help()" for more information.
>>>
I got no idea what's happening,any help is appreciated

getting log from telnet session and writing relevant info to file but line gets overwritten by timestamp variable in expect script

Here is a sample remote session that I am automating
[sample-session]
$telnet 172.16.11.2
Trying 172.16.11.2...
Connected to 172.16.11.2.
Escape character is '^]'.
BCM96858 Broadband Router
Login: user
Password:
> voice show
Global Parameters:
------------------
BoundIfName : bronu8.2501
IP address family : IPv4
BoundIpAddr : 172.16.11.2
Voice Log Levels : general=3,cmgr=3,disp=3,sipcctk=3,bos=3,ept=3,cms=3,prov=3,lhapi=3,istw=3,dsphal=3,slicslac=3
Management Protocol : OMCI
Voice DNS Server Enable : Off
Voice DNS Server Primary : 0.0.0.0
Voice DNS Server Secondary : 0.0.0.0
Service Provider 0:
--------------------
Associated Voice Profile: 1
Locale : IND
DTMFMethod : InBand
HookFlashMethod : None
DigitMap : x+T
Log Server Addr : 0.0.0.0
Log Server Port : 0
T38 : on
V18 : on
RTPDSCPMark : 46
European flash : Off
SIP:
SIP mode : RFC3261
Domain :
Port : 5060
Transport : UDP
SIP URI for TLS calls: Off
RegExpires : 300
RegRetryInterval : 60
DSCPMark : 46
Registrar Addr : 172.16.11.201
Registrar Port : 5060
Proxy Addr : 172.16.11.201
Proxy Port : 5060
OutBoundProxy Addr : 172.16.11.201
OutBoundProxy Port : 5060
Music Server Addr : 0.0.0.0
Music Server Port : 0
Conferencing URI :
Conferencing Option : Local
Failover Enable : Off
Sip OPTIONS Enable : Off
Back-to-primary cfg : Disabled
Secondary Domain :
Secondary Registrar Addr : 0.0.0.0
Secondary Registrar Port : 5060
Secondary Proxy Addr : 0.0.0.0
Secondary Proxy Port : 5060
Secondary Outbound Proxy Addr : 0.0.0.0
Secondary Outbound Proxy Port : 5060
To Tag Matching : On
Timer B ( in ms ) : 32000
Timer F ( in ms ) : 32000
SRTP Usage Option : Disabled
Account 0:
-----------
ActivationStatus : Enabled
VoipServiceStatus : Up
CallStatus : Idle
Associated LineInst : 1
PhysEndpt : 0
Extension : 122
DisplayName :
AuthName : 122
AuthPwd : 0000
TxGain : 0 dB
RxGain : 0 dB
CALLFEATURES:
MWI : off
Caller ID number : on
Caller ID name : on
CallWaiting : on
CFWDNum :
CallFwdAll : off
CallFwdBusy : off
CallFwdNoans : off
AnonymousOutgoingCall: off
AnonymousCallRcvBlock: off
DoNotDisturb : off
CallCompOnBusy : off
SpeedDial : off
WarmLine : off
WarmLineNum :
CallBarring : off
CallBarringMode : None
CallBarringPin : 9999
CallBarringDigitMap :
NetPrivacy : on
CODECSETTINGS:
VAD : on
pTime : 20
CodecList : (0) G.711MuLaw
(1) G.711ALaw
(2) G.723.1
(3) G.726_16
(4) G.726_24
(5) G.726_32
Account 1:
-----------
ActivationStatus : Enabled
VoipServiceStatus : Up
CallStatus : Idle
Associated LineInst : 2
PhysEndpt : 1
Extension : 121
DisplayName :
AuthName : 121
AuthPwd : 0000
TxGain : 0 dB
RxGain : 0 dB
CALLFEATURES:
MWI : off
Caller ID number : on
Caller ID name : on
CallWaiting : on
CFWDNum :
CallFwdAll : off
CallFwdBusy : off
CallFwdNoans : off
AnonymousOutgoingCall: off
AnonymousCallRcvBlock: off
DoNotDisturb : off
CallCompOnBusy : off
SpeedDial : off
WarmLine : off
WarmLineNum :
CallBarring : off
CallBarringMode : None
CallBarringPin : 9999
CallBarringDigitMap :
NetPrivacy : on
CODECSETTINGS:
VAD : on
pTime : 20
CodecList : (0) G.711MuLaw
(1) G.711ALaw
(2) G.723.1
(3) G.726_16
(4) G.726_24
(5) G.726_32
> exit
Bye bye. Have a nice day!!!
Connection closed by foreign host.
[/sample-session]
My aim is to obtain lines containing ActivationStatus and VoipServiceStatus.
So I wrote this script
#!/usr/bin/expect -f
set timeout 2
set ip_addr [lindex $argv 0]
set OUTFILE "voip_status.log"
spawn telnet 172.16.11.$ip_addr
expect {
timeout { send_user "\nFailed to get login prompt for $ip_addr\n"; exit 1 }
eof { send_user "\ntelnet failure for server $ip_addr\n"; exit 2 }
"*Login:"
}
#expect "*Login:"
send -- "user\r"
expect "*Password:"
send -- "user\r"
expect ">"
send -- "voice show\r"
expect ">"
set voice_full_output $expect_out(buffer)
set voice_stat_lines [ split $voice_full_output "\n" ]
foreach line $voice_stat_lines {
if {[string match "*VoipServiceStatus*" $line]} {
set timestamp [timestamp -format %Y-%m-%d_%H:%M:%S]
set chan [open $OUTFILE a+]
#puts "ok - MATCH $line"
puts $chan "$line $timestamp"
close $chan
}
if {[string match "*ActivationStatus*" $line]} {
set chan [open $OUTFILE a+]
#puts "ok - MATCH $line"
puts $chan "$line"
close $chan
}
}
send -- "exit\r"
expect eof
Here is my output
$ cat voip_status.log
ActivationStatus : Enabled
2021-03-17_11:32:35tus : Up
ActivationStatus : Enabled
2021-03-17_11:32:35tus : Up
As you can see that time stamp has overwritten the line I had filtered out.
I wanted timestamp to appear at the end of line .
Why is this happening ?
Here I made an experimental setup which anybody can run to see this behaviour.
Contents of 'output-voice-log-for-experiment.sh' follow
[file to give input]
#!/usr/bin/perl
print "
Account 0:
-----------
ActivationStatus : Enabled
VoipServiceStatus : Up
CallStatus : Idle
Associated LineInst : 1
PhysEndpt : 0
Extension : 122
DisplayName :
AuthName : 122
AuthPwd : 0000
TxGain : 0 dB
RxGain : 0 dB
CALLFEATURES:
MWI : off
Caller ID number : on
Caller ID name : on
CallWaiting : on
CFWDNum :
CallFwdAll : off
CallFwdBusy : off
CallFwdNoans : off
AnonymousOutgoingCall: off
AnonymousCallRcvBlock: off
DoNotDisturb : off
CallCompOnBusy : off
SpeedDial : off
WarmLine : off
WarmLineNum :
CallBarring : off
CallBarringMode : None
CallBarringPin : 9999
CallBarringDigitMap :
NetPrivacy : on
CODECSETTINGS:
VAD : on
pTime : 20
CodecList : (0) G.711MuLaw
(1) G.711ALaw
(2) G.723.1
(3) G.726_16
(4) G.726_24
(5) G.726_32
Account 1:
-----------
ActivationStatus : Enabled
VoipServiceStatus : Up
CallStatus : Idle
Associated LineInst : 2
PhysEndpt : 1
Extension : 121
DisplayName :
AuthName : 121
AuthPwd : 0000
TxGain : 0 dB
RxGain : 0 dB
CALLFEATURES:
MWI : off
Caller ID number : on
Caller ID name : on
CallWaiting : on
CFWDNum :
CallFwdAll : off
CallFwdBusy : off
CallFwdNoans : off
AnonymousOutgoingCall: off
AnonymousCallRcvBlock: off
DoNotDisturb : off
CallCompOnBusy : off
SpeedDial : off
WarmLine : off
WarmLineNum :
CallBarring : off
CallBarringMode : None
CallBarringPin : 9999
CallBarringDigitMap :
NetPrivacy : on
CODECSETTINGS:
VAD : on
pTime : 20
CodecList : (0) G.711MuLaw
(1) G.711ALaw
(2) G.723.1
(3) G.726_16
(4) G.726_24
(5) G.726_32
> exit
"
[/file to give input]
Contents of 'process-experimental-echo.sh' follow
[file to process input]
#!/usr/bin/expect -f
spawn ./output-voice-log-for-experiment.sh
set timeout 20
set OUTFILE "experimental_voip_status.log"
expect ">"
set voice_full_output $expect_out(buffer)
set voice_stat_lines [ split $voice_full_output "\n" ]
foreach line $voice_stat_lines {
if {[string match "*VoipServiceStatus*" $line]} {
set timestamp [timestamp -format %Y-%m-%d_%H:%M:%S]
set chan [open $OUTFILE a+]
puts "ok - MATCH $line"
puts $chan "$line $timestamp"
close $chan
}
if {[string match "*ActivationStatus*" $line]} {
set chan [open $OUTFILE a+]
puts "ok - MATCH $line"
puts $chan "$line"
close $chan
}
}
[/file to process input]
Now simply run ./process-experimental-echo.sh and see this behaviour yourself.
Here is the output file you will get
$ cat experimental_voip_status.log
ActivationStatus : Enabled
2021-03-17_12:27:11tus : Up
ActivationStatus : Enabled
2021-03-17_12:27:11tus : Up
Thanks.
If you look at the output file using cat -vet it shows the non-printing control characters, tabs, and end-of-line, and you get:
ActivationStatus : Enabled^M$
VoipServiceStatus : Up^M 2021-03-17_09:02:53$
You can see ^M in the middle of a line, which is carriage-return. On a terminal this makes the cursor go back to the start of the line, and start overprinting.
This is the typical result of spawn, which runs a command through a pty, which alters each output newlines into carriage-return and newline. This is normal and desired for a pty. You can either turn it off (see stty -onlcr), or knowing that it is likely to be there, you can remove it in your script: after the foreach ... line, trim the variable $line to remove \r:
set line [string trimright $line "\r"]

TimeoutException when trying to connect to Azure service bus queue through informatica

I am trying to load 2k records on azure service bus queue through informatica, but getting timeout exception. The connection is working file for 700 records, successfully loading on queue.
I have created JMS and JNDI connection and is working fine if number of records are less.
Error:
2020-05-04 23:27:28 : ERROR : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : JAVA PLUGIN_1762 : [ERROR] JMS writer encountered a JMS exception: Timed out while waiting to get credit to sendException Stack: javax.jms.JMSException: Timed out while waiting to get credit to send
at org.apache.qpid.amqp_1_0.jms.impl.MessageProducerImpl.send(MessageProducerImpl.java:331)
at com.informatica.powerconnect.jms.server.writer.JMSMessageWriter$QueueWriter.writeMessage(JMSMessageWriter.java:93)
at com.informatica.powerconnect.jms.server.writer.JMSWriterPartitionDriver.execute(JMSWriterPartitionDriver.java:401)
Linked Exception Stack: java.util.concurrent.TimeoutException
at org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint.waitUntil(ConnectionEndpoint.java:1232)
at org.apache.qpid.amqp_1_0.transport.SessionEndpoint.waitUntil(SessionEndpoint.java:686)
at org.apache.qpid.amqp_1_0.transport.LinkEndpoint.waitUntil(LinkEndpoint.java:360)
at org.apache.qpid.amqp_1_0.client.Sender.send(Sender.java:320)
at org.apache.qpid.amqp_1_0.jms.impl.MessageProducerImpl.send(MessageProducerImpl.java:321)
at com.informatica.powerconnect.jms.server.writer.JMSMessageWriter$QueueWriter.writeMessage(JMSMessageWriter.java:93)
at com.informatica.powerconnect.jms.server.writer.JMSWriterPartitionDriver.execute(JMSWriterPartitionDriver.java:401)
.
2020-05-04 23:27:28 : ERROR : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : JAVA PLUGIN_1762 : [ERROR] at com.informatica.powerconnect.jms.server.writer.JMSWriterPartitionDriver.execute(JMSWriterPartitionDriver.java:431)
2020-05-04 23:27:28 : ERROR : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : SDKS_38502 : Plug-in #300800's target [Target_jms: Partition 1] failed in method [execute].
2020-05-04 23:27:28 : INFO : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : WRT_8333 : Rolling back all the targets due to fatal session error.
2020-05-04 23:28:28 : INFO : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : WRT_8325 : Final rollback executed for the target [Target_jms] at end of load
2020-05-04 23:28:28 : ERROR : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : WRT_8081 : Writer run terminated. [Error in loading data to target table [Target_jms: Partition 1]]
2020-05-04 23:28:28 : INFO : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : WRT_8168 : End loading table [Target_jms: Partition 1] at: Mon May 04 13:58:28 2020
2020-05-04 23:28:28 : INFO : (3084 | WRITER_1__1) : (IS | PC_INT_EE_QA) : node01_lxinfaeeqa1 : WRT_8035 : Load complete time: Mon May 04 13:58:28 2020
Appreciate the help.
The queue size for azure was 1GB but it seems that Azure service bus queue can only accept 100 messages in one transaction. I was able to solve the issue by changing the properties at informatica session level.
Commit type to "Target"
commit interval to "100"
And in target properties kept the JMS priority to 9.

Powershell: get DHCP status with Get-NetIPConfiguration?

I'm a powershell newbie.
If I run Get-NetIPConfiguration -Detailed I can see the IPv4 DHCP status. This is a good start - took me a lot of googling to get this far:
PS C:\Windows\system32> Get-NetIPConfiguration -Detailed
ComputerName : VM-172-26-39-24
InterfaceAlias : Ethernet
InterfaceIndex : 6
InterfaceDescription : Red Hat VirtIO Ethernet Adapter
NetCompartment.CompartmentId : 1
NetCompartment.CompartmentDescription : Default Compartment
NetAdapter.LinkLayerAddress : FA-16-3E-FF-0D-60
NetAdapter.Status : Up
NetProfile.Name : Network
NetProfile.NetworkCategory : Public
NetProfile.IPv6Connectivity : NoTraffic
NetProfile.IPv4Connectivity : Internet
IPv6LinkLocalAddress : fe80::x:x:x:x
IPv4Address : 172.26.39.249
IPv6DefaultGateway :
IPv4DefaultGateway : 172.26.36.1
NetIPv6Interface.NlMTU : 9000
NetIPv4Interface.NlMTU : 9000
NetIPv6Interface.DHCP : Enabled
NetIPv4Interface.DHCP : Disabled
DNSServer : x.x.x.x
x.x.x.x
But if I run something like
Get-NetIPConfiguration -Detailed | select InterfaceAlias,NetIPv4Interface.DHCP
I get an empty field?
PS C:\Windows\system32> Get-NetIPConfiguration -Detailed | `
select InterfaceAlias, NetIPv4Interface.DHCP
InterfaceAlias NetIPv4Interface.DHCP
-------------- ---------------------
Ethernet
Am I doing something wrong?
If I remove the trailing .DHCP ("what's in there?") I see nothing recognisable
PS C:\Windows\system32> Get-NetIPConfiguration -Detailed | select InterfaceAlias, NetIPv4Interface
InterfaceAlias NetIPv4Interface
-------------- ----------------
Ethernet MSFT_NetIPInterface (Name = "#55?55;", CreationClassName = "", SystemCreationClassName = "", SystemName = "")
You need to calculate the sub property when used in a Select statement:
Get-NetIPConfiguration -Detailed | `
select InterfaceAlias, #{N="DHCP";E={$_.NetIPv4Interface.DHCP}}
Or try this:
Get-NetIPConfiguration | Select -ExpandProperty NetIPv4Interface | Select InterfaceAlias,DHCP
...or you could just retrieve the config, put it in a variable then get the desired sub-properties:
$Config = Get-NetIPConfiguration
$Config | forEach {
[pscustomobject]#{InterFaceAlias=$_.InterFaceAlias;DHCP=$_.NetIPv4Interface.DHCP}
}

Elasticsearch on LAN not connecting

I have an elasticsearch running on a server (ubuntu) hosted on a local machine in our network. We have used it for testing and want to connect from local computers. The machines lan ip is 192.168.1.100. My ip is 192.168.1.54. It is running when I do
curl -X GET 'http://localhost:9200'
{
"name" : "node-1",
"cluster_name" : "norrath",
"cluster_uuid" : "0EqCQH1ZTSGzOOdq_Sf7EQ",
"version" : {
"number" : "6.2.1",
"build_hash" : "7299dc3",
"build_date" : "2018-02-07T19:34:26.990113Z",
"build_snapshot" : false,
"lucene_version" : "7.2.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
When I try from my machine..
curl 'http://192.168.1.100:9200'
curl: (7) Failed to connect to 192.168.1.100 port 9200: Connection refused
First thing I did was follow digital oceans instructions and changed
network.host: 0.0.0.0
Using netstat -atun
tcp6 0 0 :::9200 :::* LISTEN
tcp6 0 0 :::9300 :::* LISTEN
UFW status
sudo ufw status
Status: inactive
I have tried multiple config file changes..
#http.cors.enabled: true
#http.cors.allow-origin: "/.*/"
#transport.host: 0.0.0.0
#transport.tcp.port: 9300
#http.port: 9200
network.host: 0.0.0.0
#network.bind_host: 0.0.0.0
#network.publish_host: 0.0.0.0
systemctl restart elasticsearch
Still not able to connect over lan.
After examining my netstat output, I realized it is listening for tcp6 requests but not ipv4. Changing my curl request to the inet6 address, and setting up tcp/udp rather than tcp only fixed our issue.

Resources