Sunday, January 28, 2024

Eero Pro 6 router with TPG NBN cable modem

 Connecting an Eero Pro 6 to TPG NBN modem require few additional settings, the simple setup flow in the app doesn't cover these steps.




1. Setup VLAN 






2. Setup PPPoE username / password 





















Wednesday, January 20, 2021

E32-868T20D Lora module UART access with MacOS

This only shows how to put the module in to sleep mode and access config parameters.



 

 
 
Now you can access the info using CoolTerm HEX mode













Command reference - User manual








Saturday, January 16, 2021

HC-05 bluetooth AT commands on MacOS

 

 I bought HC-05 to use with Arduino but ran in to some issues trying to get the AT commands working. In this example I will show how to use this with a 3.3V UART - USB cable.

Module : HC-05, ZS-040

Firmware : VERSION:4.0-20190728- BAD version

Firmware : VERSION:2.0-20100601 - GOOD version (AT commands)


MacBook <---> USB-UART cable <--> HC-05




 

 

 

1) Power on while press and holding the button to switch to AT mode








2) In MacOS use CoolTerm with these settings 

 http://freeware.the-meiers.org/













3) connect the 3.3V UART to USB cable 

https://www.amazon.co.jp/-/en/gp/product/B0742CLF6M/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1














4) Power on the module while press and holding the button

press and hold the button every time an AT command is sent

AT

AT+VERSION?











5) Other useful commands 

AT+NAME=HC-05-TEST-1
AT+PSWD=1212



 




Wednesday, February 19, 2020

WPS pushbutton setup pkt capture

Just tested WPS pushbutton setup and trying to figure out how does the client know which AP to connect to. The client is scanning all the channels and the WiFi AP is adding some extra Information elements to the beacon to indicate that it is ready for WPS pushbutton setup




Wednesday, June 19, 2019

SIM7000E Raspberry Pi HAT Sydney, Australia - Telstra testing

I bought a SIM7000E Raspberry Pi HAT and wanted to test with a Telstra regular mobile phone SIM card. This is how I tested it.

***  Seems to only work with Telstra (PLMN 505-01) 

Bought directly from www.waveshare.com , sent by DHL and arrived in 4 days in Sydney.
 

1) Plug the unit directly in to Raspberry Pi GPIO





2) Connect using UART and Picocom 

raspberry pi 3 model b+  - use port  /dev/ttyAMA0  - read this page on how to change the UART port in raspberry pi --> https://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/

pi@raspberrypi:~ $ picocom --baud 115200 /dev/ttyAMA0
picocom v1.7

port is        : /dev/ttyS0
flowcontrol    : none
baudrate is    : 115200
parity is      : none
databits are   : 8
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv
imap is        :
omap is        :
emap is        : crcrlf,delbs,

Terminal ready
at
OK

3) Check SIM status

at+cpin?
+CPIN: READY

OK

4) Scan for networks. Retry the same command if you get an error.

at+cops=?
+COPS: (1,"505 01","505 01","50501",7),,(0,1,2,3,4),(0,1,2)

OK

PLMN 505-01 is Telstra
PLMN 505-02 is Optus
PLMN 505-03 is Vodafone

It seems like the module only can see Telstra

5) Manually connect to Telstra

at+cops=1,2,"50501"
OK

6) Check signal strength and attached status 

at+csq
+CSQ: 23,99

OK
at+creg?
+CREG: 0,1

OK
 at+cgatt?
+CGATT: 1

OK

 7) Test sending SMS 

at+cmgf=1
OK


at+cmgs="+6148XXXXXXX"
> hi hi hi hi hi
> .
>
+CMGS: 46

OK

8) Test receiving SMS

When you send an SMS to the number of the SIM in the module, these messages will appear on the console

+CMTI: "SM",1

+CMTI: "SM",2

To read individual SMS

OK
at+cmgr=1
+CMGR: "REC UNREAD","+61XXXXXXX",,"19/06/19,14:33:36+40"
Help

OK
at+cmgr=2
+CMGR: "REC UNREAD","+614XXXXXXX",,"19/06/19,14:33:52+40"
How are things

OK


9) Read all SMS

AT+CMGL="ALL"

10) Show massage storage status 

AT+CPMS?

11) Delete all messages 

at+cmgd=0,4

12) Reset

