1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Proself 4 の管理者ログを取得する

Posted at

目的

Proself 4 の管理者画面にあるログをスクリプトでダウンロードする

テンプレート

#!/usr/bin/env python

import re
import requests

host = 'https://example.com'
username = 'admin_user'
password = 'admin_password'

s = requests.session()

headers = {
    'Accept-Language': 'ja,en;q=0.8',
    'Referer': host + '/',
}
data = {
    'AD': 'certification',
    'username': username,
    'password': password,
}
res = s.post(host + '/proself/login/login.go', headers=headers, data=data)
loginticket = re.search('name="loginticket" value="(.*?)"', res.text).group(1)

data = {
    'AD': 'logindownload', # 下記参照
    'loginticket': loginticket,
    'targetdate': '2017/06', # yyyy/mm
}
res = s.post(host + '/proself/admin/log/downloadhistory.go', headers=headers, data=data)
# print res.text etc.
  • Cookie と Referer, フォームの loginticket は必須
  • Accept-Language で ja を優先すると、結果の一部が日本語になるが、完全ではないようだ。

取得できるログの種類

名称 AD
ログインログ logindownload
管理ログ admindownload
ダウンロードログ getdownload
アップロードログ putdownload
ファイル操作ログ resourceoperationdownload
Web公開操作ログ publicdownload
Web公開ダウンロードログ getpublicdownload
Web公開アップロードログ putpublicdownload
  • 列数可変の CSV 形式で出力されている。
  • それぞれのログの内容は https://www.proself.jp/support/faq129/ に説明がある。
  • ある時刻のあるログを取得するたびにスクリプトを起動すると、ログインログが自分ので埋まってしまうので注意する。
    • 一定時間以内にアクセスすればセッションを維持できるので、永続化を検討する。
1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?