zcat & gzcat

Macにおいて表題のコマンド。

■ 環境

  • macOS High Sierra

■ zcat

gzipで圧縮されたファイルを`zcat`で確認しようとしたところ下記のようになった。

$ zcat example.csv.gz
zcat: can't stat: example.csv.gz (example.csv.gz.Z): No such file or directory
$

なんでだろう?と思い確認。

$ file example.csv.gz
example.csv.gz: gzip compressed data, last modified: Sun Apr  1 18:10:01 2018, from Unix

特に問題なさそうであるのだが…。

$ zless example.csv.gz

`zless`では問題なく中身を確認することができた。

■ gzcat

調べていると、`gzcat`でやるべきとの記載を見つけ試してみる。

$ gzcat example.csv.gz

`gzcat`では思い通りの結果が得られた。これでパイプで他のコマンドに渡していろいろ処理をすることができる。

以上。

Excel@Macで取り消し線

表題の通り。単なるメモである。

■ 環境

  • Microsoft Excell
  • macOS High Sierra

■ 取り消し線

文章の一部に”取り消し線“を付けたかったのだが、メニューのリボンを探しても見つからない…。さてどこにあるのだろう?と探し回ってしまったのでメモしておく。

ちなみに探していないので他にもっと速いショートカット等があるかもしれない。

取り消し線“を付けたいセルや文字列を選択後に、”command + 1“で”セルの書式設定”を開く。

フォント > 文字飾り > 取り消し線“にチェックを入れる。

以上。

exploitdb

表題について。`brew`で検索していて”exploitdb“なるものがあるのに気が付いたので触ってみる。

■ 環境

  • exploitdb
  • Homebrew
  • macOS High Sierra

■ exploitdb

$ brew info exploitdb
exploitdb: stable 2018-04-05, HEAD
The official Exploit Database
https://www.exploit-db.com/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/exploitdb.rb
==> Options
--HEAD
    Install HEAD version
$

exploitdb“ってあれだよな?と思って`info`で表示されるURLを訪れてみたが、イメージ通りであった。インストールすると何かあるのか?

$ brew install exploitdb

さて何がインストールされたのであろう。

$ brew ls exploitdb
/usr/local/Cellar/exploitdb/2018-04-05/bin/searchsploit
/usr/local/Cellar/exploitdb/2018-04-05/share/exploit-database/ (39996 files)
$

`searchsploit`はコマンドであろうし、名前からイメージがつく。

$ searchsploit -h
  Usage: searchsploit [options] term1 [term2] ... [termN]

==========
 Examples
==========
  searchsploit afd windows local
  searchsploit -t oracle windows
  searchsploit -p 39446
  searchsploit linux kernel 3.2 --exclude="(PoC)|/dos/"

  For more examples, see the manual: https://www.exploit-db.com/searchsploit/

=========
 Options