AT+CFUN=1,1 

13) Get band info

AT +CPSI? 

+CPSI: LTE CAT-M1,Online,505-01,0x2029,134409228,328,EUTRAN-BAND28,9410,5,5,-13,-96,-66,14

 

Saturday, May 11, 2019

Get the third highest salary in the employee table - SQL

This is my Table, and I want to get the 3rd highest salary




First lets sort the table by salary in descending order 


Then to get the 3rd highest. Set offset to 2 and get only one line by setting limit to 1.





Traceroute Mac vs Windows

1) Tracert in Windows use ICMP

Packet Capture Link






2 Traceroute in Mac use UDP

 



















Wednesday, April 24, 2019

MCP42100 - 100K with Raspberry Pi 3 model B+ - using spi

MCP42100 is a 100K variable resister controlled using spi interface. The only issue with this one is that it has a very high variation in resistance (high tolerance ) can vary from 70K to 130K

Data sheet - http://ww1.microchip.com/downloads/en/devicedoc/11195c.pdf




Python code for controlling this with SPI


import time
import spidev
import RPi.GPIO as gpio

gpio.setmode(gpio.BCM)
gpio.setup(4,gpio.OUT)

#if you need to open circuit 
#gpio.output(4, gpio.LOW) # Open circuit
#gpio.output(4, gpio.HIGH) # Closed circuit, resistor working


bus = 0 
device = 0

spi = spidev.SpiDev()
spi.open(bus, device)

spi.max_speed_hz = 500000
spi.mode = 0

# try 0 that will set resistance to the min value
res = input("value?")

x = spi.xfer2([19,res])

print(x)


AD5272 - 100K with Raspberry Pi 3 model B+ - using i2c

I am testing this AD5272 digital variable resistor and was really not easy to find any info on how to write to the registers in the ic to change resistance.

Data sheet - https://www.analog.com/media/en/technical-documentation/data-sheets/AD5272_5274.pdf

Useful link - https://stackoverflow.com/questions/46230777/operating-the-ad5272-with-python-3-and-smbus2-on-raspberry-pi-3-b


This is how it work in python,


bus.write_i2c_block_data(Address,First byte,[2nd byte up to 32])

------
import smbus

bus = smbus.SMBus(1)

# This write 0x1c and 0x03 to device with address 0x2c. This unlocks the register
bus.write_i2c_block_data(0x2c,0x1c,[0x03])

# This set the wiper to 0 - get around 30Ohms 
bus.write_i2c_block_data(0x2c,0x04,[0x00])

# This set the wiper to 1023 - get 100K 
bus.write_i2c_block_data(0x2c,0x07,[0xff])

------



I bought this model from DigiKey - AD5272BRMZ-100-RL7CT-ND 

TO solder this I bought a 10MOSP breakout board - LCQT-MSOP10 



Also bought low temperature soldering paste - Chip Quik Inc. / TS391LT 


Used the oven at home to bake it following the graph below.


Used 2.0mm GOOT Desolder Braid to remove soldering bridges 






Sunday, March 4, 2018

Wifi passive site survey using Ekahau



This video describes the process of mapping wifi coverage of an exisiting wifi deployment. Wifi data is collected by listening to beacons, since the software only passively listen to wifi transmissions this is called a passive survey. Ekahau software is the tool that was used for this video, there are other product which has a similar functionality.





Tuesday, February 27, 2018

[WinError 10054] An existing connection was forcibly closed by the remote host

I got this error when I was working on a Python script which use telnet to execute some show commands in Cisco 3650 and Cisco 2960 switches. Strangely I only got this error with Cisco 3650 (16.3.5b) switches.

[WinError 10054] An existing connection was forcibly closed by the remote host 


I was in a rush to get the script working and the work around below fixed the issue. 


1) The most useful method troubleshoot this was enabling debug in telnetlib

telnet = telnetlib.Telnet(ipOfRouterf)
telnet.set_debuglevel(1000)


2) Looking at the output with debugging on, it looked like that this issues is caused by the "exit" command in Cisco CLI.

cmd1 = 'show snmp location'

telnet = telnetlib.Telnet(ipOfRouterf)

telnet.set_debuglevel(1000)

telnet.read_until(b"Username: ",3)

telnet.write(user.encode('ascii') + b"\r\n")

