android の マルチウィンドウ ってどんなの? 【動画あり】

そんな噂があるそうですが.

An Exclusive Look At Google's Early Multi-Window Explorations For Android

どんな雰囲気になるのか.

Multiwindow_Android_4_1_2_Galaxy_S3_-_YouTube

似た動画を探して眺めてみます.

どれも xposed 絡みなのですが, スマートホンのサイズの画面でもウィンドウ2つぐらいなら十分使えそうな気がします.

Xposed Installer | Xposed Module Repository


Google API を利用するときの 認証トークン の取得

ネット上で調べていると混乱する.

android_-_In_a_nutshell_what_s_the_difference_from_using_OAuth2_request_getAuthToken_and_getToken_-_Stack_Overflow

 /**
   * Gets the google account credential.
   * 
   * @param context the context
   * @param accountName the account name
   * @param scope the scope
   */
  public static GoogleAccountCredential getGoogleAccountCredential(
      Context context, String accountName, String scope) throws IOException, GoogleAuthException {
    GoogleAccountCredential credential = GoogleAccountCredential.usingOAuth2(context, scope);
    credential.setSelectedAccountName(accountName);
    credential.getToken();
    return credential;
  }

  /**
   * Gets the OAuth2 token.
   * 
   * @param context the context
   * @param accountName the account name
   * @param scope the scope
   */
  public static String getToken(Context context, String accountName, String scope)
      throws IOException, GoogleAuthException {
    GoogleAccountCredential credential = GoogleAccountCredential.usingOAuth2(context, scope);
    credential.setSelectedAccountName(accountName);
    return credential.getToken();
  }

以下, StackOverflowからの抜粋.

The Google APIs Client Library for Java is as the name suggests a library for accessing Google APIs and it is available for several platforms such as Java (in general) and Android while the Google Play Services and GoogleAuthUtil is only available on Android.

Google APIs Client Library
→ 汎用的 Java向け (Androidも含む)

GoogleAuthUtil(Google Play services)
→ Android向け専用

However if you dig into the code and their issue tracker a bit you can see that the tasks sample you linked actually uses GoogleAuthUtil since version 1.12.0 of the Google APIs Client Library when support for GoogleAuthUtil was added.

Google APIs Client Library バージョン 1.12.0 移行 は GoogleAuthUtil が追加されている.

AccountManager.getAuthToken

良いとこ:
- OS 2.0+ から使える.
- Android自体に含まれていて,別SDKを必要としない.
- 認証をもつすべてのアカウント(Google以外でも)で使える.

悪いとこ:
- トークンが期限切れなら再度新しいトークンを取得.
- GET_ACCOUNTS と USE_CREDENTIALS のパーミッションを必要とする.
- 認証要求画面が 2.x でダサい.

GoogleAuthUtil.getToken

良いとこ:
- 常に使えるトークンを返す.
- パーミッションは GET_ACCOUNTS のみ.
- 認証要求画面がダサくない
- Google が推奨している.

悪いとこ:
- 2.2+ の GooglePlay利用のデバイスに限る.
- Google Play services SDK が必要.
- Google API Console からアプリ登録が必要.
- Google services での OAuth 2.0 のみ.

android - Access to Google API - GoogleAccountCredential.usingOAuth2 vs GoogleAuthUtil.getToken() - Stack Overflow

android - In a nutshell what's the difference from using OAuth2 request getAuthToken and getToken - Stack Overflow


君たちの WordPress は shellshock 対策をしたのか!?

実質, ウワモノのPHPスクリプトで動くブログパッケージの問題ではないですけど.

Shellshock_-_Nam_'67

Troy Hunt: Everything you need to know about the Shellshock Bash bug

サーバとかよく分からず, ウワモノの WordPress のみで頑張ってる人はプラグインとかありますわ.

チェッカーとして使えます.

入れたらボタン押すだけ.

プラグインを追加_‹_新___android_ファッション通信_Σ_^A^;__—_WordPress

Shellshock_Vulnerability_Check_‹_新___android_ファッション通信_Σ_^A^;__—_WordPress

bash アップデート後にやってみたので, 問題なし.

Shellshock_Vulnerability_Check_‹_新___android_ファッション通信_Σ_^A^;__—_WordPress 2

WordPress › Shellshock Check « WordPress Plugins

詳しいことはよくわからないけど, ここらに書いてる.

CVE-2014-6271

CVE-2014-7169

サーバ内に入れる人は以下で「VULNERABLE」と表示されたらアウト, と.

ほとんど該当してるんじゃないかと思うけど.

env x='() { :;}; echo VULNERABLE' bash -c 'echo hello'

対策は, bash をアップデートするだけ.

yum update bash
apt-get install --only-upgrade bash

対策(アップデート)前だと,

# env x='() { :;}; echo VULNERABLE' bash -c 'echo hello'
VULNERABLE
hello

対策(アップデート)後だと,

# env x='() { :;}; echo VULNERABLE' bash -c 'echo hello'
hello

らしい.

環境変数から, bashコマンドを実行するようです.

ちと, さきほどのPHPで書かれたWPプラグインのコードを見てみる.

以下抜粋.

// CVE-2014-6271
$env = array('SHELL_SHOCK_TEST' => '() { :;}; echo VULNERABLE');
$desc = array(
    0 => array('pipe', 'r'),
    1 => array('pipe', 'w'),
    2 => array('pipe', 'w'),
);
$p = proc_open('bash -c "echo Test"', $desc, $pipes, null, $env);
$output = stream_get_contents($pipes[1]);
proc_close($p);
if (strpos($output, 'VULNERABLE') === false) {
    return false;
} else {
    return true;
}

// CVE-2014-7169
$desc = array(
    0 => array('pipe', 'r'),
    1 => array('pipe', 'w'),
    2 => array('pipe', 'w'),
);

$p = proc_open(
    "rm -f echo; env 'x=() { (a)=>\' bash -c \"echo date +%Y\"; cat echo", 
    $desc, $pipes, sys_get_temp_dir()
);
$output = stream_get_contents($pipes[1]);
proc_close($p);

$test = date('Y');

if (trim($output) === $test) {
    return true;
} else {
    return false;
}

true となれば, アウチサバ.

このプラグイン的には,PHPの関数「proc_open()」を使ってやってようですが, 他にもあるはず, shell 実行系の関数.

...
- system — 外部プログラムを実行し、出力を表示する
- exec() - 外部プログラムを実行する
- passthru() - 外部プログラムを実行し、未整形の出力を表示する
- popen() - プロセスへのファイルポインタをオープンする
- escapeshellcmd() - シェルのメタ文字をエスケープする
- pcntl_exec() - 現在のプロセス空間で指定したプログラムを実行する
- バックティック演算子
...

PHP: system - Manual

アプリ開発者 vs サーバ管理者で「おまえらがやれよ」とか不毛なことになったり,

大した理由もなしに, LLからshell叩くようなアプリを作ってたり.

 なお、ソースコードからのコンパイルではなく、ディストリビューターが配布しているbashパッケージを導入すれば、CVE-2014-6277/6278として報告されている脆弱性以外は影響を受けない事実を確認できたことも併せて発表している

ニュース - 「ShellShock」は公式パッチでは不十分、JPCERT/CCが追加の注意喚起:ITpro

Shellshockの影響が及ぶケースをまとめてみた - piyolog

けどまあ, それぞれ, いろいろな事情があったりして, いろんなレイヤーで対応策を知ってたほうが, きっとうまくいくだろうと.