=========
   -c, --case     [Term]      Perform a case-sensitive search (Default is inSEnsITiVe).
   -e, --exact    [Term]      Perform an EXACT match on exploit title (Default is AND) [Implies "-t"].
   -h, --help                 Show this help screen.
   -j, --json     [Term]      Show result in JSON format.
   -m, --mirror   [EDB-ID]    Mirror (aka copies) an exploit to the current working directory.
   -o, --overflow [Term]      Exploit titles are allowed to overflow their columns.
   -p, --path     [EDB-ID]    Show the full path to an exploit (and also copies the path to the clipboard if possible).
   -t, --title    [Term]      Search JUST the exploit title (Default is title AND the file's path).
   -u, --update               Check for and install any exploitdb package updates (deb or git).
   -w, --www      [Term]      Show URLs to Exploit-DB.com rather than the local path.
   -x, --examine  [EDB-ID]    Examine (aka opens) the exploit using $PAGER.
       --colour               Disable colour highlighting in search results.
       --id                   Display the EDB-ID value rather than local path.
       --nmap     [file.xml]  Checks all results in Nmap's XML output with service version (e.g.: nmap -sV -oX file.xml).
                                Use "-v" (verbose) to try even more combinations
       --exclude="term"       Remove values from results. By using "|" to separated you can chain multiple values.
                                e.g. --exclude="term1|term2|term3".

=======
 Notes
=======
 * You can use any number of search terms.
 * Search terms are not case-sensitive (by default), and ordering is irrelevant.
   * Use '-c' if you wish to reduce results by case-sensitive searching.
   * And/Or '-e' if you wish to filter results by using an exact match.
 * Use '-t' to exclude the file's path to filter the search results.
   * Remove false positives (especially when searching using numbers - i.e. versions).
 * When updating or displaying help, search terms will be ignored.

$

試しに最近話題になった”drupal“でやってみる。

$ searchsploit drupal
------------------------------------------------------------------- -------------------------------------------------------------------
 Exploit Title                                                     |  Path
                                                                   | (/usr/local/opt/exploitdb/share/exploit-database/)
------------------------------------------------------------------- -------------------------------------------------------------------
Drupal 4.0 - News Message HTML Injection                           | exploits/php/webapps/21863.txt
Drupal 4.1/4.2 - Cross-Site Scripting                              | exploits/php/webapps/22940.txt
Drupal 4.5.3 < 4.6.1 - Comments PHP Injection                      | exploits/php/webapps/1088.pl
Drupal 4.7 - 'Attachment mod_mime' Remote Command Execution        | exploits/php/webapps/1821.php
Drupal 4.x - URL-Encoded Input HTML Injection                      | exploits/php/webapps/27020.txt
Drupal 5.2 - PHP Zend Hash ation Vector                            | exploits/php/webapps/4510.txt
Drupal 5.21/6.16 - Denial of Service                               | exploits/php/dos/10826.sh
Drupal 6.15 - Multiple Persistent Cross-Site Scripting Vulnerabili | exploits/php/webapps/11060.txt
Drupal 7.0 < 7.31 - 'Drupalgeddon' SQL Injection (Add Admin User)  | exploits/php/webapps/34992.py
Drupal 7.0 < 7.31 - 'Drupalgeddon' SQL Injection (Admin Session)   | exploits/php/webapps/44355.php
Drupal 7.0 < 7.31 - 'Drupalgeddon' SQL Injection (PoC) (Reset Pass | exploits/php/webapps/34984.py
Drupal 7.0 < 7.31 - 'Drupalgeddon' SQL Injection (PoC) (Reset Pass | exploits/php/webapps/34993.php
Drupal 7.0 < 7.31 - 'Drupalgeddon' SQL Injection (Remote Code Exec | exploits/php/webapps/35150.php
Drupal 7.12 - Multiple Vulnerabilities                             | exploits/php/webapps/18564.txt
Drupal 7.x Module Services - Remote Code Execution                 | exploits/php/webapps/41564.php
Drupal < 4.7.6 - Post Comments Remote Command Execution            | exploits/php/webapps/3313.pl
Drupal < 5.1 - Post Comments Remote Command Execution              | exploits/php/webapps/3312.pl
Drupal < 5.22/6.16 - Multiple Vulnerabilities                      | exploits/php/webapps/33706.txt
Drupal < 7.34 - Denial of Service                                  | exploits/php/dos/35415.txt
Drupal Module Ajax Checklist 5.x-1.0 - Multiple SQL Injections     | exploits/php/webapps/32415.txt
Drupal Module CAPTCHA - Security Bypass                            | exploits/php/webapps/35335.html
Drupal Module CKEditor 3.0 < 3.6.2 - Persistent EventHandler Cross | exploits/php/webapps/18389.txt
Drupal Module CKEditor < 4.1WYSIWYG (Drupal 6.x/7.x) - Persistent  | exploits/php/webapps/25493.txt
Drupal Module CODER 2.5 - Remote Command Execution (Metasploit)    | exploits/php/webapps/40149.rb
Drupal Module Coder < 7.x-1.3/7.x-2.6 - Remote Code Execution      | exploits/php/remote/40144.php
Drupal Module Cumulus 5.x-1.1/6.x-1.4 - 'tagcloud' Cross-Site Scri | exploits/php/webapps/35397.txt
Drupal Module Drag & Drop Gallery 6.x-1.5 - 'upload.php' Arbitrary | exploits/php/webapps/37453.php
Drupal Module Embedded Media Field/Media 6.x : Video Flotsam/Media | exploits/php/webapps/35072.txt
Drupal Module RESTWS 7.x - PHP Remote Code Execution (Metasploit)  | exploits/php/remote/40130.rb
Drupal Module Sections - Cross-Site Scripting                      | exploits/php/webapps/10485.txt
Drupal Module Sections 5.x-1.2/6.x-1.2 - HTML Injection            | exploits/php/webapps/33410.txt
------------------------------------------------------------------- -------------------------------------------------------------------
Shellcodes: No Result
$

なるほど。`ls`の時にも見えたpathは実際のコードが入っている場所か。セキュリティ界隈の人には便利なのかな。

以上。

brew doctor

何の気なしに表題を実施した。

■ 環境

  • Homebrew
  • macOS High Sierra

■ brew doctor

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  google-cloud-sdk

Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so
  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile

Warning: Broken symlinks were found. Remove them with `brew prune`:
  /usr/local/bin/chef-zero
  /usr/local/bin/docker-credential-osxkeychain.backup
  /usr/local/bin/fauxhai
  /usr/local/bin/hyperkit.backup
  /usr/local/bin/notary.backup
  /usr/local/bin/vpnkit.backup
$

3点ほど問題があるらしい。

■ Warning: You have unlinked kegs in your Cellar

google-cloud-sdk“に対しての問題のようだ。`brew link`を実施してみるもエラーとなる。

$ brew link google-cloud-sdk
Error: Multiple kegs installed to /usr/local/Cellar/google-cloud-sdk
However we don't know which one you refer to.
Please delete (with rm -rf!) all but one and then try again.
$

使用していないし削除しようかと思い下記を実施。

$ brew uninstall google-cloud-sdk
Error: Multiple kegs installed to /usr/local/Cellar/google-cloud-sdk
However we don't know which one you refer to.
Please delete (with rm -rf!) all but one and then try again.
$

特に変化なし。削除してしまう。

$ rm -rf /usr/local/Cellar/google-cloud-sdk

■ Warning: Homebrew’s sbin was not found in your PATH but you have installed

/usr/local/sbin“に対するPATHが足りないようである。自身の環境では”.bashrc“にいろいろ記載しているのでこちらに追記するようにした。

$ echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bashrc

実際にはコマンドで追記ではなく直接編集した。

■ Warning: Broken symlinks were found. Remove them with `brew prune`:

不要なシンボリックリンクが残ってしまっているようだ。記載された通りに実施。

$ brew prune
Pruned 6 symbolic links and 8 directories from /usr/local
$

これらの対応で問題が無くなったようである。

$ brew doctor
Your system is ready to brew.
$

以上。

Posted in: Mac | Tagged:

.localized

Macにおいて表題のファイルによる影響。

■ 環境

  • Mac OSX El Capitan

■ .localized

特に気にしたことはなく、そういうものなんだと認識していたのでFinderで見るときと、ターミナルでコマンドで移動するときは勝手に読み替えていたのだが”.localized“という0byteのファイルを消せば統一できるということを知った。

.localizedがあるとき。

.localizedを削除したあと。

~/Application/.localized“も削除したのだが影響が出なかった。”マイファイル“はそもそもどこを指しているのかよくわからなかったので気にしていない。

以上。

Posted in: Mac | Tagged: