Life is fun and easy!
不正IP報告数
Okan Sensor
ページへ戻る
印刷
Safari/History
をテンプレートにして作成 ::
UJP
tech_regist2
:Safari/History をテンプレートにして作成
開始行:
*SQLite3でSafariの履歴を読み出す
**はじめに
WebブラウザのSafariの履歴をCSVで取り出す.監査目的.
**フォルダへの移動
Safariの履歴はSQLite3データベース形式で保存されており,...
このディレクトリは,macOS X 10.15(Mojave)以降はコマンド...
#ref(site://modules/xelfinder/index.php?page=view&file=71...
まずは,Finder上で,フォルダに移動する.
#ref(site://modules/xelfinder/index.php?page=view&file=71...
チルダで監査対象ユーザのユーザディレクトリを指定する.(...
#ref(site://modules/xelfinder/index.php?page=view&file=71...
Finderでファイルをコピーする.
#ref(site://modules/xelfinder/index.php?page=view&file=71...
ターミナルから,確認する.
MBA2013:SafariHistory ujpadmin$ ls -la🆑
total 12616
drwxr-xr-x 6 ujpadmin staff 192 5 25 16:50 .
drwxr-xr-x 7 ujpadmin staff 224 5 25 16:54 ..
-rw-r--r--@ 1 ujpadmin staff 126976 5 25 13:29 Histo...
-rw-r--r--@ 1 ujpadmin staff 0 4 16 12:31 Histo...
-rw-r--r--@ 1 ujpadmin staff 32768 5 25 13:29 Histo...
-rw-r--r--@ 1 ujpadmin staff 5524952 5 25 16:40 Histo...
MBA2013:SafariHistory ujpadmin$
コピー完了.
**SQLite3に接続する
macOS XにはデフォルトでSQLite3が導入されいるので,これ...
MBA2013:SafariHistory ujpadmin$ sqlite3 History.db🆑
SQLite version 3.24.0 2018-06-04 14:10:15
Enter ".help" for usage hints.
sqlite>
保管されているテーブルの一覧を確認する.
sqlite> .tables🆑
history_client_versions history_items histor...
history_event_listeners history_items_to_tags histor...
history_events history_tags metada...
sqlite>
SQLite3のコマンドモニタの表示を行モードにする.
sqlite> .mode line🆑
sqlite>
今回利用するテールブの構造を確認する.
sqlite> select * from sqlite_master where name = 'histor...
type = table
name = history_items
tbl_name = history_items
rootpage = 2
sql = CREATE TABLE history_items (id INTEGER PRIMAR...
url TEXT NOT NULL UNIQUE,domain_expansion TEXT NULL,
visit_count INTEGER NOT NULL,daily_visit_counts BLO...
BLOB NULL,autocomplete_triggers BLOB NULL,should_re...
INTEGER NOT NULL,visit_count_score INTEGER NOT NULL)
sqlite>
2つめ.
sqlite> select * from sqlite_master where name = 'histor...
type = table
name = history_visits
tbl_name = history_visits
rootpage = 5
sql = CREATE TABLE history_visits (id INTEGER PRIMA...
history_item INTEGER NOT NULL REFERENCES history_it...
visit_time REAL NOT NULL,title TEXT NULL,load_succe...
http_non_get BOOLEAN NOT NULL DEFAULT 0,synthesized...
redirect_source INTEGER NULL UNIQUE REFERENCES hist...
redirect_destination INTEGER NULL UNIQUE REFERENCES...
origin INTEGER NOT NULL DEFAULT 0,generation INTEGE...
attributes INTEGER NOT NULL DEFAULT 0,score INTEGER...
sqlite>
テーブルの定義は確認できた.
**Safariの履歴をCSV形式で書き出す
表示モードをCSV形式に設定する.
sqlite> .mode csv🆑
sqlite>
出力結果を,CSVファイルに出力する設定とする.
sqlite> .output SafariHistory.csv🆑
sqlite>
一行目に項目のヘッダを書き出す.
sqlite> .headers on🆑
sqlite>
次のSQL文を実行する.
sqlite> select datetime(v.visit_time + 978307200, 'unixe...
i.domain_expansion, v.title, i.url from history_items ...
i.id = v.history_item order by date desc;🆑
sqlite>
このSQLにある978307200は,1970年1月1日0時から2001年1月1...
実行した後は,Control+DでSQLite3のモニターモードを抜け...
sqlite> ^D
MBA2013:SafariHistory ujpadmin$
取り出したCSVファイルを確認.
MBA2013:SafariHistory ujpadmin$ ls -la SafariHistory.csv
-rw-r--r-- 1 ujpadmin staff 36552 5 25 16:59 SafariH...
MBA2013:SafariHistory ujpadmin$
#ref(site://modules/xelfinder/index.php?page=view&file=71...
CSVファイルに,Safariの履歴が保存されていることが確認で...
終了行:
*SQLite3でSafariの履歴を読み出す
**はじめに
WebブラウザのSafariの履歴をCSVで取り出す.監査目的.
**フォルダへの移動
Safariの履歴はSQLite3データベース形式で保存されており,...
このディレクトリは,macOS X 10.15(Mojave)以降はコマンド...
#ref(site://modules/xelfinder/index.php?page=view&file=71...
まずは,Finder上で,フォルダに移動する.
#ref(site://modules/xelfinder/index.php?page=view&file=71...
チルダで監査対象ユーザのユーザディレクトリを指定する.(...
#ref(site://modules/xelfinder/index.php?page=view&file=71...
Finderでファイルをコピーする.
#ref(site://modules/xelfinder/index.php?page=view&file=71...
ターミナルから,確認する.
MBA2013:SafariHistory ujpadmin$ ls -la🆑
total 12616
drwxr-xr-x 6 ujpadmin staff 192 5 25 16:50 .
drwxr-xr-x 7 ujpadmin staff 224 5 25 16:54 ..
-rw-r--r--@ 1 ujpadmin staff 126976 5 25 13:29 Histo...
-rw-r--r--@ 1 ujpadmin staff 0 4 16 12:31 Histo...
-rw-r--r--@ 1 ujpadmin staff 32768 5 25 13:29 Histo...
-rw-r--r--@ 1 ujpadmin staff 5524952 5 25 16:40 Histo...
MBA2013:SafariHistory ujpadmin$
コピー完了.
**SQLite3に接続する
macOS XにはデフォルトでSQLite3が導入されいるので,これ...
MBA2013:SafariHistory ujpadmin$ sqlite3 History.db🆑
SQLite version 3.24.0 2018-06-04 14:10:15
Enter ".help" for usage hints.
sqlite>
保管されているテーブルの一覧を確認する.
sqlite> .tables🆑
history_client_versions history_items histor...
history_event_listeners history_items_to_tags histor...
history_events history_tags metada...
sqlite>
SQLite3のコマンドモニタの表示を行モードにする.
sqlite> .mode line🆑
sqlite>
今回利用するテールブの構造を確認する.
sqlite> select * from sqlite_master where name = 'histor...
type = table
name = history_items
tbl_name = history_items
rootpage = 2
sql = CREATE TABLE history_items (id INTEGER PRIMAR...
url TEXT NOT NULL UNIQUE,domain_expansion TEXT NULL,
visit_count INTEGER NOT NULL,daily_visit_counts BLO...
BLOB NULL,autocomplete_triggers BLOB NULL,should_re...
INTEGER NOT NULL,visit_count_score INTEGER NOT NULL)
sqlite>
2つめ.
sqlite> select * from sqlite_master where name = 'histor...
type = table
name = history_visits
tbl_name = history_visits
rootpage = 5
sql = CREATE TABLE history_visits (id INTEGER PRIMA...
history_item INTEGER NOT NULL REFERENCES history_it...
visit_time REAL NOT NULL,title TEXT NULL,load_succe...
http_non_get BOOLEAN NOT NULL DEFAULT 0,synthesized...
redirect_source INTEGER NULL UNIQUE REFERENCES hist...
redirect_destination INTEGER NULL UNIQUE REFERENCES...
origin INTEGER NOT NULL DEFAULT 0,generation INTEGE...
attributes INTEGER NOT NULL DEFAULT 0,score INTEGER...
sqlite>
テーブルの定義は確認できた.
**Safariの履歴をCSV形式で書き出す
表示モードをCSV形式に設定する.
sqlite> .mode csv🆑
sqlite>
出力結果を,CSVファイルに出力する設定とする.
sqlite> .output SafariHistory.csv🆑
sqlite>
一行目に項目のヘッダを書き出す.
sqlite> .headers on🆑
sqlite>
次のSQL文を実行する.
sqlite> select datetime(v.visit_time + 978307200, 'unixe...
i.domain_expansion, v.title, i.url from history_items ...
i.id = v.history_item order by date desc;🆑
sqlite>
このSQLにある978307200は,1970年1月1日0時から2001年1月1...
実行した後は,Control+DでSQLite3のモニターモードを抜け...
sqlite> ^D
MBA2013:SafariHistory ujpadmin$
取り出したCSVファイルを確認.
MBA2013:SafariHistory ujpadmin$ ls -la SafariHistory.csv
-rw-r--r-- 1 ujpadmin staff 36552 5 25 16:59 SafariH...
MBA2013:SafariHistory ujpadmin$
#ref(site://modules/xelfinder/index.php?page=view&file=71...
CSVファイルに,Safariの履歴が保存されていることが確認で...
ページ名: