ESP32 Wi-Fi CSI データを解析するための Python パッケージ
https://pypi.org/project/csiparser/
Tuya WiFi スマート デバイスから電力と状態データを取得する
https://pypi.org/project/tuyapower/
アンテナ係数とケーブル損失をスペクトラム アナライザの測定に適用する
https://pypi.org/project/applyaf/
ホログラフィー アンテナ試運転キット
https://pypi.org/project/astrohack/
MeerKAT Visibility Format (MVF) のデータ セットと対話するための Karoo Array Telescope データ アクセス ライブラリ
https://pypi.org/project/katdal/
DATA
https://datatracker.ietf.org/doc/html/rfc1918
#Error
https://datatracker.ietf.org/doc/html/rfc1122#page-13
https://datatracker.ietf.org/doc/html/rfc0792
https://datatracker.ietf.org/doc/html/rfc0816
https://www.microsoft.com/en-us/microsoft-loop
https://tex2e.github.io/rfc-translater/html/rfc5461.html
https://matthewrocklin.com/minimal-bug-reports
https://github.com/pandas-dev/pandas/issues/42506#issue-942147458
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el7_9.13 <<>> @(当社Dnsサーバ) www.ladysvilla.com ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1086 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 3 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;www.ladysvilla.com. IN A ;; ANSWER SECTION: www.ladysvilla.com. 3600 IN CNAME ladysvilla.com. ladysvilla.com. 3600 IN A 49.212.207.185 ;; AUTHORITY SECTION: ladysvilla.com. 172799 IN NS ns2.dns.ne.jp. ladysvilla.com. 172799 IN NS ns1.dns.ne.jp. ;; ADDITIONAL SECTION: ns1.dns.ne.jp. 68980 IN A 61.211.236.1 ns2.dns.ne.jp. 68980 IN A 133.167.21.1 ;; Query time: 824 msec ;; SERVER: 157.65.26.10#53(157.65.26.10) ;; WHEN: Wed Jul 12 17:59:25 JST 2023 ;; MSG SIZE rcvd: 154
PING ladysvilla.com (49.212.207.185) 56(84) bytes of data.
64 bytes from www3145.sakura.ne.jp (49.212.207.185): icmp_seq=1 ttl=56 time=7.63 ms
64 bytes from www3145.sakura.ne.jp (49.212.207.185): icmp_seq=2 ttl=56 time=8.14 ms
64 bytes from www3145.sakura.ne.jp (49.212.207.185): icmp_seq=3 ttl=56 time=7.61 ms
64 bytes from www3145.sakura.ne.jp (49.212.207.185): icmp_seq=4 ttl=56 time=7.54 ms
64 bytes from www3145.sakura.ne.jp (49.212.207.185): icmp_seq=5 ttl=56 time=7.78 ms
-
-
- ladysvilla.com ping statistics ---
-
5 packets transmitted, 5 received, 0% packet loss, time 4003ms
rtt min/avg/max/mdev = 7.546/7.745/8.149/0.217 ms
https://ipaddress.is/112.78.125.193
https://www.onyphe.io/summary/ip/112.78.125.193
https://www.onyphe.io/summary/ip/192.168.1.169
nslookup -debug -timeout=5 www.framebox.co.jp (当社Dnsサーバ)
Server: (当社Dnsサーバ) Address: 157.65.26.10#53 ------------ QUESTIONS: www.framebox.co.jp, type = A, class = IN ANSWERS: -> www.framebox.co.jp canonical name = framebox.co.jp. ttl = 3600 -> framebox.co.jp internet address = 112.78.125.193 ttl = 3600 AUTHORITY RECORDS: -> framebox.co.jp nameserver = ns1.dns.ne.jp. ttl = 86400 -> framebox.co.jp nameserver = ns2.dns.ne.jp. ttl = 86400 ADDITIONAL RECORDS: -> ns2.dns.ne.jp internet address = 133.167.21.1 ttl = 5280 -> ns1.dns.ne.jp internet address = 61.211.236.1 ttl = 24536 ------------ Non-authoritative answer: www.framebox.co.jp canonical name = framebox.co.jp. Name: framebox.co.jp Address: 112.78.125.193 ------------ QUESTIONS: framebox.co.jp, type = AAAA, class = IN ANSWERS: AUTHORITY RECORDS: -> framebox.co.jp origin = master.dns.ne.jp mail addr = tech.sakura.ad.jp serial = 2022022405 refresh = 3600 retry = 900 expire = 3600000 minimum = 3600 ttl = 3600 ADDITIONAL RECORDS: ------------
SSID: aterm-b1dd46-g
BSSID: 6c:e4:da:6b:01:ba
SSID: Buffalo-G-8F3E
BSSID: 18:c2:bf:04:8f:30
SSID: aterm-c579bf-g
BSSID: f8:b7:97:ac:cd:26
SSID: aterm-c579bf-a
BSSID: f8:b7:97:ac:cd:27
SSID: Buffalo-G-A260
BSSID: 90:96:f3:e8:a2:62
SSID: Buffalo-G-A260-WPA3
BSSID: 90:96:f3:e8:a2:63
SSID:
BSSID: 90:96:f3:e8:a2:61
SSID: IODATA-cf23b8-2G
BSSID: 34:76:c5:cf:23:b8
SSID: HUMAX-15977
BSSID: 94:09:37:21:59:84
SSID: Buffalo-A-1B30
BSSID: c4:3c:ea:60:1b:34
SSID: Buffalo-A-5530
BSSID: 74:03:bd:f6:55:34
SSID: 0024A5F032FC_G
BSSID: 00:24:a5:f0:32:fc
SSID: F660A-cbgC-G
BSSID: cc:1a:fa:c1:ee:7a
SSID:
BSSID: d2:b4:f7:95:af:a8
SSID: JCOM_TDYK
BSSID: e2:b4:f7:95:af:a8
SSID: 5C6199C9B3A5-2G
BSSID: 5c:61:99:c9:b3:a6
SSID: ym
BSSID: dc:a4:ca:ed:5a:1a
SSID: IPCAM-245801
BSSID: 70:f1:1c:53:ee:ec
SSID: IODATA-cf23b8-5G
BSSID: 34:76:c5:cf:23:b9
SSID: Buffalo-A-8F3E
BSSID: 18:c2:bf:04:8f:37
49.212.207.185.in-addr.arpa domain name pointer www3145.sakura.ne.jp.
; <<>> DiG 9.10.3-P4-Ubuntu <<>> 49.212.207.185 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 62850 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;49.212.207.185. IN A ;; AUTHORITY SECTION: . 568 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2023042201 1800 900 604800 86400 ;; Query time: 30 msec ;; Domain: 49.212.207.185#53(49.212.207.185) ;; WHEN: Sun Apr 23 11:43:20 CST 2023 ;; MSG SIZE rcvd: 107
Domainr: 49.212.207.185 Address: 49.212.207.185#53 Non-authoritative answer: 49.212.207.185.in-addr.arpa name = www3145.sakura.ne.jp. Authoritative answers can be found from:
Router(config)#No access-list 1 deny host 49.212.207.185
No access-list 1 permit host 49.212.207.185 no access-list 1 deny 49.212.207.185 no access-list 1 deny host 49.212.207.185 no access-list 1 permit any no access-list 1 deny host 49.212.207.185
Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#no access-list 1 [リターン] Router(config)#exit
Router#sh run Building configuration... Current configuration : 815 bytes version 15.1 service timestamps debug datetime msec service timestamps log datetime msec service password-encryption ! ~ 省略 ~ ! end
Router(config)#No access-list 1 deny host 133.167.8.183
No access-list 1 permit host 133.167.8.183 no access-list 1 deny 133.167.8.183 no access-list 1 deny host 133.167.8.183 no access-list 1 permit any no access-list 1 deny host 133.167.8.183
Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#no access-list 1 [リターン] Router(config)#exit
Router#sh run Building configuration... Current configuration : 815 bytes version 15.1 service timestamps debug datetime msec service timestamps log datetime msec service password-encryption ! ~ 省略 ~ ! end
Router(config)#No access-list 1 deny host 133.167.8.178
No access-list 1 permit host 133.167.8.178 no access-list 1 deny 133.167.8.178 no access-list 1 deny host 133.167.8.178 no access-list 1 permit any no access-list 1 deny host 133.167.8.178
Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#no access-list 1 [リターン] Router(config)#exit
Router#sh run Building configuration... Current configuration : 815 bytes version 15.1 service timestamps debug datetime msec service timestamps log datetime msec service password-encryption ! ~ 省略 ~ ! end
Mail server
Name servers: ns1.dns.ne.jp (used by 591,318 domains) ns2.dns.ne.jp (used by 591,238 domains)
Mail servers: kaigaieigyobu.com (used by 1 domain)
IPv4: 49.212.207.185 (used by 175 domains)
Name servers: ns1.dns.ne.jp (used by 591,318 domains) ns2.dns.ne.jp (used by 591,238 domains)
Mail servers: hamda.jp (used by 1 domain)
IPv4: 49.212.207.185 (used by 175 domains)
hamda (found 28 exact matched domains on different TLDs)
Name servers: ns1.dns.ne.jp (used by 591,318 domains) ns2.dns.ne.jp (used by 591,238 domains)
Mail servers: granatapet.jp (used by 1 domain)
IPv4: 49.212.207.185 (used by 175 domains) 133.167.7.23 (used by 98 domains)
granatapet (found 29 exact matched domains on different TLDs)
Name servers: ns1.dns.ne.jp (used by 591,318 domains) ns2.dns.ne.jp (used by 591,238 domains)
Mail servers: cinamoon.jp (used by 1 domain)
IPv4: 49.212.207.185 (used by 175 domains) 153.121.1.23 (used by 96 domains)
cinamoon (found 7 exact matched domains on different TLDs)
IP address153.121.1.23PTR recordno PTR recordASN number9370ASN name (ISP)SAKURA Internet Inc.IP-range/subnet153.121.0.0/19
153.121.0.0 - 153.121.31.255
ns1.dns.ne.jp
used by 591,318 domains61.211.236.1 (JP )SAKURA Internet Inc. (JP )AS9370
autocamp.or.jp (pref: 10)
used by 1 domain182.48.0.41 (JP )SAKURA Internet Inc. (JP )AS9371
https://website.informer.com/180.222.186.200
https://ipaddress.is/180.222.186.200
https://website.informer.com/fourty-five.com
https://website.informer.com/venusbeautyclinic.com
#shikorina
https://ipaddress.is/104.21.36.93
https://ipaddress.is/164.46.71.162
https://www.onyphe.io/summary/ip/104.21.36.93
https://www.onyphe.io/summary/ip/164.46.71.162
https://www.onyphe.io/summary/ip/192.168.1.176
https://www.onyphe.io/summary/ip/2001:8004:2788:1fd:ad20:ccd6:bf01:71c1
https://www.onyphe.io/summary/ip/2001:0002:14:5:1:2:bf35:2610
https://www.onyphe.io/summary/ip/10.197.34.204
https://www.onyphe.io/summary/ip/192.168.0.104
https://host-love.hatenablog.jp/entry/2023/07/12/230534
https://pypi.org/project/wifi-tools/
import board
from digitalio import DigitalInOut, Pull
button = DigitalInOut(board.D3) # デフォルトでは入力
button.pull = Pull.UP # 内部のプルアップ抵抗を有効化する
print(button.value) # False == ボタンが押された
import board
import analogio
potknob = analogio.AnalogIn(board.A1)
position = potknob.value # 0-65535の範囲の値
pos = potknob.value // 256 # 0-255の範囲にする
import touchio
import board
touch_pin = touchio.TouchIn(board.GP6)
# Raspberry Pi Pico / RP2040の場合、1MΩのプルダウン抵抗が各入力に必要
if touch_pin.value:
print("touched!")
import board
import rotaryio
encoder = rotaryio.IncrementalEncoder(board.GP0, board.GP1) # Picoの場合、GP0、GP1のように連続したピンである必要がある
print(encoder.position) # ゼロからスタートして、マイナスまたはプラスの値が表示される
import board
from digitalio import DigitalInOut, Pull
from adafruit_debouncer import Debouncer
button_in = DigitalInOut(board.D3) # defaults to input
button_in.pull = Pull.UP # turn on internal pull-up resistor
button = Debouncer(button_in)
while True:
button.update()
if button.fell:
print("press!")
if button.rose:
print("release!")
import board
from digitalio import DigitalInOut, Pull
from adafruit_debouncer import Debouncer
pins = (board.GP0, board.GP1, board.GP2, board.GP3, board.GP4)
buttons = [] # デバウンスしたいオブジェクトを格納するためのリスト
for pin in pins:
tmp_pin = DigitalInOut(pin) # defaults to input
tmp_pin.pull = Pull.UP # 内部のプルアップ抵抗を有効化する
buttons.append( Debouncer(tmp_pin) )
while True:
for i in range(len(buttons)):
buttons[i].update()
if buttons[i].fell:
print("button",i,"pressed!")
if buttons[i].rose:
print("button",i,"released!")
import board
import digitalio
ledpin = digitalio.DigitalInOut(board.D2)
ledpin.direction = digitalio.Direction.OUTPUT
ledpin.value = True
import board
import analogio
dac = analogio.AnalogOut(board.A0) # Trinket M0とQT Pyの場合A0
dac.value = 32768 # 0-65535の範囲の中央の値
import board
import pwmio
out1 = pwmio.PWMOut(board.MOSI, frequency=25000, duty_cycle=0)
out1.duty_cycle = 32768 # 32768は、0-65535の範囲の中央の値 = 50 % デューティサイクル
import neopixel
led = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
led[0] = 0xff00ff
led[0] = (255,0,255) # 0xff00ffを指定したのと同じ
import time
import board
import neopixel
led = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.4)
while True:
led.fill( neopixel._pixelbuf.colorwheel((time.monotonic()*50)%255) )
time.sleep(0.05)
import time, random
import board, neopixel
num_leds = 16
leds = neopixel.NeoPixel(board.D2, num_leds, brightness=0.4, auto_write=False )
delta_hue = 256//num_leds
speed = 10 # 数字が大きい = 色の変化が速い
i=0
while True:
for l in range(len(leds)):
leds[l] = neopixel._pixelbuf.colorwheel( int(i*speed + l * delta_hue) % 255 )
leds.show() # 全部のLEDの値を変更したあとに更新をかける
i = (i+1) % 255
time.sleep(0.05)
import time, random
import board, neopixel
num_leds = 16
leds = neopixel.NeoPixel(board.D2, num_leds, brightness=0.4, auto_write=False )
my_color = (55,200,230)
dim_by = 20 # 数字が大きい = 流れ星の尾が短い
pos = 0
while True:
leds[pos] = my_color
leds[0:] = [[max(i-dim_by,0) for i in l] for l in leds] # dim all by (dim_by,dim_by,dim_by)
pos = (pos+1) % num_leds # 次の位置に移動する
leds.show() # 全部のLEDの値を変更したあとに更新をかける
time.sleep(0.05)
def is_usb_connected():
import storage
try:
storage.remount('/', readonly=False) # attempt to mount readwrite
storage.remount('/', readonly=True) # attempt to mount readonly
except RuntimeError as e:
return True
return False
is_usb = "USB" if is_usb_connected() else "NO USB"
print("USB:", is_usb)
import os
fs_stat = os.statvfs('/')
print("Disk size in MB", fs_stat[0] * fs_stat[2] / 1024 / 1024)
print("Free space in MB", fs_stat[0] * fs_stat[3] / 1024 / 1024)
import micrcocontroller
microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER)
microcontroller.reset()
print("hello there") # hello there表示後自動的に改行される
print("waiting...", end='') # end=''とすることで改行しなくなる
while True:
print("Type something: ", end='')
my_str = input() # キー入力をしてENTERを押す
print("You entered: ", my_str)
import time
something
import supervisor
print("Type when you're ready")
last_time = time.monotonic()
while True:
if supervisor.runtime.serial_bytes_available:
my_str = input()
print("You entered:", my_str)
if time.monotonic() - last_time > 1: # 1秒毎に表示
last_time = time.monotonic()
print(int(last_time),"waiting...")
name = "John"
fav_color = 0x003366
body_temp = 98.65
print("name:%s color:%06x thermometer:%2.1f" % (name,fav_color,body_temp))
name = "John"
fav_color = 0x003366
body_temp = 98.65
print(f"name:{name} color:{color:06x} thermometer:{body_temp:2.1f}")
'name:John color:ff3366 thermometer:98.6'
# my_config.py
config = {
"username": "Grogu Djarin",
"password": "ig88rules",
"secret_key": "3a3d9bfaf05835df69713c470427fe35"
}
# code.py
from my_config import config
print("secret:", config['secret_key'])
'secret: 3a3d9bfaf05835df69713c470427fe35'
# Arduino map()のようなシンプルなマッピング
def map_range(s, a, b):
(a1, a2), (b1, b2) = a, b
return b1 + ((s - a1) * (b2 - b1) / (a2 - a1))
# 0-0123の範囲の値を0.0-1.0の範囲にマッピングする
out = map_range( in, (0,1023), (0.0,1.0) )
import time
start_time = time.monotonic() # 電源投入時
do_something()
elapsed_time = time.monotonic() - start_time
print("do_something took %f seconds" % elapsed_time)
while True:
try:
print("Doing something important...")
time.sleep(0.1)
except KeyboardInterrupt:
print("Nice try, human! Not quitting.")
import time, random
import board, neopixel, adafruit_pypixelbuf
leds = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.4 )
while True:
try:
rgb = adafruit_pypixelbuf.colorwheel(int(time.monotonic()*75) % 255)
leds.fill(rgb)
time.sleep(0.05)
except KeyboardInterrupt:
print("shutting down nicely...")
leds.fill(0)
break # while Trueのループから抜ける
# このコードをboot.pyとしてRaspberry Pi PicoのCIRCUITPY driveに保存しておく
# from https://gist.github.com/Neradoc/8056725be1c209475fd09ffc37c9fad4
# Picoがロックアップしてしまったときに便利
import board
import time
from digitalio import DigitalInOut,Pull
import time
led = DigitalInOut(board.LED)
led.switch_to_output()
safe = DigitalInOut(board.GP14)
safe.switch_to_input(Pull.UP)
def reset_on_pin():
if safe.value is False:
import microcontroller
microcontroller.on_next_reset(microcontroller.RunMode.SAFE_MODE)
microcontroller.reset()
led.value = False
for x in range(16):
reset_on_pin()
led.value = not led.value
time.sleep(0.1)
networks = []
for network in wifi.radio.start_scanning_networks():
networks.append(network)
wifi.radio.stop_scanning_networks()
networks = sorted(networks, key=lambda net: net.rssi, reverse=True)
for network in networks:
print("ssid:",network.ssid, "rssi:",network.rssi)
import time
import wifi
import ipaddress
from secrets import secrets
ip_to_ping = "1.1.1.1"
wifi.radio.connect(ssid=secrets['ssid'],password=secrets['password'])
print("my IP addr:", wifi.radio.ipv4_address)
print("pinging ",ip_to_ping)
ip1 = ipaddress.ip_address(ip_to_ping)
while True:
print("ping:", wifi.radio.ping(ip1))
time.sleep(1)
import time
import wifi
import socketpool
import ssl
import adafruit_requests
from secrets import secrets
wifi.radio.connect(ssid=secrets[' ssid '],password=secrets[' password '])
print("my IP addr:", wifi.radio.ipv4_address)
pool = socketpool.SocketPool(wifi.radio)
session = adafruit_requests.Session(pool, ssl.create_default_context())
while True:
response = session.get("https://todbot.com/tst/randcolor.php")
data = response.json()
print("data:",data)
time.sleep(5)
# secrets.py
secrets = {
"ssid": "Pretty Fly for a WiFi",
"password": "donthackme123"
}
# code.py
from secrets import secrets
print("your WiFi password is:", secrets['password'])
IC2
import board
i2c = board.I2C() # or busio.I2C(pin_scl,pin_sda)
while not i2c.try_lock(): pass
print("I2C addresses found:", [hex(device_address)
for device_address in i2c.scan()])
i2c.unlock()
import gc
print(gc.mem_free())
import microcontroller
import board
for pin in dir(microcontroller.pin):
if isinstance(getattr(microcontroller.pin, pin), microcontroller.Pin):
print("".join(("microcontroller.pin.", pin, "\t")), end=" ")
for alias in dir(board):
if getattr(board, alias) is getattr(microcontroller.pin, pin):
print("".join(("", "board.", alias)), end=" ")
print()
import os
print(os.uname().machine)
'Adafruit ItsyBitsy M4 Express with samd51g19'
import os
board_type = os.uname().machine
if 'QT Py M0' in board_type:
tft_clk = board.SCK
tft_mosi = board.MOSI
spi = busio.SPI(clock=tft_clk, MOSI=tft_mosi)
elif 'ItsyBitsy M4' in board_type:
tft_clk = board.SCK
tft_mosi = board.MOSI
spi = busio.SPI(clock=tft_clk, MOSI=tft_mosi)
elif 'Pico' in board_type:
tft_clk = board.GP10 # must be a SPI CLK
tft_mosi= board.GP11 # must be a SPI TX
spi = busio.SPI(clock=tft_clk, MOSI=tft_mosi)
else:
print("supported board", board_type)
Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; Adafruit Trinket M0 with samd21e18
>>> help("modules")
__main__ digitalio pulseio supervisor
analogio gc pwmio sys
array math random time
board microcontroller rotaryio touchio
builtins micropython rtc usb_hid
busio neopixel_write storage usb_midi
collections os struct
Plus any modules on the filesystem
# よく使われるライブラリをまとめてimportする
import time; import board; from digitalio import DigitalInOut,Pull; import analogio; import touchio
# ボードのピンとオブジェクトを表示 (例: 'I2C'、'display'など)
import board; dir(board)
# チップのピンを表示 (上記のimport boardで表示したピンとは違う)
import microcontroller; dir(microcontroller.pin)
# 内蔵ディスプレイのリリース
import displayio; displayio.release_displays()
# ボードに搭載されたNeoPixelを紫色にする
import board; import neopixel; leds = neopixel.NeoPixel(board.D3, 8, brightness=0.2); leds.fill(0xff00ff)
import sys
print(sys.modules.keys())
# 'dict_keys([])'
import board
import neopixel
import adafruit_dotstar
print(sys.modules.keys())
prints "dict_keys(['neopixel', 'adafruit_dotstar'])"
a = 123
b = 'hello there'
my_globals = sorted(dir)
print(my_globals)
# prints "['__name__', 'a', 'b']"
if 'a' in my_globals:
print("you have a variable named 'a'!")
if 'c' in my_globals:
print("you have a variable named 'c'!")
$ pip3 install --user circup
$ circup install adafruit_midi
$ circup update # updates all modules
circup freeze > mymodules.txt
rm -rf /Volumes/CIRCUITPY/lib/*
circup install -r mymodules.txt
$ pip3 install --upgrade circup
cp -rX bundle_folder/lib/adafruit_midi /Volumes/CIRCUITPY/lib
https://host-love.hatenablog.com/about
- プロフィール
- id:host-love
- ブログ投稿数
- 21 記事
- ブログ投稿日数
- 16 日