2023年10月18日星期三

[LEGO EV3]Battery Checker

 Created this for our little robot team.


It is simple but it can help you to detect your LegoEV3 battery status quickly after you created a base line for it in competitions.
Yes, I am their coach.

“Although we did not get enough score to enroll the WRO in Panama this year, I think our team will win in next year. “ teammate said.






2023年8月25日星期五

[Windows]License for windows95_WIndow95のライセンス解析

It is real that someone is still checking with old OS license key.

They are the heroes of internet.



  「Windows 11」ではデジタルライセンス認証も可能になったが、Windowsを使い始めるには、正規品であることを証明するために数桁のユニークな英数字「プロダクトキー」の入力が求められる。

 ある研究者は興味本位で「Windows 95」のプロダクトキーを解析したところ、ある法則によって生成されていたことが分かった。本質を理解すれば、誰でも簡単にプロダクトキーを生成できてしまうという。その法則とは?

 セキュリティ研究者のstacksmashing氏は、Windows OSのプロダクトキー認証を突破できる裏ワザを発見した。同氏はさまざまなデバイスやアプリ、ゲーム機などをハッキングしてはその模様をYouTubeに投稿している。Windowsのプロダクトキーに関する話も動画で取り上げられた話題の一つだ。

 ただし、この裏ワザが通用するのは「Windows 95」のインストール時のみだ。Windows 95は1995年8月25日に英語版が、同年11月23日に日本語版が発売され、今のWindowsの礎を築いたOSと言っても過言ではない。

 stacksmashing氏が解明したプロダクトキーの生成アルゴリズムについて、詳しく解説しよう。

 Windows 95のプロダクトキーは「XXX-YYYYYYY」というように「-(ハイフン)」で接続された10桁(前半3桁と後半7桁)の数字で構成される。同氏は試行錯誤しながらそのプロダクトキーを入力する中で、ある傾向をつかんだ。

 まず、「111-1111111」と全て「1」にするとインストールは成功する。また、全て「0」の場合でも成功する。そして前半3桁を「000」「001」「567」と変更し、後半7桁が全て「1」の場合も有効なキーと認識される。ただし「333」「444」「555」といった「0」や「1」「2」以外の3連続の数字を入力した場合は失敗するようだ。

 後半7桁は「0000001」だと失敗し、そこから1ずつ数を増やしていったところ「0000007」の場合は成功することが分かった。それを繰り返していくと、後半の数字は「0000000」「0000007」「0000016」「0000025」だと成功することが判明した。同氏は、後半7桁の各数字の合計が「7の倍数」であれば成功するのでは、と推測した。確かに「1111111」も全て合算すれば「7」だ。

 stacksmashing氏はリバースエンジニアリングツール「Ghidra」を使って禁断のプログラム解析を敢行した。すると前半3桁は「333」「444」「555」「666」「777」「888」「999」の数字がブラックリスト入りしているだけで、その他の3桁の数字なら何でもいいことが判明した。そして後半7桁については、同氏の予測通り、全ての桁の数字を合計して7で割り切れれば成功することが分かった。しかも、3桁と7桁の間の文字はチェックされておらず、必ずしも「-(ハイフン)」である必要がない。

 これらの情報をまとめると「前半3桁は3~9の3並び以外なら何でもいい」「前半と後半をつなぐ文字はどれでもいい」「後半7桁は合計したとき『7』で割り切れればいい」と単純なものだったのだ。

 ちなみに、このアルゴリズムはWindows 95リテール版で通用するものであり、OEM版はまた異なる。OEM版の場合、プロダクトキーは「AAABB-OEM-XXXXXXX-YYYYY」という形式(「A」「B」「X」「Y」はそれぞれ整数、「OEM」は固定の文字列)で構成されているが、これも単純なアルゴリズムだ。

 stacksmashing氏の解析をまとめると「AAA」は「1~366」で、「BB」は「00~02」または「95~99」、「XXXXXXX」は先頭が「0」で、かつ合算して7で割り切れる7桁の数字、そして「YYYYY」はノーチェック、つまり「何でもいい5桁の数字」だ。何とも単純な仕様だ。

2023年2月14日星期二

[RaspBerry Pi]How to expand the root partition of your Raspberry PI’s SD card

 How to expand the root partition of your Raspberry PI’s SD card?

After installing a new OS on your PI’s SD card you might notice there is a lot of diskspace ‘missing’ on the card…

By expanding the root partition of the card you can regain that ‘missing’ space!

This is the easiest way to do it:

  • open the PI’s configuration screen (in the terminal window) by typing:
    sudo raspi-config
  • run the bottom option just to make sure you have the latest version of the configuration software:
    update
  • run the second option:
    expand_rootfs
  • click:
    Finish
  • select ‘YES‘ when it asks for a reboot

2023年1月30日星期一

[PERL]Confirm installed module on linux server

 ■以下のコマンドを実行すること確認できる

find `perl -e 'print "@INC"'` -name '*.pm' -print

 