telnet.read_until(b"Password: ",3)

telnet.write(password.encode('ascii') + b"\r\n")

telnet.write(cmd1.encode('ascii')+b"\r\n")

telnet.write(b"exit\r\n")

cmdOUT1 = telnet.read_all().decode('ascii')

print(cmdOUT1)


3) The work around I applied was to remove "exit" ,  enter a command that is invalid but unique so that telnet.read_until('testtest1234') can find it and then use telnet.close() instead of "exit"


cmd1 = 'show cdp neighbor'
cmd2 = 'show snmp location'

telnet = telnetlib.Telnet(ipOfRouterf,timeout = 3)
telnet.set_debuglevel(1000)
  
telnet.read_until(b"Username: ",3)

telnet.write(user.encode('ascii') + b"\r\n")
  
telnet.read_until(b"Password: ",3)
 
telnet.write(password.encode('ascii') + b"\r\n")
  
telnet.write(b"\r\n")
telnet.write(b"\r\n")
telnet.write(cmd1.encode('ascii')+b"\r\n")
telnet.write(b"\r\n")
telnet.write(cmd2.encode('ascii')+b"\r\n")
telnet.write(b"\r\n")
  
telnet.write(b"testtest1234\r\n")
  
cmdOUT1 = telnet.read_until(b"testtest1234").decode('ascii')

telnet.close()

print(cmdOUT1)





Sunday, February 11, 2018

Screen record in Windows using PowerPoint

In Mac OS you can screen record easily using quick time, but in Windows I have been struggling to find a way to do the same. Then I came across this function in PowerPoint. You can use this to screen record and voice over. check the screenshots below.

Windows 10 64bit
MS office professional plus 2016

1) Go to Insert --> Screen Record 


2. Click record . And Windows key + shift  + Q to stop recording




3) Once you stop recording the recorded video will appear as an embedded video in the ppt slide. Right click on the video and save it on to your desktop as a mp4 file.




Thursday, December 14, 2017

Show cisco 2950 switch info from rommon mode

This is how to show the MAC and serial number while you are in rommon mode of Cisco 2950 switch:


switch: flash_init


switch: more flash:env_vars

BOOT=flash:c2950-i6k2l2q4-mz.121-22.EA13.bin
MAC_ADDR=00:0B:FD:60:C0:40
MODEL_NUM=WS-C2950C-24
MODEL_REVISION_NUM=G0
MOTHERBOARD_ASSEMBLY_NUM=73-5710-11
MOTHERBOARD_REVISION_NUM=A0
MOTHERBOARD_SERIAL_NUM=FO1170307Z7
POWER_SUPPLY_PART_NUM=34-091165-01
POWER_SUPPLY_SERIAL_NUM=PHI0648051JE
SYSTEM_SERIAL_NUM=FOC07013AZ0N1

switch:

Thursday, November 30, 2017

SSH to Cisco WLC using Python (3.6) - simple example

import paramiko
import netmiko
from netmiko import ConnectHandler

host = "IP address"
user = "admin"
pw = "xxxxxxx"
platform = "cisco_wlc"


device = ConnectHandler(device_type=platform, ip=host, username=user, password=pw)


output = device.send_command('show wlan 1')

print(output)


device.disconnect()

Tuesday, October 31, 2017

Cisco AP power level 1 in UNII-1 and Level 4 in UNII-3

I was testing two Cisco 3602e access points. In The RF profile I had set min and max power to be 14dBm. Therefore I would expect the RRM will set the same power level in both APs



But when I checked the two APs one has power level 4 and the other has power level 1



Then I checked the output of command "show advanced 802.11a txpower". The output below explains why the two APs show two different power level. Because one is using an UNII-1 channel and the other is using a UNI-3 channel.





Tuesday, October 24, 2017

Set time zone in Cisco ISE 2.3

Cisco ISE has a CLI interface very similar to Cisco IOS.

1) SSH in to ISE 

2) show time zones 


ise-1/admin# show timezones

Australia/NSW
Australia/North
Australia/Perth
Australia/Queensland
Australia/South
Australia/Sydney



3) Set the time zone

ise-1/admin(config)# clock timezone Australia/Sydney

