$ xrandr
Screen 0: minimum 1 x 1, current 800 x 600, maximum 8192 x 8192
Virtual1 connected primary 800x600+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
800x600 60.00*+ 60.32
2560x1600 59.99
1920x1440 60.00
~
640x480 59.94
8x1_60.00 0.00
NAME
Wget - The non-interactive network downloader.
~
-q
--quiet
Turn off Wget's output.
~
-O file
--output-document=file
The documents will not be written to the appropriate files, but all will be
concatenated together and written to file. If - is used as file, documents will be
printed to standard output, disabling link conversion. (Use ./- to print to a file
literally named -.)
Use of -O is not intended to mean simply "use the name file instead of the one in the
URL;" rather, it is analogous to shell redirection: wget -O file http://foo is
intended to work like wget -O - http://foo > file; file will be truncated immediately,
and all downloaded content will be written there.
DESCRIPTION
apt-key is used to manage the list of keys used by apt to authenticate
packages. Packages which have been authenticated using these keys will
be considered trusted.
~
COMMANDS
add filename
Add a new key to the list of trusted keys. The key is read from the
filename given with the parameter filename or if the filename is -
from standard input.
$ sudo sh -c 'echo "deb [arch=amd64] https://packagecloud.io/AtomEditor/atom/any/ any main" > /etc/apt/sources.list.d/atom.list'
sh ~からはじまる前半部分の結果が、/etc/apt/sources.list.d/atom.listへと、sudo権限のもとで出力されています。
まずはshコマンドのマニュアルを調べます。
$ man sh
NAME
dash — command interpreter (shell)
~
-c Read commands from the command_string operand instead of from the
standard input. Special parameter 0 will be set from the
command_name operand and the positional parameters ($1, $2, etc.)
set from the remaining argument operands.
2.1.3 What GDB Does During Startup
Here’s the description of what GDB does during session startup:
1. Sets up the command interpreter as specified by the command line. 2. Reads the system-wide init file and executes all the commands in that file. 3. Reads the init file in your home directory and executes all the commands in that file. 4. Executes commands and command files specified by the ‘-iex’ and ‘-ix’ options in their specified order. 5. Processes command line options and operands. 6. Reads and executes the commands from init file in the current working directory. 7. If the command line specified a program to debug, or a process to attach to, or a core file, GDB loads any auto-loaded scripts provided for the program or for its loaded shared libraries. 8. Executes commands and command files specified by the ‘-ex’ and ‘-x’ options in their specified order. 9. Reads the command history recorded in the history file.
ここで着目すべきは3番目の処理です。
3. Reads the init file in your home directory and executes all the commands in that file.
> ?
Usage: [.][times][cmd][~grep][@[@iter]addr!size][|>pipe] ; ...
Append '?' to any char command to get detailed help
Prefix with number to repeat command N times (f.ex: 3x)
| %var=value alias for 'env' command
| *[?] off[=[0x]value] pointer read/write data/values (see ?v, wx, wv)
| (macro arg0 arg1) manage scripting macros
| .[?] [-|(m)|f|!sh|cmd] Define macro or load r2, cparse or rlang file
| _[?] Print last output
| =[?] [cmd] send/listen for remote commands (rap://, http://, <fd>)
| <[...] push escaped string into the RCons.readChar buffer
| /[?] search for bytes, regexps, patterns, ..
| ![?] [cmd] run given command as in system(3)
| #[?] !lang [..] Hashbang to run an rlang script
| a[?] analysis commands
| b[?] display or change the block size
| c[?] [arg] compare block with given data
~
#以下略
上の方にAppend '?' to any char command to get detailed helpとあるように、更に詳細なヘルプを見るにはコマンドに再度?を付ければいいようです。
例えば、コマンドaの次に何のコマンドを追加すればいいかを調べたければ、a?とすればaに付け加えるべきコマンドが表示されます。
>aaa
[x] Analyze all flags starting with sym. and entry0 (aa)
[x] Analyze function calls (aac)
[x] Analyze len bytes of instructions for references (aar)
[x] Constructing a function name for fcn.* and sym.func.* functions (aan)
[x] Type matching analysis for all functions (afta)
[x] Use -AA or aaaa to perform additional experimental analysis.
(gdb) ni
0x00005555555546db in main ()
(gdb)
0x00005555555546de in main ()
(gdb)
0x00005555555546e2 in main ()
(gdb)
0x00005555555546e5 in main ()
(gdb)
0x00005555555546e9 in main ()
(gdb)
0x00005555555546ed in main ()
アドレス748、つまり左の分岐ルートに行ったことがわかります。
これは、アドレス6e9において、ある変数と0x2を比較cmpした結果が"not equal"だったため、アドレス748にjne(jump not equal)した、ということを意味しています。
このままniコマンドで先へ行くと、
(gdb) ni
0x000055555555474f in main ()
(gdb)
Access Denied.
0x0000555555554754 in main ()
(gdb)
0x0000555555554759 in main ()
(gdb)
0x000055555555475a in main ()
(gdb) run wrong-password
Starting program: /home/user/your_pass wrong-password
Breakpoint 1, 0x00005555555546da in main ()
(gdb) ni
0x00005555555546db in main ()
(gdb)
0x00005555555546de in main ()
(gdb)
0x00005555555546e2 in main ()
(gdb)
0x00005555555546e5 in main ()
(gdb)
0x00005555555546e9 in main ()
(gdb)
0x00005555555546ed in main ()
~
(gdb)
0x0000555555554709 in main ()
(gdb)
Checking Your Pass: wrong-password
~
(gdb)
0x000055555555472a in main ()
(gdb)
0x000055555555473a in main ()
(gdb)
0x0000555555554741 in main ()
(gdb)
Access Denied.
~
709のprintf関数ではChecking Your Pass: wrong-passwordが表示され、その後の分岐点72aでは左側のルートに行き、741のputs関数ではAccess Denied.が表示されました(Fig. 3)。
つまり、この左ルートはハズレです。
(gdb) ni
0x000055555555472a in main ()
(gdb)
0x000055555555472c in main ()
(gdb)
0x0000555555554733 in main ()
(gdb)
Hello, Master.
0x0000555555554738 in main ()
strcmpのマニュアルによると、It returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2.つまりstrcmpは、比較する2つの変数が等しい時、0を返します。↩
NAME
gdb - The GNU Debugger
~
DESCRIPTION
The purpose of a debugger such as GDB is to allow you to see what is going on "inside"
another program while it executes -- or what another program was doing at the moment it
crashed.
· Start your program, specifying anything that might affect its behavior.
· Make your program stop on specified conditions.
· Examine what has happened, when your program has stopped.
· Change things in your program, so you can experiment with correcting the effects of
one bug and go on to learn about another.
$ man ls | grep all
Sort entries alphabetically if none of -cftuvSUX nor --sort is speci‐
-a, --all
-A, --almost-all
print the allocated size of each file, in blocks
-X sort alphabetically by entry extension
Written by Richard M. Stallman and David MacKenzie.
or available locally via: info '(coreutils) ls invocation'
man lsコマンドの結果を、grep allコマンドに渡したことで、lsコマンドマニュアルから"all"という文字列を含む列が検索されました。
" > " リダイレクト
>の左側の出力を、>の右側に渡します。
使用例:
$ echo Hello, Lain. > hello.txt
#hello.txt
Hello, Lain.
Hello, Lain.という文字列が、hello.txtファイルとして出力されました。
ファイル分析
file
ファイルの形式を表示します。
使用例:
$ file your_pass
your_pass: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=92e8f5e9bc90478dfdcb5fc4bd6c63f414ed2f6e, not stripped
PID: the process ID (プロセスID)
TTY: the terminal associated with the process (プロセスを行っているターミナル)
TIME: the cumulated CPU time (累積CPU使用時間)
CMD: the executable name (実行コマンド)
~
Removing a package removes all packaged data, but leaves usually small
(modified) user configuration files behind, incase the remove was an
accident. Just issuing an installation request for the accidentally removed
package will restore its function as before in that case. On the other hand
you can get rid of these leftovers by calling purge even on already removed
packages. Note that this does not affect any data or configuration stored in
your home directory.
~
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
If the -l option is specified, the following information shall be written for files other than character special and block special files:
"%s %u %s %s %u %s %s\n", [file mode], [number of links], [owner name], [group name], [size], [date and time], [pathname]