LoginSignup
1
1

More than 5 years have passed since last update.

自分用勉強メモ4日目

Posted at

調べた知識

Exchangeable image file format

Exif.
写真のメタデータ(撮影日時など)が保存されている.
GPS情報が含まれているので,注意が必要.
タイムゾーンの設定がないらしい.

tips

仮想マシンの共有フォルダがマウントされなかった

Virtualboxの共有フォルダ設定
Guest Addtions をインストールして再起動すれば解決した.
環境
- Guest OS: Ubuntu 19.04
- Virtualbox 6.0.6
- Host OS: macOS Mojave 10.14.4

スーパーユーザじゃないと共有フォルダにアクセスできなかった

以下を実行してユーザをvboxsfグループに追加して解決.

gpasswd -a ユーザ名 vboxsf

cpawCTF

ksnctfよりも難易度が低く初心者に優しいと聞いて解いてみた.
これなら今の自分でもWrite-up調べずに解けそう.

Q6.[Crypto] Classical Cipher

シーザー暗号.
ksnctfのときに実装したPythonスクリプトを実行してフラグ獲得.

Q7.[Reversing] Can you execute ?

問題ファイルをfileコマンドで見てみると,ELF 64-bit LSB executableと書いてある.
Ubuntuでファイルを実行してフラグ獲得.

Q8.[Misc] Can you open this file ?

問題ファイルをfileコマンドで見てみると,Name of Creating Application: Microsoft Office Wordと書いてある.
Wordで開くとフラグ発見.

Q9.[Web] HTML Page

HTMLソースを開いて"flag"で検索したら発見した.

Q10.[Forensics] River

ヒント通り,Exif情報を抜き出す必要がある.
今後も使うことを見込んで,Exifを扱うスクリプトを書いてみた.

from pprint import pprint
import sys
from PIL import Image
from PIL.ExifTags import TAGS


def conv_deg(fractions):
    d = float(fractions[0][0]) / fractions[0][1]
    m = float(fractions[1][0]) / fractions[1][1]
    s = float(fractions[2][0]) / fractions[2][1]

    return d + (m/60) + (s/3600)


class MyExif:

    def __init__(self, jpeg_path):
        target_image = Image.open(jpeg_path)
        exif_info = target_image.getexif()
        self.info = {
            TAGS[id]: value for id, value in exif_info.items() if id in TAGS
        }

    def print_info(self):
        pprint(self.info)

    def get_GPS(self):
        gps_info = self.info['GPSInfo']
        latitude = conv_deg(gps_info[2])
        longitude = conv_deg(gps_info[4])
        if gps_info[1] == 'S':
            latitude *= -1
        if gps_info[3] == 'W':
            longitude *= -1
        return latitude, longitude


if __name__ == '__main__':
    exif = MyExif(sys.argv[1])
    print(exif.get_GPS())

緯度と経度がわかれば,Google Mapsで検索して答えを見つけることができる.

参考

1
1
0

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
1