如果需要每个level的密码请看OverTheWire-bandit模块密码合集(0-33)
- bash中“-”的用途:
(1)命令的选项标志,用于操作符的前缀。
ls -a
。
(2)被解析为标准输入流[stdin],如果文件名是以“-”开头,则需要加上前缀路径。bunzip2 linux-2.6.13.tar.bz2|tar xvf -
。
(3)先前的工作目录。
(4)算术操作中的减法或负号。
- 如果文件名中有空格,则需要使用\转义字符进行转义。
- linux中隐藏文件是以“.”开头的。
- find常用命令:
(1)查找指定字节文件:
find . -size 1033c
,c表示bytes。
(2)查找指定类型文件:find . -type f
,f表示一般文件。
(3)查找属于指定用户,指定组文件:find / -user abtgu -group abtgu
。
- 错误输出重定向,
2>/dev/null
。 - grep -v deny,筛选不包含deny的内容。
- sort 命令用于将文本文件内容加以排序,可针对文本文件的内容,以行为单位来排序。
- uniq 命令用于检查及删除文本文件中重复出现的行列,一般与 sort 命令结合使用。(当重复的行并不相邻时,uniq 命令是不起作用的)。
- strings在文件中查找可打印字符串。
base64 -d data.txt
,解码data.txt中编码的文本。- tr 指令从标准输入设备读取数据,经过字符串转译后,将结果输出到标准输出设备。
cat data.txt | tr 'a-zA-Z''n-za-mN-ZA-M'
。 - xxd将十六进制文件转换为二进制文件
xxd -r data.txt
- bzip2解压:
bzip2 -d data.bz
;
gzip解压:gzip -d data.gz
;
tar解压:tar -xvf data.tar
。 - 以指定私钥登录服务器
ssh -i ./ssh_private user@zhujiming
。 - 网络工具中的瑞士军刀:netcat常用命令:
(1)创建服务器端:
nc -l -p 2222
。
(2)客户端与服务器端建立连接:nc -w3 ip port
。
(3)传输文件:
- 服务器端:
nc -l -p 2222 > outfile
;- 客户端:
nc ip port < infile
;- 服务器端:
nc -l -p 2222 < infile
;- 客户端:
nc ip port > outfile
。(4)端口扫描:
nc -v -n -z -w3 192.168.1.100 1-200
(5)建立后门:nc -l -p 222 -e cmd.exe
、nc -l -p 222 -e /bin/bash
。
- 以ssl的方式建立连接:
openssl s_client -connect localhost:30001 -quiet
。 - 扫描开放端口以及服务版本:
nmap -sV loacalhost -p 31000-32000
。 - 比较两个文件的不同:
diff new old
。 - ssh常用命令:
(1)建立远程连接:
ssh -p 10000 bandit0@localhost
。
(2)建立连接同时执行命令:ssh -p 10000 bandit0@localhost 'cat readme'
。
(3)禁止分配伪终端,但仍能获得shell:ssh -p 10000 bandit0@localhost -T
。
- 关于uid,gid,suid,sgid,euid,查看http://ybin.cc/linux/linux-file-permission-and-uid-euid/。
- 在more命令还没有结束执行时,按v可以进入vim模式。
- vim模式下e命令可以导入文件到编辑器,r命令读取文件,
:set shell=/bin/bash
:sh
设置新的shell。
23.git常用命令:
(1)克隆远程仓库:
git clone ssh://xxxx
。
(2)查看文件的更改记录:git log filename
。
(3)查看某次的具体更改内容:git show commitid
。
(4)查看提交历史的变化:git log -p filename
。
(4)对比更改前后的文件内容:git diff commitid0 commitid1
。
(5)查看所有分支:git branch -a
。
(6)切换分支:git checkout branch1
。
(7)查看某次提交的内容:git show commitid
。
(8)查看本地存储库的所有可用的引用以及关联的提交id:git show-ref
。
(9)将本地更改内容提交到远程仓库:git add file
,git commit -m 'add file'
,git push origin master
。
- $0可以调用shell。