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?

bandit 二日目

Last updated at Posted at 2025-10-10

level 7 → level 8

課題

data.textファイルの中のmillionthにpasswordがある

方法

grepを使ってファイルの中身を抽出できる
-A1を使うことでヒットした後の行も表示できる(A2なら二行後ろまで)

grep -A1 "millionth" data.txt

password

dfwvzFQi4mU0wfNbFOe9RoWskMLg7eEc

level 8 → level 9

課題

テキストファイルで出現回数が一回の行を探す

解法

strings,sort,uniqをパイプで使う

strings
ファイルからテキストを抽出する
4文字以上を抽出(標準)
sort
ファイル内の並べ替えなど
-uで重複行を削除
uniq
事前にsortが必要
重複行を削除
-cで重複回数を表示

パイプを使って実行する

strings data.txt | sort data.txt | uniq -c

password

4CKMh1JI91bUIZZPXDqGanal4xvAg0JM
1
0
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
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?