% On ise distributed deployments, it is recommended all nodes be
% configured with the same time zone.
Continue with time zone change?  Y/N [N]: y
System timezone was modified. You must restart ISE for change to take effect.
Do you want to restart ISE now? (yes/no) no

ise-1/admin(config)#
ise-1/admin(config)# end
ise-1/admin#
ise-1/admin# show clock
Tue Oct 24 20:47:09 AEDT 2017

Monday, October 16, 2017

PKI-3-CERTIFICATE_INVALID_NOT_YET_VALID - Cisco vWLC

I installed a fresh copy of Cisco vWLC version  AIR_CTVM-K9_8_2_151_0. But my AP3502i refused to connect to this controller and returns the error "PKI-3-CERTIFICATE_INVALID_NOT_YET_VALID" in the console output.

Then I checked the WLC self signed certificate (SSC) and it is not valid yet !!!



I thought I could regenerate the certificate with correct time but could find any CLI command or GUI option to do that.

Then I thought, lets change the time so that the certificate will be valid.



After few minutes that changed the AP's time as well and the AP connected to the controller !!!





Saturday, April 15, 2017

IPsec capture with decryption information

This is a capture I did from a StrongSwan net-to-net IPsec VPN I setup for testing.

Packet capture : pkt capture link





Phase 1 main mode - IKEv1 

Initiator cookie : 751b83775c20d140
Encryption key : d38c64bef9facf441f8ad9080e2bb157



Phase 2 quick mode 

Src IP : 172.16.1.70
Dest IP : 172.16.1.71
SPI : 0xc04af751
Encryption : AES-CBC
Encryption key : 0x7c60aad1e87addb04ce8030de87c95aa
Authentication : HMAC-SHA-1
Authentication key : 0x7d46f88c672d660d7a36d5a1a756f4e10ba6c29d


Src IP : 172.16.1.71
Dest IP : 172.16.1.71
SPI : 0xce38569e
Encryption : AES-CBC
Encryption key : 0x9b6eeff11d56d9e7e658d9b09c78d19a
Authentication : HMAC-SHA-1
Authentication key : 0x8ff0d9ff940d81198d555e3574e51a6354f9d7f6





If you want to do this your self follow the steps below to capture encryption keys from StrongSwan.


Edit /etc/sysctl.conf and uncomment "net.ipv4.ip_forward=1"  to enable routing

enter the command "ipsec up net-net" to start the IPsec tunnel




1) To get the two values to decrypt ISAKMP (IKE phase 1 and 2 )


Initiator cookie : can be found in the first pkt sent.



























Edit  /etc/ipsec.conf and add debug level 4 for IKE


# /etc/ipsec.conf - strongSwan IPsec configuration file

config setup
        charondebug="ike 4,enc 4"
        uniqueids=yes
        strictcrlpolicy=no

conn %default
        ikelifetime=60m
        keylife=8h
        rekeymargin=3m
        keyingtries=1
        keyexchange=ikev1
        authby=secret

conn net-net
        left=172.16.1.70
        leftsubnet=10.1.0.0/24
        leftid=@moon.strongswan.org
        leftfirewall=yes
        right=172.16.1.71
        rightsubnet=10.2.0.0/24
        rightid=@sun.strongswan.org

        auto=add



Restart the IPsec session and check /var/log/syslog file for the encryption key







2) To get keys data to decrypt the ESP data payload enter the command "ip xfrm state". You need enter data for the two security association.


root@ubuntu-1-ipsec:/home/ruwanindika# ip xfrm state
src 172.16.1.70 dst 172.16.1.71
proto esp spi 0xc39e664b reqid 1 mode tunnel
replay-window 32 flag af-unspec
auth-trunc hmac(sha1) 0x6cd0b2f0fa5a81642150b059b6333a3919426da7 96
enc cbc(aes) 0x392c130f3fc8b82c7552e12746cfcf36
anti-replay context: seq 0x0, oseq 0x1f8, bitmap 0x00000000

src 172.16.1.71 dst 172.16.1.70
proto esp spi 0xc2709853 reqid 1 mode tunnel
replay-window 32 flag af-unspec
auth-trunc hmac(sha1) 0xf9f4ab8729ce3f844f5d59de64ba30b24a99ca92 96
enc cbc(aes) 0x63ce266892721d11301631c504d63979

anti-replay context: seq 0x1f8, oseq 0x0, bitmap 0xffffffff