■grep で限定表示

 find `perl -e ' print "@INC"' `-name '*.pm' -print | grep LWP


●@INC

Perlの特殊変数

●LWP

Perlモジュール 

2022年9月22日星期四

[Raspberry Pi]Install mail server on local raspberry pi with own domain

Yes, We will run the command [sudo apt-get install postfix].

To ensure you will get the newest version, you have to run below first.

sudo apt-get update

sudo apt-get upgrade

Then you can go with [sudo apt-get install postfix]

You will see some log like below.

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following packages were automatically installed and are no longer required:

  libgnutls-dane0 libunbound8

Use 'sudo apt autoremove' to remove them.

Suggested packages:

  procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre postfix-lmdb postfix-sqlite sasl2-bin | dovecot-common libsasl2-modules

  | dovecot-common postfix-cdb ufw postfix-doc

The following packages will be REMOVED:

  exim4-base exim4-config exim4-daemon-light

The following NEW packages will be installed:

  postfix

0 upgraded, 1 newly installed, 3 to remove and 0 not upgraded.

Need to get 1,412 kB of archives.

After this operation, 62.5 kB disk space will be freed.

Do you want to continue? [Y/n] y

Get:1 http://ftp.udx.icscoe.jp/Linux/raspbian/raspbian buster/main armhf postfix armhf 3.4.23-0+deb10u1 [1,412 kB]

Fetched 1,412 kB in 2s (774 kB/s)    

Preconfiguring packages ...

(Reading database ... 221744 files and directories currently installed.)

Removing exim4-daemon-light (4.92-8+deb10u7) ...

Removing exim4-base (4.92-8+deb10u7) ...

Removing exim4-config (4.92-8+deb10u7) ...

Selecting previously unselected package postfix.

(Reading database ... 221611 files and directories currently installed.)

Preparing to unpack .../postfix_3.4.23-0+deb10u1_armhf.deb ...

Unpacking postfix (3.4.23-0+deb10u1) ...

Setting up postfix (3.4.23-0+deb10u1) ...

Adding group `postfix' (GID 126) ...

Done.

Adding system user `postfix' (UID 118) ...

Adding new user `postfix' (UID 118) with group `postfix' ...

Not creating home directory `/var/spool/postfix'.

Creating /etc/postfix/dynamicmaps.cf

Adding group `postdrop' (GID 127) ...

Done.

setting myhostname: raspberrypi

setting alias maps

setting alias database

changing /etc/mailname to achillia-mfg.com

setting myorigin

setting destinations: achillia-mfg.com, $myhostname, raspberrypi, localhost.localdomain, localhost

setting relayhost: smtp.localhost

setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

setting mailbox_size_limit: 0

setting recipient_delimiter: +

setting inet_interfaces: all

setting inet_protocols: all

WARNING: /etc/aliases exists, but does not have a root alias.


Postfix (main.cf) is now set up with a default configuration.  If you need to 

make changes, edit /etc/postfix/main.cf (and others) as needed.  To view 

Postfix configuration values, see postconf(1).


After modifying main.cf, be sure to run 'service postfix reload'.


Running newaliases

Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /lib/systemd/system/postfix.service.

Processing triggers for systemd (241-7~deb10u8+rpi1) ...

Processing triggers for man-db (2.8.5-2) ...

Processing triggers for rsyslog (8.1901.0-1+deb10u2) ...


2022年9月5日星期一

Raspberry pi上使用nslookup和dig

在Raspberry Pi上,初期状态是无法使用nslookup和dig等一些DNS相关命令的。

需要安装dnsutils package.

                    $ sudo apt-get update

$ sudo apt-get install dnsutils

安装后就可以使用下列命令了。 

$ nslookup example.com

$ dig example.com

2014年7月21日星期一

【WINDOWS8 & OFFICE2013】win8和office2013同时还原激活

1.备份
当一台电脑同时安装已激活的win8office 2013时,我们就有必要备份一下已经激活状态,不然重装系统后将很费心思地找激活密钥。windows8office 2013同时俱在时,
1 我们只需将系统盘(通常为CC:\Windows\System32\spp\storestore文件夹备份到网盘上(注意store中含有隐藏的文件要全部备份)
2)记住重装win8系统的用户名和激活密钥(无论是电话激活还是联网激活的密钥)
3)记住office2013的安装路径(如D:\Programs\office)和激活密钥(无论是电话激活还是联网激活密钥)
2.还原激活信息
1)安装win8的系统时注意版本和用户名要与备份的一样,然后将已备份的密钥用slmgr /ipk **** **** **** ****安装到电脑中
2)安装office2013并注意版本和安装路径要与备份的一样,安装已备份密钥
3)将备份的store完覆盖到C:\Windows\System32\spp\store,重启
将显示win8office2013同时激活
说明1:这个方法也可以用来备份单独的win8激活信息或者office 2013的激活信息

说明2:原来的有一种对win8备份还原的方是将电话激活的ID和用到的密钥备份,然后用命令激活的办法好像不怎么好用了,最好用本经验方法简单可行稳定长久。