案例1 :显示目录树 tree
┌──(root㉿kali)-[~]
└─# tree --help
usage: tree [-acdfghilnpqrstuvxACDFJQNSUX] [-L level [-R]] [-H baseHREF]
[-T title] [-o filename] [-P pattern] [-I pattern] [--gitignore]
[--gitfile[=]file] [--matchdirs] [--metafirst] [--ignore-case]
[--nolinks] [--hintro[=]file] [--houtro[=]file] [--inodes] [--device]
[--sort[=]<name>] [--dirsfirst] [--filesfirst] [--filelimit #] [--si]
[--du] [--prune] [--charset[=]X] [--timefmt[=]format] [--fromfile]
[--fromtabfile] [--fflinks] [--info] [--infofile[=]file] [--noreport]
[--version] [--help] [--] [directory ...]
------- Listing options -------
-a All files are listed.
-d List directories only.
-l Follow symbolic links like directories.
-f Print the full path prefix for each file.
-x Stay on current filesystem only.
-L level Descend only level directories deep.
-R Rerun tree when max dir level reached.
-P pattern List only those files that match the pattern given.
-I pattern Do not list files that match the given pattern.
--gitignore Filter by using .gitignore files.
--gitfile X Explicitly read gitignore file.
--ignore-case Ignore case when pattern matching.
--matchdirs Include directory names in -P pattern matching.
--metafirst Print meta-data at the beginning of each line.
--prune Prune empty directories from the output.
--info Print information about files found in .info files.
--infofile X Explicitly read info file.
--noreport Turn off file/directory count at end of tree listing.
--charset X Use charset X for terminal/HTML and indentation line output.
--filelimit # Do not descend dirs with more than # files in them.
-o filename Output to file instead of stdout.
------- File options -------
-q Print non-printable characters as '?'.
-N Print non-printable characters as is.
-Q Quote filenames with double quotes.
-p Print the protections for each file.
-u Displays file owner or UID number.
-g Displays file group owner or GID number.
-s Print the size in bytes of each file.
-h Print the size in a more human readable way.
--si Like -h, but use in SI units (powers of 1000).
--du Compute size of directories by their contents.
-D Print the date of last modification or (-c) status change.
--timefmt <f> Print and format time according to the format <f>.
-F Appends '/', '=', '*', '@', '|' or '>' as per ls -F.
--inodes Print inode number of each file.
--device Print device ID number to which each file belongs.
------- Sorting options -------
-v Sort files alphanumerically by version.
-t Sort files by last modification time.
-c Sort files by last status change time.
-U Leave files unsorted.
-r Reverse the order of the sort.
--dirsfirst List directories before files (-U disables).
--filesfirst List files before directories (-U disables).
--sort X Select sort: name,version,size,mtime,ctime.
------- Graphics options -------
-i Don't print indentation lines.
-A Print ANSI lines graphic indentation lines.
-S Print with CP437 (console) graphics indentation lines.
-n Turn colorization off always (-C overrides).
-C Turn colorization on always.
------- XML/HTML/JSON options -------
-X Prints out an XML representation of the tree.
-J Prints out an JSON representation of the tree.
-H baseHREF Prints out HTML format with baseHREF as top directory.
-T string Replace the default HTML title and H1 header with string.
--nolinks Turn off hyperlinks in HTML output.
--hintro X Use file X as the HTML intro.
--houtro X Use file X as the HTML outro.
------- Input options -------
--fromfile Reads paths from files (.=stdin)
--fromtabfile Reads trees from tab indented files (.=stdin)
--fflinks Process link information when using --fromfile.
------- Miscellaneous options -------
--version Print version and exit.
--help Print usage and this help message and exit.
-- Options processing terminator.
┌──(root㉿kali)-[~]
└─# dpkg -l | grep tree
ii cherrytree 0.99.48+dfsg-1 amd64 hierarchical note taking application
ii libhtml-tree-perl 5.07-3 all Perl module to represent and create HTML syntax trees
ii libxml-twig-perl 1:3.52-2 all Perl module for processing huge XML documents in tree mode
ii libxml-xpathengine-perl 0.14-2 all re-usable XPath engine for DOM-like trees
ii python3-asciitree 0.3.3-3 all Draw tree structures using (ASCII or Unicode) characters
ii python3-asttokens 2.2.1-1 all annotate Python asbtract syntax trees with code references (Python 3)
ii tree 2.1.1-1 amd64 displays an indented directory tree, in color
案例2 :使用dpkg安装软件包
┌──(root㉿kali)-[~] ## 卸载
└─# apt-get remove tree
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
┌──(root㉿kali)-[~]
└─# cd work/doc
┌──(root㉿kali)-[~/work/doc]
└─# pwd
/root/work/doc
## apt-get download -- 下载指定的二进制包到当前目录
┌──(root㉿kali)-[~/work/doc]
└─# apt-get download tree
获取:1 http://mirrors.ustc.edu.cn/kali kali-rolling/main amd64 tree amd64 2.1.1-1 [54.4 kB]
已下载 54.4 kB,耗时 0秒 (200 kB/s)
W: 由于文件'/root/work/doc/tree_2.1.1-1_amd64.deb'无法被用户'_apt'访问,已脱离沙盒并提权为根用户来进行下载。 - pkgAcquire::Run (13: 权限不够)
┌──(root㉿kali)-[~/work/doc]
└─# ls -lh
总计 56K
-rw-r--r-- 1 root root 54K 6月27日 02:08 tree_2.1.1-1_amd64.deb
## dpkg -i 安装本地软件包
┌──(root㉿kali)-[~/work/doc]
└─# dpkg -i tree_2.1.1-1_amd64.deb
正在选中未选择的软件包 tree。
(正在读取数据库 ... 系统当前共安装有 428197 个文件和目录。)
准备解压 tree_2.1.1-1_amd64.deb ...
正在解压 tree (2.1.1-1) ...
正在设置 tree (2.1.1-1) ...
正在处理用于 kali-menu (2023.4.2) 的触发器 ...
正在处理用于 man-db (2.11.2-3) 的触发器 ...
┌──(root㉿kali)-[~/work/doc]
└─# which tree
/usr/bin/tree
┌──(root㉿kali)-[~/work/doc]
└─# dpkg -l | grep tree
ii cherrytree 0.99.48+dfsg-1 amd64 hierarchical note taking application
ii libhtml-tree-perl 5.07-3 all Perl module to represent and create HTML syntax trees
ii libxml-twig-perl 1:3.52-2 all Perl module for processing huge XML documents in tree mode
ii libxml-xpathengine-perl 0.14-2 all re-usable XPath engine for DOM-like trees
ii python3-asciitree 0.3.3-3 all Draw tree structures using (ASCII or Unicode) characters
ii python3-asttokens 2.2.1-1 all annotate Python asbtract syntax trees with code references (Python 3)
ii tree 2.1.1-1 amd64 displays an indented directory tree, in color
案例3 :安装一个集成的开发环境(IDE Visual Studio Code)
## 拿到下载链接
┌──(root㉿kali)-[~/work/doc]
└─# wget https://az764295.vo.msecnd.net/stable/6c3e3dba23e8fadc360aed75ce363ba185c49794/code_1.81.1-1691620686_amd64.deb
--2023-08-24 15:43:14-- https://az764295.vo.msecnd.net/stable/6c3e3dba23e8fadc360aed75ce363ba185c49794/code_1.81.1-1691620686_amd64.deb
正在解析主机 az764295.vo.msecnd.net (az764295.vo.msecnd.net)... 117.18.232.200
正在连接 az764295.vo.msecnd.net (az764295.vo.msecnd.net)|117.18.232.200|:443... 失败:拒绝连接。
## apt-get install -f 这样的方式 会自动解决依赖 dpkg -i 本地安装不会自动解决依赖
┌──(root㉿kali)-[~/work/doc]
└─# apt-get install -f ./code_1.81.1-1691620686_amd64.deb
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
注意,选中 'code' 而非 './code_1.81.1-1691620686_amd64.deb'
案例4 :安装mtr 路由跟踪工具
window – tracert
linux – traceroute
┌──(root㉿kali)-[~/work/doc]
└─# traceroute --help
Usage:
traceroute [ -46dFITnreAUDV ] [ -f first_ttl ] [ -g gate,... ] [ -i device ] [ -m max_ttl ] [ -N squeries ] [ -p port ] [ -t tos ] [ -l flow_label ] [ -w MAX,HERE,NEAR ] [ -q nqueries ] [ -s src_addr ] [ -z sendwait ] [ --fwmark=num ] host [ packetlen ]
Options:
-4 Use IPv4
-6 Use IPv6
-d --debug Enable socket level debugging
-F --dont-fragment Do not fragment packets
-f first_ttl --first=first_ttl
Start from the first_ttl hop (instead from 1)
-g gate,... --gateway=gate,...
Route packets through the specified gateway
(maximum 8 for IPv4 and 127 for IPv6)
-I --icmp Use ICMP ECHO for tracerouting
-T --tcp Use TCP SYN for tracerouting (default port is 80)
-i device --interface=device
Specify a network interface to operate with
-m max_ttl --max-hops=max_ttl
Set the max number of hops (max TTL to be
reached). Default is 30
-N squeries --sim-queries=squeries
Set the number of probes to be tried
simultaneously (default is 16)
-n Do not resolve IP addresses to their domain names
-p port --port=port Set the destination port to use. It is either
initial udp port value for "default" method
(incremented by each probe, default is 33434), or
initial seq for "icmp" (incremented as well,
default from 1), or some constant destination
port for other methods (with default of 80 for
"tcp", 53 for "udp", etc.)
-t tos --tos=tos Set the TOS (IPv4 type of service) or TC (IPv6
traffic class) value for outgoing packets
-l flow_label --flowlabel=flow_label
Use specified flow_label for IPv6 packets
-w MAX,HERE,NEAR --wait=MAX,HERE,NEAR
Wait for a probe no more than HERE (default 3)
times longer than a response from the same hop,
or no more than NEAR (default 10) times than some
next hop, or MAX (default 5.0) seconds (float
point values allowed too)
-q nqueries --queries=nqueries
Set the number of probes per each hop. Default is
3
-r Bypass the normal routing and send directly to a
host on an attached network
-s src_addr --source=src_addr
Use source src_addr for outgoing packets
-z sendwait --sendwait=sendwait
Minimal time interval between probes (default 0).
If the value is more than 10, then it specifies a
number in milliseconds, else it is a number of
seconds (float point values allowed too)
-e --extensions Show ICMP extensions (if present), including MPLS
-A --as-path-lookups Perform AS path lookups in routing registries and
print results directly after the corresponding
addresses
-M name --module=name Use specified module (either builtin or external)
for traceroute operations. Most methods have
their shortcuts (`-I' means `-M icmp' etc.)
-O OPTS,... --options=OPTS,...
Use module-specific option OPTS for the
traceroute module. Several OPTS allowed,
separated by comma. If OPTS is "help", print info
about available options
--sport=num Use source port num for outgoing packets. Implies
`-N 1'
--fwmark=num Set firewall mark for outgoing packets
-U --udp Use UDP to particular port for tracerouting
(instead of increasing the port per each probe),
default port is 53
-UL Use UDPLITE for tracerouting (default dest port
is 53)
-D --dccp Use DCCP Request for tracerouting (default port
is 33434)
-P prot --protocol=prot Use raw packet of protocol prot for tracerouting
--mtu Discover MTU along the path being traced. Implies
`-F -N 1'
--back Guess the number of hops in the backward path and
print if it differs
-V --version Print version info and exit
--help Read this help and exit
Arguments:
+ host The host to traceroute to
packetlen The full packet length (default is the length of an IP
header plus 40). Can be ignored or increased to a minimal
allowed value
┌──(root㉿kali)-[~/work/doc]
└─# apt-cache search ^mtr
mtr - Full screen ncurses and X11 traceroute tool
mtr-tiny - Full screen ncurses traceroute tool
mtree-netbsd - Validates directory tree against specification
┌──(root㉿kali)-[~/work/doc]
└─# apt-get install mtr
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
下列软件包是自动安装的并且现在不需要了:
└─# mtr qq.com
案例5 :升级软件包
python3的升级
┌──(root㉿kali)-[~/work/doc]
└─# python3 -V
Python 3.11.4
┌──(root㉿kali)-[~/work/doc]
└─# apt-get upgrade python3
案例6 :通过git方式安装软件
┌──(root㉿kali)-[~/work/doc]
└─# git -h
用法:git [-v | --version] [-h | --help] [-C <路径>] [-c <名称>=<取值>]
[--exec-path[=<路径>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<路径>] [--work-tree=<路径>] [--namespace=<名称>]
[--config-env=<名称>=<环境变量>] <命令> [<参数>]
这些是各种场合常见的 Git 命令:
开始一个工作区(参见:git help tutorial)
clone 克隆仓库到一个新目录
init 创建一个空的 Git 仓库或重新初始化一个已存在的仓库
在当前变更上工作(参见:git help everyday)
add 添加文件内容至索引
mv 移动或重命名一个文件、目录或符号链接
restore 恢复工作区文件
rm 从工作区和索引中删除文件
检查历史和状态(参见:git help revisions)
bisect 通过二分查找定位引入 bug 的提交
diff 显示提交之间、提交和工作区之间等的差异
grep 输出和模式匹配的行
log 显示提交日志
show 显示各种类型的对象
status 显示工作区状态
扩展、标记和调校您的历史记录
branch 列出、创建或删除分支
commit 记录变更到仓库
merge 合并两个或更多开发历史
rebase 在另一个分支上重新应用提交
reset 重置当前 HEAD 到指定状态
switch 切换分支
tag 创建、列出、删除或校验一个 GPG 签名的标签对象
协同(参见:git help workflows)
fetch 从另外一个仓库下载对象和引用
pull 获取并整合另外的仓库或一个本地分支
push 更新远程引用和相关的对象
命令 'git help -a' 和 'git help -g' 显示可用的子命令和一些概念帮助。
查看 'git help <命令>' 或 'git help <概念>' 以获取给定子命令或概念的
帮助。
有关系统的概述,查看 'git help git'。
开源的 情报搜集工具 recon-ng
┌──(root㉿kali)-[~/work/doc]
└─# git clone https://github.com/lanmaster53/recon-ng.git
正克隆到 'recon-ng'...
remote: Enumerating objects: 9522, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 9522 (delta 3), reused 14 (delta 3), pack-reused 9503
接收对象中: 100% (9522/9522), 3.06 MiB | 775.00 KiB/s, 完成.
处理 delta 中: 100% (4958/4958), 完成.
┌──(root㉿kali)-[~/work/doc]
└─# ls
code_1.81.1-1691620686_amd64.deb recon-ng tree_2.1.1-1_amd64.deb
┌──(root㉿kali)-[~/work/doc]
└─# cd regon-ng
cd: 没有那个文件或目录: regon-ng
┌──(root㉿kali)-[~/work/doc]
└─# cd recon-ng
┌──(root㉿kali)-[~/work/doc/recon-ng]
└─# ls
docker-compose.yml LICENSE recon recon-ng REQUIREMENTS
Dockerfile README.md recon-cli recon-web VERSION
┌──(root㉿kali)-[~/work/doc/recon-ng]
└─# pip install -r REQUIREMENTS
┌──(root㉿kali)-[~/work/doc/recon-ng]
└─# recon-ng
[*] Version check disabled.
_/_/_/ _/_/_/_/ _/_/_/ _/_/_/ _/ _/ _/ _/ _/_/_/
_/ _/ _/ _/ _/ _/ _/_/ _/ _/_/ _/ _/
_/_/_/ _/_/_/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/_/_/
_/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/_/ _/ _/
_/ _/ _/_/_/_/ _/_/_/ _/_/_/ _/ _/ _/ _/ _/_/_/
/\
/ \\ /\
Sponsored by... /\ /\/ \\V \/\
/ \\/ // \\\\\ \\ \/\
// // BLACK HILLS \/ \\
www.blackhillsinfosec.com
____ ____ ____ ____ _____ _ ____ ____ ____
|____] | ___/ |____| | | | |____ |____ |
| | \_ | | |____ | | ____| |____ |____
www.practisec.com
[recon-ng v5.1.2, Tim Tomes (@lanmaster53)]
[*] No modules enabled/installed.